My blog has been moved to ariya.ofilabs.com.

Monday, March 23, 2009

what you see is important, how you see it is even more

In case you miss it, Benjamin just added Google Suggest to Arora, within hours after I showed how to do it in Qt Labs. His BSD-licensed Google Suggest implementation is very lightweight, it is pretty trivial to integrate it to most common applications.

Screenshot follows (click to enlarge):

Friday, March 20, 2009

I was blindfolded but now I'm seeing

Two (old) tricks for the price of one. Well, since it takes two to Tango anyway.

The first is to make your window movable by dragging, especially if the window does not have a title bar (remember the classic WinAmp?) or use a custom-drawn one (Google Chrome is the prominent example here). To make the challenge more difficult, no change to the main window code is allowed. To reveal the secret (which is a matter of using event filtering properly), go to my Qt Labs blog entry: Moving top-level window by dragging.

To see it in action, peek at the following screencast (alternatives: YouTube, blip.tv, 3.7 MB Ogg Theora).

The second is about Google Suggest. Almost all browsers have supported it. For a minimalistic example on how to do it, check out my other Qt Labs blog on Google Suggest made easy. The demo launches your default browser with the chosen search term, with or without autocompletion.

The proof lies in this short screencast (alternatives: YouTube, blip.tv, 450 KB Ogg Theora).

(It is evident that my default browser is Konqueror. I told you I am not that biased :-)

Now just like last time, who is going to turn this into a plasmoid?

it takes two to tango

tango

Thursday, March 12, 2009

I can see it's coming, like a serenade of sound

The initial version of WYSIWYG editor based on QtWebKit (see my post on Qt Labs for details) apparently works pretty well. There are rough edges here and there, something which need fixing, but overall I am quite happy. Live editing a web page opens a whole new possibilty. For an HTML-based help system, you can offer annotation feature, where the user can add his own note right inside the documentation (you may want enable editing on certain parts, not the whole document). You can make a note-taking system that copies something from the web (in HTML) and then the user can touch the content to adjust it to his need. Translate web pages easily, with all the formatting and whatnot intact, and without the need to scare the translators with raw HTML black magic. Any more useful examples?

Screenshots follow. Click on each image to enlarge.

bias

Readers of my blogs might notice the remark "heavy corporate bias" [1] which was the most interesting comment after I showed the result of JavaScript benchmark test. Interesting? Because I work for Nokia [2] and none of the product shown in that benchmark result is from Nokia.

Of course I am not stupid. It is just because I am paid to hack on QtWebKit [3], right? It does not matter if I never pushed QtWebKit to replace KHTML or KJS. It does not matter if I never (God forbid) bad-mouthed or insulted KHTML, KJS, KOffice, or any other KDE sub-projects, or any of its developers. It does not matter if I (and other KDE developers and ex-developers here in Qt Software) give our best [4] to ensure that the latest Qt release plays well with KDE 4.x.

I guess some people are just hostile, not matter what I do. The greatest lessons of it are (1) I try to be active again in KDE, despite Real Life (tm) would make it a difficult task (2) I will post more food pictures, apparently these did not annoy people enough :-)

On a slightly unrelated side note: after all these (tough) years, "biased" is probably not really my thing (those who know me well, please speak up!). I use all major browsers on an almost equal basis. Of all three phones I use since I start working for Nokia, none of them are Nokia ones. I enjoy working on QtWebKit, yet I like the simplicity and easy-to-follow KHTML. My home machine runs (the beautiful) KDE 4, my work desktop is still with (the trusted) KDE 3. I am a proud vim user but hardly recommend it to novices. My main debugging tool is still gdb but everyone knows how I praise VS integrated debugging. I like and use git (rebase) with passion, still I believe mercurial patch-queue rocks. I contributed a lot to KOffice but I am a great fan of Jody Goldberg and Michael Meeks' work on Gnumeric and OpenOffice.org.

If you come to me [5] and tell me how bad my code is, likely I will buy you a drink. And I am usually still the one who hates my code most.

[1] The phrase "heavy corporate bias" starts to become an insider joke here among my fellow Trolls :-)
[2] The disclaimer in my blog explicitly states do not necessarily represent the official view of my employer.
[3] If you fail to see the connection, Chrome and Safari are powered by WebKit as well.
[4] We are still human^Troll, and there are only 7 days a week.
[5] Nokia employees may not enter the contest.

sate kelapa

A dish that is on the prominent position of my must-eat list (when I am on vacation) is sate kelapa (or in its local variant known as sate kelopo). This is like the usual satay, except that it is sprinkled with coconut rasp (hence the name, kelapa is coconut) before being grilled, thus giving its distinctive, wonderful and appetizing smell.

You can find sate kelapa if you travel around Surabaya and perhaps other places in East Java. A portion of 10 pieces typically costs only 50 Eurocents. Served with lontong (bite-size compressed rice), with peanut-mixed-with-soy-bean sauce, you would never stop eating it. There was a time I had a double portion for breakfast, every single day in a week!

sate kelopo

Sunday, March 08, 2009

won't you take me where the streetlights glow

Let's start with the screenshot (aka the proof):

For the full explanation, read what I wrote in our Qt Labs. Basically we just use Google Talk web app for iPhone, which is 100 percent HTML and JS. There is seldom an uglier hack than this.

Now, who is going to turn this into a plasmoid?

chocolate brownies

It is cold. It is snowing outside. It is weekend time. What would be better than baking something delicious?

chocolate brownies (with mango and cinnamon)

By popular demand, here is the recipe for home-made chocolate brownies. It is so easy, it would never fail. Think about this: last summer, after I was injured in a football match, I had a surgery on my left hand. Effectively for weeks I could use only my right hand. Guess what? I still baked brownies when I was in the mood!

Ingredients: 4 eggs, 200 gr sugar, 100 gr flour, 100 gr butter, 100 gr bitter chocolate.

Preheat your oven to 450 K (OK, it's around 180 C or 360 F). Melt the chocolate. Melt the butter. In a bowl, stir together everything. Grease a pan and pour the mix. Bake for 30 minutes. Enjoy!

For a variant, add slices of fruit to the mix. My favorite is mango, but banana and orange apparently work pretty well. Usually I also spice it up with a bit of ginger and/or cinnamon.

Tuesday, March 03, 2009

quattro cinque zero

Today (three-three-nine, no conspiracy about the chosen date, please!) Qt Software releases Qt 4.5.0!

There are a number of interesting things about this particular release: lots of performance improvements, simultaneous release of Qt Creator 1.0 which enables the Qt SDK package, LGPL as the new license option, and plenty of new and improved features.

Personally this is an exciting release for me, since it contains some of my work since I joined Qt Software (nee Trolltech). Among others, I did a bit of optimizations for Graphics View, touched the low-level graphics stuff at times where I understood it, and of course - my main task - integrated a lot of WebKit features into the QtWebKit module.

Download Qt 4.5 (or via torrents) while it is fresh. Especially with the SDK package, there is no excuse not to learn C++ and Qt anymore.

PS: can you spot me in the group picture? :-)

didn't have a choice but to lift you up

QTimeLine is a nice class to control animation [1], used among others in Plasma::Animator. There are some curve shapes available for the timeline, from a linear one to some easing combinations. Though linear gives a rather standard movement effect, using easing often can give a better touch. This makes sense, as everything is our daily life usually moves not in a linear movement, due to e.g. inertia and gravity.

Which brings me to another point. At least for me, the ease in and out curve shapes do not feel as natural as they could be. The solution is to create a custom timeline. This becomes the latest graphics example in our Qt Labs blogs. Basically I use the logistic function (again [2]) for a nice S-shape curve. You can even adjust the sharpness of the S-shape. From the animation (click the Show Panel or Hide Panel button), you might see that the starting part of the curve gives you the feeling of overcoming the inertia of the panel and the friction of the panel to the desktop, while the last part of the curve makes you think as if you release the push force and let the panel slides by itself.

Time to make this as the default curve shape for Plasma? :-)

[1] For Qt 4.6, a new animation framework is planned which is supposed to give a much more flexible animation control.
[2] I used it for the genie effect before.

for the glorious nation

Approaching the Qt 4.5 release, in order to relax the atmosphere a bit, and while I was just back from vacation in Indonesia, last week I brought nice goodies to the office. Read what I posted to our internal list:


Subject: durian, for the glorious nation of Indonesia
Date: Tuesday 24 February 2009
From: Ariya Hidayat <ariya.hidayat@trolltech.com>

Executive summary: try durian candies I brought, find them on the desk in the 5th floor, next to the stairs.

Durian [1], an arguably very nutritious and delicious fruit, my all-time favorite snack, best things before sliced bread and LISP, is unfortunately forbidden to be carried in the flight, placing it in the same category as guns and drugs. Since I am not a brave as our Chief Troll (with his cheese adventure), instead of smuggling a large quantity of durians, cowardly I fall back to a simpler solution: durian (flavored) candies. For me, they taste fantastic (albeit not as heavenly as the fresh fruit, or when made into mixed drink [2,3]), but for most people, they stink, smell horribly, and taste disgusting.

When you start the losing fight with your stomach, when you count the minutes in the toilet, when your days in Emergency Room are almost over, now think about it: how do most Asian feel about European cheese? [4]

Now I am back on completing my patent application on "Method and Apparatus of Information Extraction from Combatants Using Exotic Tropical Fruit", before someone ratifies the counterpoint as an addendum to the Geneva Convention.

Enjoy the ride!

[1] http://en.wikipedia.org/wiki/Durian
[2] http://flickr.com/photos/ariyahidayat/3293814359/
[3] http://flickr.com/photos/ariyahidayat/3294638128/
[4] Surprisingly, "durian" and "revenge" share a general theme: they are best served cold


These candies of course can not reach the real taste of the fruit itself, especially when made into fresh drink like the picture here:

durian with ice