Karachi   ->   Sweden   ->   Karachi, again   ->   Dubai   ->   Bahrain   ->   Karachi, once more   ->   London and Leeds

Wednesday, June 25, 2008

Book Review: Dreaming in Code

The road to wisdom? --- Well, it's plain
and simple to express:
Err
and err
and err again
but less
and less
and less
By Piet Hein (Danish Poet/ Scientist/ Designer)


I mistakenly bought this gem while actually looking for Beautiful Code. The tag line of the book, Dreaming in Code, is"Two Dozen Programmers, Three Years, 4,732 Bugs, and one Quest for Transcendent Software." The software project this book talks about as a case study is Chandler, which started around 2003 and expected to provide a solid version 1.0 to the world for personal information management by the end of the year. The project is still at version 0.7.7 at the time of this writing.

You might be thinking what exactly is so hard about writing a PIM tool. Well, if you want to do it right, and different, it would definitely take long. Just for the sake of example, consider how you enter dates in modern day information systems: using a drop down calendar, right? How about letting the user type in the date in any format he wants: "June 25, 2008" or "25-06-08" or even "today." These and several other novel ideas were behind the tool to make it the next "killer application."

The project was initiated by Mitch Kapor of Lotus fame. In later years, it turned out to be extremely ambitious, and Scott Rosenberg (author of Dreaming in Code) tries to find out the reasons behind the slow progress/ wrong estimates of the project in paritcular, and why software is so hard in general. To give you an idea of what the current version of Chandler delivers, I quote from the project wiki:

  1. The basic unit of information is The Note
    • Starred
    • Added to the Calendar as Events
    • Addressed and Sent to others via Email
  2. Notes can be organized into Collections
    • A Note can be added to Multiple Collections via drag and drop
    • Collections have 3 views: All, Starred and a Calendar
    • Calendars can be color-coded and overlayed
  3. Each Collection is divided by Triage Status into 3 sections: NOW LATER DONE
    • Events are automatically triaged based on when they happen
    • Events automatically move into NOW when they start
    • You can also set custom Tickler Alarms to automatically move Notes to NOW
  4. You can back up your data, access it from the web and share collections with others by signing up for a FREE Chandler Hub account.



The book has around 350 pages divided into 12 chapters. Below is a brief outline of each chapter:

  • "Software Time" sets the stage in an interesting manner; comparing author's youth game programming to modern day's web 2.0 site management. He also talks of bridge construction and mechanical engineering, and comes back to this comparison quite often in the book.


  • The chapter titled "Doomed" starts the discussion on the Chandler project from a meeting being held in July 2003; the meeting discusses a bug, flickering when Chandler's window is resized. The bug turns out to be in wxWidgets which is used by the project team to build a cross platform UI for Chandler. It also reveals to the user that the project has missed several of its release deadlines and the team is in trouble.


  • "The Soul of Agenda" goes into some history of "personal information management tools." It also talks of the last project Kapor managed at Lotus, Agenda. The software came with the idea of "put it in first; categorize it later," which Kapor wanted to be the core of Chandler as well.


  • "Prototypes and Pythons" talks of Rapid Application Development and some history of programming languages, specially the creation of Python and the new ground it intended to break. Chandler team finally settled for Python as its programming language.


  • "Lego Land" discusses the repository design of Chandler and Zope Object Database aka ZODB. The chapter goes into the core issue of "building reusable software components," like Lego blocks that can be connected to build something new. It's a dream promoised by every new technology/ programming language but which, in reality, has never come true. Other topics of interest could be Brad Cox' Objective-C.


  • The topics covered in "Managing Dogs and Geeks" are the Mythical-Man-Month, Dilbert's Pointy Hair Boss, the word Geek and how to manage them.


  • "Getting Design Done" talks of User Interface designing. Additionally, it discusses the merits of going with a web based approach vs. a cross platform desktop application. Chandler finally settled with CPIA, Chandler Presentation and Interaction Architecture.


  • "Detail View" tells the readers how a feature that might seem tiny to end-users, has hundreds of issues associated with it which need to be handled by the software developers. The book gives the example of "a recurring task in a calendar." Do we generate all instances of this recurring task? What if the time for one particular instance of the recurrence needs to be changed? What would happen if we want to associate some notes with this task?


  • "Stickies on a Whiteboard" informs us how Chandler's featuers were divided into releases to finally get something out. It also taks about the push to use "WebDAV" for information sharing between Chandler clients.


  • In the chapter labelled "Methods," Scott Rosenberg digresses for a moment to talk of software methodologies, ranging from waterfall through CMM to eXtreme Programming. I consider to be the best part of the whole book. If you can get an excerpt of this chapter, I highly recommend reading it.


  • Besides Methdos, "Engineers and Artists" is an extremely well-written chapter. This one is also applicable to software development in general. Amongst other interesting ideas, Scott talks of how essays/ poems written by students are read out in an arts class for criticism/ review/ improvement and no such practice is carried out in software engineering curriculum. Another interesting concept is that of Leakage of Abstraction.


  • The term dogfood as discussed in "The Road to Dogfood" is using your software for your own work. Chandler finally delivered a working Calendar application and Mitch Kapor started using it for himself.


  • A Long Bet is a closing chapter where we are told that Kapor wagered $20,000 that by 2029 no computer or "machine intelligence" would have passed the Turing Test but Kurzweil, a leading inventor, disagrees.



I give this book an 8 out of 10; there is some repetition and the focus is too much towards Chandler, which make me deduct two points. It's another must have!

Saturday, June 21, 2008

World's 5th largest gold, copper reserves found in Baluchistan (Pakistan)

I received this in an email from a colleague; my first impression was, "We, Pakistanis, never try to authenticate a news before forwarding despite this being attributed akin to lying in Islam." So, I did a quick search and found a 2006 news item on a Chinese site. Apparently, the news seems to be true. What's surprising is that the license to Canadian and Chilean firms were awarded 10 years ago, and most of the Pakistanis remain unaware.

However, there are some contradictions and some more affirmations here. Another report confirming the news and putting the worth at 65 billion dollars is posted here.

Now, this clearly tells me why corrupt politicians---Nawaz and Zardari---were so eager to come back to this dry and troubled country, where you don't even have water and electricity as a commoner, and you don't even have any assurance why you wouldn't be blown up while offering prayers today.

Friday, June 06, 2008

Book Review: The Jinn From Hyperspace

If you are a fan of Martin Gardner's recreational mathematics book, and would like to see his other writings, this book might be for you; others should be ok if they miss it. It's a collection of essays, on no single topic. The book is divided into four parts, with 36 chapters in all spread over 300 pages. The parts are

  • Science, Math, and Baloney: This part (19 chapters) contains Martin's opinion on various science related topics, as well as some paradoxes which philosophers and logicians seem to be very fond of. The topics range from False Memory Syndrome to a hypothetical Time Reversed Universe. The title of the book is actually name of a fictional story related to Klein bottles in this part.

  • Literature: This series of chapters (5) contains Martin's view of literature, specifically focusing on the work of Chesterton and how the Santa Clause came into being.

  • L. Frank Baum: Martin Gardner seems to be a fan of L. Frank Baum (the author of The Wizard of Oz); though, people outside the US (like me) might not have heard of him earlier. This section consists of 7 chapters, entirely dedicated to the writing style of L. Frank Baum.

  • Lewis Carroll: Like Frank Baum, Martin seems to be a fan of Lewis Carroll as well. Martin discusses the background of the writings of the famous logician. This might be very interesting for you if you know a little bit about Lewis and/ or have enjoyed reading Alice in the Wonderland/ Through the Looking Glass. This part consists of 5 chapters, and also sheds some light on the life of Lewis.
Depending on where you live, some of the content---such as False Memory Syndrome which discusses false childhood abuse memories---in the book might be disturbing for you. While there were certain bits and pieces to learn from here and there, I am not much impressed by the overall theme and content of the book.

Tuesday, May 27, 2008

Disabling The Application Crash Dialog Box in C++

First of all, you must know that there are two types of exceptions that can arise in a C++ program: synchronous and asynchronous. The names might be misleading but the concept is simple: A synchronous exception is what is actually "thrown" in code. An asynchronous is a hardware or Windows level exception. For example, you might get "bad_alloc" exception thrown at you when insertion in an stl vector fails. That would be a synchronous exception. An example of asynchronous exception is division by zero. There is no "throw" statement which actually causes the exception to be thrown.

When you have a catch all block, written as catch (...) in your code, asynchronous exceptions might or might not get caught, depending on
  • whether you are compiling in debug mode or release mode

  • whether you are using Visual Studio 2005 or an earlier version

If you want to go into the details of what has been explained above, this could be a very good article.

Coming back to the original topic, when you have an unhandled exception, i.e. something for which there is no appropriate catch block, several things happen in the background. You can read this MSJ article for details. In short, your application crashes (but doesn't terminate!), and you get a popup at the end similar to the one shown below. Once you press OK on this popup, the process terminates completely.

You can disable the release mode pop-up using
SetErrorMode (SEM_NOGPFAULTERRORBOX);

However, if you are building in debug mode, the pop-up box would be completely different; offering debug services!

The reason you see this "application has requested the runtime to terminate it" is because of the settings debugger does. You can disable them by using _CrtSetReportMode and _CrtSetReportFile methods. You'll have to include crtdbg.h in your code.
Below is one example:
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE);
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR );

Tuesday, May 13, 2008

Online Stock Trading for KSE

A number of online stock trading options are available to invest in Karachi Stock Exchange (KSE) these days. While AKD Trade might be the best service in this regard, it requires a deposit of Rs. 200K. If you would like to start with a less demanding provider, ClikTrade.com might be a good fit, albeit with low quality of service. You can open up an account with Rs. 50K.

An interesting related site is Pak Stock Exchange, modeled after FOREX.com; it lets you virtually trade in KSE for free!