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)>