Wednesday, December 22, 2010

Winter brake 2010-2011

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

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

Monday, December 20, 2010

Abbrev for Multibyte characters

Each Ruby implementations have distinct behavior of abbrev library (in Japanese). There is a sample program:
# -*- coding: UTF-8 -*-
require 'abbrev'

puts RUBY_VERSION
result = Abbrev.abbrev(%w{あした あなた})
puts result, result.count

"あした" means "tomorrow", and "あなた" means "you". So let's run this script on Ruby 1.9(Linux), JRuby(Linux) and IronRuby(Windows).

Friday, December 17, 2010

Studying F# : Local Calendars #2

(continued from phosphorescence: Studying F# : Local Calendars)

In previous article, I try to retrieve System.DateTime with local calendar. And in this article, I try to display the date and its local era with local calendar in local "culture". In .NET/CLR terminology, "culture" is equivalent with "locale".

> open System;;
> open System.Globalization;;
> let japanInfo = new CultureInfo("ja-JP");;

val japanInfo : CultureInfo = ja-JP

> japanInfo.DateTimeFormat.Calendar <- new JapaneseCalendar();;
val it : unit = ()
> DateTime.Now.ToString("D", japanInfo);;
val it : string = "平成 22年12月17日"

"平成" is the era pronouncing "Heisei".

Tuesday, December 14, 2010

Studying F# : Local Calendars

One of the most useful features in .NET/CLR is supporting not only Gregorian calendar but also many local calendars. For me, it is awesome that there is the Japanese Calendar (in Japanese : 和暦 / pronounce "wareki").

For instance, Era 3 (Shouwa) ends at 1989/01/07 (Shouwa 64) and Era 4 (Heisei) starts at 1989/01/08 (Heisei 1). Of course, F# (on .NET/CLR) supports these like below:
> let wareki = new System.Globalization.JapaneseCalendar();;

val wareki : System.Globalization.JapaneseCalendar

> wareki.GetYear(new System.DateTime(1989, 1, 7));;
val it : int = 64
> wareki.GetEra(new System.DateTime(1989, 1, 7));;
val it : int = 3
> wareki.GetYear(new System.DateTime(1989, 1, 8));;
val it : int = 1
> wareki.GetEra(new System.DateTime(1989, 1, 8));;
val it : int = 4

And when System.DateTime is initialized with the Japanese Calendar, its Era is indicated for 4 (Heisei). For example, This year is Heisei 22 in the Japanese Calendar:
> new System.DateTime(22, 12, 14, wareki);;
val it : System.DateTime = 2010/12/14 0:00:00 {Date = 2010/12/14 0:00:00;
                                               Day = 14;
                                               DayOfWeek = Tuesday;
                                               DayOfYear = 348;
                                               Hour = 0;
                                               Kind = Unspecified;
                                               Millisecond = 0;
                                               Minute = 0;
                                               Month = 12;
                                               Second = 0;
                                               Ticks = 634278816000000000L;
                                               TimeOfDay = 00:00:00;
                                               Year = 2010;}

Saturday, December 11, 2010

Qt Conference - Tokyo 2010

In yesterday, Qt Conference - Tokyo 2010 was held at Akihabara, Tokyo. There are many sessions like below:
  1. Keynote 1
    • Speaker: Daniel Kihlberg
    • Japan: 45% growth on the web in 2010
    • Nokia is now shipping devices with Qt
    • Qt 4.7: Increased performance and QML
    • Open governance of Qt
    • Qt Certification
    • Qt = the application platform
    • Bridges Symbian and Meego
    • eating our own dog food
    • Meego focuses open innovation
      • Application Vendors, Chipset Vendors and Device Vendors
  2. Keynote 2
    • Speaker: David Almstrom
    • Qt Architecture : Cross platform
    • Qt Everywhere: STB, Mobile, HP Printer, Coffee maker and so on
    • Qt licenses
      • Commercial
      • LGPL v2.1
      • GPL v3
    • Code once -Deploy Everywhere using SDK
    • Qt for Mobile Devices
      • Symbian Devices
      • Meego Devices
      • Ovi services
    • Genivi Consortium
      • Meego IVI Distro
    • Qt 4.7
      • QtQuick
      • benchmark-driven development culture
      • quality
      • mobile development
    • Future
      • more quality
      • hardware acceleration
      • modularity
    • Market Feedback
      • hardware acceleration
      • Web integration
      • data from sensors
      • 3D
      • touch data
    • Scene Graph Project
    • Project Lighthouse
      • New abstract layer for window systems
  3. Qt in Use: Dynamic UI for CE Devices
    • Speaker: Masato Shimoi
    • Who is Netflix?
      • DVD and Blu-ray rent by mail
      • Streaming video has started since 3 years ago
      • 2009, member 12 million / streaming user 6 million
      • 2010, member 19 million / streaming user 11 million
      • New launch at 2010 Q3
        • PS3 embedded app
        • Google TV
        • Apple TV
    • IMO, UI innovations for Video service may increase
    • Innovation area
      • codec
      • DRM
      • protocol
      • security
      • UI Framework
    • NRDP SDK
      • Netflix ready device partner SDK
      • 2008: 1.0: C++ based UI
      • 2009: 2.0 Flash based UI
      • 2010: 2.1/3.0/3.1 Dynamic UI (Flash or HTML5 based UI)
    • We recommend DHTML using Webkit
      • HTML5 momentum
      • HTML expertise is widely available
      • NRDP SDK contains Javascript Extensions for refine Webkit
    • Which distro of Webkit
      • Time to Market
      • Skill of Partners
      • Support
      • Developer community
      • We choose QtWebkit
        • Partners already know Qt technologies
        • Nokia local offices are widely existing
    • Selecting Qt 4.6.2
      • challenge to speed up animations
      • challenge to decrease RAM/flash footprint
    • Benefits
      • no need to wait for firmware updates
      • A/B testing for continuously improving UX
  4. Qt in Use: UX Development with QML on MeeGo
    • Speaker: Hideto Kobayashi
    • Nomovok and Qt
      • #1 MeeGo ARM Integrator
      • using Qt since 2005
      • developing Qt technologies
      • using QML since as QtDeclarative
    • Why QML?
      • Smooth developing with little C++ knowledge
      • Same performances with traditional Qt development
      • Clean separation between UI and logic
      • ease to HW acceleration
      • UX is optimized for different form factors
    • Challenging points
      • There are no tools supporting QML completely still QtCreator 2.1 is released
      • Not so many examples and practices
      • OpenGL: problematic
      • Both l10n and i18n are not supported still QtSDK 4.7.1 is released
    • Coming future we hope
      • Qt lighthouse
        • less dependencies with X11
      • Qt widget toolkits
      • Qt Scene Graph
        • HW acceleration ready
    • QML can create yet another MeeGo UI
  5. Meet Qt: Styling Qt Widgets
    • Speaker: Ryosuke Yamada
    • Increasing demands for applications
      • Improvement of expression
      • Improvement of operability
    • We develop custom widgets
      • Change appearance of original widgets
      • Need for learning both structures and drawings for widget
    • QWidget inherits both QObject and QPaintDevice
    • Each widgets inherit QWidget
    • QWidget has many virtual methods
    • Each widgets override these methods as necessary
    • paintEvent: method for drawing appearance
    • StyleOption Option for states of drawing
      • features
      • state
      • text
      • icon
    • We can set Qstyle for each widgets or whole application
    • GUI Emulation
      • Emulate appearance of distinct platforms inside Qt Framework
      • Subclass of QStyle is created for each platform
      • Drawing is calling primitive API of each platform
      • Some QStyle implementations depend on specific platform
    • If we want to create our own appearance, we implement the subclass of QStyle
  6. Meet Qt: QtCreator
    • Speaker: Kenji Sugita
    • Past Qt GUI tools
      • Qt Designer
      • Qt Assistant
      • Qt Lingulst
    • Qt Creator
      • Code editor optimized for Qt development
      • Integrate with Qt Designer and Qt Assistant
      • qmake, Cmake
      • gdb / CDB
      • Quick Access a.k.a. locator
      • Integrate with VCS (like git)
    • Demo for tips of QtCreator
    • Qt SDK for Windows
      • Application created with Qt SDK is compiled with g++(in MinGW)
      • QtCreator itself and its libraries are compiled with VisualStudio
      • So any plug-ins created with Qt SDK are not adaptable for QtCreator on Windows
      • solutions
        • Create whole with VisualStudio
        • Bulld QtCreator from source with g++(in MinGW)
  7. Meet Qt: QtQuick
    • Speaker: Takumi Asaki
    • Speaker: Tasuku Suzuki
    • What is QtQuick?
      • Qt User Interface Creation Kit
      • Framework for UI development
      • Easy to develop gorgeous UI
      • Easy to develop by who knows less knowledge of C++
    • Past development
      • Using C++ and Qt Designer
      • Problems
        • Qt Designer only deals with static layout
        • If we create gorgeous UI, we must code with C++
      • For instance) If we create Cover art UI
        • C++ : 1622 lines
        • QML : 150 lines
    • Components of QtQuick
      • Qt Declarative Module
        • Execution engine since Qt 4.7
        • usage as C++ API
      • QML
        • Qt Meta-Object Language
        • Declarative language for UI development
        • Syntax like CSS and JSON
      • QtCreator (2.1)
        • QML Editor
        • QML Designer
        • QML Debugger
    • QML syntax
      • tree structures
      • Declares, elements and properties
    • Demo for QML programming on QtCreator
      • There are no button elements
      • Scratch up mouse area, label and so forth as Button
      • Designer in QtCreator can develop creating State
      • Designer in QtCreator cannot develop transitions between states
    • Demo for developing data list
      • There are no compiling in development
    • Matters we still develop with Qt/C++
      • Table manipulation with SQL
      • Network access without HTTP
    • Qt/C++ can access QtQuick features
      • Of course, signals and slots
      • QML can access the instance in Qt/C++
    • Coming features of QtQuick
      • Scene Graph
      • QtQuick Components
      • Qt3D
  8. Optimize the performance
    • Speaker: Tomonari Miyazaki
    • What is QTestLib
      • lightweight
      • highspeed
      • Test for GUI
      • benchmark
    • orders
      1. initTestCase
      2. init
      3. each test functions
      4. cleanup
      5. cleanupTestCase
    • QT += testlib
    • Demo for QTestLib
    • Demo for QBENCHMARK of QTestLib
    • For Window, compile option '-ltcg' increases running speed(10~15%)
    • http://qt.gitorious.org/qt-labs/qtestlib-tools
Advanced Qt Programming Japanese Edition will be published in Summer, 2011.

Thursday, December 9, 2010

If you fail Install RMagick on MinGW and MSYS...

If you fail phosphorescence: Install RMagick on MinGW and MSYS, it may be the reason that convert command in extconf.rb file is overloaded with Windows File System's one. So edit the gems/rmagick-2.13.1/ext/RMagick/extconf.rb file at #171 and #178 like below:
`identify -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-\d+ /

Then let's type the command in gems/rmagick-2.13.1 directory.
> gem build rmagick.gemspec
> gem install rmagick-2.13.1.gem --platform=ruby -- --with-opt-lib=c:/ImageMagick/6.6.6-Q16/lib --with-opt-include=c:/ImageMagick/6.6.6-Q16/include

And Now I'm requesting pulling it.

Monday, December 6, 2010

Ruby DevKit 4.5.1 has been released

A few days ago, Ruby DevKit 4.5.1 has been released. (See also phosphorescence: Newest Ruby Devkit is released #1.)

If you never install older one, type these commands in DevKit directory:
> ruby dk.rb init
> ruby dk.rb install

If you already install older one, type these commands in DevKit directory:
> ruby dk.rb init
> ruby dk.rb install -f

Friday, December 3, 2010

Ruby's DateTime is treating "the Gregorian Conversion"

In Western world, there is the Gregorian Conversion. Fortunately, Ruby's DateTime class is treating this.

irb(main):001:0> require 'date'
=> true
irb(main):002:0> dt1015 = DateTime.new(1582,10,15)
=> #<DateTime: 1582-10-15T00:00:00+00:00 (4598321/2,0,2299161)>
irb(main):003:0> dt1015 - 1
=> #<DateTime: 1582-10-04T00:00:00+00:00 (4598319/2,0,2299161)>
irb(main):004:0> dt1111 = DateTime.new(1582,11,11)
=> #<DateTime: 1582-11-11T00:00:00+00:00 (4598375/2,0,2299161)>
irb(main):005:0> dt1111 << 1
=> #<DateTime: 1582-10-04T00:00:00+00:00 (4598319/2,0,2299161)>

Tuesday, November 30, 2010

Studying F# : catch the exception

In ruby, the clauses for catching some exception is like below:
begin
  # some actions
rescue
  # the action when error occurs
else
  # the action when error does not occur
ensure
  # the final action whether error occurs or not
end

But, in F#, there are two point that is different from ruby.

  1. There are no clause corresponding else.
  2. There are only clauses either try/with(corresponding begin/rescue) or try/finally(corresponding begin/ensure)

In other words, clause try/with/finally is Forbidden.

> let results =    
-     try
-         (1 / 0)
-     with
-         | ex -> "Some error occurs."
-     finally
-         "Final";;

      finally
  ----^^^^^^^

/Users/youhei/stdin(9,5): error FS0010: Unexpected keyword 'finally' in binding. Expected incomplete structured construct at or before this point or other token.

Saturday, November 27, 2010

Both openSUSE and Mono will be alive, maybe.

4 days ago, Novell agreed to be bought by Attachmate. And my interest is "Will both openSUSE and Mono be alive, or not?".

For Mono, there is a Miguel de Icaza's tweet.
After the Novell acquisition, Mono continues as-is, but our paychecks will come from Attachmate instead of Novell.

For openSUSE, there is a n article that says "openSUSE is safe".

I hope both projects are alive.

Wednesday, November 24, 2010

One more instruction for installing MonoDevelop F# add-in on Linux

If you install MonoDevelop F# add-in on Linux and you use with non-root user, you should do one more instruction:
sudo chmod a+w -R /etc/mono/registry/

Monday, November 22, 2010

F# in MonoDevelop on Mac OS X

In the article "F# in MonoDevelop and cross-platform web sites & screencasts", there are the instruction for installing F# in MonoDevelop on Linux. But someone ( of course, me too ) want to use this on Mac OS X and that instruction not suitable for on Mac OS X. So I introduce in this post.

0. Install F#

see also in this post.

Friday, November 19, 2010

.NET Book Zero equals Mono Book Zero

.NET Book Zero is the most famous book as free and online PDF, for C# beginners.
http://www.charlespetzold.com/dotnet/

But, of course, this book also useful for Mono beginners like me. I am reading both this book and Professional F# 2.0.

Tuesday, November 16, 2010

Start reading Professional F# 2.0

I have started reading "Professional F# 2.0".
No I'm reading the first chapter: PART-0-CHAPTER-1. This introduce where we have to use functional programming in, with showing us many complicated C# codes. Yes, at now, F# codes have not appeared yet.

Saturday, November 13, 2010

Euler's formula in F#

  1. Create new F# application on VS2010
  2. Check the references containing System.Numerics
Then edit the code like below:
open System
open System.Numerics

let euler_formula = Numerics.Complex.Exp(Numerics.Complex(0.0, -Math.PI))
printfn "%O" euler_formula

At last, launch the command prompt with F5:
(-1, -1.22460635382238E-16)
It occurs by inexactness of floating-point.

Wednesday, November 10, 2010

Do you know Ruby 1.9 encoding rule?

Ruby 1.9 treats the encoding within each String instance. And there are rules which encoding are defined from script or from external file. The rules are there (in Japanese).

I think, CRuby is the one and only Ruby implementation treating this rules correctly. When I had used irb, I had found its bug in JRuby and in IronRuby, and have reported this for each projects. In JRuby, this bug will be fixed for v1.6 release.

Monday, November 8, 2010

Studying F# : Dictionary (a.k.a. Hash or Map)

In F#, there are no types like Dictionary, Hash, Map and so on. We must implement using List, Tuple and dict function.
(This above sentence is incorrect. I correct by thie entry.)

In F#, there are no ways to create Dictionary directly. We must create Dictionary using List, Tuple and dict function.

> let dictionary_1 = dict [ (1, "one"); (2, "two"); (3, "three"); (4, "four") ];;
val dictionary_1 : System.Collections.Generic.IDictionary

> let dictionary_2 = dict [ (1, "one"); (2.0, "two"); (3, "three"); (4, "four")];;
  let dictionary_2 = dict [ (1, "one"); (2.0, "two"); (3, "three"); (4, "four")];;
  ---------------------------------------^^^

stdin(7,40): error FS0001: This expression was expected to have type
    int
but here has type
    float
> let dictionary_3 = dict [ ("one", 1); ("two", 2); ("three", 3.0); ("four", 4)];;
  let dictionary_3 = dict [ ("one", 1); ("two", 2); ("three", 3.0); ("four", 4)];;
  ------------------------------------------------------------^^^

stdin(8,61): error FS0001: This expression was expected to have type
    int
but here has type
    float

Each key and value must be same types.

Friday, November 5, 2010

Studying F# : String literal

In Ruby, there are two types for String literal. The first one is the literal not-escaping at all:
irb(main):001:0> s1 = "Hello World\n"
=> "Hello World\n"
irb(main):002:0> print s1
Hello World
=> nil
And the second one is escaping all:
irb(main):003:0> s2 = 'Hello World\n'
=> "Hello World\\n"
irb(main):004:0> print s2
Hello World\n=> nil

In F#, String literal is only using double-quote and this way is not escape at all.
> let s1 = "Hello World\n";;

val s1 : string = "Hello World
"

> printf "%s" s1;;
Hello World
val it : unit = ()

How do we escape all? The answer is using @ before double-quote, like below:
> let s2 = @"Hello World\n";;

val s2 : string = "Hello World\n"

> printf "%s" s2;;
Hello World\nval it : unit = ()

Tuesday, November 2, 2010

Mongrel2 repositry for openSUSE 11.3

As you know, "mongrel" is Ruby's web server as substitute of Webrick. But, "mongrel2" is not only for Ruby. "mongrel2" is for all of modern languages. And, its repositry for openSUSE 11.3 is alreday in there:

http://download.opensuse.org/repositories/server:/http:/mongrel2/openSUSE_11.3/

Saturday, October 30, 2010

Studying F# : Currying

In this article, there is a sample about the finction having more than one parameter:
val sum : int = 8

> printf "%d" sum;;
8val it : unit = ()

And now, we want to do Currying for this function. How should we do?

Thursday, October 28, 2010

Studying F# : Difference of List, Array and Tuple

Now I'm studying about F#. And I learned the difference of List, Array and Tuple.

List

A list in F# is an ordered, immutable series of elements of the same type.
Each elements are separated by semicolons.
> let integer_list = [1; 2; 3];;

val integer_list : int list = [1; 2; 3]

> let string_list = ["a"; "b"; "c"];;

val string_list : string list = ["a"; "b"; "c"]

Monday, October 25, 2010

IronRuby 1.1.1 is released

A few days ago, IronRuby 1.1.1 has been released. It is the first release compatible with Ruby 1.9.2. And now, non-English languages are recognized almost correctly.

Friday, October 22, 2010

If you want to use Mono 2.8 on openSUSE 11.3 immediately...

In default Mono repository for openSUSE 11.3 (http://download.opensuse.org/repositories/Mono/openSUSE_11.3/), there are packages of version 2.6, not 2.8. If you want to use Mono 2.8 on openSUSE 11.3 immediately, use the repository below:

http://ftp.novell.com/pub/mono/download-stable/openSUSE_11.3/

Tuesday, October 19, 2010

F# TIMTOWTDI : fibonacci

1st step

let defines function, and let rec defines recursive function.
> let rec fibonacci n = if n=0 then 0 elif n=1 then 1 else fibonacci(n-2) + fibonacci(n-1);;
> for i in [0..10] do
-     let fibn = fibonacci i
-     printfn "%d" fibn
- done;;
0
1
1
2
3
5
8
13
21
34
55
val it : unit = ()

Saturday, October 16, 2010

Install F# on Mac OS X

This article is for Mono 2.8.x and older. Mono 2.10.x and newer contain F# out-of-the-box.
Since Mono 3.0.2, Our Mac can run F# 3.0. Please check F# 3.0 on Mac

F# is an object-oriented functional language by Microsoft. It's based on C#. I try to explain what technologies of Java-lang are corresponding to:
execution environmentobject-oriented languageobject-oriented functional language
Java technologiesJVMJavaScala
.NET technologiesCLRC#F#

And F# is also available on Mono, not only .NET . Let's install F# on Mac OS X from scratch!

Thursday, October 14, 2010

memcached for Windows had been expired

Until few days before, Memcached binaries for Windows were in http://labs.northscale.com/memcached-packages/. But now, no more in there because Northscale has moved to Membase and Membase.org since 4 days ago. And, if we still use memcached on Windows, we should to install Membase Server Enterprise Edition or Membase Community Edition. memcached is included in there.

For instance, I try to install Membase Community Edition on my Windows. This product has administration web pages like below:

Monday, October 11, 2010

Qt 4.7 for openSUSE is available

Qt 4.7 for each openSUSE versions is available. For instance, the repository of Qt 4.7 for openSUSE 11.3 is below:
http://download.opensuse.org/repositories/KDE:/Qt47/openSUSE_11.3/

Install with Yast2, restart and launch QtCreator 2.0.1 for running QML sample application.

Friday, October 8, 2010

I've finished reading "Metaprogramming Ruby"

I've finished reading Metaprogramming Ruby. This book is great book for:
  • What metaprogramming is in Ruby
  • Why do we do metaprogramming with Ruby
  • How do we do metaprogramming by Ruby

But not only that, this is also great book for leaning what safe level is in Ruby. There are simple and lucid examples for leaning safe level. And, this book have taught me about nested irb.
irb(main):001:0> s = 'hello world'
=> "hello world"
irb(main):002:0> irb s
irb#1(hello world):001:0> upcase
=> "HELLO WORLD"
irb#1(hello world):002:0> exit
=> #<IRB::Irb: @context=#<IRB::Context:0x00000100849a30>, @signal_status=:IN_EVAL, @scanner=#<RubyLex:0x000001008454f8>>
irb(main):003:0> exit
I did not know at all until reading this book.

Tuesday, October 5, 2010

Install RMagick on MinGW and MSYS

Currently, Windows Rubyist is installing RMagick from here. But there are 3 problems.
  1. Not latest RMagick version
  2. Not latest Ruby version
  3. Not latest bundled ImageMagick

But we are already having Ruby Devkit (MinGW). So let's get latest RMagick on Windows.

Saturday, October 2, 2010

Testing ActiceRecord-JDBC with DB2 on Mac OS X

(continued from phosphorescence: Install DB2 on Mac OS X)

I helped to testing ActiveRecord-JDBC with DB2 on my Macmini. But there are two big traps. In this article, I write about the second trap : Testing ActiceRecord-JDBC with DB2 on Mac OS X.

Clone sources and tests from repository

$ git clone http://github.com/nicksieger/activerecord-jdbc-adapter.git

Wednesday, September 29, 2010

Install DB2 on Mac OS X

I helped to testing ActiveRecord-JDBC with DB2 on my Macmini. But there are two big traps. In this article, I write about the first trap : Install DB2 on Mac OS X. I have researched with IBM developerWorks, Antonio Cangiano's blog, Google and Google.

Choose Installer

I use DB2 Express-C for this test. But, unfortunately, There are no V9.7.x installer for Mac OS X. So I choose the V9.5.2 beta installer.

Monday, September 27, 2010

Qt SDK 4.7.0 was released

1 week ago, Qt SDK 4.7.0 was FINALLY released. In this release, QML is enabled. So we can install Qt, QML and QtCreator straightforward.

When I install the Qt SDK of windows version, I DON'T choose MinGW option because GCC of Ruby DevKit is newer than one of this Qt SDK.

So let's launch sample QML application from QtCreator with Qt 4.7.0.

Saturday, September 18, 2010

Autumn short vacation 2010

I take a autumn vacation, so I suspend posts and comments to this blog for a moment. Resume will be September 27, 2010.

Wednesday, September 15, 2010

confusion of many gem environments

In this article, I installed many Ruby languages on my Macmini. But Confusion of many gem environments occurs. It's the conflict about Ruby1.8's and Ruby 1.9's

$ gem1.9 outdated
/opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems/source_index.rb:68:in `installed_spec_directories': undefined method `path' for Gem:Module (NoMethodError)
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems/source_index.rb:58:in `from_installed_gems'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems.rb:883:in `source_index'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems/gem_path_searcher.rb:81:in `init_gemspecs'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems/gem_path_searcher.rb:13:in `initialize'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems.rb:841:in `new'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems.rb:841:in `block in searcher'
    from :10:in `synchronize'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems.rb:840:in `searcher'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems.rb:479:in `find_files'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems.rb:983:in `load_plugins'
    from /opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems.rb:1139:in `'
    from :29:in `require'
    from :29:in `require'
    from /usr/bin/gem:8:in `
'

It's the bug reported in Debian (see the report) and it may occurs in Mac OS X too. Temporary solution for this bug is, edit the shebang.
$ sudo vi `which gem1.9`
#!/opt/local/bin/ruby1.9 --disable-gems
...
$ gem1.9 outdated
mail (2.2.5 < 2.2.6.1)

That's okay.

Monday, September 13, 2010

IronRuby 1.1 is available, maybe.

IronRuby's latest version is 1.1 (stable version is still 1.0) . This version will be compatible with Ruby 1.9.2.

Really? Show the irb of Ruby 1.9.2.

Next, show the irb of IronRuby 1.1.

Oops, String#encoding is not ready.

Friday, September 10, 2010

Now I'm reading "Metaprogramming Ruby"

The best selling book in RubyKaigi 2010 is the Japanese edition of "Metaprogramming Ruby"


IMO, it's cool cover than original edition, isnt' it?

BTW, now I'm reading this book to Chapter 3, it's very interesting and useful.

Tuesday, September 7, 2010

Start Rails3 on MinGW

(The library name "sqlite3-ruby" had been renamed to "sqlite3".)

One week ago, Ruby on Rails 3.0 (Rails3) has been released. I try to do the first step of Rails3 application on MinGW. Fortunately, SQLite3 and sqlite3-ruby had been installed in previous post phosphorescence: Install sqlite3-ruby on MinGW and MSYS. Let's start!

$ rails new sample
$ cd sample
$ rails g scaffold person first_name:string last_name:string
$ rake db:migrate
$ rails s

update summaries of RubyKaigi 2010

I update summaries that I attend of RubyKaigi 2010.

phosphorescence: The 1st day of RubyKaigi 2010
phosphorescence: The 2nd day of RubyKaigi 2010 (Morning)
phosphorescence: The 2nd day of RubyKaigi 2010 (Afternoon)
phosphorescence: The 3rd day of RubyKaigi 2010 (Morning)
phosphorescence: The 3rd day of RubyKaigi 2010 (Afternoon)

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

And one more thing you should read is this, - the most influencing article to Yoshimasa Takahashi's "The Last RubyKaigi in next year".

Saturday, September 4, 2010

Ruby's License will change to BSDL + Ruby's dual license

At three days ago, in mail list, ruby core team announce the plan to change license from "GPLv2 + Ruby's dual" to "BSDL + Ruby's dual".

[ruby-core:31971] Change Ruby's License to BSDL + Ruby's dual license
[ruby-dev:42166] Ruby'sライセンスの、BSDLとのデュアルライセンスへの変更

IMO, I think it caused by the 'CVE-2010-0541' problem about license.

Wednesday, September 1, 2010

Install sqlite3-ruby on MinGW and MSYS

(The library name "sqlite3-ruby" had been renamed to "sqlite3".)

For this instruction, we can get c-ext ruby libraries on MinGW and MSYS as We can do on Unix/Linux.

So I try to install both SQLite3 and sqlite3-ruby, of course, on MinGW and MSYS.

Sunday, August 29, 2010

The 3rd day of RubyKaigi 2010 (Afternoon)


In this afternoon, I attended these sessions:

The 3rd day of RubyKaigi 2010 (Morning)

Today is the 3rd day of RubyKaigi 2010.

I attended these sessions in this morning:

Saturday, August 28, 2010

The 2nd day of RubyKaigi 2010 (Afternoon)

In this afternoon, I attended these sessions:

The 2nd day of RubyKaigi 2010 (Morning)


Today is the 2nd day of RubyKaigi 2010.

I attended these sessions in this morning:

Friday, August 27, 2010

The 1st day of RubyKaigi 2010

The 1st day of RubyKaigi 2010 was held (only afternoon) at here.



I attended some sessions and try to report them.
  • If the session has a movie in English, I just write summaries of the article. Please see that movies if you want more details.
  • If the session has a movie in Japanese, I write the article with translating and little-summarizing.
  • If the session has no movies in any languges, I try to write the article with little-summarizing.
  • But, for Ceremonies and Lightning Talks, I only put the link of movies.
  • And I don't translate Q&As in the article because these are the gift for attendees in there.

Wednesday, August 25, 2010

Newest Ruby Devkit is released #2

(continued from phosphorescence: Newest Ruby Devkit is released #1)

If you already using both MinGW and MSYS installed by you, and these are working well, You should copy to each directories manually.

Monday, August 23, 2010

Newest Ruby Devkit is released #1

Newest Ruby Devkit (containing GCC 4.5.0) is released at the same time that RubyInstaller 1.9.2p0 is released. This contains those files and directories:

bin            # directory for MSYS
devkitvars.bat # Utility if you want to set PATH automatically
dk.rb          # devkit installer to lib/ruby/site_ruby
etc            # directory for MSYS
include        # directory for MSYS
lib            # directory for MSYS
m.ico          # Icon for MSYS
mingw          # directory for MinGW
msys.bat       # MSYS launcher
msys.ico       # Icon for MSYS
perllocal.pod  # perllocal.pod
postinstall    # directory for MSYS
sbin           # directory for MSYS
share          # directory for MSYS


If you are not using both MinGW and MSYS, You just install Newest Devkit as this installation steps.

Friday, August 20, 2010

Ruby 1.9.2 p0 is FINALLY released

In two days ago, Ruby 1.9.2 p0 has been released. Before installing it, remember the 2nd day of RubyKaigi 2009 (Morning) and this article I mentioned. Ruby team recommends we are installing Ruby 1.9.2 and later with '1.9.1' path. So let's install and check

> ./configure --prefix=/opt/ruby-1.9.1 --enable-shared --srcdir=.
> make
> sudo make install
> /opt/ruby-1.9.1/bin/ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
> /opt/ruby-1.9.1/bin/ruby -e 'puts RUBY_VERSION, $:'
1.9.2
/opt/ruby-1.9.1/lib/ruby/site_ruby/1.9.1
/opt/ruby-1.9.1/lib/ruby/site_ruby/1.9.1/i686-linux
/opt/ruby-1.9.1/lib/ruby/site_ruby
/opt/ruby-1.9.1/lib/ruby/vendor_ruby/1.9.1
/opt/ruby-1.9.1/lib/ruby/vendor_ruby/1.9.1/i686-linux
/opt/ruby-1.9.1/lib/ruby/vendor_ruby
/opt/ruby-1.9.1/lib/ruby/1.9.1
/opt/ruby-1.9.1/lib/ruby/1.9.1/i686-linux

As you see, $: does not contain . directory.

Tuesday, August 17, 2010

NetBeans 6.9.1 was released

One and a falf week ago, NetBeans 6.9.1 was released. This bundles JRuby 1.5.1 and now supports Rails 3.0 (RC).

Saturday, August 14, 2010

How to add official tweet button on each blogspot posts

In yesterday, Official tweet button has been released. But, as out-of-box, this is not optimized for each blog posts like facebook's like button I wrote in phosphorescence: How to add facebook like button on each blogspot post. So I do the "try and error" to customize tweet button for each blogspot post, then I found the approach with referring official tweet button API page.
  1. [Layout] -> [Edit HTML]
  2. Turn on the checkbox "Expand widget templates"
  3. Into the tag of class='post-header-line-n' or class='post-footer-line-n', put the snipet like below:
    <a class='twitter-share-button' data-count='horizontal' data-via='your_twitter_name' expr:data-text='data:post.title' expr:data-url='data:post.url' href='http://twitter.com/share'>Tweet</a>
    <script src='http://platform.twitter.com/widgets.js' type='text/javascript'/>

We need to take care of containing ' in title. If contained, page title is omitted after '. So we should check all page titles and convert from ' to &apos;.

Thursday, August 12, 2010

Clean Ruby 1.9.2's remaining older gems manually

When I install Ruby 1.9.2 RC2, update gems and clean up older gems, but there are some remaining older gems like below:

> /opt/ruby-1.9.1/bin/gem update
> /opt/ruby-1.9.1/bin/gem cleanup
> /opt/ruby-1.9.1/bin/gem list

*** LOCAL GEMS ***

minitest (1.7.0, 1.6.0)
rake (0.8.7)
rdoc (2.5.9, 2.5.8)
test-unit (2.1.1)

What happened? In /opt/ruby-1.9.1/lib/ruby/gems/1.9.1/specifications directory, there are files like below:
> ls /opt/ruby-1.9.1/lib/ruby/gems/1.9.1/specifications
minitest-1.7.0.gemspec  minitest.gemspec  rake.gemspec  rdoc-2.5.9.gemspec  rdoc.gemspec  test-unit-2.1.1.gemspec

As you see, minitest.gemspec and rdoc.gemspec are remaining. So I remove manually and re-list gems.
> cd /opt/ruby-1.9.1/lib/ruby/gems/1.9.1/specifications
> rm minitest.gemspec rdoc.gemspec
> /opt/ruby-1.9.1/bin/gem list

*** LOCAL GEMS ***

minitest (1.7.0)
rake (0.8.7)
rdoc (2.5.9)
test-unit (2.1.1)

Monday, August 9, 2010

What version of Qt and QtRuby are bundled on openSUSE 11.3?

I check what version of Qt and QtRuby are bundled on openSUSE 11.3 like this entry. And the results are below:

> rbrcc -version
Ruby Resource Compiler for Qt version 4.6.3
> rbuic4 -v              
Qt User Interface Compiler version 4.6.3   
> rbqtapi -v             
QtRuby 2.1.0 using Qt-4.6.3
QtRuby 2.1.0 is the latest trunk version.

Friday, August 6, 2010

JRubyKaigi2010 is held with RubyKaigi2010 at same place

JRubyKaigi2010 is held with RubyKaigi2010 at same place(Tsukuba) and same time(2010/08/28). Its official site is below:
Fortunately, The sessions I want to join in RubyKaigi2010 and in JRubyKaigi2010 are not overlapping.

Tuesday, August 3, 2010

openSUSE 11.3 doesn't contain QML

Unfortunately, openSUSE 11.3 doesn't contain QML. So we cannot evaluate QML as out-of-box. We should use Qt 4.7.0 beta2 or should wait that Qt 4.7.0 final will be released. But QtCreator is ready for QML.

Saturday, July 31, 2010

openSUSE 11.3 contrib packages are usable

openSUSE 11.3 contrib repository contains usable packages. So I introduce some packages

(1) vim plugins

There are many plugins to improve vim.

(2) nginx

The HTTP server suitable LL frameworks.

(3) chromium

It's just Chrome port for Linux. But before, we had built from source by myself with long long hours. And now, in openSUSE 11.3 contrib repository, we just install it. Of course, chromium supports Chrome's themes.

Thursday, July 29, 2010

A short impression of MeeGo Seminar Summer 2010

3 days ago, MeeGo Seminar Summer 2010 was held in Shinagawa, Tokyo. There are some sessions about Qt and QML. But most impressed thing in these sessions is "OviStore is not ready for QML applications". We still may remain to create Qt applications.

Monday, July 26, 2010

Ruby 1.9.2 RC2 had been released

A half month ago, ruby 1.9.2 RC2 was already released. I installed for Linux and for MinGW. Ruby 1.9.2 RC2 can work on openSUSE 11.3 correctly.

Friday, July 23, 2010

openSUSE 11.3 was released

One week ago during I was in summer vacation, openSUSE 11.3 was released. From this version, You can choice either MySQL Community or MariaDB. I choice MariaDB. Of course, we can set run-level as same as MySQL Community.

Tuesday, July 20, 2010

Timetables of RubyKaigi2010 are revealed

Timetables of RubyKaigi2010 are revealed now.
In my opinion, all sessions I want to join are not overlapping, happily!

Saturday, July 10, 2010

Summer vacation 2010

I take a summer vacation, so I suspend posts and comments to this blog for a moment. Resume will be July 20, 2010.

Thursday, July 8, 2010

MacPorts upgraded, Newest Ruby and JRuby are available

Repositry tree of MacPorts has been upgraded, and now, Ruby 1.9.1 p429 and JRuby 1.5.0 are both available.

$ sudo port selfupdate
$ sudo port outdated
...
jruby                          1.4.0_0 < 1.5.0_0
...
ruby19                         1.9.1-p378_0 < 1.9.1-p429_0
...
$ sudo port upgrade outdated
$ sudo port -f activate jruby @1.5.0_0
$ jruby -v
jruby 1.5.0 (ruby 1.8.7 patchlevel 249) (2010-07-05 6586) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_20) [x86_64-java]
$ ruby1.9 -v
ruby 1.9.1p429 (2010-07-02 revision 28523) [i386-darwin10]
I learned the sudo port -f activate jruby @1.5.0_0 instrucation. If I upgrade library on my MacPorts upto major version, sometimes needs sudo port -f activate library @version .

Monday, July 5, 2010

Ruby 1.9.2 RC1 was released

At the same time on Ruby 1.9.1 p429 release, Ruby 1.9.2 RC1 was also released. Of course, It's ready for Linux and MinGW, see corresponding instructions on these articles(for Linux / for MinGW).

If you fail MinGW instruction, you may success with --srcdir=. option.
Youhei@3935-CF61 ~/ruby-1.9.2-rc1 $ ./configure --prefix=c:/ruby-1.9.1 --enable-shared --srcdir=.
Youhei@3935-CF61 ~/ruby-1.9.2-rc1 $ make
Youhei@3935-CF61 ~/ruby-1.9.2-rc1 $ make install

Saturday, July 3, 2010

Ruby 1.9.1 p429 was released BUT SEGV occurs

Yesterday, Ruby 1.9.1 p429 was released. So I download from here and install its package like this entry. But, SEGV occur in make instrunction.

SEGV shows below:

Thursday, July 1, 2010

Fukuoka Pref. starts to lead the development of FPGA chips for Ruby

There have been AWESOME news in last week, Fukuoka Prefecture and its partners had announced that they start the development of two Ruby technologies. The first one is lightweight Ruby subset for embedded systems. The second one is FPGA (field-programmable gate arrays) chip optimized for Ruby. If you can read Japanese, see these link below.

Monday, June 28, 2010

Nokia Qt SDK 1.0 and QtCreator 2.0 are finally released

As I mentioned in this article, Nokia Qt SDK 1.0 and QtCreator 2.0 have been released 5 days ago. This release is not enable building QML.

Friday, June 25, 2010

MacPorts and Ruby environments

Generally, The most easy way to install ruby on Mac OS is to use MacPorts. I read the installation guide, then I do 3 operations:

  1. Install "Xcode Developer Tools" from Mac OS X installation DVD
  2. Download MacPorts-1.9.1-10.6-SnowLeopard.dmg
  3. Install MacPorts from MacPorts-1.9.1-10.6-SnowLeopard.dmg

Then let's check the ruby environments MacPorts is managing.
$ sudo port list | grep lang/.*ruby
jruby                          @1.4.0          lang/jruby
ruby                           @1.8.7-p249     lang/ruby
ruby186                        @1.8.6-p388     lang/ruby186
ruby19                         @1.9.1-p378     lang/ruby19

As you see, Ruby 1.8.6, 1.8.7 and 1.9.1 are up to date. But 1.9.2 is not available, and JRuby is NOT 1.5.x.
I decide to install ruby 1.8.7, ruby 1.9.1 and JRuby 1.4.0.
$ sudo port install ruby
$ sudo port install ruby19
$ sudo port install jruby

Tuesday, June 22, 2010

I bought a Macmini, and the first thing I had to inquire...

I bought a Macmini (Snow Leopard 10.6.4). It's the first Mac OS machine to me. So there are some different UXs with Linux or Windows. The first goal to me is to use ruby 1.9 on my Mac. But the first thing I had to inquire is ... to take a screen shot! It's the most different thing with Linux or Windows. I found this approach by google. I re-summarize 3 screenshot tips below:

  • [Command]+[Shift]+[3] takes a screenshot of entire desktop, and save the PNG file to desktop.

    If you press [control] at same time, output goes to clipbord(doesn't go to desktop).
  • [Command]+[Shift]+[4] takes a screenshot of rectangular portion with dragging crosshair cursor, and save the PNG file to desktop.

    If you press [control] at same time, output goes to clipbord(doesn't go to desktop).
  • {[Command]+[Shift]+[4] and spacebar} takes a screenshot of specific window with highlighting camera cursor, and save the PNG file to desktop.
    If you press [control] at same time, output goes to clipbord(doesn't go to desktop).

Well, I can finally begin to operate installing Ruby 1.9.

Saturday, June 19, 2010

re-check "begin-rescue-else-end" on your ruby environment

I found some bug report for JRuby in here (now fixed).

I copy and simplify this sample code like below:
def hoge
  puts 1
rescue Exception => e
  puts 2
  raise "shouldn't get here"
else
  puts 3
  raise "should raise out of the method"
end
begin
  puts RUBY_VERSION
  hoge
rescue => e
  puts e.message
end

Let's evaluate this on each ruby environment.

Thursday, June 17, 2010

NetBeans 6.9 has been released

NetBeans 6.9 FCS has been released. This "Ruby bundle installer" bundles JRuby 1.5.0 and FCS of Glassfish server 3.01.

Monday, June 14, 2010

Release schedule of Qt 4.7.0 has been changed

In five days ago, Qt community announced the change of release schedule of Qt 4.7.0 and its related products. According to this article, Qt 4.7.0 will be released during this summer. And QtCreator will be released at the same time, but its version is changed from 2.0 to 2.1. What's happened? See the matrix below:

Former release plan
QtQtCreator
Qt 4.6.xQtCreator 1.x
Qt 4.7.0QtCreator 2.0
Nokia Qt SDK
Nokia Qt SDK 1.0
↓  ↓  ↓
Current release plan
QtQtCreatorNokia Qt SDK
Qt 4.6.xQtCreator 1.x
Nokia Qt SDK 1.0(with QtCreator 2.0)
Qt 4.7.0QtCreator 2.1

And now, Nokia Qt SDK 1.0 RC and QtCreator 2.0 RC are available.

Friday, June 11, 2010

QML opacity

It's easy to change the opacity to child QML elements. It's only setting opacity property between 0(full transparency) to 1(full opacity).

import Qt 4.7
import org.webkit 1.0

Rectangle {
    width: webView.width
    height: webView.height
    Text {
        x: 300
        y: 200
        text: "hidden text"
        smooth: true
    }
    WebView {
        id: webView
        width: 640
        height: 480
        opacity: 0.5
        url: 'http://html5demos.com/canvas-grad'
    }
}

This sample(opacity is 0.5) seems like below:

And if opacity is 0, above sample seems like below:

Tuesday, June 8, 2010

Ruby 1.9.2 preview 3 is able on Windows using MinGW

As you see these article(#1, #2), installing ruby 1.9.1 on Windows using MinGW a little hurt. But in ruby 1.9.2 preview 3, there is all okay. You just do CMMI instructions on your MSYS terminal like below:

Youhei@3935-CF61 ~ $ tar -jxvf ruby-1.9.2-preview3.tar.bz2
Youhei@3935-CF61 ~ $ cd ruby-1.9.2-preview3
Youhei@3935-CF61 ~/ruby-1.9.2-preview3 $ ./configure --prefix=c:/ruby-1.9.1 --enable-shared
Youhei@3935-CF61 ~/ruby-1.9.2-preview3 $ make
Youhei@3935-CF61 ~/ruby-1.9.2-preview3 $ make install

Saturday, June 5, 2010

Ruby 1.9.2 preview 3 was released

One week ago, ruby 1.9.2 preview 3 was also released. So I download from here and install its package like this entry. Let's check.

>/opt/ruby-1.9.1/bin/ruby --version
ruby 1.9.2dev (2010-05-31 revision 28117) [i686-linux]

In ruby 1.9.2 preview 3, there are 2 notable changes. 1st, LD_LIBRARY_PATH never includes current directory. 2nd, Japanese encoding deals "emoji" for Japanese phone carriers, these are NOT equal with Unicode emoji.

Wednesday, June 2, 2010

State management for QML

In 2 samples(phosphorescence: Change the scale of QML text and phosphorescence: Rotate QML Text), I implement the change of QML element with transform property. And there is one another and more smart approach: using State elements.

1st, naming id for the element to manage states. 2nd, implement the event to change to one another state. 3rd, implement State elements. Each State element is a couple of state name and behavior. See the sample below:
import Qt 4.7

Rectangle {
    width: 200
    height: 200
    Text {
        id: message // naming this to manage states
        x: 60
        y: 80
        text: "changable"
        smooth: true
        states: [
            State {
                name: "right"
                PropertyChanges { target: message; color: "#0000FF"; font.pointSize: 12; font.italic: true }
            }, // couple of state:right and its behavior
            State {
                name: "left"
                PropertyChanges { target: message; color: "#000000"; font.pointSize: 10; font.italic: false }
            } // couple of state:left and its behavior
        ] // state elements
    }
    MouseArea {
        anchors.fill: parent
        acceptedButtons: Qt.LeftButton | Qt.RightButton
        onClicked: {
            if (mouse.button == Qt.RightButton) {
                message.state = "right"; // change the state to "right"
            } else {
                message.state = "left"; // change the state to "left"
            }
        }
    }
}

Let's launch, and click with right button.


And with left button.

Monday, May 31, 2010

QML sample using Webkit

QML can use Webkit because Qt 4.7 integrates it.
import Qt 4.7
import org.webkit 1.0

Rectangle {
    width: webView.width
    height: webView.height
    WebView {
        id: webView
        width: 640
        height: 480
        url: 'http://html5demos.com/canvas-grad'
    }
}

Of course, it is ready for HTML5.

Friday, May 28, 2010

Speakers of RubyKaigi2010 are revealed

2 days ago, all speakers are revealed in RubyKaigi2010 site (Japanese site).

Keynote Speakers

  • Yukihiro "Matz" Matsumoto
  • Chad Fowler
  • Jeremy Kemper

Speakers

(This is quick notification. we'll make an announcement of detail soon.)

okkez, Jake Scruggs, Shay Friedman, paulelliott, Kenta Murata, Hideki Miura, Yasuko Ohba, Tanaka Akira, Masatoshi SEKI, Carl Lerche, Toshiyuki Terashita, geemus, tenderlove, Paolo "Nusco" Perrotta, Alex Sharp, nari, Shugo Maeda, Yusuke Endoh, Jiang Wu, Munjal Budhabhatti And Sudhindra Rao, Sarah Allen, Sarah Mei, Yehuda Katz, Ted Han, Shin-ichiro OGAWA, Tom Lieber, Masahiro Tanaka, Hiroshi Yoshioka, SHIBATA Hiroshi, Makoto Kuwata, jugyo, Kazuhiro NISHIYAMA, Shintaro Kakutani, Satoshi Shiba, Tetsu Soh, ujihisa, Makoto Inoue, Masaki Yamada, Kouhei Sutou, Yuki Sonoda, Kei Hamanaka, Yuichi Saotome


At the same time, the RubyKaigi2010 team starts to call for "individual sponsors" (Japanese site).

Tuesday, May 25, 2010

Array in QML

In phosphorescence: Qt 4.7.0 Beta 1 and QtCreator 2.0 Beta 1 were released, I mentioned about a few big changes from TP1 to beta. But while coding QML, I found one change of specification.

For instance, in the last sample of phosphorescence: Mouse event on QML, transform property appears twice, but from Qt 4.7.0 beta, it is forbidden appearing transform property twice. So I rewrite this with QML array like below:

import Qt 4.7

Rectangle {
    width: 200
    height: 200
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
        MouseArea {
            /* inherit parent item area to handle click event
                because default area is none */
            anchors.fill: parent
            /* write acceptable buttons
                because there are no default button events*/
            acceptedButtons: Qt.LeftButton | Qt.RightButton
            onClicked: { // hooked event when mouse is clicked
                if (mouse.button == Qt.RightButton) {
                    parent.color = 'black';
                } else {
                    parent.color = 'red';
                }
            }
        }
    }
    Text {
        x: original.x
        y: original.y + 16
        text: original.text + "!"
        font {
            family: "Helvetica"
            pointSize: 12
            italic: true
        }
        color: "blue"
        transform: [Scale {
            xScale: 1.25
            yScale: 0.8
        }, Rotation {
            angle: 45
        }]
        smooth: true
    }
}

Saturday, May 22, 2010

QML editor's "Run settings" is improved

In phosphorescence: Qt 4.7.0 Beta 1 and QtCreator 2.0 Beta 1 were released, I mentioned about a few big changes from TP1 to beta. But while manipulating QtCreator, I found one more improved thing. It's "QML runtime argument" textbox.

In QtCreator 2.0 TP1, this textbox cannot accept translated message file, but from QtCreator 2.0 beta, can accept it. So we have not to launch with message file like phosphorescence: QML i18n, launch from QtCreator!

Thursday, May 20, 2010

Will WebM become a default video codec of HTML5?

At Google I/O, Google announced that VP8 turn to OSS 'WebM' and become the default video codec for some HTML5 browsers, e.g. Chrome, Firefox and Opera.

Will Qt Webkit be supported or not?

Monday, May 17, 2010

Qt 4.7.0 Beta 1 and QtCreator 2.0 Beta 1 were released

About 10 days ago, Qt 4.7.0 Beta 1 was released, And QtCreator 2.0 was also released.

The Biggest change for me of this release is there are already setted default_load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH and have not to change this flag like this article.

I again show the installation of both products:

Download Qt 4.7.0 Beta 1
# tar -zxvf qt-everywhere-opensource-src-4.7.0-beta1.tar.gz
# cd qt-everywhere-opensource-src-4.7.0-beta1
# ./configure -declarative -optimized-qmake -nomake demos -nomake examples \
-no-qt3support -no-gtkstyle -system-sqlite -qt-sql-sqlite \
-opensource -prefix /opt/Qt-4.7.0
# gmake
# gmake install

Download QtCreator 2.0 Beta 1
# chmod +x qt-creator-linux-x86-opensource-2.0.0-beta1.bin
# ./qt-creator-linux-x86-opensource-2.0.0-beta1.bin

Friday, May 14, 2010

How to add facebook like button on each blogspot posts

Facebook social plugin was released. It's easy to add facebook like button on our whole site. But It's little difficult to add facebook like button on our each blog post. So I explain this approach for blogger/blogspot service.

  1. [Layout] -> [Edit HTML]
  2. Turn on the checkbox "Expand widget templates"
  3. Into the tag of class='post-header-line-n' or class='post-footer-line-n', put the snipet like below:
    <fb:like expr:href="data:post.url"/>
    <span id="fb-root"/>
    <script>
      window.fbAsyncInit = function() {
        FB.init({appId: 'your_app_id', status: true, cookie: true, xfbml: true});
      };
      (function() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
      }());
    </script>

That's OK!

Wednesday, May 12, 2010

RubyWorld Conference 2010 committee starts

In this Japanese news post, RubyWorld Conference 2010 committee starts and decide to hold in September 6 ~ 7, 2010 in Matsue city, Japan. These informations are not in Ruby Association's site, RubyWorld Conference's site and RubyWorld Conference's twitter.

Monday, May 10, 2010

I've finished reading "Design Patterns in Ruby"

I've finished reading Design Patterns in Ruby. And I found some leverage points for myself.

  • Both some class and its subclass can access same class variables. I did not know that.
  • This book contains one clear sample of coding Ruby's internal DSL.
  • Author encourages Meta-programming using method_missing like ActiveRecord's find_by_... method. But IMO I don't like it so as Meta-programming.

In conclusion, This book is having worth to read for every Rubyist (from experts to newbie).

Thursday, April 29, 2010

Spring short vacation 2010

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 10, 2010.

Monday, April 26, 2010

Your Linux can become to develop Qt applications for symbian

These sources (1, 2) are explaining approaches to develop Qt applications for symbian on your Linux.

If you are a Linux guru or a Linux user, and you are interested in developing open mobile application, these posts are good solution. Especially, openSUSE may be most suitable distribution because openSUSE is most friendly for Qt.

Friday, April 23, 2010

Mouse event on QML

How do we hook the call back event like mouse click to the QML applications? The most QML-ish way to do that is to set the element like XXXXArea. This sample shows changing the text colot when mouse buttons (left or right) are clickked with concrete element MouseArea.

At first, see the MouseArea and its parent element:
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
        MouseArea {
            /* inherit parent item area to handle click event
                because default area is none */
            anchors.fill: parent
            /* write acceptable buttons
                because there are no default button events*/
            acceptedButtons: Qt.LeftButton | Qt.RightButton
            onClicked: { // hooked event when mouse is clicked
                if (mouse.button == Qt.RightButton) {
                    parent.color = 'black';
                } else {
                    parent.color = 'red';
                }
            }
        }
    }

Tuesday, April 20, 2010

Rotate QML Text

Like this post, we can rotate text easily with Rotate element.
import Qt 4.7

Rectangle {
    width: 200
    height: 200
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
    }
    Text {
        x: original.x
        y: original.y + 16
        text: original.text + "!"
        font {
            family: "Helvetica"
            pointSize: 12
            italic: true
        }
        color: "blue"
        transform: Rotation {
            angle: 45
        } // rotate this text item
    }
}
And let's be smooth the text:
        transform: Rotation {
            angle: 45
        } // rotate this text item
        smooth: true // smooth the transformation of this text

Saturday, April 17, 2010

Change the scale of QML text

Using transform property and Scale element, we can change the scale of QML text.
import Qt 4.7

Rectangle {
    width: 200
    height: 200
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
    }
    Text {
        x: original.x
        y: original.y + 16
        text: original.text + "!"
        font {
            family: "Helvetica"
            pointSize: 12
            italic: true
        }
        color: "blue"
        transform: Scale {
            xScale: 1.25
            yScale: 5
        } // change the scale of this text item
    }
}
But this font is dirty. Then let's be smooth.
        transform: Scale {
            xScale: 1.25
            yScale: 5
        } // change the scale of this text item
        smooth: true // smooth the transformation of this text
Re-run the QML application:

Thursday, April 15, 2010

IronRuby 1.0 is FINALLY released!

A few days ago, IronRuby 1.0 has been released. I download and install IronRuby for .Net 2.0 because My windows environment does not have .NET 4.0.

And I run sample WinForms application from IronRuby console:
IronRuby 1.0.0.0 on .NET 2.0.50727.4927
Copyright (c) Microsoft Corporation. All rights reserved.

>>> require 'System.Windows.Forms'
=> true
>>> include System::Windows::Forms
=> Object
>>> f = Form.new
=> System.Windows.Forms.Form, Text:
>>> f.text = 'Hello World'
=> "Hello World"
>>> Application.run(f)

Monday, April 12, 2010

RubyKaigi2010 starts many callings and lookings

RubyKaigi2010 starts many callings and lookings in the site.

(1) Call for presentations

(2) Call for sub events

(3) Look for sponsors

(4) Look for illustrations

For instance, "(2) Call for sub events" is like JRubyConf at RubyConf2009, and "(4) Look for illustrations" is calling an key illustration for RubyKaigi2010.

Friday, April 9, 2010

Change font and color of QML text

It's easy than normal QT applications:
import Qt 4.7

Rectangle {
    width: 200
    height: 200
    Text {
        id: original
        x: 60
        y: 80
        text: qsTr("Hello World")
    }
    Text {
        x: original.x
        y: original.y + 16
        text: original.text + "!"
        font {
            family: "Helvetica"
            pointSize: 12
            italic: true
        } // change the font of this text item
        color: "blue" // change the color of this text item
    }
}