Tuesday, March 29, 2011

mysql2 0.2.7 has been released. MariaDB Ready!

mysql2 0.2.7 has been released today. This release includes my patch for header file. This can install with MariaDB on Ruby DevKit(i.e. MinGW).

> gem install mysql2 --platform=ruby -- --with-mysql-include=C:/MariaDB/include --with-mysql-lib=C:/MariaDB/lib/opt

Saturday, March 26, 2011

Studying F# : Upcasting and Downcasting

In normal object-oriented languages, upcasting is implicit and downcasting is explicit. But, in F#, Both upcasting and downcasting are explicit. Suppose we have 2 classes like below:
type Person(fn, ln, a) =
    member p.FirstName = fn
    member p.LastName = ln
    member p.Age = a
type Student(fn, ln, a, sub, sch) =
    inherit Person(fn, ln, a)
    member p.Subject = sub
    member p.School = sch

Thursday, March 24, 2011

F# interpreter and KDE4

If you launch F# interpreter(fsi) on KDE4, error message is rising up in some cases. The message is:
Microsoft (R) F# 2.0 Interactive build (private)
Copyright (c) 2002-2010 Microsoft Corporation. All Rights Reserved.

For help type #help;;

> KDE colorscheme read failure, using built-in colorscheme

This is caused by:
  1. There are no KDE3 libraries and there are only KDE4 libraries.
  2. Mono or F# calls only ReadKDEColorsheme() function and does not call ReadKDE4Colorsheme()

The simplest solution is to type below in ~ directory:
>ln -s .kde4 .kde
That's all!

Monday, March 21, 2011

JRuby 1.6.0 has been released

About 1 week ago, JRuby 1.6.0 was finally released.

>%JRUBY_HOME%\bin\jruby --1.9 -S jirb
irb(main):001:0> JRUBY_VERSION
=> "1.6.0"
irb(main):002:0> RUBY_VERSION
=> "1.9.2"
irb(main):003:0> say_hello = ->(message) { "Hello #{message}" }
=> #<Proc:0x1cfd3b2@(irb):1 (lambda)>
irb(main):004:0> say_hello.("world")
=> "Hello world"

I repeat to say again, this release is especially useful both for windows users and for non-western language speakers. (phosphorescence: JRuby for Windows users or for Non-western languages: "Non-western language")

Friday, March 18, 2011

openSUSE 11.4 was released

1 week ago, openSUSE 11.4 was released.
This is the first distribution ready for LibreOffice 3.3 out-of-the-box. But both Mono 2.10 and MonoDevelop 2.6 are in additional repositories.

Mono 2.10 Repository for openSUSE 11.4
MonoDevelop 2.6 repository for openSUSE 11.4

Tuesday, March 15, 2011


Foreign Rubyists establish for relief for Japan and Japanese Rubyists.

Donate to the Japanese Relief Effort - RubyistForJapan.com

I am just script newbie. I sent only few patches for activerecord-jdbc and few bug reports for JRuby.
But, I write this article to introduce this effort.

Thanks for them and I am really encouraged!

Saturday, March 12, 2011

Now I'm safe.

I'm in Tokyo. I'm installing openSUSE 11.4

Thursday, March 10, 2011

Calling IronRuby in F# on Mono

This is just a hobby, but wonderful. Mono 2.10 only can do it as out-of-the-box!
Microsoft (R) F# 2.0 Interactive build
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.dll";;

--> Referenced '/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.dll'

> #r "/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.Libraries.dll";;

--> Referenced '/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.Libraries.dll'

> #r "/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/Microsoft.Scripting.dll";;   

--> Referenced '/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/Microsoft.Scripting.dll'

> open IronRuby;;
> let runtime = IronRuby.Ruby.CreateRuntime();;          

val runtime : Microsoft.Scripting.Hosting.ScriptRuntime

> let engine = runtime.GetEngine("Ruby");;
Binding session to '/Library/Frameworks/Mono.framework/Versions/Current/lib/ironruby/bin/IronRuby.Libraries.dll'...
val engine : Microsoft.Scripting.Hosting.ScriptEngine

> engine.Execute("class Hello;def world;'Hello World';end;end");;
val it : obj = null
> engine.Execute("puts Hello.new.world");;
Hello World
val it : obj = null

Monday, March 7, 2011

Studying F# : Constructor

In any other object-oriented languages, "This class has one constructor" means there is only one definition. But, F# is not. F# distinguishes primary constructor from non-primary constructor.

Friday, March 4, 2011

Qt 4.7.2 has been released and more

At the first day of this month, Qt Framework 4.7.2 and Qt Creator 2.1 have been released. If you are using these on Linux or on Mac OS X, you just download and install straightforward. But if you are using on Windows, it is slightly complicated.

Tuesday, March 1, 2011

Euler's formula in F# : #2

In last year, I wrote Euler's formula in F#. In this article, I used C# classes in System.Numerics namespace. At this time, i write again, with using F# PowerPack.
Microsoft (R) F# 2.0 Interactive build
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "FSharp.PowerPack";;

--> Referenced 'C:\Program Files\FSharpPowerPack-\bin\FSharp.PowerPack.dll'

> open Microsoft.FSharp.Math;;
> let euler_formula = complex 0.0 -Complex.pi.RealPart |> Complex.exp;;

val euler_formula : Complex = -1r-1.22460635382238e-16i
But this also becomes inexact result of floating-point.