Monday, July 29, 2013

PC-BSD starts to distribute rolling release based on FreeBSD 9.2

PC-BSD starts to distribute rolling release "PC-BSD 9.2 beta".

Rolling-Release and 9.2-BETA1 Released

This is based on FreeBSD 9.2 beta. and its ISOs and images are available in here.

Friday, July 26, 2013

A book for Qt Quick will be also published in Japan.

In last year, a book for Qt Quick had been published in China.
http://www.amazon.com/dp/7512407815/

And in this year, another one will be also published in Japan.
http://ascii.asciimw.jp/books/books/detail/978-4-04-891512-0.shtml

Tuesday, July 23, 2013

Regular Expression in F#

Regular Expression in F# is used with Active pattern, in most cases.
open System.Text.RegularExpressions
let (|Matcher|_|) pattern input =
  let matcher = Regex.Match(input, pattern)
  if matcher.Success then Some (List.tail [ for group in matcher.Groups -> group.Value ])
  else None
let matchHttpUrl target =
  match target with
    | Matcher @"(https?:\/\/\S+)" result -> Some(result.Head)
    | _ -> None
> matchHttpUrl "http://www.google.com";;
val it : string option = Some "http://www.google.com"
> matchHttpUrl "https://www.google.com";;
val it : string option = Some "https://www.google.com"
> matchHttpUrl "ftp://www.google.com";;
val it : string option = None

Friday, July 19, 2013

ISOs and images for PC-BSD's rolling release have been re-deployed

ISOs and images for PC-BSD's rolling release have been re-deployed in here.

Tuesday, July 16, 2013

"Strong parameters" is for controlling mass assignment, not for validation.

Since rails4, controller has new feature called "strong parameters".

rails/strong_parameters

"strong parameters" is an alternative for controlling mass assignment. The original ones are known as attr_accessible and attr_protected on ActiveRecord/ActiveModel until rails3. But, because of "Mass Assingment Vulnerability(CVE-2012-2055)" in last year, these features are considered they should be on controller, should not be on ActiveRecord/ActiveModel. So that "strong parameters" begins.

And, the most important thing is, -"strong parameters" is JUST for controlling mass assignment, not for validation-. ActiveRecord/ActiveModel still have their own (and well known) validation features. that's natural because ActiveRecord/ActiveModel is not only used from Web (controllers) but also from non-Web (batches).

Friday, July 12, 2013

Calculate the firefox year with using Seq.unfold #2

(continued from phosphorescence: Calculate the firefox year with using Seq.unfold)

To refine more readable, adapt Active Pattern.

open System
let (|IsBetweenDate|) (targetDate, currentDate, nextDate) =
  (DateTime.Compare(targetDate, currentDate)>0, DateTime.Compare(targetDate, nextDate)>0)
let firefoxRollingReleaseDate n =
  let firefox5ReleaseDate = new DateTime(2011, 6, 21)
  let firefox6ReleaseDate = firefox5ReleaseDate.AddDays(7.0 * 8.0)
  let firefoxRollingRelease (currentDate:DateTime, nextDate:DateTime) =
    match (new DateTime(2012, 12, 25), nextDate, nextDate.AddDays(7.0 * 6.0)) with
    | IsBetweenDate (true, false) -> Some(currentDate, (nextDate, nextDate.AddDays(7.0 * 7.0)))
    | IsBetweenDate _ -> Some(currentDate, (nextDate, nextDate.AddDays(7.0 * 6.0)))
  match n < 5 with
  | true -> failwith "The version was not yet in rolling release."
  | _ -> Seq.nth (n - 5) <| Seq.unfold firefoxRollingRelease (firefox5ReleaseDate, firefox6ReleaseDate)

Monday, July 8, 2013

ISOs and images for PC-BSD's rolling release have been erased.

All packages and binaries for PC-BSD have been switched from mirrors sites to Contents Delivery Network (e.g. BitTorrent).
PC-BSD Now Uses a CDN

But, ISOs and images for PC-BSD's rolling release have also been erased, so that the site http://mirrors.isc.org/pub/pcbsd/9.1-RELEASE/ is now "404 - Not Found".


The information above is now obsoleted. Please check current information:
phosphorescence: ISOs and images for PC-BSD's rolling release have been re-deployed

Thursday, July 4, 2013

Qt 5.1 and QtCreator 2.7.2 have been released

Today, Qt 5.1 and QtCreator 2.7.2 have been released

As you can see in download page, there are many binaries, especially, for Windows.

Monday, July 1, 2013

Calculate the firefox year with using Seq.unfold

(Check also phosphorescence: Calculate the firefox year #2 and phosphorescence: Calculate the firefox year #2 (Fixed))
In this article, rewrite with using Seq.unfold . It becomes quite simple architecture.
open System
let firefoxRollingReleaseDate n =
  let firefox5ReleaseDate = new DateTime(2011, 6, 21)
  let firefox6ReleaseDate = firefox5ReleaseDate.AddDays(7.0 * 8.0)
  let isBetweenDate(targetDate:DateTime, currentDate:DateTime, nextDate:DateTime) =
    match (DateTime.Compare(targetDate, currentDate)>0, DateTime.Compare(targetDate, nextDate)>0) with
    | (true, false) -> true
    | (_, _) -> false
  let firefoxRollingRelease (currentDate:DateTime, nextDate:DateTime) =
    match isBetweenDate(new DateTime(2012, 12, 25), nextDate, nextDate.AddDays(7.0 * 6.0)) with
    | true -> Some(currentDate, (nextDate, nextDate.AddDays(7.0 * 7.0)))
    | _ -> Some(currentDate, (nextDate, nextDate.AddDays(7.0 * 6.0)))
  match n < 5 with
  | true -> failwith "The version was not yet in rolling release."
  | _ -> Seq.nth (n - 5) <| Seq.unfold firefoxRollingRelease (firefox5ReleaseDate, firefox6ReleaseDate)
(continue to phosphorescence: Calculate the firefox year with using Seq.unfold #2)