Monday, March 29, 2010

External iterator for Ruby 1.9

Until Ruby 1.8, there was only internal iterator. But from Ruby 1.9, external iterator comes.

external_iterator.rb
array_1 = %w{1 2 3 4 5 6 7 8 9}
array_2 = %w{a b c d e f g h i}

external_iterator_1 = array_1.each
external_iterator_2 = array_2.each

begin
  while (element_1 = external_iterator_1.next) and
    (element_2 = external_iterator_2.next)
    puts "#{element_1} #{element_2}"
  end
rescue StopIteration
  puts 'External iterator has finished'
end
Let's check!
> ruby external_iterator.rb
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 i
External iterator has finished

Friday, March 26, 2010

Learn the QML #1

Let's start the "Hello World" sample straightforwardly - using QtCreator 2.0.0 tech preview.

At first create the QML project with wizard.

At second, switch the IDE in "project" mode, then set "QML Viewer" and "Main QML File". "QML Viewer" is executable file qml in your Qt 4.7.0's bin directory.

At last, launch the QML widget from IDE.

Wednesday, March 24, 2010

QtCreator 2.0.0 Technology Preview is released

QtCreator 2.0.0 Technology Preview is also released at the same time when Qt 4.7 Technology Preview is released. It needs Qt 4.7.0 or later.

Normally, you can download installer from here and can install with it.
# chmod +x qt-creator-linux-x86-opensource-2.0.0-alpha1.bin
# ./qt-creator-linux-x86-opensource-2.0.0-alpha1.bin
But some CJK font users need more instructions as I described in this post.

Monday, March 22, 2010

Ruby 1.9.2 release plan is unveiled

1 week ago, in ruby-core mailing list, Release plan of Ruby 1.9.2 is unveiled.
- 31 Mar. freeze the spec
- 30 Apr. freeze the code
- 31 May. release 1.9.2-preview2
- 30 Jun. release 1.9.2-rc
- 31 Jul. release 1.9.2-p0

Friday, March 19, 2010

Appendix for Qt 4.7 Technology Preview is released

If you are CJK font user, and its font has incorrect behavior for "Global Advance Width", phosphorescence: Qt 4.7 Technology Preview is released is not enough. The width of glyphs is too wide for ASCII characters. It's me too.

There are hints in Japanese Qt mailing list. I try to summarize and translate to English, to fix the width of glyphs correctly, we should set FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH on in corresponding source. For instance, at Qt 4.7 Technology Preview, We set at once in src/gui/text/qfontengine_ft.cpp file:

qfontengine_ft.cpp.diff
622c622
< default_load_flags = 0;
---
> default_load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;

Then I rebuild Qt 4.7 Technology Preview, and succeed with correct font width.