Friday, 9 May 2008

C++ GUI Programming with Qt4 - Book Review

Qt is a cross platform application development framework which is widely used for the development of GUI and non-GUI programs. Some of the most visible products which have been developed using Qt are KDE, Opera web browser, Google Earth, Skype and Photoshop Elements just to name a few. Some of the pertinent reasons for using Qt are -

One: Qt library is released under a dual licensing business model which means you can develop open source or closed source applications. If you are developing the former, then you do not have to pay any money for using the library.

Two: It is truly cross platform - which filters down to the fact that you can write the code for your application in one platform - say Linux, and then copy the code to Windows and recompile the code without making any changes and your application is guaranteed to run on Windows.

Three: Cellphone behemoth Nokia's recent acquisition of Trolltech has definitely infused fresh breadth and energy into the future of Qt. The latest version of Qt namely version 4.3 has a lot of enhancements which make developing GUI applications using this library a joy for most C++ programmers.

"C++ GUI Programming with Qt4" authored by Jasmin Blanchette and Mark Summerfield; published under the Prentice Hall Open source software development series is well into its second edition. This book is touted as the "Official book on Qt from Trolltech".

The main goal of this book is to teach how to write GUI programs using Qt4 and is targeted at the entry level to intermediate and advanced C++ programmer. So it starts off on a shallow curve, hand holding the reader from the first rudimentary steps in writing a simple C++ GUI program using Qt4. And over the chapters, gradually builds up steam and introduces the reader to complex scenarios such as creating plugins, 3D graphics, application scripting and more. Going through the book, I didn't feel like I was studying a programming framework rather I found the language used in explaining things quite lucid, clear and interesting all the same.

The book is divided into three parts. A new programmer in Qt will find the first part really useful because it covers the fundamental concepts and practices required for programming in Qt. The second and third part of this book comprising of 12 and 7 chapters respectively deal with specialized topics and can be read in any order. For example, if I want to build a GUI program which needs to connect to a database at the back end, then I can straight away read the 13th chapter namely "Databases", of this book provided I am conversant with Part I of this book which covers the foundation of programming in Qt 4.

The second edition of this book builds up on the first edition and contains numerous changes. For one, a couple of additional chapters have been included such as "Look and Feel Customization" and "Application Scripting". The book has been thoroughly revised to include changes incorporated in Qt 4.2 and Qt 4.3. The original "Graphics" chapter has been split into 2D and 3D graphics chapters respectively. The tiny chapter on Embedded Programming has been expanded to include programming in Qtopia, thus making it not tiny anymore.

What I really like about this book is the realistic examples which are used to introduce each Qt control or concept. There are plenty of images scattered within, which impart visual appeal to the book. More over, these images hopefully give the reader an idea about the correct way of designing their software.

Going through this book, I find that the authors have explained different scenarios of developing programs in Qt 4 exhaustively without overwhelming the reader. Each program is split into digestible chunks of code with detailed explanation succeeding them. This makes it quite easy to understand what each line of code accomplishes.

The appendixes contain a new section namely "Introduction to Qt Jambi". Qt Jambi is the Java edition of the Qt application development framework. Apart from that, there are of course the other sections in the appendix namely installing Qt, building Qt applications and also a concise section listing the main nuances of programming in C++ for Java and C# programmers.

One thing I noticed is that the hard bound book I received did not have a companion CD containing the Qt library and the IDE used to design your applications. Then again, one can always visit the Trolltech site and get the Qt 4.3 library and applications which is available as a free download. Even better, if you are developing your Qt applications in Linux then it is very simple to install all the necessary libraries depending upon the Linux distribution you are using.

All in all, this is a great book not just for any neophyte in Qt but also for the accomplished Qt programmer to use as a ready reference.

Book Specifications
Name : C++ GUI Programming with Qt4 - Second edition
ISBN No : 0-13-235416-0
Authors : Jasmin Blanchette & Mark Summerfield
No of pages : 720
Publisher : Prentice Hall
Price : $ 59.99 (US), $ 65.99 (Canada)
Rating : 9/10

Thursday, 8 May 2008

VirtualBox 1.6.0 for OpenSolaris has been released

Sun xVM VirtualBox software 1.6.0 has been released and it's the first non-beta version for Solaris. I just removed the old 1.5.5 beta package, installed 1.6.0 with a quick pkgadd and VirtualBox is running perfectly without any hack, as I previously wrote here.

If you're upgrading from a previous version, as I did, pay attention to the warning in the download page:
Warning: saved states and snapshots are not compatible between different versions of VirtualBox. Merge all snapshots, restore all saved states and shutdown all VMs properly before attempting to upgrade.
Have fun with VirtualBox on your Solaris!

Loreena McKennitt - Penelope's song

Now that the time has come
Soon gone is the day
There upon some distant shore
You'll hear me say

Long as the day in the summer time
Deep as the wine-dark sea
I'll keep your heart with mine
Till you come to me

There like a bird I'd fly
High through the air
Reaching for the sun's full rays
Only to find you there

And in the night when our dreams are still
Or when the wind calls free
I'll keep your heart with mine
Till you come to me

Now that the time has come
Soon gone is the day
There upon some distant shore
You'll hear me say

Long as the day in the summer time
Deep as the wine-dark sea
I'll keep your heart with mine.
Till you come to me

Tuesday, 6 May 2008

Loreena McKennitt - Dante's prayer

When the dark wood fell before me
And all the paths were overgrown
When the priests of pride say there is no other way
I tilled the sorrows of stone

I did not believe because I could not see
Though you came to me in the night
When the dawn seemed forever lost
You showed me your love in the light of the stars

Cast your eyes on the ocean
Cast your soul to the sea
When the dark night seems endless
Please remember me

Then the mountain rose before me
By the deep well of desire
From the fountain of forgiveness
Beyond the ice and the fire

Cast your eyes on the ocean
Cast your soul to the sea
When the dark night seems endless
Please remember me

Though we share this humble path, alone
How fragile is the heart
Oh give these clay feet wings to fly
To touch the face of the stars

Breathe life into this feeble heart
Lift this mortal veil of fear
Take these crumbled hopes, etched with tears
We'll rise above these earthly cares

Cast your eyes on the ocean
Cast your soul to the sea
When the dark night seems endless
Please remember me.
Please remember me.
Please remember me.

A small form factor Linux PC for the Marines

A regular reader of this blog would be aware of mini Linux PC's which fit on the palm of your hand and which is targeted at end users. Now what would you say if I told you that there exists a miniature Linux PC which is targeted at the Military ?

No Kidding! There is indeed such a PC and its name is "Engineering Development Kit" (EDK) which is a 7-10 pound computer that targets small ground, naval, and air vehicles. And believe it or not, it has a whooping 100 Gigaflops of processing power. The PowerBlock 50 measures 4.1 x 5.3 x 5.8 inches, with a seven-pound shipping weight, and a weight of less than 10 pounds fully configured, says Mercury.

Linuxdevices.com has the full scoop on this story.

Slackware 12.1 released

Which Linux user wouldn't know about the venerable Slackware ? The same one which has been elevated to cult status through the efforts of a single person Patrick Volkerding. Over all these years when flashy Linux distributions like Ubuntu rule the roost, Slackware has been successful in retaining its followers. Nay, Slackware user group comprises of a passionate set of Linux users who are keen on configuring their Linux box the old fashioned way namely editing plain text files. And these users have invariably mastered the art of configuring their Linux OS inside out.

A long time back, I had reviewed Slackware 11.0 and I found it every bit classic Linux and really took a liking to it. In fact, after I installed Slackware on my machine, I used to use it most of the time even though I had a couple of other Linux distributions installed on my machine too.

If you negate the latest versions of the packages that are bundled with Slackware 12.1, I believe not much has changed as far as installing it on your machine and configuring it. To know what are the changes in this new release, do read the official announcement.

Sunday, 4 May 2008

Guide to adding a new partition or drive to an existing system

Suppose you are required to create a 10 GB partition on your server running Linux, you have got two options namely :
  • Create a partition from the unpartitioned space on your machine or
  • Add a new drive.
If you are opting for the latter then it is a simple thing of plugging in the new drive, letting the system detect it, using a partitioning tool to create the requisite partition, formating the newly created partition and finally mounting it. But if it is the former namely, creating a partition from unpartitioned space, then the task gets a bit trickier.

Joey Prestia explains the exact steps needed to add a new partition to an existing system. The task can be broken down into the following steps :
  1. Determine what partitions need to be created and where.
  2. Create the partitions (I use 'fdisk' here but any Linux disk partitioning tool should work)
  3. Re-read the partition table either with 'partprobe' or by a reboot
  4. Make a filesystem on the partition, label it, and create the necessary mount points
  5. Add the appropriate entries to '/etc/fstab' so the partitions are mounted upon reboot
Check out Joey's notes to know the exact commands used to accomplish the above tasks.