Main

December 04, 2006

How to code anything in JavaScript

This began as a post for the JAG internal wiki. But I wound up looking up a lot of good links, so I thought I'd mirror the post here in order to keep those links handy.

When I want to implement a requirement, such as a business rule or DHTML behavior in JavaScript, sometimes I find that I don't know how to implement that behavior. Sometimes this might be because the requirement is complex, as in the case of DHTML animation. Or the algorithm I am searching for may just be obscure, such as a unique ID generator that uses a closure instead of a global counter.

When I do not immediately know how to implement a requirement, I usually need that information in a hurry. I do not have time to make extensive flow charts, or to research the deep features of JavaScript. What I want is to find someone else who has already implemented something ''similar'' to the requirement. And I want to see their source code.

Continue reading "How to code anything in JavaScript" »

November 01, 2006

BlogLines inside NetVibes

I've been using NetVibes for a while. But I just discovered the Web Page Module. And that has greatly increased NetVibes' usefulness to me.

First, there are several visualizations (newsmap, delicious map, delicious LiveMarks and digg spy ) which cannot be replaced by an RSS feed. Web Page Module allows me to view each of these interfaces from within Netvibes, each in its own tab. NewsMap is so flexible that it fits into one column of a 3-column layout.

Netvibes is a smooth interface for reading 10 or 20 important feeds. Beyond that, I either have to scroll deeper than I'd like, or I have to start breaking up my feeds into tabs; and then I have to go back to BlogLines. Reading a bunch of little boxes spread across many tabs, does not appeal to me. I cannot make a good case for just why that is, however.

In any case, tonight I realized that the Web Page Module means that I can put BlogLines inside Netvibes. So now I truly do have all my feed-reading on one page.

September 11, 2006

Neat little example of a useful JavaScript closure

I just picked up the 5th edition of David Flanagan's JavaScript, the Definitive Guide. I find it amusing that that book is the only JavaScript book officially recommended at comp.lang.javascript.

Continue reading "Neat little example of a useful JavaScript closure" »

September 08, 2006

The Simplest Example of Recursion in JavaScript

Here is the simplest example of recursion that I can think of:

(function (arr, count) { 
  alert[count]; 
  if(count < (arr.length -1)) {arguments.callee (arr, ++count)}
})(['This','is','trivial!'], 0);

Why is this important?

Continue reading "The Simplest Example of Recursion in JavaScript" »

May 26, 2006

Prototype.js cheat sheet set

These are a visual and a hypertext cheat sheet for the Prototype.js library. Prototype.js is the foundation of Script.aculo.us and Rico, among others.

http://www.snook.ca/archives/prototype1280.png
http://www.sergiopereira.com/articles/prototype.js.html

More on what to do with Prototype.js after the jump.

Continue reading "Prototype.js cheat sheet set" »

April 19, 2006

Big Web Application weekend

This week I put together the largest JavaScript application I have attempted so far. It was a lot of fun to learn all the new Web 2.0 techniques. I got to try out script.aculo.us, Rico and prototype.js. Most importantly I learned how to generate HTML using JavaScript's ability to manipulate the DOM tree. I can see a day ahead where I don't type any tags at all, except for maybe HEAD, SCRIPT and BODY. :)

I also designed a UI from the ground up for the first time. Nothing complicated, aespecially lthough I did create some 3d buttons, which was fun. I know a lot more about Photoshop than I thought, when I have a good tutorial in front of me.

One thing I didn't have time to do, that would have really helped, is to learn the command set for the Selenium client-side testing suite. Although it was very easy to install, I haven't figured out how to check rollovers with it, so it wasn't very useful.

4.22 Rollover testing AFAIK* only works in MSIE, which is why I was having so much trouble. In fact I think I had a test that would have run, had I tried it on MSIE instead of Firefox. Yet another example of why it's important to always test in multiple browsers.

*I read this fact on a forum whose url I can no longer remember. It is, in fact the case, as I have tested it several times (MSIE 6 vs. FF 1.5.0.1 on XP SP 2).