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

Tuesday, January 27, 2009

the ultimate answer to life, the universe, and everything

Remember what I wrote about Qt 4.2 back then? Well now KDE 4.2 also reached it.

Rock on!

Qt, not QT

Qt, the application framework from Qt Software is written as Qt (capital Q). It is not written as QT (capital Q, capital T). QT can refer to a lot of other things, e.g. Apple QuickTime.

The official pronunciation of Qt is "cute". It is not pronounced as "cue tea".

Monday, January 26, 2009

Qt::CheatTransform

Qt::CheatTransform was supposed to be a joke in Qt Developer Days graphics talk (though some people took it seriously). It still resembles the idea of blazing-fast by cheating whenever you can. Basically this is about creating a thumbnail preview of a large image in an optimized way. Downscaling an image is usually done using QImage::scaled() function. You have two choices: Qt::SmoothTransformation gives the best quality but very slow or Qt::FastTransformation is extremely fast at the expense of the quality. But what if there is a compromise: not too slow but the quality is still acceptable? Well, apparently it is possible to do. Check out my latest Qt Labs blog which exactly exposes the trick.

In the above screenshot, the result of downscaling a 10-megapixel picture is depicted. There are three images, each for Qt::FastTransformation, Qt::SmoothTransformation and one "cheat scaling" method. Use the key 1 to 3 to switch the scaling method and watch out the bottom right image. If you flip back and forth using 2 (for Qt::SmoothTransformation) and 3 (using the cheat method), can you spot the different pixels immediately? Do you think the cheat downscaled image is good enough?

How about the speed? Check out the following chart (longer is better), which speaks for itself:

Of course your milage may vary. The above comparison is for downscaling a 10-megapixel image to something like 200x150 pixels. You may gain less for smaller source images, though.

Saturday, January 24, 2009

wisdom of the week

Klug zu reden ist doch schwer, klug zu schweigen noch viel mehr.

English: To talk cleverly is difficult, to hold the tongue cleverly is even more.

in a field

Tuesday, January 20, 2009

secrets, a sign, a reason

Let us start with a comparison (longer is better):

If you see the my latest graphics example: 50% scaling of (A)RGB32 image, you will find a 10x faster way (compared to QImage::scaled() function) to downscale an image to the half its original size, of course with (approximately) the same visual quality as when you use Qt::SmoothTransformation.

For the readers who also did listened to my Qt Developer Days graphics talk, you can have an idea why I make so much fuss just for image halfscaling :-) Bear with me and we will reach that point.

Friday, January 16, 2009

enlightment of the week

You would know someone better, not from the way he treats his friends, but rather the way he deals with his enemies.

Thursday, January 15, 2009

capture the idea, before it is long gone

Using WebKit, it is quite trivial to create a tool that grabs the contents of a web page and then saves everything as an image. Together with the new full page zoom feature, we can have the zoomed in or zoomed out version of the page, even at different viewport sizes (which may simulate different screen resolutions). In fact, that is what I describe in Qt Labs on the topic of Capturing web pages.

Just imagine you can have that small utility and you can run something like (web address, zoom factor in percent, output filename, optionally also the viewport width):

webcapture www.trolltech.com 50 trolltech.png

what would you do then?

Wednesday, January 14, 2009

lima golf papa lima

Sebastian just announced that Qt 4.5 will be also available under LGPL 2.1. Yes, it's the Lesser General Public License (check the FAQ). It means a good change for KDE as well.

One small step for Qt Software, one giant leap for mankind...

Tuesday, January 13, 2009

bleeding-edge ioquake3 to play Quake III: Arena

Here is step by step short instructions if you want to play Quake III: Arena using the bleeding-edge version of ioquake3. Reasons to do this (instead of using the vanilla Q3A executable): ioquake is still actively developed and maintained and it has new fancy features like in-game VoIP, SDL backend, OpenAL support, x86-64 JIT, MinGW build, and many others.

Get ioquake3 source code using subversion, git, or a normal plain web browser.

To get the source code using Subversion:

svn co svn://svn.icculus.org/quake3/trunk ioquake3

Windows users might want to use something like TortoiseSVN and enter svn://svn.icculus.org/quake3/trunk to check it out.

Since cool kids are using git these days, I set up an unofficial git mirror of the repository at github.com/ariya/ioquake3/. It is synchronized with the subversion repository. To get the code:

git clone git://github.com/ariya/ioquake3.git

Windows users might want to use something like msysgit.

If you are allergic to subversion and git, grab the most up-to-date source code as ZIP or tar.gz package. Use a web browser or tool like wget. How is the last one possible? Hint: download button at the github page.

Build ioquake3, which is quite easy.

On Windows, you need MinGW, MSYS, along with typical development packages (gcc, make, etc). Run MSYS, go to the ioquake3 source directory (e.g. C:\ioquake3), and just type make. If everything is OK, you will get the executable (e.g. at C:\ioquake3\build\release-mingw32-x86\ioquake3.x86.exe). After that, grab SDL 1.2.11 (try to match it with ioquake3, see e.g. C:\ioquake3\code\SDL12\include\SDL_version.h) development package for MinGW, extract it and put it in your MinGW directory (e.g. C:\MinGW).

On Linux/Unix, you need SDL and OpenAL development packages. Then go to the ioquake3 source (e.g. ~/ioquake3) directory and type make. You will find the executables at the build subdirectory (e.g. ~/ioquake/build/release-linux-i386/ioquake3.i386)

Start to play, since the executable is now ready. Before that, we need to copy the Q3A game data.

On Windows, get the pak0.pk3 from your Q3A CD. Afterwards, find and install Q3A point release 1.32 and then locate its additional data files (e.g. C:\Program Files\Quake III Arena\baseq3). Place all these *.pk3 files to your user Q3 directory (e.g. C:\Document and Settings\username\Application Data\Quake3\baseq3). Launch ioquake3 and you are set.

On Linux/Unix, copy all pk3 files to the baseq3 directory (e.g. ~/.q3a/baseq3). Again, if you have installed 1.32 point release, there will be 9 pk3 files needed. Now just launch the ioquake.i386 executable and have some fun.

Related note: if you don't own Quake 3, then just download and install OpenArena. Of course, it is not an exact 1:1 copy of Quake 3, but enough to have some fraggin' fun. You don't even need to bother with building ioquake3 at all because OpenArena already packages it. If you are bored with Q3A, there are other similar free and good games, like Warsow, Nexuiz, Tremulous, Urban Terror, and many others.

Tuesday, January 06, 2009

white is not the new color

Let us start with a screenshot:

The graph itself is not something new, since I just recreated SquirrelFish Extreme comparison (against its predecessors). The focus is actually the tool which was used to generate that bar chart.

For the code and a little explanation, check out what I wrote on Qt Labs on the topic of QtScript-based bar chart.

Saturday, January 03, 2009

I could sit for hours finding new ways to be awed each minute

Just like Jim Rohn said: Miss a meal if you have to, but don't miss a book, these days I force myself to read more books more often than before. Here is a list of English fictions that I managed to read fortnightly, in the order of my preference, just in case you are looking for good books and want to read some of them as well.

  • Paulo Coelho's The Alchemist. I always wanted to finish this one and finally I did. Needless, it is only one of its kind. At one point in your life, you simply need to read and digest this book, because there is just Santiago in each and everyone of us.
  • The Kite Runner by Khaled Hosseini. I wrote the short review before. I also watched the movie, but the movie was not even close to the book.
  • The Curious Incident of the Dog in the Night-time, an award winning book from Mark Haddon. You may finish this small book in a day, but that day will be the day that changes your life. The story is about an intelligent (lots of excellent math references in the book) but autistic young boy who tried to find the villain that murdered a dog. However, the story unfolds into something a lot bigger than that, something that changed his life significantly.
  • The Witch of Portobello, again from Paulo Coelho.The witch, who was murdered, was a woman named Athena. She was very special and her life story was narrated by her relatives and friends. A trivia: find a sentence that exists both in this book and The Alchemist.
  • Conn Iggulden's Emperor series: The Gates of Rome, The Death of Kings, The Fields of Swords, The Gods of War. A heavily fictionalized story of arguably the greatest leader ever in the whole Roman Empire, Julius Caesar. I really like these books and want to write a separate short review for this series.
  • Marina Lewycka's very funny A Short History of Tractors in Ukrainian. Both entertaining and educating. I wish someday it will be made into a movie. Set in modern day England, the story of the tractors is told by one of the protagonists, a brilliant old immigrant from Ukraina.
  • A Thousand Splendid Sun by Khaled Hosseini (again). A sad story about Mariam and Laila, two Afghan women. It is a very nice read, especially after The Kite Runner. I am, however, a bit spoiled because fews of the plots become more predictable once you recognize The Kite Runner's patterns.
  • The Book Thief, an award-winning bestseller, written by Markus Zusak. A sad but vivid story of a young German girl's experience during the second world war. She was closed to Death several times, and it was Death who narrated her story of life.
  • The Last Templar by Raymond Khoury, that draws the commonly used theme: the adventure to find out hundred years old relic, supposed to be guarded by the Templar knight in the old time, which may change the foundation of the religion.
  • Sandstorm, a wonderful thriller from ex-SAS Michael Asher. George Sterling, upon a hint that his son who was missing in the desert some time ago, mounted a journey to try to find back the lost son. Right from the beginning, it was not smooth at all and soon he would be involved in a mystery larger than just a family reunion.
  • A collection of short stories, The Veteran by Frederick Forsyth. The highlight is the short story of the same title, a detective investigation of a murder that looked boring and usual at the beginning but then revealed a much larger matter in the end.
  • Captain Corelli's Mandolin. Everyone knows the Nicholas Cage version (of the movie), but trust me, the book is much much better. Set in the second world war, the story is about the struggle of an Italian captain in an island in Greece.
  • Another one from Raymond Khoury: The Sanctuary. Again about a secret, a centuries-old relic, that was supposed to change the way we look at the life and the universe.
  • The Apocalypse Watch, written by Robert Ludlum. A top-notch agent disappeared after successfully sneaked into a supersecret military facility. What did happen to him? His brother was set to find that out.
  • With a backdrop of second world war, The Black Order, a spy-thriller by James Rollins, is a story of the search for the cause of life. Introducing the concept of quantum evolution, apparently it was also possible to abuse the technology to "modify" the life itself.
  • A reporter was missing and someone was supposed to find him. All of sudden, a mystery and a big conspiracy were the stake. Andy McNab's Crossfire.
  • East of The City by Grant Sutherland. Yet another thriller (albeit with a slow start) about an underwriter which, when doing an investigation, was dragged into his dark past.
  • What if you try to trace the mysterious girl who lived in your place before? That is what Michael Connelly wrote in the tech-thriller Chasing the Dime. At first, it looked just normal, but soon it became an important part of a dangerous game.
  • Ultimate Weapon from Chris Ryan. A story of two men fighting in war-time Iraq to find their loved one.

I may forget some other books. But maybe those are not really important after all.

on coincidence

Kein Sieger glaubt an den Zufall.

-- Friedrich Nietzsche

(English translation: No winner believes in coincidence)

Autumn in Paderborn

Photo by this girl.