Saturday, October 31, 2009

Ruby initialize puzzle (answer part)

(continued from phosphorescence: Ruby initialize puzzle (question part))

The answer is:
irb(main):017:0> Sample.new('qux')
qux World
=> #<Sample:0x246f508>

The Ruby method super doesn't mean calling same method of super class, it means calling same method defined in last class.

For example, if same method is defined in super class only, it behaves to rewrite super class's one. But if same method is defined in included module like as this question, it behaves to rewrite included module's one because it's last defined method.

Thursday, October 29, 2009

Ruby initialize puzzle (question part)

There are classes and module like below:
class Foo
  def initialize(a)
    puts "Hello #{a}"
  end
end
module Bar
  def initialize(b)
    puts "#{b} World"
  end
end
class Sample < Foo
  include Bar
  def initialize(c)
    super
  end
end

When you call Sample.new('qux'), what standard output will you see?

Monday, October 26, 2009

Memo for Qt i18n

Chapter 17 of this Qt book is for internationalization (i18n). There are some leverage points. So I write memo of these points on this article.

(1) If you force to internationalize all characters, you must define below line in .pro file:
DEFINES += QT_NO_CAST_FROM_ASCII


(2) Wrap all characters with tr() (if you want to internationalize) or QLatin1String() (if you want not to internationalize).

Friday, October 23, 2009

Japan Linux Symposium

The 1st Japan Linux Symposium was held. I only attend opening and 2 sessions because I'm busy with public and private in this month (and I am absent 3 events related with openSUSE in this month).

Tuesday, October 20, 2009

Gestalt and Moonlight

I learned 'Gestalt' recently - that is browser-side Ruby/Python/XAML scripting (instead of ECMAScript) driven with jQuery and Silverlight. Is that the product only for Windows? No! Gestalt supports not only Silverlight but also Moonlight.

I try to run sample bundled with Gestalt onto the Firefox on the my openSUSE.
  1. Install Firefox add-on of moonlight from here
  2. Download the zip of Gestalt from here
  3. Uncompress the zip of Gestalt
  4. Open the XAML sample files Gestalt/samples/getting.started/03_xaml.html, Gestalt/samples/getting.started/04_animation.html and Gestalt/samples/getting.started/05_final.html
If Gestalt/samples/getting.started/03_xaml.html succeeded, Firefox renders like below:

But samples of Ruby or Python didn't work in intact. I guess it's suspicious that Moonlight on the openSUSE 11.1 is 1.0, not 2.0 even though Firefox add-on of moonlight is 2.0 beta.

Saturday, October 17, 2009

Qt 4.6 Beta

Qt 4.6 Beta and Qt Creator 1.3 have been announced.
There are both binary packages and source codes, exclude Qt 4.6 Beta binary package of Linux.

And I decide to use Qt 4.5.3 installed recently, unbtil 4.6 final version will be released.

Wednesday, October 14, 2009

1.9.2 release in Christmas was canceled

(continued from phosphorescence: Ruby 1.9.2 release plans will be re-scheduled)

In conclusion, Ruby 1.9.2 release in Christmas was canceled. If you can read Japanese, see the minutes of Ruby Developer's Meeting 20091013. The most important points are the following three:
  • preview2 ... the end of 2009/10
  • feature freeze ... the end of 2009/12
  • release requirement of 1.9.2 ... pass the rubyspec

Monday, October 12, 2009

Ruby 1.9 new features: All about encoding

The biggest change in Ruby 1.9 is the all about encoding. First, Encoding class had been created to deal encode information. If you see the all encodings in your Ruby environment, see the output of Encoding
> /opt/ruby-1.9.1/bin/irb
irb(main):001:0> RUBY_VERSION              
=> "1.9.1"                                 
irb(main):002:0> Encoding.constants.find_all{|const|Encoding.const_get(const).is_a?(Encoding)}
=> [:ASCII_8BIT, :Big5, :BIG5, :CP949, :Emacs_Mule, :EMACS_MULE, :EUC_JP, :EUC_KR, :EUC_TW, :GB18030, :GBK, :ISO_8859_1, :ISO_8859_2, :ISO_8859_3, :ISO_8859_4,:ISO_8859_5, :ISO_8859_6, :ISO_8859_7, :ISO_8859_8, :ISO_8859_9, :ISO_8859_10, :ISO_8859_11, :ISO_8859_13, :ISO_8859_14, :ISO_8859_15, :ISO_8859_16, :KOI8_R, :KOI8_U, :Shift_JIS, :SHIFT_JIS, :US_ASCII, :UTF_8, :UTF_16BE, :UTF_16LE, :UTF_32BE, :UTF_32LE, :Windows_1251, :WINDOWS_1251, :BINARY, :IBM437, :CP437, :IBM737, :CP737, :IBM775, :CP775, :CP850, :IBM850, :IBM852, :CP852, :IBM855, :CP855, :IBM857, :CP857, :IBM860, :CP860, :IBM861, :CP861, :IBM862, :CP862, :IBM863, :CP863,:IBM864, :CP864, :IBM865, :CP865, :IBM866, :CP866, :IBM869, :CP869, :Windows_1258, :WINDOWS_1258, :CP1258, :GB1988, :MacCentEuro, :MACCENTEURO, :MacCroatian, :MACCROATIAN, :MacCyrillic, :MACCYRILLIC, :MacGreek, :MACGREEK, :MacIceland, :MACICELAND, :MacRoman, :MACROMAN, :MacRomania, :MACROMANIA, :MacThai, :MACTHAI, :MacTurkish, :MACTURKISH, :MacUkraine, :MACUKRAINE, :CP950, :Stateless_ISO_2022_JP,:STATELESS_ISO_2022_JP, :EucJP, :EUCJP, :EucJP_ms, :EUCJP_MS, :EUC_JP_MS, :CP51932, :EucKR, :EUCKR, :EucTW, :EUCTW, :EUC_CN, :EucCN, :EUCCN, :GB12345, :CP936, :ISO_2022_JP, :ISO2022_JP, :ISO_2022_JP_2, :ISO2022_JP2, :ISO8859_1, :Windows_1252, :WINDOWS_1252, :CP1252, :ISO8859_2, :Windows_1250, :WINDOWS_1250, :CP1250, :ISO8859_3, :ISO8859_4, :ISO8859_5, :ISO8859_6, :Windows_1256, :WINDOWS_1256, :CP1256, :ISO8859_7, :Windows_1253, :WINDOWS_1253, :CP1253, :ISO8859_8, :Windows_1255, :WINDOWS_1255, :CP1255, :ISO8859_9, :Windows_1254, :WINDOWS_1254, :CP1254, :ISO8859_10, :ISO8859_11, :TIS_620, :Windows_874, :WINDOWS_874, :CP874, :ISO8859_13, :Windows_1257, :WINDOWS_1257, :CP1257, :ISO8859_14, :ISO8859_15, :ISO8859_16, :CP878, :SJIS, :Windows_31J, :WINDOWS_31J, :CP932, :CsWindows31J, :CSWINDOWS31J, :MacJapanese, :MACJAPANESE, :MacJapan, :MACJAPAN, :ASCII, :ANSI_X3_4_1968, :UTF_7, :CP65000, :CP65001, :UTF8_MAC, :UTF_8_MAC, :UCS_2BE, :UCS_4BE, :UCS_4LE, :CP1251]

Friday, October 9, 2009

New URLs of Qt Sample code on Chapter14

I still keep on studying about Qt with book: "C++ GUI Programming with Qt 4". I spent a long time to read this book until Chapter 14. So I found that Sample URLs of this chapter (no wonder) remains old.

I write its changes below:
BeforeAfter
ftp://ftp.trolltech.com/mirrors->ftp://ftp.qtsoftware.com/mirrors
ftp://ftp.trolltech.com/freebies/leafnode->ftp://ftp.qtsoftware.com/freebies/leafnode
http://doc.trolltech.com/qq/index.html->http://qt.nokia.com/doc/qq/index.html

Tuesday, October 6, 2009

Qt 4.5.3 was released

In the first day of this month, Qt 4.5.3 was released. I download and install Qt 4.5.3 SDK (LGPL) from here.
#./qt-sdk-linux-x86_64-opensource-2009.04.bin
Installation instructions of QtRuby are below:
>cmake \
> -DCMAKE_INSTALL_PREFIX=/opt/ruby-1.9.1 \
> -DRUBY_EXECUTABLE=/opt/ruby-1.9.1/bin/ruby \
> -DRUBY_LIBRARY=/opt/ruby-1.9.1/lib/libruby.so.1.9.1 \
> -DRUBY_INCLUDE_PATH=/opt/ruby-1.9.1/include/ruby-1.9.1 \
> -DQT_QMAKE_EXECUTABLE=/opt/qtsdk-2009.04/qt/bin/qmake \
> -DQT_MKSPECS_DIR=/opt/qtsdk-2009.04/qt/mkspecs \
> -Wno-dev \
> -DENABLE_SMOKE=on \
> -DENABLE_QTRUBY=on \
> -DENABLE_QTWEBKIT_SMOKE=on \
> -DENABLE_QTSCRIPT_SMOKE=on \
> -DENABLE_QTUITOOLS_SMOKE=on \
> -DENABLE_QTTEST_SMOKE=off \
> -DENABLE_PHONON_SMOKE=off \
> -DENABLE_QSCI_SMOKE=off \
> -DENABLE_QWT_SMOKE=off \
> -DENABLE_KDE_SMOKE=off \
> -DENABLE_KDEVPLATFORM_SMOKE=off \
> -DENABLE_KHTML_SMOKE=off \
> -DENABLE_KTEXTEDITOR_SMOKE=off \
> -DENABLE_SOLID_SMOKE=off \
> -DENABLE_PLASMA_SMOKE=off \
> -DENABLE_QTWEBKIT_RUBY=on \
> -DENABLE_QTUITOOLS_RUBY=on \
> -DENABLE_QTSCRIPT=on \
> -DENABLE_QTTEST=off \
> -DENABLE_PHONON_RUBY=off \
> -DENABLE_QSCINTILLA_RUBY=off \
> -DENABLE_QWT_RUBY=off \
> -DENABLE_SOPRANO_RUBY=off \
> -DENABLE_KDEVPLATFORM_RUBY=off \
> -DENABLE_KORUNDUM_RUBY=off \
> -DENABLE_KHTML_RUBY=off \
> -DENABLE_KTEXTEDITOR_RUBY=off \
> -DENABLE_SOLID_RUBY=off \
> -DENABLE_KROSSRUBY=off \
> -DENABLE_PLASMA_RUBY=off \
> -DENABLE_QIMAGEBLITZ_SMOKE=off
Then check QtRuby commands.
>/opt/ruby-1.9.1/bin/rbrcc -version
Ruby Resource Compiler for Qt version 4.5.3
>/opt/ruby-1.9.1/bin/rbuic4 -v
Qt User Interface Compiler version 4.5.3
>/opt/ruby-1.9.1/bin/rbqtapi -v
QtRuby 2.0.3 using Qt-4.5.3
And QtCreator of this installer was also updated to 1.2.1.

Saturday, October 3, 2009

Ruby 1.9.2 release plans will be re-scheduled

In the 2nd day of RubyKaigi 2009, release plans of Ruby 1.9.2 had been announced. But 4 days ago, InfoQ's article reported its re-scheduling. See also release manager's post and meeting for announcing new release plan.

Thursday, October 1, 2009

cannot attend Qt Developer Days 2009

Qt Developer Days 2009 will be held, in Germany after 2 weeks, in USA after 1 month. There are QtWebkit related session and hands-on, so I have wanted to go there. But I cannot attend both.

If this conference will be held in next year, please hold in Asia: of course, I hope it in Japan.