Archive for October, 2005

sIFR 3: A Request for Requests

posted October 28th, 2005, no comments, tagged

As The Seattle Lion pointed out, we’re taking suggestions for sIFR 3. Head over to the request page and let us know what you’d like to see!

Astronaut Suits on the BBC

posted October 28th, 2005, no comments, tagged ,

Last week at BarCamp Paul Mason from Newsnight made a special about Flock. Last night it was broadcasted. I took some pictures, which can be found on Flickr.

Normally a stream would be available for 24 hours after broadcast, but not this time!

Unfortunately, we cannot make the Thursday, 27 October edition of Newsnight available online because of copyright problems.

Crap, I wanted to rip the stream, so now I have no recording. I’m afraid the pictures will have to do…

There’s an article up, too.

No-Tech

posted October 25th, 2005, no comments, tagged ,

In this tech-infested world, the question really is how to balance the tech. Are you better of with less tech?

When I made the presentation for BarCamp, I didn’t make it in S5 but in Keynote. S5 makes you write in HTML, makes you think in two different levels: the markup and the presentation. And you can’t see those at the same time — constantly switching the presentation of your content hurts the way you think.

I didn’t write this post in HTML. I use Markdown: plain text with some syntatic sugar to extract semantics. But the only sugar I’ve used this far is grouping the text in paragraphs (and adding two links after the fact).

When I want to code something I turn on some music, stand up and walk to a whiteboard. Pick up a pen and start sketching stuff. Pause, walk around a bit, drink some water, and improve things. Get your mind in a flow state, design the app. Then, start coding. Throw away parts you don’t need. Get up again if you get stuck, rethink.

Would OmniGraffle work here? Although, to be honest, I haven’t tried, I don’t think it would. It’d be sitting at my desk, typing away and connecting dots on the screen. Quickly drawning some physical lines is easier than doing it in the virtual world. And since these wireframes won’t reflect the actual code, does it matter in what medium I make them? If necessary I can always redo them in the virtual space later.

At uni, we had to make UML charts for Java code with Together. Aside from annoying the crap out of me, because seriously, that app is confusing, did it really make me code better? Not really, since I thought of the abstractions in my head, then put them into Together, and then wrote the code. Sketching on a real whiteboard would’ve been faster.

No-tech is important, don’t let all the shiny tech blind you from that.

Unconference Thougths

posted October 23rd, 2005, 4 comments, tagged ,

BarCamp rocked. Thirty-two hours (and then some) of hanging out with cool people talking and learning and hacking. It’s quite amazing how you can set up an unconference in a months time and have it all working out really well.

I was planning to write a really long post about how cool and great BarCamp is, but you really have to see it to believe it. So, if you can make it to one of the camps, just go there and enjoy.

Photos on Flickr: BarCamp Amsterdam. Slides and links from my (admittedly short) presentation on JavaScript bugs are also available.

BarCamp Amsterdam…

posted October 20th, 2005, no comments, tagged ,

… is really cool. Great people here, even Bobby dropped by for an hour of six. More later :)

Experiment: Function.$case

posted October 19th, 2005, one comment, tagged ,

One of the few things I like about Java is how methods are identified not by their identifier (language collision here, it’d seem) but by their signature. In code:

public static void foo (String bar) {
  // do things
}

public static void foo (String[] bar) {
  // do things
}

These foo() methods are different in that they accept different types of parameters. In dynamic languages this is not possible, but of course you aren’t limited to one type of parameter.

And yet, I was wondering if there was an elegant way to implement someting comparable in JavaScript. Let’s take the following code, and try to make it more elegant:

function say (value) {
   value = value || "";

   if (typeof (value) != "string") {
      if (value.constructor == Array)
         value = value.join("\n");
      else {
         var result = "";
         for(var prop in value)
            result += prop + ": " + value[prop] + "\n";
         return result;
      }
   }

   alert(value);
}

Hmm, some conditions and specific code in their bodies. It’d almost look like a switch statement, but in JavaScript you can only compare values, not use your own conditions. However, Ruby has a switch mechanism which lets you evaluate conditions:

case
when 1 + 1 == 2
  puts "1 + 1 is indeed  2"
when 1 * 1 == 1
  puts "1 * 1 is indeed 1"
else
  puts "Somebody must have disproved mathematics"
end

Quite elegant. Let’s consider this example:

function say (value) {
   value = value || "";

   alert (Function.$case (
      typeof value == "string", // when
         value, // expression

      value.constructor == Array, // when
         function () { // expression
            return value.join("\n");
         },

      function () { // else
         var result = "";
         for(var prop in value)
            result += prop + ": " + value[prop] + "\n";
         return result;
      }
   ));
}

The even attributes (counting from 0) are the conditions. The odd attributes are the expressions, and the last even attribute is the “or else” expression.

I’d say this is (in theory) more elegant, but it looks confusing and requires more code — sounds a bit like Java, actually. And this is what Function.$case() looks like:

Function.$case = function () {
   var condition;
   for (var i = 0, expr = null; i < arguments.length; i+=2, expr = null) {
      condition = arguments[i];
      if (i == arguments.length - 1)
         expr = condition;
      else if (condition === true)
         expr = arguments[i + 1];
      else if (typeof (condition) == "function" && condition () === true)
         expr = arguments[i + 1];

      if (typeof (expr) == "function")
         return expr ();
      else if (expr != null) // To obviate the need for superfluous functions, you can also use a value instead of a function
         return expr;
   }
}

More Site Updates

posted October 14th, 2005, 7 comments

After some hard work (cough) I’ve updated the following:

  • Valid Atom feeds, even for comments
  • Feed to get the 20 most recent comments
  • Comments form without tables
  • and better hints
  • Highlighted the comment posted notification
  • Ensured no XHTML escapes the system. HTML rocks
  • Fixed Last-Modified on comment feeds
  • Full content feeds (with summary)

TextPattern rocks.

Rip

posted October 14th, 2005, one comment, tagged ,

You know those pesky “Copy-Protected” CDs? Unfortunately I’ve got a few of them (found out too late) and they were a pain to rip on the Windows box. Sometimes they’d crash iTunes (or other ripping software), and if it worked, well, they had some small gaps in them.

Not anymore. I have no idea whether it’s iTunes 6, or Tiger, but I can now rip right through them with perfect quality. (Not perfect as in lossless, but perfect as in 160 kbps VBR AAC.) On one disc it even found a bonus track, which I missed out on when I ripped it on Windows.

Also nice is how Tiger shows two discs if the CD contains a data part and an audio part. Perhaps that’s why ripping works so well?

BarCamp Amsterdam

posted October 12th, 2005, 2 comments, tagged ,

Next week I’ll be in Amsterdam for BarCampAmsterdam. Two days of hanging out, hacking, and other cool, interesting stuff. Rock.

I’m thinking of giving a presentation on working with JavaScript in this cross-browser world. If you have ideas, let me know.

Shiny

posted October 11th, 2005, 10 comments

Look! All new, all shiny! Running on a somewhat hacked version of TextPattern, valid HTML 4.0.1 Strict and Atom 1.0. Now with comments. And article-level feeds. Yay!

This site is not guaranteed to work in browsers originating from Redmond. Batteries not included (but stolen from smoke alarms).