Thursday, December 22, 2011

Winter brake 2011-2012

I take a winter brake, so I suspend posts and comments to this blog for a moment. Resume will be January 7, 2012.

I wish you a Merry Christmas and a Happy New Year.

Monday, December 19, 2011

Tips: Which are you using java command, JDK's or JRE's?

This is an easy tips. Which are you using java command, JDK's or JRE's? How do you recognize it? Let's type the command below:
> java -server -version
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
If succeed, that is JDK's , and if not, that is JRE's.

Friday, December 16, 2011

Qt 4.8.0 and QtCreator 2.4.0 have been released

In a few days, Qt Framework 4.8.0 and QtCreator 2.4.0 have been released. Since this release, Lighthouse project is finally integrated.

Tuesday, December 13, 2011

BigMath

Since Ruby 1.9.3, bigdecimal library has powered up. Especially, BigMath module is so.

irb(main):001:0> require 'bigdecimal/math'
=> true
irb(main):002:0> prec = 10
=> 10
irb(main):003:0> (-BigMath::PI(prec)).to_s
=> "-0.3141592653589793238462643388813853786957412E1"
irb(main):004:0> BigMath::exp(-BigMath::PI(prec), prec).to_s
=> "0.4321391826E-1"

But, unfortunately, bigdecimal library now does not support complex calculations:
irb(main):005:0> BigMath::exp(Complex(0, -BigMath::PI(prec)), prec)
ArgumentError: Complex can't be coerced into BigDecimal
        from (irb):5:in `exp'
        from (irb):5
        from c:/ruby-1.9.3/bin/irb:12:in `<main>'

Saturday, December 10, 2011

Mono 2.10.7 for Mac has been released

A few days ago, Mono Framework 2.10.7 has been released only for Mac OS X. this release includes fixes for gtk related bug - e.g. Multi-byte characters are garbled on MonoDevelop. So that, since 2.10.7, we just install and use Mono and MonoDevelop without multi-byte font settings like phosphorescence: Modify the default font of Mono after 2.10.3.

Thursday, December 8, 2011

Ignore case partially

It's easy to ignore case of whole word in regular expression. But How do we do ignore case partially? For example, matching with AbcD, abcD, Abcd and abcd, but not matching ABCD, aBCd and so forth.

In the Japanese edition of "Regular Expressions Cookbook", there are two approaches.

mode toggle "i"

In the page #28, surround the word to ignore between (?i) and (?-i):
/(?i)a(?-i)bc(?i)d(?-i)/

group with modifier "i"

In the page #76, use modifier "i" for the word to ignore:
/(?i:a)bc(?i:d)/

Monday, December 5, 2011

Start reading Regular Expressions Cookbook

I have started reading the Japanese edition of "Regular Expressions Cookbook".

The cover of English edition is below:

In earlier page, I encountered (?i) that I never knew until reading the Recipe 2.1 on this book.

Friday, December 2, 2011

Screenshot of Snippper

In my previous article, I introduced just a little bit about "Snapper". Now then I introduce these screenshots.

The first one is the screenshot about list of snapshots.

The second one is the screenshot about each snapshot.

Tuesday, November 29, 2011

I've finished reading "Agile Web Development with Rails 4th edition"

I've finished reading Agile Web Development with Rails 4th edition.

  • Rails 3.1 is significantly different both from rails2 and from rails3.0, so that you should read it if you want to catch up latest rails.
  • In this book, all samples are written with Ruby 1.9 - there is no exaggeration that Pragmatic Programmers recommend using Ruby 1.9.
  • In this book, MinGW is introduced as Windows Environment - there is no exaggeration that Pragmatic Programmers recommend using MinGW .

Saturday, November 26, 2011

Tips for MongoDB cache store and assets on Rails 3.1

(continued from phosphorescence: How to use MongoDB as model, session store and cache store on Rails3)

MongoDB cache store does not accept binary cache

Rails3.1's cache feature caches all – page caches, action caches, fragment caches and caches for files called assets(JavaScripts, stylesheets and images). All these are cached in default. But MondoDB cache store we have chosen in previous article is only supporting to cache text files. In other words, MongoDB cache store accepts JavaScripts and stylesheets, but does not accept images.

So we should configure to cache page caches, action caches and fragment caches, and not to cache assets at all. Referring these two sites(1 2), we can do it by editing config/environments/production.rb like below:
require 'rack/cache'
........
  # Prevent caching assets
  config.middleware.insert_before Rack::Cache, ::ActionDispatch::Static, 'public', config.static_cache_control
........

Thursday, November 24, 2011

How to use MongoDB as model, session store and cache store on Rails3

When we use rails3 as out-of-the-box, we implicitly choose ActiveRecord for model, Cookie for session store and on-memory for cache store. But we can choose MongoDB for all of them. I start to explain these ways one by one.

Monday, November 21, 2011

Mono Project is looking for answers to the questionnaire

On download page of Mono project, they are looking for answers to the questionnaire. In current status, Mono project faces to mobile products, and less facing to existing products and features. So, if you want to run ASP.NET MVC, F# and so forth on Mono Framework in the future as same as current, please visit the site and appear with answering the questionnaire.

On download page of Mono project

Friday, November 18, 2011

openSUSE 12.1 has been released - for new UXs

2 days ago, openSUSE 12.1 has been released (see this post). This is not only the release for latest packages but also the release for new UXs.

New Installation Experience

If you want install from openSUSE 11.3 or former one, or want to clean-install, download and use install media as you done before. But if you want to install from openSUSE 11.4, you can update with this approach. Of course, it's easy.

New Cloud Experience

openSUSE 12.1 supports cloud solution - named "OwnCloud". You can seemlessly use Dropbox, Ubuntu One, Facebook and so forth via OwnCloud.

New Backup Experience

openSUSE 12.1 also supports "Snapper" - the backup system with using snapshot feature of btrfs. If you want to use this feature, you should use btrfs file system.

Comparison with OS X Lion

IMO, these UXs are corresponding to OS X Lion's ones.
 openSUSE 12.1OS X Lion
Update Experienceeasy to upgrade from openSUSE 11.4easy to upgrade from OS X SnowLeopard
Cloud ExperienceOwnCloudiCloud
Backup ExperienceSnapperTime Machine

Tuesday, November 15, 2011

Sample for uploading file in Rails3 way on AWDwR 4th chapter21

At page 348 on Agile Web Development with Rails 4th edition chapter21 (ActionView), there are samples for uploading file. But, these are totally in Rails2 way. So I re-write in rails3 way.

Model

> rails g model Picture comment:string name:string content_type:string data:binary

migration file : same as on the book

Saturday, November 12, 2011

Rails3's form helpers are ready to HTML5 input types

On Agile Web Development with Rails 4th edition chapter21 (ActionView), I learn the fact that Rails3's form helpers are ready to HTML5.

Form helper of Rails3Corresponding HTML5 input type
search_fieldsearch
telephone_fieldtel
url_fieldurl
email_fieldemail
number_fieldnumber
range_fieldrange

There are no form helpers corresponding neither input types related with date or time, nor input type related with color ( type="color" ). I could understand date time ones will be integrated in helper methods like date_select in the future, but could not understand where is color form helper.

IMO, Opera browser is the most advanced browser implementing HTML5 input tag, so that you should check those form helpers on Opera browser.

Thursday, November 10, 2011

mini_magick - A better RMagick alternative

Unfortunately, RMagick has been a vaporware despite new developer had been inherited from former one. There are less activities. So that we should seek its alternative. The better one is mini_magick.

installation

> gem list mini_magick
Successfully installed subexec-0.1.0
Successfully installed mini_magick-3.3

Usage

In short, check readme.

For example for POSIX:
require 'mini_magick'
image = MiniMagick::Image.open("http://www.google.com/images/logos/logo.png")
image.resize "50%"
image.format :gif
image.write "localcopy.gif"


(Since the end of 2011, we can write the same codes both for POSIX and for Windows. Please check this article.)

For example for Windows:
require 'mini_magick'
MiniMagick.timeout = 42
image = MiniMagick::Image.open("http://www.google.com/images/logos/logo.png")
image.resize "50%"
image.format :gif
image.write "localcopy.gif"


Because of the bug both in mini_magick and in subexec, the developer using Ruby 1.9.x on Windows should write the mantra MiniMagick.timeout = milliseconds

Next version of mini_magick and subexec

As you see the sources on github, next version of mini_magick and subexec fix bugs for running on Windows. So you can write the same codes both for POSIX and for Windows.

Monday, November 7, 2011

Install Ruby goodies for ruby 1.9.3 on Windows

If you install Ruby 1.9.3 on Windows from source, there are two lacked features - readline and debugger. This article introduces using these features in Ruby 1.9.3 on Windows.

readline

If you are a specialist of cygwin or mingw, you may also build readline from source. But, there are an easier way - installing rb-readline.
> gem install rb-readline
And you should check rb-readline is active like below:
> irb --readline -r irb/completion

debugger

In short: check this post. In more detail, let's do three installation like below:
  1. Download linecache19 (0.5.13 or above) from here, then
    > gem install linecache19-0.5.13.gem
    at last check that c:/ruby-1.9.3/include/ruby-1.9.1/ruby-1.9.3-p0 is created.
  2. Download ruby-debug-base19 (0.11.26 or above) from here, then
    > gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=c:/ruby-1.9.3/include/ruby-1.9.1/ruby-1.9.3-p0
  3. > gem install ruby-debug19

If you want to manage these features in Rails3

Edit for your Gemfile on your app like below:
group :development do
  gem 'rb-readline'
  gem 'ruby-debug19', require: 'ruby-debug'
end

Friday, November 4, 2011

Ruby 1.9.3 p0 has been released

A few days ago, finally, Ruby 1.9.3 p0 has been released.

If you are a Windows user, you can download installer from here.

If you are a Windows user and if you want to build from source by yourself, let's refer to the instructions written in phosphorescence: Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS (Of course, ready for Windows 8 preview).

Monday, October 24, 2011

Autumn short vacation 2011

I take a autumn vacation, so I suspend posts and comments to this blog for a moment. Resume will be November 4, 2011.

Friday, October 21, 2011

make unobtrusive CoffeeScript on AWDwR 4th beta chapter15

On Agile Web Development with Rails 4th edition beta chapter15 (Internationalization), there is one more stuck point not-related with internationalization. In this chapter, JavaScript sample is not unobtrusive one. So I try to rewrite the sample with unobtrusive CoffeeScript.

application.js and application.html.erb

In this tutorial, we should use CoffeeScript only store.js.coffee. So we can omit to use another *.js.coffee files.
  1. In application.js file, delete the line //= require_tree ..
  2. In application.html.erb file, add the line <%= javascript_include_tag "store" %>.

make unobtrusive

In store.js.coffee, write the code for erase submit button and execute the action when drop down list is changed.
$ ->
  $('.locale input').hide()
........
$ ->
  $('#set_locale').change ->
    $(this).parent('form.locale').submit()
so that we just write the drop down list in layouts/application.html.erb like below:
    <%= form_tag store_path, class: 'locale' do %>
      <%= select_tag 'set_locale', options_for_select(LANGUAGES, I18n.locale.to_s) %>
      <%= submit_tag 'submit' %>
    <% end %>

Tuesday, October 18, 2011

Addenda for AWDwR 4th beta chapter15

Agile Web Development with Rails 4th edition beta has a quality almost like final version. But, chapter15 (Internationalization) just has beta one. There are some stuck points. So I try to explain these points.

Configure default locale and available locales

In this book, author creates the file config/initializers/i18n.rb and configure default locale and locales for drop down list in this file. But, there are two better ways:
  1. This sample does not explain the code for available locales.
  2. There are some definitions for locale in config/application.rb file.
So that we should write below in config/application.rb file, not config/initializers/i18n.rb file:
# -*- coding: UTF-8 -*-
........
LANGUAGES = [
  ['English', 'en'],
  ['日本語'.html_safe, 'ja']
]


module Depot
  class Application < Rails::Application
........
    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    config.i18n.default_locale = :en
    config.i18n.available_locales = LANGUAGES.map(&:last)

........
  end
end

default_url_options in controller

In this book, method default_url_options is inplemented in ApplicationController class. But, this brings two troublesome points.
  1. default_url_options would take an optional argument for hash.
  2. This works when server running or functional test running, but does not when integration test running.
So that we re-write these:
application_controller.rb
  def default_url_options(options={})
    options.merge({locale: I18n.locale})
  end
In each integration tests
  def setup
    app.default_url_options = { locale: I18n.locale }
  end

Saturday, October 15, 2011

Rails 3.1.1 never depends on bcrypt-ruby, but must be required.

One week ago, Ruby on Rails 3.1.1 has been released. Since this release, rails never depends on bcrypt-ruby. But, when you use some functions related with encryption, you need to choice from some encryption gems.

For example, if you want to use has_secure_password, you should write onto Gemfile like below:
gem 'bcrypt-ruby', '~> 3.0.0'

Wednesday, October 12, 2011

MySQL Connector/Net 6.4.4 has been released

In two weeks ago, MySQL Connector/Net 6.4.4 has been released(Check change log).

You may think this release is small bug-fix one. But, for ASP.NET MVC3 / EntityFramework4 developer, this contains big change. Since this release, "Code first" function runs correctly with PluralizingTableNameConvention. So you don't have to remove this convention like this post anymore!

Monday, October 10, 2011

Ruby community announces 1.8.x will be discontinued

Ruby community announces that Ruby 1.8.7 will be stopped developing in June 2012 and will be discontinued including any bug-fixes in June 2013.

Plans for 1.8.7

I strongly welcome this decision. And I also hope for Ruby Association that they will change their Ruby Certification from Ruby 1.8.7 tests to ruby 1.9.3 tests!

Friday, October 7, 2011

R.I.P. Steve Jobs

Thank you, Steve. I use OS X Lion on my Macmini, and Windows 8 DP on its Bootcamp comfortably.

Tuesday, October 4, 2011

Two .js templates in Rails 3.1

In Rails 3.1, there are two JavaScript templates - the one is 'app/views/**/*.js.erb', the other one is 'app/assets/javascripts/*.js.coffee'. What are these? And how different are these?

In short, 'app/views/**/*.js.erb' is bare jQuery with ERb template, and 'app/assets/javascripts/*.js.coffee' is CoffeeScript file.

In more detail, 'app/views/**/*.js.erb' is written for the response of Ajax request, both with bare jQuery and with ERb. 'app/assets/javascripts/*.js.coffee' is written for another scripts with CoffeeScript when the page is loaded. And then, 'app/assets/javascripts/*.js.coffee' is compiled to jQuery by server-side JavaScripts (e.g. node.js).

Saturday, October 1, 2011

Where will Qt go? (reprise)

10 months ago, I wrote the article: phosphorescence: Where will Qt go?. In today, despite the fact that Qt 4.7.4 and QtCreator 2.3.1 had been released, Qt again encounters the pinch to be discontinued.

The reason is that Meego is discontinued because Intel decide to marge Meego to Samsung's LiMo, and rename these to Tizen. Tizen announces they recommand to use HTML5 as mobile application platform, not any native applications include Qt.

I agree that the future mobile application platform will be HTML5. And IMO, Qt should go back to just be a library for KDE.

Thursday, September 29, 2011

"git show" nearly equals to "git diff"

git diff has many options and these can do many features. And the most useful feature is to get latest diff.
> git diff HEAD^
but, this feature has more useful alias: git show
> git show

Monday, September 26, 2011

Ruby 1.9.3 RC1 has been released

A few days ago, Ruby 1.9.3 RC1 has been released. If you are Windows user, you can install with doing instructions in phosphorescence: Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS (Of course, ready for Windows 8 preview).

Friday, September 23, 2011

What means "fsc" in functional programming?

In functional programming domain, there are 2 executable files named "fsc". Which one is Scala's daemon compiler. Which other one is F# compiler. If you install both and set both to your PATH, a name collision occurs. So that, F# team treats it with renaming F# compiler from "fsc" to "fsharpc" when installer finds there is Scala. That commit is below:

Commit ac7d60de9e7017aa22ac76e2c6b5a02bee92f935 to fsharp/fsharp - GitHub


Affected by it, "fsi" also renames to "fsharpi".

Tuesday, September 20, 2011

Ruby 1.9.3 preview on Windows 8 preview

I have installed Ruby 1.9.3 preview1 on Windows 8 preview on Mac mini (Late 2009).
When I installed Windows 8 preview on Mac mini (Late 2009) with using Boot camp, I referred these articles.
Then I have installed Ruby 1.9.3 preview1 with using MinGW, referring my phosphorescence: Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS.

Saturday, September 17, 2011

AWDwR 4th beta is ready for Rails 3.1

As you may know, Agile web development with Rails(a.k.a. AWDwR) becomes ready for Rails 3.1. In other words...
  • Now the edition of AWDwR is 4th beta. And its e-book becomes ready for Rails 3.1 and Ruby 1.9.x.
  • It's good entry book for starting Rails 3.1 with Ruby 1.9.x.
  • It's also good book for starting Sass and CoffeeScript.

Of course, I'm reading this e-book.

Thursday, September 15, 2011

F# 3.0 is officially announced

In the BUILD conference, F# 3.0 is officially announced.

F# 3.0 Developer Preview Now Available!

Good news


Bad news

  • At this moment, it is released for only MSDN subscriber.
Despite Windows 8 previrew does not need any subscriptions :-<

Monday, September 12, 2011

Two tips for installaing Rails 3.1

About two weeks ago, Ruby on Rails 3.1 had been released. I found there are two tips for installation - compared with the previous version.

You should install node.js

Ruby on Rails 3.1 needs server-side ECMAScript because some gems of Rails 3.1 need it - CoffeeScript and sass. So you should install node.js. Especially, I recommend it for windows user because node.js provides windows binary.

You could uninstall abstract gem

Ruby on Rails 3.1 needs erubis 2.7.0, And this version of erubis is noe depending on abstract gem despite erubis 2.6.x depends it. So you could uninstall abstract gem if you upgrade Rails from 3.0.x.

Monday, August 29, 2011

Summer vacation 2011

I take a summer vacation, so I suspend posts and comments to this blog for a moment. Resume will be September 12, 2011.

Friday, August 26, 2011

Studying F# : async

The sample in phosphorescence: Studying F# : Accumulator, pipe and composition is written as sync program. In this article, I try to re-write that sample to async program with async { } cluase.
Microsoft (R) F# 2.0 Interactive build 2.0.0.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

> let fizzBuzzMapper data =
-     Seq.map ( fun elem -> async { return (elem, (elem % 3 = 0), (elem % 5 = 0) ) } ) data;;

val fizzBuzzMapper : seq<int> -> seq<Async<int * bool * bool>>

> let fizzBuzzReducer interims =
-     Array.foldBack (fun (elem, m3, m5) acc ->
-         match (m3, m5) with
-         | (true, true) -> "FizzBuzz" :: acc
-         | (true, false) -> "Fizz" :: acc
-         | (false, true) -> "Buzz" :: acc
-         | _ -> elem.ToString() :: acc ) interims [];;

val fizzBuzzReducer : ('a * bool * bool) [] -> string list

> [1..40] |> fizzBuzzMapper |> Async.Parallel |> Async.RunSynchronously |> fizzBuzzReducer;;
val it : string list =
  ["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"]
> [1..40] |> ( fizzBuzzReducer << Async.RunSynchronously << Async.Parallel << fizzBuzzMapper ) |> List.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
val it : unit = ()

Tuesday, August 23, 2011

I've finished reading "Professional F# 2.0"

I've finished reading Professional F# 2.0. This book is useful for learning F# at first, especially Part0 ~ Part III. But to read this book requires some prerequisites.
  1. Minimum knowledge of OCaml - this book does not contain any explanations about let in clause.
  2. Minimum knowledge of CLR - but that is covered in .NET Book Zero
Contents in Part IV are slightly out of date and slightly out of need. And there are no contents about any kinds of side effects or monads. But, say again, this book is useful for learning F# at first.

Saturday, August 20, 2011

Studying F# : ignore

POSIX shell has /dev/null - a kind of redirect target to ignore standard outputs and error outputs. In F#, there is a similar function, the name is ignore. To illustrate along the examples in Studying F# : Accumulator, pipe and composition, all the functions using |> ignore return unit.
> let fizzBuzzMapper data =
-     List.map ( fun elem -> (elem, (elem % 3 = 0), (elem % 5 = 0) ) ) data;;

val fizzBuzzMapper : int list -> (int * bool * bool) list

> [1..40] |> fizzBuzzMapper |> ignore;;
val it : unit = ()

Thursday, August 18, 2011

Studying F# : Accumulator, pipe and composition

F#'s collection classes have some accumulator methods.
method namedescription
foldthe base accumulator method to accumulate a collection
fold2the variation of fold method to accumulate two collections
scanthe variation of fold method to return not only last result and but also intermediate results
reducethe special usage of fold method if both accumulator and elements are in same type

Monday, August 15, 2011

Modify the default font of Mono after 2.10.3

(Since MonoFramework 2.10.7, there are no needs to do this instructions. Please update your MonoFramework to 2.10.7 or above.)

After Mono Framework 2.10.3, the way was changed how we modify the default font of Mono application like MonoDevelop. In this post, I write the way to modify from "Lucida Grande" to "Hiragino Maru Gothic Pro".
  1. Detect gtkrc file. If you are a MacOS X user, this file is in /Library/Frameworks/Mono.framework/Versions/Current/etc/gtk-2.0/gtkrc
  2. patch below onto /Library/Frameworks/Mono.framework/Versions/Current/etc/gtk-2.0/gtkrc
    58a59
    > font_name = "Hiragino Maru Gothic Pro 14"
    216c217
    < gtk-font-name = "Lucida Grande 12"
    ---
    > gtk-font-name = "Hiragino Maru Gothic Pro 12"

Friday, August 12, 2011

I've finished reading "Semiotics of Programming"

I've finished reading Semiotics of Programming. I recognized these things from this book:
  • What is "Object-oriented programming", and what is "Functional programming".
  • Object-oriented programming as trialism.
  • Why and How "tail call optimization" is.
  • Why and How "currying" is.
  • The word "Monad" indicates different meanings - the one for the term of philosophy and the other for the term of Functional programming.
In this book, there are some sample code written in Java or Haskell. And I try to rewrite these in my languages - Ruby and F#.

Tuesday, August 9, 2011

Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS

My previous post is only applicable for overwriting onto existing ruby 1.9.x. But, if you want to install ruby 1.9.3 with MinGW and MSYS from zero, we need more instructions.

Saturday, August 6, 2011

SublimeText2 - a supreme editor I encountered

In fact, now Sublime Text 2 is still beta. But, I have tried it a little, I discover this editor is the one I ever encountered. There are many advantage for me.

  1. Multi language - tons of Static and dynamic languages ready
  2. Multi platform - for Windows, Mac OS X and Linux
  3. Very useful on every platforms
  4. Affordable - 1 user 1license

So I decide to throw past editors away - say good-bye to xyzzy, NetBeans, redcar, XCode and so forth.

Thursday, August 4, 2011

Build libffi and libyaml on MinGW for Ruby 1.9.3

This article is for overwriting installation. If you want to do clean installation, check phosphorescence: Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS.

Since Ruby 1.9.3, Ruby will become to depend on both libffi and libyaml. If you are Mac user or Linux user, that's easy. But, if you are windows user, it's difficult. In this post, I introduce building both libffi, libyaml and ruby 1.9.3 preview1 on MinGW. If you want to use cygwin or VisualStudio, see other articles with google.

Monday, August 1, 2011

Kernel 3.0 is coming in openSUSE tumbleweed

http://download.opensuse.org/repositories/openSUSE:/Tumbleweed/standard/
Kernel 3.0 is ready in openSUSE Tumbleweed. Of course, it succeeds to start up.

Friday, July 29, 2011

Units of measure libraries for ruby

alchemist and vanunits, these are two ruby libraries to manipulate "Units of measure". Most impressive character of both is these can write "Units of measure" codes in rubyish method chain style.

alchemist

Pros

  • Light

cons

  • Cannot calculate devision of units
  • Not ready for String#inspect to show units

vanunits

Pros

  • Can calculate devision of units
  • Ready for String#inspect to show units

cons

  • Too heavy, oftenly deep stack error occurs

Tuesday, July 26, 2011

Retrospective of my LT

Slide (fixed)

YetAnotherMVC3vsRails3.pdf

Survey

  • Comparing whole cultures when developing with each framework, not framework itself only.
  • Comparing de-facto and out-of-the-box libraries and tools with full-stack structure, if each framework consists in loosely coupled.
  • Ruby and C#, Both my languages.

Where I fixed

incorrect:LINQ to SQL
correct:LINQ to Entities

Sample codes

https://github.com/dw3w4at/Mvc3Depot

Abstract

Sample web application by ASP.NET MVC3
It's originated from AWDwR 4th's Depot application (without Tests, Mails and I18Ns).

Appendix

There is no "carts" table (containing just only p-key and timestamps) in Rails' sample version.
Because, C# has System.Guid class and SQL Server has the column type for GUID.
So that this sample has no need for preparing "carts" table to pretend p-key as GUID like Rails' sample version.

Saturday, July 23, 2011

update summaries of RubyKaigi 2011

I update summaries that I attend of RubyKaigi 2011.

phosphorescence: The 1st day of RubyKaigi 2011 (Morning)
phosphorescence: The 1st day of RubyKaigi 2011 (Afternoon)
phosphorescence: The 2nd day of RubyKaigi 2011 (Morning)
phosphorescence: The 2nd day of RubyKaigi 2011 (afternoon)
phosphorescence: The last day of RubyKaigi 2011

I say again thanks to all staffs, speakers and attendees.

Congrats, kernel 3.0 is out!

The 3.0 kernel is out

If you want to try kernel 3.0 on your openSUSE, use repository below at your own risk.
http://download.opensuse.org/repositories/Kernel:/HEAD/standard/

And there are no available ones in stable repository and in Tumbleweed repository at now.
(continue to phosphorescence: Kernel 3.0 is coming in openSUSE tumbleweed)

Thursday, July 21, 2011

Ruby 1.9.2 p290 and Ruby DevKit 4.5.2 have been released

A few days ago, Ruby 1.9.2 p290 and Ruby DevKit 4.5.2 have been released. If you are Windows user, You are able to choice installing from source with DevKit or installing with RubyInstaller.

Monday, July 18, 2011

The last day of RubyKaigi 2011

Today is the 3rd day of RubyKaigi 2011 and THE LAST DAY of the RubyKaigi.
In this day, I attended these sessions:

Sunday, July 17, 2011

The 2nd day of RubyKaigi 2011 (afternoon)

In this afternoon, I attended these sessions:

The 2nd day of RubyKaigi 2011 (Morning)

Today is the 2nd day of RubyKaigi 2011.
In this morning, I attended these sessions:

Saturday, July 16, 2011

The 1st day of RubyKaigi 2011 (Afternoon)

In this afternoon, I attended these sessions:

The 1st day of RubyKaigi 2011 (Morning)

The 1st day of RubyKaigi 2011 was held at here.

Google Maps
In this morning, I attended these sessions:

Wednesday, July 13, 2011

ViewBag is not living in redirected action

ViewBag - a place holder between action and view - is living in one response. In other words, ViewBag is not living in redirected action despite the fact Rails' flash go living. Then, what should we use? It is TempData

Monday, July 11, 2011

Mono 2.12 is coming soon

There are a draft of release note for Mono 2.12. This release will make improvement both for SGen and for C# compiler.

Friday, July 8, 2011

Java7 launch event in Tokyo

In yesterday, Java7 launch event was held at Aoyama, Tokyo. the program is like below:
  1. Opening
  2. Summary of Java7 & Java8
  3. HotRockit / New licenses for Java
  4. NetBeans 7.0 / Project Coin
  5. InvokeDynamic
  6. Fork/Join Framework -> Lambda
  7. More new I/O
  8. Lightning talks
I had two thoughts from this event.
  • Both G1GC and InvokeDynamic are great technologies. It's good news for LLs (like JRuby) on JVM.
  • But, new Java7 features for Java language are imperfect because there are lack of lambda. Those features will become perfect since Java8.
And most funniest talk is about "JRuby and invokedynamic".

Wednesday, July 6, 2011

Updated MySQL Connector/Net

Current MySQL Connector/Net is 6.3.7, and this version can do code first in limited condition. This post expresses the instruction of code first with MariaDB.

Monday, July 4, 2011

mysql2 runs successfully again

after the version 0.2.11 or 0.3.6, mysql2 runs successfully again.

And I introduce the way to run rails 3.0.9 with mysql2 0.2.11 on MariaDB 5.2.7 in Windows.

  1. Install the MariaDB on Windows into C:/MariaDB
  2. Install ruby 1.9.x with Ruby DevKit 4.5.1
  3. Install rails 3.0.9
  4. Install mysql2 0.2.11
    > gem install mysql2 --version=0.2.11 --platform=ruby -- --with-mysql-include=C:/MariaDB/include --with-mysql-lib=C:/MariaDB/lib
  5. Do rails ways
    > rails -d mysql sample
    > cd sample
    > rails g scaffold person first_name:string last_name:string
    > rails s
That's all.

Friday, July 1, 2011

Semiotics of Programming

Now I'm reading "Semiotics of Programming".
The book deals with semiotics. And at the same time, the book also deals with the difference of paradigm between object-oriented programming and functional programming. This book is a interesting academic book, and is also a good introduction for who wants to learn this difference of paradigm.

Tuesday, June 28, 2011

Selected as an LTer

I've selected as an Lightning Talker in RubyKaigi2011.

Lightning talks 1 - July 17, 2011 (Main Hall)

My LT title is Yet Another "ASP.NET MVC 3 vs. Ruby on Rails 3".

I will do my best!!

Goodies

RubyKaigi staffs release some goodies in here.

Saturday, June 25, 2011

Calculate the firefox year #2

(continued from phosphorescence: Calculate the firefox year)
A rapid pace of growth of IT is often likened to a "dog year". And now, more rapid pace comes! It calls "firefox year".

http://mozilla.jp/firefox/preview/faq/#q-rapid-3
  • Firefox 5 was released at 2011-06-21.
  • Firefox 6 will be released at 8 weeks after Firefox 5's one.
  • Firefox n + 1 will be released at 6 weeks after Firefox n's one.

So I again try to calculate the year when the version equals release year and when the version passes release year, in F#.

Thursday, June 23, 2011

Calculate the firefox year

A rapid pace of growth of IT is often likened to a "dog year". And now, more rapid pace comes! It calls "firefox year".

http://mozilla.jp/firefox/preview/faq/#q-rapid-3
  • Firefox 5 was released at 2011-06-21.
  • Firefox 6 will be released at 8 weeks after Firefox 5's one.
  • Firefox n + 1 will be released at 6 weeks after Firefox n's one.

So I try to calculate the year when the version equals release year and when the version passes release year, in Ruby 1.9.

Monday, June 20, 2011

Studying F# : Combination of Generics and Discriminated Union

We can use generics in Discriminated Union's of clause.
type Component<'a> =
    | Composite of list<Component<'a>>
    | Leaf of 'a
let compositeSample = Composite([ Leaf(2); Composite([ Leaf(1); Leaf(3) ]) ])

Friday, June 17, 2011

MariaDB 5.2.7 for windows is big change.

In yesterday, MariaDB 5.2.7 has been released. For POSIX, this release is minor release. But. for windows, this release is almost major release with three things.
  1. Upgrading wizard for existing MariaDB windows services.
  2. HeisiSQL is bundled as Defualt client for Windows MariaDB.
  3. Default my.ini is in "MariaDB installation directory\data\my.ini".

Tuesday, June 14, 2011

Studying F# : Reference cell

Reference cell is a keyword for using immutable binding as mutable container approximately.

define reference cell

> let refCellInt = ref 10;;

val refCellInt : int ref = {contents = 10;}

change value in reference cell

> refCellInt := 20;;
val it : unit = ()
> System.Console.WriteLine(refCellInt.Value);;
20
val it : unit = ()

undefine reference cell

> let normallInt = !refCellInt;;

val normallInt : int = 20

Saturday, June 11, 2011

Comparison of Ruby's Enumerable and C#'s Linq to Object #2

The samples for Grouping in interactive shell.

Ruby 1.9's Enumerable on Mac OS X

$ irb1.9
irb(main):001:0> one_to_ten = 1..10
=> 1..10
irb(main):002:0> one_to_ten.group_by {|i| i % 3}
=> {1=>[1, 4, 7, 10], 2=>[2, 5, 8], 0=>[3, 6, 9]}

Mono(C#)'s Linq to Object on Mac OS X

$ csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> using System.Linq;
csharp> int[] oneToTen = new int[]{1,2,3,4,5,6,7,8,9,10};
csharp> oneToTen.GroupBy(i => i % 3).ToDictionary(g => g.Key, g => g.ToList());
{{ 1, { 1, 4, 7, 10 } }, { 2, { 2, 5, 8 } }, { 0, { 3, 6, 9 } }}

Thursday, June 9, 2011

Comparison of Ruby's Enumerable and C#'s Linq to Object #1

The samples for restriction and projection in interactive shell.

Ruby 1.9's Enumerable on Mac OS X

$ irb1.9
irb(main):001:0> one_to_ten = 1..10
=> 1..10
irb(main):002:0> one_to_ten.find_all {|i| i % 2 == 1 }.collect {|i| i**2}
=> [1, 9, 25, 49, 81]

Mono(C#)'s Linq to Object on Mac OS X

$ csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> using System.Linq;
csharp> int[] oneToTen = new int[]{1,2,3,4,5,6,7,8,9,10};
csharp> oneToTen.Where(i => i % 2 == 1).Select(i => Math.Pow(i, 2));
{ 1, 9, 25, 49, 81 }

Monday, June 6, 2011

Timetables of RubyKaigi2011 are revealed

Timetables of RubyKaigi2011(a.k.a. THE LAST RubyKaigi) are revealed now.
The most notable and the most misterious session is Yami RubiKaigi. It means roughly "Conference In The Dark".

Friday, June 3, 2011

Studying F# : let in

I confused about "let in" clause because there are no explains and no descriptions about this in the book Professional F# 2.0. So I search about it in another sites, then I guess "let in" clause is used for "throwaway" binding. The sample is below:
> let useForRightSideOfIn arg =
-     System.Console.WriteLine(arg.ToString()) in List.iter useForRightSideOfIn [1;2;3];;
1
2
3
val it : unit = ()
> useForRightSideOfIn [1;2;3];;

  useForRightSideOfIn [1;2;3];;
  ^^^^^^^^^^^^^^^^^^^

stdin(3,1): error FS0039: The value or constructor 'useForRightSideOfIn' is not defined

Tuesday, May 31, 2011

Studying F# : inline keyword

When you define simple calculator function, you just write like below:
let add a b = a + b

There is a question. What type of these arguments? In F# interactive console, it's int, so othre numeric types is not accepted for this function.
> let add a b = a + b;;

val add : int -> int -> int

> add 2 3;;
val it : int = 5
> add 2.0 3.0;;

  add 2.0 3.0;;
  ----^^^

stdin(3,5): error FS0001: This expression was expected to have type
    int
but here has type
    float
How do we make the function acceptable other numeric types?

Saturday, May 28, 2011

openSUSE Tumbleweed on VirtualBox

If you want to launch openSUSE Tumbleweed on your machine directory, you just install from this repository.

http://download.opensuse.org/repositories/openSUSE:/Tumbleweed/standard/

But, if you want to launch openSUSE Tumbleweed on VirtualBox, that is not enough. You should add the repository below:

http://download.opensuse.org/repositories/Virtualization:/VirtualBox_Tumbleweed/openSUSE_Tumbleweed/

Thursday, May 26, 2011

Yet another simple way to associate One-To-One relation and to modify both tables.

There's a sample to associate One-To-One relation and to modify both tables in ASP.NET MVC3.
But there is some margin for more CoC. So I describe yet another simple way.

Monday, May 23, 2011

Tickets for RubyKaigi2011 are on sale

From yesterday, Some tickets about RubyKaigi2011 (a.k.a. THE LAST RubyKaigi) were on sale. There are three SKUs for attending this conference.
In addition to these SKUs, there are one more ticket for attending official conference party.

I already bought a Normal Ticket.

Friday, May 20, 2011

O'Reilly's e-books go DRM free in Japan too.

E-books on oreilly.co.jp were not DRM free, despite e-books on oreilly.com had been DRM free already. But that is over. In yesterday, oreilly.co.jp announced they made their e-books DRM free (news release in Japanese).

Tuesday, May 17, 2011

Studying F# : Module

In F#, there are namespace like C#. But, it is not normal F# way and F#'s namespace is not permitted nested namespaces. The normal F# way is defining module.

Declaration

module Examples
let helloWorld() = "Hello World"
module Greeting =
    let helloWorld() = "Hello Module World"
    module Inner =
        let helloWorld() = "Hello Inner Module World"
Normally, it is enough that there is just one module declaration in the first line. If you want to declare more than one modules or nested modules, module declaration is in below lines and it requires =.

Usage

If you want to use some modules, open statement must be in another module or in namespace global.
namespace Program
open Examples
[<Class>]
type Simple() =
    static member execute() =
        System.Console.WriteLine("Examples.helloWorld() : {0}", helloWorld())
        System.Console.WriteLine("Examples.Greeting.helloWorld() : {0}", Greeting.helloWorld())
        System.Console.WriteLine("Examples.Greeting.Inner.helloWorld() : {0}", Greeting.Inner.helloWorld())
        0

Saturday, May 14, 2011

Studying F# : Generics

In Java or C#, Generics is written as <T>, T is the type parameter.

In F#, it's similar to above, we just write <'a>, 'a is the type parameter.
[<Class>]
type Reflector<'a>() =
    member r.GetMembers() =
        let ty = typeof<'a>
        ty.GetMembers()
let rflc = new Reflector<System.Math>()
// usage
Array.iter (fun it -> System.Console.WriteLine(it.ToString())) (rflc.GetMembers())
Function typeof gets the concrete type of type parameter.

This is normal generic way. And there is one more generic way - with static type parameter.
[<Class>]
type StaticReflector() =
    static member GetMembers<'a>() =
        let ty = typeof<'a>
        ty.GetMembers()
// usage
Array.iter (fun it -> System.Console.WriteLine(it.ToString())) (StaticReflector.GetMembers<System.Math>())

Wednesday, May 11, 2011

Studying F# : Interface

F# has interfaces. we can define it and use it like other object-oriented languages.

Definition


[<Interface>]
type IDrinker =
    inherit System.IComparable
    inherit System.IFormattable
    abstract Drink : unit -> unit // method definition of interface
    abstract FavoriteDrink : string // property definition of interface
Interface can inherit another interfaces multiply.

Usage


[<Class>]
type DrinkingPerson(fn, ln, a) =
    inherit System.Object()
    interface IDrinker with
        member this.CompareTo(other) =
            let other = other :?> DrinkingPerson
            let tln : string = this.LastName
            let ln = tln.CompareTo(other.LastName)
            if ln <> 0 then
                let tfn : string = this.FirstName
                let fn = tfn.CompareTo(other.FirstName)
                if fn <> 0 then
                    let ta : int = this.Age
                    ta.CompareTo(other.Age)
                else
                    fn
            else
                ln
        member this.ToString(s:string, fp:System.IFormatProvider):string =
           "Not interesting enough to implement yet"
        member this.Drink() =
            System.Console.WriteLine("Yep")
        member this.FavoriteDrink =
            "Grapefruit juice"
    override this.GetHashCode() =
        hash(fn, ln, a)
    override this.Equals(other) =
        compare this (other:?>DrinkingPerson) = 0
    member p.FirstName = fn
    member p.LastName = ln
    member p.Age = a
hash and compare are utility functions for implementing GetHashCode() and Equals(other) explicitly.

Monday, May 9, 2011

Qt 4.7.3 has been released

A few days ago, Qt Framework 4.7.3 and Qt Creator 2.2 have been released. We can choose for installing the latest Qt either by using QtSDK only or by using each installers (Qt Framework and Qt Creator).

Thursday, April 28, 2011

Spring short vacation 2011

In Japan, last week of April and first week of May are short vacation weeks. Of course, I take a short vacation, so I suspend posts and comments to this blog for a moment. Resume will be May 9, 2011.

Tuesday, April 26, 2011

Install and Launch MariaDB on Mac OS X

MariaDB is not ready to install from MacPorts. So should we configure from source in the tarball? No. MariaDB team recommends to build with Bazaar. Read these links:

  1. Build Environment Setup for Mac
  2. Getting the MariaDB Source Code

And there are three more instructions to complete the installation and launch MariaDB.
$ sudo mysql_install_db --user=mysql
$ sudo /usr/local/share/mysql/mysql.server start
$ sudo mysql_secure_installation

That's all.

Saturday, April 23, 2011

F# April 2011 has been released

F# April 2011 Community Technology Preview has been released. You can download from here.

Wednesday, April 20, 2011

Enable ASP.NET Web Site Administration Tool with MariaDB on MVC3

(continued from phosphorescence: Create Simple MVC 3 App with VWDExpress and MariaDB)
If you want to use the system built in ASP.NET with MariaDB, you should do some configurations. This article is referring this article.

Create schema for aspnetdb on MariaDB

Like in this post, create the schema named as aspnetdb and special user for aspnetdb schema.


Monday, April 18, 2011

Create Simple MVC3 App with VWDExpress and MariaDB

(continued from phosphorescence: Prepare MVC 3 with VWDExpress and MariaDB)

Create new MVC 3 project

Launch Visual Web Development 2010 Express, and at first, set the default development web server as IIS Express. [Tools]-[Options]-[Project or Solution]-[Web projdct], turn on the checkbox.
Then, create new MVC 3 project following the wizard. In this sample, I name this project as Mvc3Training. If xunit.net is installed, you can choose test project in the wizard.

Friday, April 15, 2011

Easier way to install F# PowerPack both on Mac OS X and on Linux

There are the easier way to install F# PowerPack both on Mac OS X and on Linux. After downloading F# PowerPack zip from here, operate like below:
$ sudo unzip FSharpPowerPack.zip -d /opt
$ cd /opt/FSharpPowerPack-2.0.0.0/bin
$ sudo gacutil /i FSharp.Compiler.CodeDom.dll
$ sudo gacutil /i FSharp.PowerPack.Build.Tasks.dll
$ sudo gacutil /i FSharp.PowerPack.Compatibility.dll
$ sudo gacutil /i FSharp.PowerPack.dll
$ sudo gacutil /i FSharp.PowerPack.Linq.dll
$ sudo gacutil /i FSharp.PowerPack.Metadata.dll
$ sudo gacutil /i FSharp.PowerPack.Parallel.Seq.dll
$ fsi

Microsoft (R) F# 2.0 Interactive build (private)
Copyright (c) 2002-2010 Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "FSharp.PowerPack.dll";;

--> Referenced '/opt/FSharpPowerPack-2.0.0.0/bin/FSharp.PowerPack.dll'

Tuesday, April 12, 2011

Prepare MVC3 with VWDExpress and MariaDB

(continued from phosphorescence: Minimal MariaDB configuration on Windows for Express Web Development)

Create schema for MVC 3 application

In MySQL Workbench, "Start Querying" with root account.
Add schema for MVC 3 application. I this sample, I named it as "mvc3_training"

Saturday, April 9, 2011

Minimal MariaDB configuration on Windows for Express Web Development

(continued from phosphorescence: Install MVC 3 with VWDExpress and MariaDB)

Deploy my.ini

In MariaDB installation directory, there are 5 4 templete files for my.ini
  • my-huge.ini
  • my-innodb-heavy-4G.ini
  • my-large.ini
  • my-medium.ini
  • my-small.ini
MariaDB Windows version loads my.ini from "MariaDB installation directory\data\my.ini". one of these path.
  1. C:\Windows\my.ini
  2. C:\Windows\my.cnf
  3. C:\my.ini
  4. C:\my.cnf
  5. MariaDB installation directory\my.ini
  6. MariaDB installation directory\my.cnf
So you just rename from one of above list to one fo below list.

Thursday, April 7, 2011

Install MVC3 with VWDExpress and MariaDB

ASP.NET MVC 3 is web application framework with QWAN by (unexpectedly) Microsoft. But the most disappointing point of ASP.NET MVC 3 is that this uses SQL Server by default. It's only one and at all. So I try to install and create MVC 3 application with another RDB. I choose MariaDB. And I try this by Visual Web Development 2010 Express. Let's show instructions for installation.
  1. Let's check that .NET 4 is in your Windows machine. If not, install .NET 4 .
  2. Download Windows Installer of MariaDB and install.
  3. Download Windows Installer of MySQL Workbench and install.
  4. Download Windows Installer of MySQL Connector/Net and install. But, Visual Web Development 2010 Express is not ready for some IDE features in Windows installer version of MySQL Connector/Net.
  5. Download Web Platform installer and install.
  6. Install Visual Web Development 2010 Express SP1 and IIS Express 7.5 from installed Web Platform installer.
  7. Download ASP.NET MVC 3 and its language pack and install.
  8. Download zip file of xUnit.net and unzip
  9. launch xunit.installer.exe and install for Visual Web Development 2010 Express. Visual Web Development 2010 Express has no test frameworks and xUnit.net is the only one test framework adaptable with Visual Web Development 2010 Express.
(Conitinue to phosphorescence: Minimal MariaDB configuration on Windows for Express Web Development)

Monday, April 4, 2011

Re-enable desktop effect on KDE4 on openSUSE

Desktop effect on KDE4 are sometimes falling down and not to recover enable. How do we do re-enable it? See this article.

no desktop effects

As you see, this article is written for Kubuntu, but it's adaptable for openSUSE too.

Friday, April 1, 2011

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:
[<Class>]
type Person(fn, ln, a) =
    member p.FirstName = fn
    member p.LastName = ln
    member p.Age = a
[<Class>]
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

RubyistForJapan

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 2.0.0.0
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 2.0.0.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "FSharp.PowerPack";;

--> Referenced 'C:\Program Files\FSharpPowerPack-2.0.0.0\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.

Saturday, February 26, 2011

Studying F# : Type Extension #2

In phosphorescence: Studying F# : Type Extension, I mentioned about Type Extension compared with ruby's Open Class. But, there are difference obviously. F#'s Type Extension cannot allow overload with same signature and override.

Wednesday, February 23, 2011

Studying F# : Type Extension

Ruby's Open Class is the one of cool features.
irb(main):001:0> class String
irb(main):002:1>   def say_hello
irb(main):003:2>     "Hello #{self}"
irb(main):004:2>   end
irb(main):005:1> end
=> nil
irb(main):006:0> "World".say_hello
=> "Hello World"

In F#, there is Type Extension. This is also cool code.
> type System.String with
-     member s.sayHello = "Hello " + s;;

type String with
  member sayHello : string

> "World".sayHello;;
val it : string = "Hello World"
to be continued...

Monday, February 21, 2011

Ruby 1.9.2 p180 was released

3 days ago, Ruby 1.9.2 p180 was released. So I download from here, and re-install it like this entry. Let's check.
> /opt/ruby-1.9.1/bin/ruby --version
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
The goodest news in this release is the version of RubyGems. It becomes 1.5.x!

Friday, February 18, 2011

Mono 2.10 has three more languages out-of-the-box

In two days ago, Mono 2.10 had been released. The most notable change is "three more languages out-of-the-box". These are F#,:
IronPython,:
and IronRuby.:

Tuesday, February 15, 2011

IronRuby 1.1.2 is released

One week ago, IronRuby 1.1.2 has been released. This release fixes many bugs related with RubyGems... here is also about RubyGems!

Saturday, February 12, 2011

Where will Qt go?

In yesterday, Nokia and Microsoft announce "Strategic Partnership". There are many news sources. The main topic of its pertnership is, of course, Nokia decides to adopt Windows Phone OS for Nokia's smart devices. But, one more notable topic for me is coming at the last of Q&A on Nokia's briefing webcast - Where (How) will Qt go?

Thursday, February 10, 2011

Studying F# : Discriminated Union #3

In phosphorescence: Studying F#: Discriminated Union #2, I mentioned about another similarity between "Discriminated Union" in F# and Java's enum. But there are many different paradigms in there. So I write about two advanced features of "Discriminated Union" in this article.

Monday, February 7, 2011

Studying F# : Discriminated Union #2

In phosphorescence: Studying F# : Discriminated Union, I mentioned that "Discriminated Union" in F# is similar to Java's enum. Java's enum can define any members(method, property and so on). Of course, "Discriminated Union" can do too.

Friday, February 4, 2011

RubyGems 1.5.0 is ready for Ruby 1.9.2

A few days ago, RubyGems 1.5.0 is released. And this release one supports finally Ruby 1.9.2 (previous version one was not. check this article) .

Tuesday, February 1, 2011

Studying F# : Discriminated Union

The enum of C# works as halfway between C++'s one and Java's one.

Saturday, January 29, 2011

Next NetBeans is decided to omit RoR Support

NetBeans community decides to omit Ruby on Rails Support, unfortunately.

http://netbeans.org/community/news/show/1507.html

But, NetBeans community will continues only the support for ruby-lang.

Now is the time to switch my ruby IDE to redcar?

Thursday, January 27, 2011

LibreOffice repositories for openSUSE

A few days ago, LibreOffice 3.3.0 final has been released. And this release is equivalent with LibreOffice 3.3.0 RC4. openSUSE is already preparing LibreOffice repositories.

http://download.opensuse.org/repositories/LibreOffice:/

For instance, the repository of openSUSE 11.3 is here:

http://download.opensuse.org/repositories/LibreOffice:/Unstable/openSUSE_11.3/
(Update on 2011/02/05)
http://download.opensuse.org/repositories/LibreOffice:/Stable/openSUSE_11.3/