Archive for February, 2006

Tammy tops Technorati

Friday, February 24th, 2006

Tammy and the onslaught of video searchers top Technorai’s search. Everyone is looking for the Tammy Nyp video. It’s amazing how the blog world has become the outlet for immediate media. Seems if folks could find those download links they’d be happy. Good luck Tammy Searchers.

Top Searches:

1. Tammy
2. Nyp Tammy
3. Tammy Download
4. “Ted Koppel”
5. Nyp
6. Youtube
7. Singapore
8. “War Of The World…”
9. “Will Fight For O…”
10. Iraq
11. “American Idol”
12. Tammynyp
13. “Taylor Hicks”
14. Ipod
15. Singapore Girl

Tammy Video Download Links

Friday, February 24th, 2006

Tammy Nyp Video. Tammy Download Links Poor girl lost her cell phone, and seems to have a hot video on it. Lots of folks are talking about it. Technorati is getting searched like no tomorrow. Ok so this has nothing to do with Javascript, Firefox, Venkman, Web 2.0, or any of the other topics I normally talk about. It’s just a cheap way to get some traffic.

Here’s some more links if your interested.

From that fateful incident, post after post after post after post after post after post after post after post after post after post after post after post after post after post after post after post has been written by bloggers in the region to have a say on it.

I pity her for having this much exposure even after the video got mass-circulated through e-mail. Of all the videos and unspeakable things found in Singaporean students’ phones, it was Tammy’s that made the news, a most unfortunate event. Yes, there are others. Maybe this is what you get for doing wrongful (arbitrary) things: having pre-marital sex, videotaping it, and be careless enough to let the video get stolen. People should be more careful nowadays.

This is just another example of how far the media has progressed in terms of technological advancements as a boone of human interaction and knowledge. This is reffered to the Web 2.0, where ordinary people can have a say about things of all shapes and sizes. This is my take on the entire debacle, expressed through a blog, an act not possible just a few years ago. The internet is growing ever so gracefully.

Firefox Array.toString() is very slow

Thursday, February 23rd, 2006

Ran into an interesting problem with JavaScript’s Array.toString() in Firefox.  It’s extremely slow even for a very small array.  Take an array with a single object and you’d like to call toString() to get the type of the contained object.  There are better approaches but for simple uses this might be applied.  In this case toString() of the underlying object simple returns the object’s name.  This is a very common use of toString() on custom objects. In Firefox calling toString() on the Array is nearly ten times slower than calling toString() on the object itself.  In Internet Explorer it’s about three times slower.  Needless to say be very careful with JavaScript’s Array.toString(), as it’s not a transparent call into the underlying objects performance wise.

Internet Explorer 6
anArray.toString() - 1829
anObect.toString() - 625

Firefox 1.5.0.1
anArray.toString() - 3093
anObect.toString() - 375

The full test script is posted below.


var anArray = [];
var anObject = {};
anObject.toString = function() {return “anObject”;};
anArray.push(anObject);

var startTime,endTime,i;
var repeat = 250000;

startTime=new Date().getTime();
for(i = 0; i < repeat; i++) {
anArray.toString();
}
endTime=new Date().getTime();
var arrayToStringResult = endTime - startTime;

startTime=new Date().getTime();
for(i = 0; i < repeat; i++) {
anObject.toString();
}
endTime=new Date().getTime();
var objectToStringResult = endTime - startTime;

document.write("anArray.toString() - " + arrayToStringResult);
document.write("<br/>");
document.write("anObect.toString() - " + objectToStringResult);

AJAX Auto Complete

Monday, February 20th, 2006

Few sites these days are using AJAX Auto Complete to help users filter known choices or reduce typing.  As more AJAX libraries are released this practice should appear more frequently. Autocomplete generally comes in two flavors; Local Auto Complete and remote or server based auto complete.  Local auto complete loads all the data locally into memory and then parses/pages through the data entirely in JavaScript.  Server based auto complete like Google Suggest send async queries to a server as the user types.  Local autocomplete works well when the entire data set is small enough to process at once think hundred’s or thousand’s or items.  Ten’s of thousands may be possible depending on how complex the data and what type of matching is used.  Prefix matching requires less processing that a full search for prefix, sufix, and contains matches.  The Yahoo UI Team has posted a design pattern on Auto Complete and plan to release code as part of their UI Library. script.aculo.us includes support for both Local and Server autocomplete.  They have a few demos posted that you can try yourself.

UPDATE: A couple demo’s of my own:

YubNub Suggest
Dojo Autocomplete

YubNub Suggest

Monday, February 20th, 2006

YubNub has been around for sometime. I went looking for a Suggest version that would autocomplete common commands. I did a few searches and all I came up with was DashNub which is an OSX Widget.  Using script.aculo.us’s autocomplete code and the XML feed for the YubNub Golden Eggs. My YubNub example now has basic autocomplete.  Any YubNub command can be used but autocomplete only works for the 400-500 Golden Eggs.

YubNub Suggest

Note:
 - It’s only been tested in Firefox 1.5.01

TODO:
 - Test in other browsers
 - Add descriptions to each command
 - Allow selecting with arrow keys