Monday, September 28, 2009

Confusing about smoke/generator

From several previous revision, QtRuby's and other kdebindings' code generation tool have been changed from kalyptus to smoke/generator. It's advantage to port kdebindings for non-Unix platforms: smoke/generator is based on C++ whereas kalyptus is based on Perl.

But now I'm confusing because smoke/generator fails after starting make immediately. There are message like below:
Cannot load library generator_smoke: (libgenerator_smoke.so: ...
Unfortunately, it's not only problem for me. Others are encountering this problem. And fortunately, the author is succeeding on his each environments.

I have decided not following trunk of QtRuby in a while. I only use released version.

Saturday, September 19, 2009

Autumn short vacation

Before going on vacation, I update summary of openSUSE Conference 2009 - Tokyo Branch.

In Japan (2009 only), the Japanese are extraordinally experiencing consecutive national holidays, me too. I take a autumn vacation, so I suspend posts and comments to this blog for a moment. Resume will be September 28, 2009.

Monday, September 14, 2009

Keyword: PubSubHubbub

In Tim Bray's Keynote Address at RubyWorld Conference 2009, I heard the word I never heard, "pubsubhubbub". What is this? I have searched this word and understood a little.

pubsubhubbub

It's publish/subscribe style feed protocol. This protocol is from 3 entities.
  • Publisher ... Publish Atom feed or RSS feed to the Hub
  • Subscriber ... Subscribe some feeds from the Hub
  • Hub ... Notify feeds between Publisher and Subscriber as push notification
Representative subscriber is Google Reader. Representative hub is the sample hub built with pubsubhubbub team. If you want to build and run your own hub with Ruby, you could use WebGlue. And representative publisher is... your own site. Of course, it's also possible on my site if I change the feed settings on this site (not yet). Blogger have already embedded meta tag like below:
<link rel='hub' href='http://pubsubhubbub.appspot.com/'/>

And screen capture of actual feed XML is below:

Friday, September 11, 2009

I had forgotten to apply Qt patch

At the beginning of this month, Qt announced patches for QSslCertificate class, but I had forgotten to apply patch for Qt 4.5.x. So today I download from here, and apply it.
> cd /opt/qtsdk-2009.03/qt
> patch -p1 < /path/to/cve-2009-2700-patch-4.4.x-4.5.x.diff

Tuesday, September 8, 2009

The 2nd day of RubyWorld Conference 2009 (Afternoon)


Some sessions delayed 15 minutes because of projector trouble.

I attended these sessions:

The 2nd day of RubyWorld Conference 2009 (Morning)


In venue, tea had been served in Japanese Tea Ceremony style.

I attended these sessions:

Monday, September 7, 2009

The 1st day of RubyWorld Conference 2009 (Afternoon)


This photo is "Matsue Open Source Lab." in front of Matsue station.

I attended these sessions:

The 1st day of RubyWorld Conference 2009 (Morning)

RubyWorld Conference 2009 was held at here.



I attended these sessions:

Friday, September 4, 2009

Pros and Cons of "Yet another UI File loading"

In last entry, I only introduced sample code of "Yet another UI File loading". In this post, I will write pros and cons of it.

Tuesday, September 1, 2009

Yet another UI File loading

In past entries, I wrote 2 normal approaches of loading UI file in QtRuby.

Today I introduce a little unusual approach.

require 'Qt4'
require 'rexml/document'

# define method instead of qtuiloader
def Qt.load_ruby_from_ui(file_path, rbuic4_command = 'rbuic4')
doc = REXML::Document.new(::File.new(file_path))
top_widget_name = REXML::XPath.first(doc, '/ui/class/text()').value
parent_name = REXML::XPath.first(doc, '/ui/widget/@class')
eval `#{rbuic4_command} #{file_path}`
top_widget = const_get("Ui_#{top_widget_name.gsub(/\A(\w)/) {$1.upcase}}").new
parent = Qt::const_get(parent_name.value.gsub(/\AQ/, '')).new
top_widget.setupUi(parent)
parent
end

Qt::Application.new(ARGV) do
window = Qt.load_ruby_from_ui(
'/opt/qtsdk-2009.03/qt/examples/widgets/stylesheet/layouts/default.ui',
'/opt/ruby-1.9.1/bin/rbuic4')
window.show
exec
end

In this approach, evaluate the output of rbuic4 command, and then use Module#const_get to instantiate top widget class and its parent class.