Tuesday, October 30, 2012
Improve SublimeText syntax definition file for F#
Labels:
F#
SublimeText syntax definition file is not supporting @-quote and triple-quote now. So that I fixed and pull-requested.
Saturday, October 27, 2012
Migrate JRuby from 1.6.8 to 1.7.0
Labels:
JRuby
In this week, JRuby 1.7.0 final has been released. This release becomes Ruby-1.9-based product. so that we should take care of migrating from 1.6.8 (or former) to 1.7.0 (or later).
- rename directory from jruby-1.6.8 to jruby-1.7.0
- rename from jruby-1.6.8/lib/ruby/gems/1.8 to jruby-1.7.0/lib/ruby/gems/shared
Thursday, October 25, 2012
Finally, Amazon launches Kindle and KindleStore in Japan
Labels:
book
Today is the memorial day when amazon.co.jp launches Kindle and KindleStore in Japan.
amazon.co.jp sells 3 devices
"Kindle Fire HD (8.9inch)" is not here. amazon.co.jp spokesman says that HD (8.9inch) cannot be lanuched in Japan because this product is not yet launched in all over the world.
amazon.co.jp sells 3 devices
- Kindle paperwhite(normal & 3G)
- Kindle Fire
- Kindle Fire HD (7inch)
"Kindle Fire HD (8.9inch)" is not here. amazon.co.jp spokesman says that HD (8.9inch) cannot be lanuched in Japan because this product is not yet launched in all over the world.
Monday, October 22, 2012
Friday, October 19, 2012
Japanese BTO builder launches openSUSE 12.2 pre-installed machine
Labels:
openSUSE
Japanese BTO builder STORM launches Storm Linux Box Desktop LS - an openSUSE 12.2 pre-installed machine. It takes 32550 Yen. Probably, this is the first machine pre-installed openSUSE OS in Japan.
Tuesday, October 16, 2012
SublimeText syntax definition file for TypeScript and for F#
Labels:
ECMAScript,
F#
(1) For TypeScript
- Download zip file from here
- Unzip to "%APPDATA%\Sublime Text 2\Packages"
(2) For F#
- make and change directory to "%APPDATA%\Sublime Text 2\Packages\FSharp"
- git clone http://github.com/hoest/sublimetext-fsharp .
Saturday, October 13, 2012
Thursday, October 11, 2012
TypeScript's interface looks like F#'s record
Labels:
ECMAScript,
F#
TypeScript is a superset of ECMAScript5 by Microsoft. And Microsoft is aiming to make some TypeScript syntaxes as ECMAScript6 specification (check the specification document). Like as coffee script syntax is similar to Ruby syntax, TypeScript syntax is similar to C# syntax. But, its interface syntax is similar to F# syntax, not C# one.
TypeScript's interface
F#'s record
Of course, these are entirely different classses and types. These just looks like similar.
TypeScript's interface
interface Person {
firstname: string;
lastname: string;
}
function greeter(person : Person) {
return "Hello, " + person.firstname + " " + person.lastname;
}
var user = {firstname: "Jane", lastname: "User"};
document.body.innerHTML = greeter(user);
F#'s record
type Person =
{ firstName : string;
lastName : string }
let greeter (person:Person) = sprintf "Hello, %s %s" person.firstName person.lastName
let user = {firstName = "Jane"; lastName = "User"}
greeter user |> System.Console.WriteLine
Of course, these are entirely different classses and types. These just looks like similar.
Monday, October 8, 2012
Learning F# 3.0 : LINQ in F# (sample for FizzBuzz)
Labels:
F#
To use LINQ in F#, There is no need for creating mapper function. And there is also no need for using accumulator in reducer function. The below is the sample for FizzBuzz.
module FizzBuzzLinq =
open System.Data
open System.Data.Linq
let fizzBuzz (fromNum:int) (toNum:int) =
let fizzBuzzReducer (number:int) =
match (number % 3, number % 5) with
| (0, 0) -> "FizzBuzz"
| (0, _) -> "Fizz"
| (_, 0) -> "Buzz"
| (_, _) -> number.ToString()
let numberList = [ fromNum..toNum ]
query { for number in numberList do
select (fizzBuzzReducer number) }
(FizzBuzzLinq.fizzBuzz 1 40) |> Seq.iter (fun elem -> System.Console.WriteLine(elem))
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz module FizzBuzzLinq = begin val fizzBuzz : fromNum:int -> toNum:int -> seq<string> end val it : unit = ()
Friday, October 5, 2012
Where is F# interactive of VWD2012Express?
Labels:
F#
The answer:
- (Windows 32bit)
C:\Program Files\Microsoft SDKs\F#\3.0\Framework\v4.0\Fsi.exe - (Windows 64bit)
C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\Fsi.exe
Tuesday, October 2, 2012
Calculate the firefox year #2 (Fixed)
Labels:
F#
(Check also phosphorescence: Calculate the firefox year #2)
Firefox team announced changing their "Rapid release" plan.
Firefox team announced changing their "Rapid release" plan.
- https://blog.mozilla.org/futurereleases/2012/09/24/firefox-schedule-changes-around-year-end/
- https://wiki.mozilla.org/RapidRelease/Calendar
module FirefoxReleaseDate =
let calculateIn version =
let calculateAddDays (currentDate:System.DateTime) =
let happyHoliday = new System.DateTime(currentDate.Year, 12, 25)
match ( (happyHoliday.Year >= 2012), (happyHoliday <= currentDate.AddDays(7.0 * 6.0)) ) with
| (true, true) -> currentDate.AddDays(7.0 * 7.0)
| _ -> currentDate.AddDays(7.0 * 6.0)
let rec nextFirefoxReleaseDate (currentDate:System.DateTime) (currentVersion) =
match currentVersion with
| currentVersion when currentVersion >= version -> currentDate
| _ -> nextFirefoxReleaseDate (calculateAddDays(currentDate)) (currentVersion + 1)
let ver5ReleaseDate = new System.DateTime(2011, 6, 21)
match version with
| version when version >= 7 -> nextFirefoxReleaseDate (ver5ReleaseDate.AddDays(7.0 * 8.0)) 6
| 6 -> ver5ReleaseDate.AddDays(7.0 * 8.0)
| 5 -> ver5ReleaseDate
| _ -> printfn "Not supported."; ver5ReleaseDate
let calculateFirefoxYear =
let rec incrementFirefoxYear (n:int) =
let date = calculateIn(n)
if n < date.Year
then incrementFirefoxYear (n+1)
else (n, date)
incrementFirefoxYear(5)
let result = FirefoxReleaseDate.calculateFirefoxYear
let firefoxYearVersion = fst result
let firefoxYearDate = snd result
System.Console.WriteLine("The version equals release year ({0}) ({1:d})", firefoxYearVersion, firefoxYearDate)
System.Console.WriteLine("The version passes release year ({0}) ({1:d})", firefoxYearVersion+1, FirefoxReleaseDate.calculateIn(firefoxYearVersion+1))
Subscribe to:
Posts (Atom)