In support of WordPress

With the release of firmware v2.0, playing the iPhone is more enjoyable than ever. Although the popularity of web applications is continously increasing, I just don’t feel like having to open Safari every time I need to do something on my iPhone because the responsiveness of the web applications is limited even under wifi connection.

Now that WordPress has released the iPhone version of its blogging tool, I am trying it out without any hesitation (which is what I am doing right now), just to show my support. The writing tool is very neat, and I can also attach images at the end of this blog post. Unfortunately, due to the lack of copy-n-paste function on the iPhone, I don’t think you can insert hyperlinks in the text (nor did I find the option for doing so) and nor can you insert images from a URL. As the time of writing I just found out that the source of WordPress for iPhone is made available via their SVN server, throwing Apple’s SDK NDA right back in its face. It is interesting to see how Apple would respond.

It might also be worth noting that AT&T’s 3G coverage is still under construction, at least here in Houston. For instance, I don’t have any 3G signal at home and little on campus (as can be seen from the screenshot attached). I have to manually disable 3G network to not waste my battery and to ensure the quality of my phonecalls. So basically I am using an iPhone 2.5G with a white finish (I am no fan of GPS).

Since this post is dedicated to WordPress I am going to save my comments on iPhone 3G for the next one.


A couple of good/exciting news

Out of no where (at least for me), Blizzard announced Diablo 3, the long waited successor of the famous Diablo series. Of course, I would assume (at least) another year and half before it going into beta, taking into consideration that even StarCraft 2 does not have a beta yet. Blizzard is “notorious” of postponing delivery of the final products, as they always claim that they want to take as much time as needed to achieve certain level of perfection.

Another piece of exciting news is that a bunch of Google developers have initiated the Google C++ Testing Framework project. I am not a fanatic fan of unit testing like Dat, but I do appreciate the merits of test driven development (TDD). Previously there was (there still is now) CppUnit, but it was not so straightforward to configure to work with Visual Studio. This can be attested by both Dat and me. Judging from the README and samples of googletest, everything should be as easy as in Ruby and Java. I will try it out when I finish the work at hand. The very first thing I need to do, however, is to figure out how to write the CMakeLists.txt to incorporate the test framework in a new project.

Last but not the least, I think I found a hole in AT&T’s iPhone 3G upgrade plan. According its policy, ineligible AT&T users need to pay $399/$499 for the 8G/16G model, but users who are currently on an iPhone plan are by default eligible for the upgrade price ($199/$299). Thus, before July 11th, which is the date when iPhone 3G goes on sale, if you can somehow get a hold of the first generation of iPhone, you can insert a new SIM card and activate it with your current number, which will upgrade your plan to an iPhone plan. Unless you have to show that you have an original iPhone when purchasing the new 3G model, you are qualified to upgrade just as other iPhone users.

I am not sure how AT&T countermeasure this kind of “hand-me-down” abuse. Maybe they do, but another ironic fact is that even if you start another new plan and pay for the early cancellation fee ($175), that will be only 175 + 199 = 374 for you to get an iPhone without a plan. Adding one month service fee, it is still less than $599 (price to get an iPhone 3G without signing a 2-year contract). What the heck were you thinking, AT&T?

Yay! CUDA SDK is running properly!

Although my work is not closely related to high performance computing, I just had this inherent obsession of optimizing programs to make them run faster (which I consider to be another expression of speed obsession). Last night I finally couldn’t stand waiting endlessly for NVIDIA to deliver the VS 2008-compatible CUDA toolkit and wanted to see for myself the cool examples CUDA SDK provides. Another key factor is that I still have my XP partition, which is something I can afford to screw up.

I then installed VS 2005 on it, but before I can run the examples I also need to install CUDA-enabled driver ( I tried without the driver, it didn’t work). Anyway, the driver version is 177.35 as the time of writing and when I ran setup.exe it prompted that my hardware is not supported in this driver. Hey, what’s up with that? I thought all 8-series graphic cards are CUDA-enabled (mine is 8800 GT by the way), this statement does not stand if I cannot install the CUDA-enabled driver which is required to run CUDA programs.

Googled a little bit, I soon learned that 177.35 was designed for the newest GTX 200 series (280 and 260) and I also found a workaround. Basically by replacing the original nv4_disp.inf (nv_disp.inf in Vista) with a modified one, I tell the installer that my graphic card should also be entitled to use this driver.

After a restart all the examples in the SDK are running properly. Then I plan to move a little further – install the toolkit and SDK on my MacBook Pro (with a 8600M GT). The process was painless except I need to add CUDA to my $PATH. Also worth noting is that only CUDA 1.1 is compatible with OS X (CUDA 2.0 beta2 for most of other platforms), hence there are less examples in the SDK.

One more thing, I still need a CMake module in order to generate my CUDA project files. Luckily some guru has already worked on it (even better, there is also FindCg.cmake). But since I have not tested it yet, I cannot guarantee it will function properly.

One other book that I actually finished

I set out to write this post right after I finished the book (approximately a month ago), but it seemed that I had a little problem keeping up with a good habit of blogging consistently. Anyway the book I am talking about is The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics from NVIDIA.

The Cg Tutorial

I became obsessed with hardware-accelerated real-time rendering when GT showed me the beauty and the power of Cg language while I was taking the computer graphics course. As I decided to implement the rendering of some fogged terrain using Cg for my term project, I got this Cg tutorial and had it with me wherever I went for some time. To be honest, the project did not benefit much from this book since the techniques adopted were quite simple and fundamental – barely enough for me to have a taste of its awesomeness. However, what I like about the book is its readability. For beginners like me, the adequate introduction and well explained examples are very easy to comprehend (although an advanced user might find it naive and too verbose on obvious stuff). I finished Chapter 2 through Chapter 9 half a year ago and did not pick up the rest chapters (1 and 10) until recently (I have my reasons).

At first I did have some complaints about the fact that book did not include a basic yet important tutorial on how to connect the Cg programs with the C/C++ programs. They were gone by the time I reached Appendix B, which was exactly what I was looking for. Thus in my opinion, if you are into harnessing the power of the GPU for real-time rendering and are looking for a place to start, this book is definitely worth your attention. Plus, NVIDIA just made it available online and it is free!

Because I was so into graphics by then, I also got myself a brand new GPU Gems 3. Unfortunately, it was for more advanced CG (computer graphics) practitioners and I don’t have any clue about some code snippets (as in what kind of language is this or what is this file format). If somebody has got experience with this book, I would really appreciate it if he/she can share the knowledge.

Moving ahead doesn’t always gaurantee a superior position

OK, I admit it, I don’t really know why Visual Studio 2008 is better than 2005 and I am also aware of the fact that Windows Vista is running slower than Windows XP. I did the switch only for the sake of upgrade, as I have this unexplained compulsion to become up-to-date, and visual satisfaction from the inherent fanciness of the successors.

The consequence, as one might expect, is possible negative impact on productivity. Although I was lucky to finally have workarounds (by workaround I don’t mean reinstalling the compatible version) for the projects I am actually involved in, the time spent to search for solutions is substantial.

From what I have experienced so far, there are three scenarios in which using VS2008 and Vista could be annoying.

  1. Before the recent release of Qt 4.4, VS 2008 was not officially supported by Qt 4.3. This basically means that you might be able to use Qt 4.3 without a problem, yet on the other hand it could have driven you crazy after you spent hours to debug only to find it to be a compatibility issue (I started using 4.4 when it was still a snapshot so I only speculated what would happend). This usually causes the mildest annoyance as you might not run into problems at all.
  2. Before the recent release of MySQL 5.0.51b, it had some known bugs when installed on Vista (as well as on Leopard). What makes this scenario better than the last one is that you have workarounds (thanks to Google), and at the same time a newer version often tends to be released soon and fix the bug. Another example is Warcraft III, which started to run properly on Vista after applying the latest patch.
  3. Last but perhaps the most disturbing thing, is having to wait for the software/SDK to have support for VS 2008 without any specific time frame, as in “we currently don’t have plan to support Visual Studio 2008”. CUDA, for instance, does not support Vista until the latest release of 2.0 beta. To make it even worse, this version of toolkit does not work in VS 2008. Fortunately I only wanted to play around with it.

I was actually quite surprised by these incompatibility issues since Vista has been out for two years already. Yet apparently some software developers are more rational than I do. Thus in cases when the Vista-incompatible libraries and/or applications are mission-critical, unless you find a fix and meanwhile is willing to go through the trouble, stick with VS 2005 and/or XP.

Qt 4 + CMake + Visual Studio rules now

Thanks to Bill from Kitware Inc., who responded my previous post in a very timely manner and helped me solve the compilation issues as well as the execution error.  CMake and Visual Studio 2008 are now back in the triangle.

The compilation problem lies the source code of the Qt demo. Two other classes were declared in two of the class definition .cpp files so that either moc’ing the sources or moc’ing the headers will leave some of Q_OBJECT classes un-moc’ed, which causes the linking errors. On the other hand, qmake handles this implicitly so the project file it generates doesn’t have this problem. After moving those declarations to the header files, everything compiled nicely and quietly.

As for the debug execution problem, Bill also suggested that the commercial evaluation version of Qt 4 binary I downloaded might be built with VS 2005. If that is the case, there is no way I can execute in debug mode the program linked against the Qt 4 libraries. I was just being so naive to make the assumption that the binaries should be of no difference if QMAKESPEC is the same.

After downloading and compiling the source of Qt 4.4 beta (boy, that compilation DID take QUITE a while), everything went back to normal. I am now happily “CMaking” my projects again.

Qt 4.3.4 + CMake + Visual Studio 2008 doesn’t work

Hoping to create a nice GUI for the project I am currently working on, I downloaded the commercial version of Qt 4.3.4. It installed fine, with the option of integrating with Visual Studio disabled since the integration with VS 2008 is not officially supported yet. Trolltech has already announced to support this in the upcoming version of 4.4, though.

The demo that comes with the package looks really appealing, just like how I like it: simple, themed design and fluent animated transition, which together provide the user with maximum visual satisfaction.

Trolltech is generous enough to have included all the source code of the demo so that we can play around and figure out how to mimic those fancy effects. At first I planned to use CMake to generate the project file (.sln file in the case of Visual Studio) for the demo, in accordance with all other projects that I am working on. There are also examples of CMakeLists.txt for Qt 4 projects (here is one). Despite it seemed that everything should be easily done without any hustle, it soon turned out not to be the case this time.

First, the solution file generated by CMake just won’t compile (unless it’s a single main.cpp, in which case I got it to work) if there are other Q_OBJECT classes present. I tried both QT4_AUTOMOC and QT4_WRAP_CPP, all ended up with “error LNK2019: unresolved external symbol“:

SET(SRCS src/main.cpp src/mainwindow.cpp)
SET(HDRS include/mainwindow.h)

and either




Correct me if I am doing anything wrong above. After googling a bit I figured that something is wrong with the moc’ing process, but I haven’t yet found a solution. Thus I am taking CMake out of the equation temporarily.

A nice thing about qmake that comes with the Qt package is that just like CMake it can generate project files for different platforms, with an equivalent of CMakeLists.txt, file. With the command

qmake -tp vc -spec win32-msvc2005

one can easily get the project file (.vcproj/.sln) for Visual Studio 2005 to use. The project compiled under VS 2008 without any error, but when running under debug mode I get either “This application has failed to start because the application configuration is incorrect” if the solution file is generated by qmake or “The application failed to initialize properly (0xc0150002)” if it is created by CMake (remember I had one single main.cpp compiled). However, the release builds executed correctly.

Again I googled for a while and found out the problem might lie in the manifest files of the Qt core dll’s. Since the QMAKESPEC is set to win32-msvc2005, the manifest files of the dll’s have VS 2005 info (Microsoft.VC80.DebugCRT) embedded. When the program compiled with VS 2008 (VC90) and linked against those dll’s tries execute, there’s a conflict in configuration. Unfortunately, none of the solutions I found worked.

Now it is quite clear that for now I cannot (at least easily) debug the Qt4 programs in VS 2008. VS 2005, on the other hand, is working as advertised both in debug and release mode. Guess I would have to stick with VS 2005 for a while before Qt 4.4 is released.

An alternative plan would be trying out the 4.4 beta to see if it is a solution, while using qmake to generate the Makefile, from which to see how the CMakeLists.txt should be written.