« August 2006 | Main | October 2006 »

September 30, 2006

links for 2006-09-30

September 29, 2006

links for 2006-09-29

September 28, 2006

links for 2006-09-28

September 27, 2006

links for 2006-09-27

September 26, 2006

links for 2006-09-26

September 23, 2006

links for 2006-09-23

September 22, 2006

links for 2006-09-22

September 21, 2006

links for 2006-09-21

September 20, 2006

How to run a command and save the output, in Perl

Assuming we are in a directory that contains a file called

myfile.

>perl -e "open(FOO,'cat myfile |')|| die 'cat failed'; while (){ print }"

Now I can treat FOO just like I would any other filehandle.

links for 2006-09-20

September 19, 2006

links for 2006-09-19

September 16, 2006

links for 2006-09-16

September 15, 2006

links for 2006-09-15

September 14, 2006

links for 2006-09-14

September 12, 2006

links for 2006-09-12

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.

Closures are a powerful feature of JavaScript. However it's often hard to explain in a few words, just what is useful about closures. Well, here on page 131 of the Rhino book, is the recipe for a unique ID generator that doesn't require a global counter.

One thing that I personally enjoy about the Flanagan book is that he says things like "don't pollute the global namespace." :) This technique does not pollute the global namespace.

var uid = (
  function(){
    var id=0; 
    return function(){
      return id++ ;
    };
  } 
)();
//then just say:
alert(uid());

September 10, 2006

links for 2006-09-10

September 09, 2006

links for 2006-09-09

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?

This example might become important if I were hiring someone to work with me, and I wanted to establish quickly that they had an intermediate skill level in JavaScript. While the example is quite trivial technically, it is quite incomprehensible to the typical "Web" designer.

Of course, I would like to hire someone who is a little of both (designer and engineer), so I would also ask questions like:

  • What are two colors that are complementary?
  • What is an Icon?
  • What is the difference between an icon and some other type of graphic, say a photograph?

Again, I think these questions are trivial for a designer to answer, but much harder for "server-side" programmers.

links for 2006-09-08

September 07, 2006

links for 2006-09-07

September 06, 2006

links for 2006-09-06

September 02, 2006

links for 2006-09-02

September 01, 2006

links for 2006-09-01