Sunday 28 September 2008

Hancock: Good job!

Last week's experience remindes me of scenes from the movie Hancock.

The marketing guy Ray tought Hancock how to behave in front of the crowd - here are the dialogues from the scene.

Ray Embrey: So you've used the door, the building's still intact, people are happy you've arrived, they feel safe now, there's an officer there and he's done a good job, so you might want to tell him he's done a good job.
Hancock: What the hell did I have to come for Ray if he's done a good job?

So later when Hancock when to the crime scene after the police failed to contain the situation, he repeatedly said 'Good job!' to everyone, including the policewoman who was injured and pinned down by enemy fire.

Hancock: [to pinned-down cop] Good job! Do I have permission to touch your body?
Female Cop: Yes!
Hancock: It's not sexual. Not that you're not an attractive woman. You're actually a very attractive woman and...
Female Cop: [screaming] Get me the hell out of here!

Those were the my favorite scenes from the movie. Do the above scenes look familiar in your workplace?

Friday 26 September 2008

Why Not Chrome?

I installed and tried Google Chrome recently and my first impression of Chrome as a browser is quite average. As I said before, there is nothing revolutionary about Chrome at the surface. It's really the backend functionality that Google is betting on. For now, my biggest complaint about Chrome is that it installs in user's home directory rather than a shared directory so that all users can use (maybe there is or will be an option to install it in shared mode and I just don't know it).

At the moment, each browser has its niche market: IE is pre-installed on all Windows based machines including Windows Mobile; Firefox has a great plug-in framework so that its functionality and usability can be greatly extended beyond just being a browser; Opera has over 100 million installations on mobile phones; Safari is the browser of choice on Mac...

So far, my favourite browser is Firefox v3 mostly because of the plug-ins. As a blogger, the ScribeFire blogger plug-in for Firefox is a must-have. I use it to do my blogging rather than using the Blogger's own web pages (thanks to Blogger's APIs). Another plug-in I use is the Adblock Plus where you can selectively block advertisement contents by clicking on the 'block' tab that Adblock Plus inserted over them.

IE still remains the widely used browser and I still use it. I only use it because certain plug-ins (ActiveX) are only available on IE. The most popular plug-in is probably the Microsoft Outlook for IE since most companies these days use Outlook as their email solution.

Google is also taking this approach by integrating Chrome with other Google services so that Chrome will be the best browser when it comes to Google (and its partner) provided services. Therefore, I don't see any single browser replacing all others. It will be more of a case of using certain browser for certain use cases.

Related Posts: Why Google Chrome?

Monday 22 September 2008

Turn N95 Into A Ping-Pong Bat

As I was searching for some games for my N95, I stumbled upon the Accelerometer support for N95. If you have seen the iPhone ads on TV, you may have been impressed by the feature of the applications changing their display orientation after the iPhone has been rotated. I must say I was very impressed after playing with my friend's iPhone. Little did I know that my N95 also has the capability to do this. It's just that Nokia did not put any application on it to utilise the accelerometer.

There are a couple of applications developed by Nokia Research center which take advantage of the accelorometer - Moving Ball and Activity Monitor, both available from the Nokia Research Center web site.

I have downloaded and tried the Moving Ball demo. It was great! As I move/rotate my handset in any direction, the ball moves or bounces following my motion. If I hold the phone like a ping-pong ball bat and swing it, the ball displayed on screen actually bounce up and down against the 'bat'.

According to these videos, the French developer Samir has made some cool applications using this technology - RotateMe and Nokmote. I particularly like Nokemote where it allows the user to control the application by moving the handset without having to press any buttons/keys - e.g. in the music player, tilt left to rewind, tilt right to fast-forward, bounce it down and up to select song, etc. Unfortunately, the author's web site is down.

Nokmote Caricato da soueldi

There are others of course: There is a dedicated forum on N95Users suggesting all sorts of cool uses with videos to show; NiiMe is too shaky to be practical; FlipSilent and ShakeSMS are pretty good, but I am not sure if they drain the battery; Landscape Pro, but it's not free; Alas, all I can do with a great piece of technology is to use it as a ping-pong ball bat!

Related Posts: How To Add Unicode Fonts to N95

Friday 19 September 2008

The Shortest Self-Printing Code

#!/bin/ksh
cat `whence $0`

Could this be the shortest self-printing code?

Saturday 13 September 2008

Of Tatami, jMaki and Others...

Tatami 1.2 Beta was released a few days ago.

Both GWT and Dojo are Javascript frameworks for creating Rich Internet Applications (RIA). The GWT team focuses on the foundation of the framework and does not bother with making state-of-the-art cool widgets. While Dojo has a mature and good-looking widgets library. Wouldn't it be good if the two can be seamlessly integrated at the API and runtime levels so that one can leverage on the advantages of both frameworks? That's exactly what Tatami offers.

Tatami is a widget/component library for GWT. What makes it interesting is that it is a GWT wrapper of Dojo components. With Tatami, the Dojo widgets become GWT widgets; the Dojo utilities become GWT helper classes. If you don't have the stomach for editing CSS+XHTML+Javascript directly, but still want to use the Dojo components, then Tatami is good news. The development experience is back to Java and that's it.

Another web framework which provides Dojo wrapper is the jMaki framework. While jMaki has a nifty NetBeans plug-in, the development experience is improved somewhat. However, as a developer, you'd still have to deal with a mixture of JSP, Javascript and Java: the page templates are written in JSP, the glue code is written in Javascript for event handlers (using a pub-sub mechanism), the server side code is written as Java servlets - maybe this hodge-podge is really what they mean by mash-up.

Another wrapper is the GWT-EXT, which is a GWT wrapper for EXT/JS. I have blogged about the EXT/JS, EXT-GWT and GWT-EXT and the licensing issues revolving EXT/JS previously. Well, the licensing of Dojo is very liberal, without the GPL issues introduced by EXT/JS. Thankfully, Tatami is LGPL.

Tuesday 9 September 2008

How To Add Unicode Fonts to Symbian

[Update 2009-02-17]: Fontrouter project has been open sourced. Some of the download URLs in this post may have been changed. See here for more details.

If you are like me, who got a Nokia N95 with only English but wants to view contents in other languages - e.g. Chinese, Japanese, Korean (CJK), Russian, Hindi, etc. then you will be in a bit of strife.

According to Nokia forum, there is no way that you can install an extra language package on Nokia. You'd have to go to Nokia Care to have them install it for you, for a fee! Well, from my previous encounters with Nokia Care (here in Sydney), they are bunch of slow, bureaucratic, idiotic waste of space. So that option is a no-no for me.

Fortunately, the Symbian guru oasisfeng has created a wonderful software called FontRouter. The latest incarnation of the software is the FontRouter LT. Because the software is in testing stage, there is no full documentation on how to install and use it. There are pieces of information everywhere in the forum and mostly in Chinese. It took me a day to figure out the end-to-end process of getting it to work on my N95. So I feel that I should record it down and share it. I believe it should work for all S60 v3, S80 and S90 Nokia phones.

Step 1 - Downloading the Software

There are many versions on the oasisfeng web site, the version that I used was the FontRouter LT for Symbian 9 Beta (Build 20071109) Open Signed Online测试版.

Also download the TrueType font from the same web site: 【TrueType】方正隶变 GBK字体. This contains all the CJK characters(should contain other european characters too). Note that I tried using other Chinese TrueType fonts and my handset failed to start. So experiment with other .ttf files only after you have successfully installed and tested with this one. I am currently using the 方正准圆(FZY3JW.TTF) which is a Chinese true type font and its English characters are very close to the original font on my Nokia N95.

Notice that all Nokia phones belong to a certain profile (to make it easy for software developers to select and test the target platform/handsets). The N95 is an S60 3rd edition phone and runs on Symbian version 9. You can find this out from the phone: Tools -> Utilities -> About. Also notice that the version of FontRouter that I used was "Open Signed Online". What does this mean? Read on...

Step 2 - Signing the Software

Symbian is pretty rigorous when it comes to security. Software needs to be digitally signed before installing onto the phone. You can try installing the .sis file just as it is and your phone will reject it and complain that the digital certificate/signature is invalid or something of that nature. To sign the file you just downloaded, you will have to go to www.symbiansigned.com. On its front page, there is a URL for Open Signed Online (Beta). Click this URL and fill in the form on the following page. Note:

  • The IMEI number uniquely identifies your handset (e.g. if your phone is stolen, you can report it to the carrier and they can bar the IMEI from the network so that the thief cannot use it). You can find it out by 'dialing' *#06#
  • Email - make sure you use a valid email address because you will need to retrieve email from Symbian to carry out the next steps.
  • The Application is the .sis file you just downloaded from FontRuter.

Upon successful submission of the form, Symbian will send you an email with a URL to confirm the submission. Click it.

Then Symbian will send you another email with a URL to download the signed version of the .sis file. Just click the URL and save the file.

Step 3 - Installation

Now you can install the signed version of the software that you just downloaded from Symbian using PC Suite. Make sure you install it on the Memory Card, NOT on the Phone Memory (otherwise, if it hangs your handset, you will not be able to bring your phone back to life). During installation, it will warn you that your phone is incompatible with the software, just ignore it and continue.

Then copy the fzlb_gbk.ttf file downloaded in Step 1 into the Memory Card's \data\Fonts directory. You will notice that the file FontRouter.ini has also been created in this directory by the software installation process.

Now it is time to modify the FontRouter.ini file. You can use the Windows Nodepad to edit a copy of the file and then copy it onto the handset using PC Suite. Modify the two lines of the .ini file as following:

FixFontMetrics=0
FixCharMetrics=0
changed the values from 0 to 1 like this:
FixFontMetrics=1
FixCharMetrics=1
and leave everything else the same. If you don't make the changes, the fonts will be curtailed either from the top or bottom.

That's it. Phew! Now it's time to test it - bounce the phone (i.e. switch it off then on).

Euphoria!

There are a few must-read guides that I highly recommend:

  1. Test Guide
  2. Font Location
Related posts: Turn N95 Into Ping-Pong Bat

Friday 5 September 2008

Why Google Chrome?

The release of Google Chrome beta is indead exciting news. Chrome is going to be bigger than iPhone! What makes it exciting is not the GUI - in fact, it looks and behaves pretty much just like any other browser. It is what's under the hood that make people (OK, developers) pumped about the new browser.

Google made it very clear on why they built a browser: "What we really needed was not just a browser, but also a modern platform for web pages and applications, and that's what we set out to build." So it is clear that Google intends to make Chrome to host and run next generation rich internet applications (RIA). Google's RIA platform is the Google Web Toolkit (GWT), which just had version 1.5 released a few days ago (Developer's Guide here). JavaFX folks are also excited about Chrome as shown in this article.

Google is a big proponent of Javascript. GWT 'compiles' Java code into Javascript and uses Javascript in runtime. A sophisticated GWT application can result in a large Javascript file, which poses a performance problem for the initial download of the application (a similar problem faced by Java Applets, which Java 6 Update 10 solves by allowing downloading relevant JARs only, without having to download the whole JRE libraries). Google Gears is another component that Google pushes to increase performance of Javascript applications. Yet, users have to download and install it separately if they want to take advantage of it. Therefore, it is natural for Google to come up with a browser as a unified platform for great support of Javascript. From Chrome web site, Google stated: "We also built V8, a more powerful JavaScript engine, to power the next generation of web applications that aren't even possible in today's browsers." Here we can see a glimpse of what to expect from Google on the Chrome, Gears and GWT fronts. GWT applications will run faster on Chrome than any other browser, thanks to Javascript optimisation on Chrome.

No wonder people are speculating that Microsoft is contemplating on suing Google for antitrust!

Related posts: Why Not Chrome?

Wednesday 3 September 2008

The Sorry State of ADO.NET Entity Framework 1.0

A few months ago I test-drove the ADO.NET Entity Framework 1.0 Beta 3. While I enjoyed certain aspects of EF, such as LINQ and graphical modelling, the overall experience of using EF hasn't been that great. In fact, my very first blog on this site was dedicated to EF bashing. My major complaint about EF was its intrusive approach to ORM - instead of using PONO (like in Hibernate), it generates bloated relational database-centric data entity models. This is against the domain driven design method. Another problem I encountered was its shoddy implementation of lazy loading (or lack of it, as a matter of fact).

I then realised that I was not alone in feeling disenchanted by EF. In the same month of my blog, several hundred people have signed up on the ADO.NET Entity Framework Vote of No-Confidence open letter, many of whom are from Microsoft's Most Valued Partners (MVP). In last month's issue of Visual Studio Magazine, the article A Vote for Transparency gave a blow-by-blow account of events on the controversy surrounding EF, including the aformentioned open letter. So Microsoft decided to make the EF version 2 design exercise a more transparent process. This no doubt is a step forward. However, it is too little too late for EF v1. Looks like EF v1 will not receive any significant improvements or address any of the communities concerns in the open letter. In fact, I doubt that any EF design improvements have been made into .NET Framework 3.5 SP1 (released in August 2008) since EF 1.0 Beta 3 (released in December 2007).

On a side note: although some people whine about JCP program being slow (e.g. the Java closure debate) and sometimes committee-driven, comparing to the traditional closed-door design pattern like EF v1, JCP is a great leap forward and the result speaks for itself. The JCP specifications are more readily accepted and adopted by the community than a proprietary one like EF.