Thursday, January 25, 2007

Dojo API documentation site frustration

I head out to Dojo API site to check some stuff. It look way so long to load the main page (> 3 minutes). There are more than 50 objects (I stop counting... should be close to 80-90 objects) that is loaded. I already frustrated to be stuck in some Dojo stuff and now I have to wait for so long to look at their API documentation. Not to mention that it is still not completed yet.



With so many different javascript framework out there, Dojo really have to buck up here. A good example is YUI. It have comprehensive documentation. The documentation is also available in the download so you can refer to it locally.

Saturday, January 20, 2007

Florathon, Malaysia Flora Fest 2007

Florathon 2007Florathon 2007

Have you ever seen flowers run? Florathon is a brisk 3-km walk and participants will be judged not by speed but by floral-themed costumes. This is a fun-filled beautiful and colourful event in conjunction to Malaysia Flora Fest 2007. There is a waiter race and children cooking too. Check out the photos here.

Visit Malaysia 2007

Friday, January 19, 2007

Time your javascript

In web application Javascript performance is important for web application. This is especially with Web 2.0 where javascript usage is increasing. I just found out a good feature in Firebug to measure the performance of your scripts. For those who didn't know, there is a profiling feature in Firebug. I admit I just found out after reading the article AJAX Debugging with Firebug. Jump right into using Firebug without reading what's new there. How could I have miss that feature?

It is really a great tool to time your script. You will get a sample result as below.


Firebug includes a JavaScript profiler that gives you detailed reports on the performance of every function called during a given period. You can start it directly in the toolbar of the Firebug Console tab. The other way is to start it in your code

console.profile();
yourFunctions();
console.profileEnd("Loading function");


This is definitely a tool that will help out Web Developer a lot.

Tuesday, January 16, 2007

Using List in Simple Form Validation

In LotusScript, List is a very useful collection data type. I've spoken to quite a few developer and not many of them is taking advantage of List data type. Below is a simple validation example using List.

First example, is a typical simple validation I found in a form
Function ValidateSubmit As Boolean
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument

If uidoc.FieldGetText("FirstName") = "" Then
Msgbox "Please enter your first name"
ValidateSubmit = False
Exit Function
Elseif uidoc.FieldGetText("LastName") = "" Then
Msgbox "Please enter your last name"
ValidateSubmit = False
Exit Function
Elseif uidoc.FieldGetText("Gender") = "" Then
Msgbox "Please select your gender"
ValidateSubmit = False
Exit Function
'........ other validation
End If
ValidateSubmit = True
End Function
Second example, fields and messages stored in a List for validation
Function ValidateSubmit As Boolean
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument

Dim fieldList List As String
fieldList("FirstName") = "Please enter your first name"
fieldList("LastName") = "Please enter your last name"
fieldList("Gender") = "Please select your gender"
'...fieldList("OtherFields") = "return message"

Forall f In fieldList
If uidoc.FieldGetText(Listtag(f)) = "" Then
Msgbox f
ValidateSubmit = False
Exit Function
End If
End Forall
ValidateSubmit = True
End Function
As the number of fields to be validated grows, maintaining the List in the second example is much simple than the first example. This is just a very simple example to showcase the use of List. You can even store objects in the List. Try using List if you haven't done so.

Debugging Dojo using Firebug and Greasemonkey

Debugging in Dojo is easier than ever. Shane O’Sullivan posted a great script using Greasemonkey to log the debug using Firebug.

From his blog:

The solution is to use a Greasemonkey script to enable Dojo/Firebug debugging on any page you visit, or only for pages in a given list of domains. The steps to use this script are as follows:
  1. Install Greasemonkey from http://greasemonkey.mozdev.org/
  2. Install Firebug from http://www.getfirebug.com
  3. Open the file http://www.skynet.ie/~sos/misc/dojo_debug_enable.user.js in Firefox. Greasemonkey should prompt you to install it.
That should be all that’s necessary.

You can always enable or disable the script directly in Greasemonkey.

Monday, January 08, 2007

Five Things You May Not Have Known About Me

I was tagged by Chris Blatnick and Mac Guidera.

1) Start of with my name (surname) - Beh. It means Horse. It is pronounce in Teochew (Chinese dialect). I don't speak much in Teochew, but will try to practise a much as possible with my grandparents. I normally use Cantonese (another Chinese dialect) with my parents and sisters.

2) I love photography. I pickup a digital SLR end of last year. Been learning a lot about photography. Getting a good picture is not as easy as it looks. Getting the right exposure, composition, etc is important. But.. some things can be corrected in Photoshop :) I like taking portrait pictures. You can check out some selected photos here.

3) I love to travel as well. Currently I can only afford to travel around Asia. For personal holiday I've been to Singapore, Thailand, Cambodia, Bali (Indonesia), China, Taiwan. For work, Bangkok, Shanghai, Taipei and Furth (Germany - only Europe country I've been). Malaysia currency is not strong so to travelling to Europe or US is out of my reach at the moment. While I'm still dealling in Lotus Notes, anyone willing to sponsor me a trip to LotusSphere, US :) Hehe... just trying out my luck. I've only work in Malaysia only (excluding business travel). If given a chance, still finding opportunity to work in Europe / US. I would like to learn about the working culture in different place.

4) I love rollerblading. I used to rollerblade a lot during my university years. I like roller hockey, but not good in it. I've even tried playing tennis on my blades. During those time, normally I would go for leasure blading after midnight around the campus. Now, my blade is broken :(

5) I'm born in Melaka. Melaka history dating back to the 15th Century, when it was a vital world trading port to Asia country. This year is Visit Malaysia 2007. Take this chance to visit Malaysia and not forgetting the beautiful Melaka city.

To get to know me better, drop me a line at willbeh at gmail.com . Drop me a line if you are coming to Malaysia. I will try to bring you around if I'm free.

I now tag Damien Katz, Mikkel and Radu Cadariu

Sunday, January 07, 2007

Visit Malaysia 2007


Eye On Malaysia
Originally uploaded by William Beh.

Visit Malaysia 2007 was launch yesterday together with the opening of "Eye On Malaysia" at the beautiful Taman Tasik Titiwangsa (Lake Titiwangsa Garden). People around the world should take the opportunity to visit Malaysia this year. Check out the Tourism Malaysia website.

Thursday, January 04, 2007

Quick Tips - dojo.dom

When extracting text from a DOM node (HTML or XML), different browser have different method to do it. In IE node.text() while Firefox node.textContent().

Dojo provide a simple way to extract the text content.
dojo.dom.textContent(node)

So far I've tested it on IE and Firefox and it is working fine. I do not need to check for the browser myself. Try it out.