My blog has been moved to

Tuesday, November 18, 2008

scrolling through the paragraphs, clicking through the photographs

I heard that seven is a magic number. I am seeing the seventh winter in my life. How magical.

For roughly 300 weeks I stay in Europe already. And I will still be here for some time to come. But after reaching some of my goals, missing many others, I decided I will pay my home country a visit.

Bracing for the impact of reverse culture shock.

Sunday, November 16, 2008

the sky will be my shroud, a monument of cloud

Things are still exciting as ever. In two weeks, I will be in Bali. Yes, I will be there for the Workshop on Open Source and Open Content (WOSOC) that is held in conjuction with IEEE Conference on Signal-Image Technology and Internet-based Systems.

Check out the full schedule, find the invited talk: Qt for Rapid Mobile Application Development, and enjoy some demos that I will premiere there. Update: the talk is actually one of the keynotes.

So, if you are around and want to have a snack or a chat, just let me know! Mail me at

everything is better when you hear that shout

In Oslo? Don't miss Mithas The Sweethouse (Grønland 2A Oslo)!


Photo by this girl.

Saturday, November 15, 2008


As Harry entered the room, he saw Ron hopelessly fighting with his magic tablet. Ron was desperately trying to look for something using the tablet. Harry pulled his wand and then "Flickify!"

The Qt Everywhere mantra means that Qt will be available in more and more platform, including of course mobile devices. For example, the recently announced Qt S60 means that 80 million devices can become the target market for Qt application developers.

In another front, touch screen seems to be the future direction. Nokia 5800 XpressMusic (better known as Tube) starts the new generation of S60 devices with touch screen. As introduced by Apple on iPhone, navigating a long list in a device with touch screen is best done using flickable list. The scrolling effect is also often known as kinetic scrolling.

Though up to now Qt does not offer an official mean to flick-enable your list, apparently it can be done without too much effort. Heck, you do not even need to modify your code. Flick Charm, my latest graphics example exactly demonstrates the idea. The trick is to use an event filter to hijack the mouse events and then to scroll the widget properly. This simple charm apparently works on any QAbstractScrollArea subclasses, including all the ItemViews and of course QGraphicsView as well as QWebView. Check out the following screencast for the proof:

(Screencast is also available for direct watch at or YouTube).

Friday, November 14, 2008

Scrolling QWebFrame programmatically

Here is a challenge: how to scroll QWebFrame programmatically, if the scroll bars are invisible? At first you might think: Aha, let us just set the value of the scroll bars! The idea looks great, however it does not work that way (since QWebView is not a scroll area). Though you can change the value of the scroll bars, they are not reflected in a scrolled view. Because the need for this, in Qt 4.5 there will be functions to get and set the scroll offset, regardless whether the scroll bars are hidden or visible. But then, what about the customers for Qt 4.4?

JavaScript to the rescue. Using the rather infamous hook QWebFrame::evaluateJavaScript, doing the task is rather trivial:

QWebFrame *frame = page()->mainFrame();

For a more complete example, see what I show in our graphics corner lately: WebView and panning support.

Thursday, November 13, 2008

Tinting through composition

Another example that I showed in Developer Days was an alternative way to tint an image. Suppose you want to have a little feedback to the user when s/he puts the mouse on an icon, what you can do is to colorize the icon while the cursor is still on top of it. Changing the overall tone of the color of an image can be done in different ways. One obvious way is to convert every pixels from RGB to HSV, perform some manipulations on the hue and perhaps also saturation, then convert back the result to RGB, which will be the final color of those pixels. A rather different and less correct approach (though the result is still visually good) is to convert the image to grayscale and then overdraw a big rectangle with certain composition modes, check out my latest entry on Qt Labs Blogs exactly on that matter: Colorize an image via painter composition.

The included example can also take an image from the web, e.g. drag and drop from Flickr. In case you want to know the trick and/or look for a simple example of QNetworkAccessManager, then follow the simpler code for image viewer with support for remote URL.

Wednesday, November 12, 2008

Gmail video chat

It does not work on Linux (yet), but this video and voice chat right inside Google Mail will be definitely a killer!

Tuesday, November 04, 2008

visual google

Remember the tradition that I started in Redwood City? Well, the parallax sliding demo was for the graphics talk. For my QtWebKit presentation, the challenge was different. Basically it boils down to a visual version of Google Search. Instead only getting the hits and some text snippet, you should also get the web snapshot of the hits. There are apparently browser extensions out there which implement this kind of functionality.

Before going further, let us see first how we can get a preview of any web page. With QtWebKit, it is as easy as creating a QWebPage and using it to render the content to a painter that operates on an image. Check out websnap example, if you think this is not easy enough. Running websnap to several popular web sites gives the following:

Coming back to visual search. So while rehearsing my talk in the night before, I created the search and snap demo. What is presented as the next dojo example is however a slightly better version (afterall, I have more than just one night to polish it), as I added some text snippet to make it more attractive. The result is as follows, the code can be checkout from the usual graphics corner. As you can see, a third of the code is just reusing the WebSnap class.

A screencast is worth a thousand screenshots. Thus, for your pleasure, check the following 1-minute video, too. Or view it on (high quality), YouTube (low quality, more bandwidth-friendly), or download the Ogg Theora file (3.3 MB).

So who is going to turn it into a plasmoid?

world fastest optical polarization tracking

Once a while, somebody asked me about my dissertation. Since I am working in software industry these days, it is a bit awkward to mention my previous physics and electrical-engineering related work. Now the job becomes easier. I can point those curious guys to the following paper:

High-speed endless optical polarization stabilization using calibrated waveplates
and field-programmable gate array-based digital controller

This 8-page text is basically a condensed version of my dissertation, the 2.5 MB PDF file is available for download (free). It would appear in the upcoming Vol. 16, Issue 23 of Optics Express, one of the leading peer-reviewed journal in optics (impact factor last year: 3.709).

In a nutshell, the paper consists of two parts: optical retarder characterization and implementation of FPGA-based controller. The first part deals with modelling and estimation of characteristics of off-the-shelf lithium-niobate polarization transformers, then the characterization result is used to calibrate the respective retarders. It uses a new approach based on quaternion analysis. Learning quaternion is a life-changing experience for me, and it seems natural to use it in this context. Unfortunately, as a footnote in my dissertation says "Although, rather surprisingly, quaternion is hardly employed in literature on polarization analysis".

The second part is a bit about the controller itself. It comprises an FPGA, some peripherals, and few optical components. The implementation employs a lot of tricks that were imaginable at that time so that the controller can run as fast as possible (control iteration time of 2 us) and in limited resources available on Xilinx Spartan 3. It was a hard task for the few of us. Finally we pulled it off and made it work reliably in a series of experiments. To date, the 15 krad/s stabilization experiment that is reported in that paper is still the fastest endless optical polarization tracking ever recorded on this planet.

Even these days, I often ask myself, what was in my mind when I decided to pick up this challenge back then?

Monday, November 03, 2008

Android-like parallax sliding

At Redwood City Qt Developer Days (also where, BTW, a bunch of KDE geeks made a funny group photo), I started a tradition: throw an idea for a demo and I will implement it for the talk. The challenge for my graphics talk was the subtle effect in the Android's home screen. We saw T-Mobile G1 the night before and recalled again the good old games in the eighties. So the next morning I waked up earlier both to rehearse my talk (again) and to implement this parallax sliding. It turned out to be almost trivial to implement (200 lines of code) so just check it out!

For the lazy, do enjoy the screen capture below, or see also the screencast on YouTube or or just grab the Ogg Theora video (4.2 MB).

Happy parallaxing!

Summer of Code 2008 Mentor Summit

Squeezing the time between the busy schedule, with other three Trolls (Simon, Thiago, Olivier), I attended the Google Summer of Code 2008 Mentor Summit at Googleplex in Mountain View. On the KDE side, we also met Jason and Leo. On the second day, the mentors and the organizers had two group pictures, one in the staircase and one in front of the big Android statue. The six of us from KDE also took a nice picture with the Android background.

My general impression of the summit: it was awesome! The venue was great, the talks were interesting, the food was nice, the snacks were abundant, and of course the opportunity to try out Toto E200 - the infamous 14-button toilet - was priceless. Surely the organizers did a very good job!

What is also great from Mentor Summit is the chance to meet great people. Since at Qt Software we switched from Perforce to Git, it was nice to be able to talk and discuss matters with Shawn Pearce. He happens to work on Google Android these days, unsurprisingly Android project is of course using git. Still related to Android, there were two talks about it: the story behind and the application development. Also of a great interest is Gerrit, the Python-based code review tool used Android development. According to Shawn, Gerrit is an improved fork of Rietveld, a similar tool written by Guido von Rossum. The mystery of both names is solved if you check out this Dutch architect.

I myself was so glad to be able to have a short chat with one of my personal legends, Sam Lantinga, the man behind the fantastic libsdl. He works for Blizzard and likely you know the game he is working on, as it is called World of Warcraft. As for libsdl itself, the new adventure is SDL for iPhone (which is one of its SoC projects). When finally it is released, I can't wait to see how many SDL-based games will be then available on iPhone. Plus, if you write an SDL-based application, now you have an interesting fast-growing target market as well.

I also followed a discussion from the 12-year old Dmitri Gaskin. He is the youngest mentor, he is actually too young to participate as a student (the age cut-off is 18). If you are a fan of Google Tech Talks, surely you are aware of his jQuery talk. So we discussed about JavaScript unit test, it involved a lot of coding from his side. I am not a jQuery expert so I just gave my opinions based on my little knowledge on the JavaScript engine in WebKit. I am eager to see how the unit test framework would evolve.

At the end of the summit, many of us were exhausted. But of course, we look forward to having the next-year mentor summit!

Android meets KDE guys

Sunday, November 02, 2008

I chose this mortal life

I wonder if this juice is available somewhere in Oslo, or even Norway, or even Scandinavia, or even mainland Europe...