warning: Creating default object from empty value in /home/kourge/ on line 34.

Cross-Domain Requests and Prototype

Ever since 3.5, cross-domain HTTP requests have been supported in Firefox. Getting this to work may seem easier and saner than piggy-backing Flash ("simply request a URL of different origin in your XMLHttpRequest!"), but unless you use jQuery, you'll realize that for some reason, cross-domain requests mysteriously fail in your JavaScript framework despite the fact that the server is correctly responding with an appropriate Access-Control-Allow-Origin header.

JavaScript Quiz and Explanations of its Answers

Update: Comments are now enabled.

In the field of linguistics, rules can be either descriptive or prescriptive. Simply put, descriptive rules tell you what can be done and prescriptive rules tell you what you shouldn't do. Many articles about JavaScript give you prescriptions: they tell you what you shouldn't do in JavaScript because it's bad practice. After learning to stay away from certain styles and patterns, though, sometimes a simple typo or brain fart can avalanche into a disaster in your code and still leave you puzzled even after attempting, descriptively, to explain what exactly happened.

kangax's JavaScript quiz, geared towards web developers, helps exactly that: finding descriptions that clarify perplexing situations. It does not test your knowledge of any DOM behavior and is focused on the ECMAScript language itself. Since this quiz targets web developers, SpiderMonkey gurus can likely even point to where a given quirk (the term is being used very loosely here) is manifested in the implementation. As always, please point out any possible error in the answer explanations about to follow. Those who are interested but still haven't taken it: halt! Go and take it. I'll wait. After that, read on.

Ubiquity commands for Drupal

Ubiquity is a dynamic command and quasi-natural language add-on for Firefox, recently released by Mozilla Labs. It sure is getting ever so popular, so I decided to write two Drupal-related Ubiquity commands in one shot: drupal and drupal-api.

Ubiquity Commands

I have written two Ubiquity commands so far. If you have Ubiquity installed, you should be prompted to install commands when reading this page.

Drupal tools

Drupal tools contains two commands, drupal and drupal-api.

drupal (node ID)

drupal opens the corresponding node on

drupal-api (function name) [on (drupal version)]

Firefox Summit 08: Blocker

As we can see, Mozillans all over the summit are affected by a top priority blocker. Literally.

With the rock slide, we Mozillans will no doubt find the already long two hour bus ride extended to an eight hour one. Certain sources say that this is the work of a company trying to wipe out as much Mozilla employees and contributers as possible in one clean swoop. I've heard that this certain company's name starts with an M and ends with a T, though there are still wild speculations about what entity is to blame.

On the bright side, we've got bears for company. Although particular people are quite afraid of bears, the general Mozillan reaction to bears is mixed.

History meme

It seems that a shell history meme is passing around the blogosphere. I first saw it on Dan Mills' blog post via Planet Mozilla. There are already 10 Mozilla hackers posting their top used shell commands, so I thought I'd do it too.

koeji:~ kourge$ uname -a
Darwin koeji.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar  4 21:17:34 PST 20
08; root:xnu-1228.4.31~1/RELEASE_I386 i386
koeji:~ kourge$ history | awk '{a[$2]++} END {for(i in a){print a[i] " " i}}' | 
sort -rn | head
88 ls
81 cd
28 cvs
26 rm
26 md5sum
23 ./firefox-bin
22 sudo
12 ssh
12 js
9 less

A few notes:

  • md5sum is actually md5 on Mac OS X. I aliased md5 so that I wouldn't suddenly have a hard time adapting should I start using a Linux system.
  • js is an alias of java -Xms256m -Xmx512m, which is the command to invoke the Rhino shell, which I sometimes use when I write shell scripts in JavaScript. Rhino is an awesome JavaScript implementation in Java.
  • You can see from the cvs count that I'm slacking off recently when it comes to maintaining Drupal modules.

So, fellow Drupalers / Drupalites, what are your most commonly used terminal commands? Beware of the line break before sort -rn when pasting the command into your terminal.

Playing DRM'd Songs in Songbird

Ben has written that Songbird 0.2.5 will be able to play DRM-protected tracks. To quote him:

The next version of Songbird (0.2.5) will support Apple FairPlay and Windows Media DRM audio playback. Those features are already enabled in the latest nightly build and everyone is encouraged to give those builds a spin. If you're on Windows you'll need to have a new-ish version of Windows Media Player (probably 9 or newer) for protected WMA playback and QuickTime for Windows (probably 7 or newer) for FairPlay to work. On OS X you'll only get FairPlay playback, sorry.
Running the DRM Guantlet |

Firefox 3: getElementsByClassName

John Resig (author of jQuery who recently joined Mozilla Corp) wrote about Firefox 3 will have native support for document.getElementsByClassName(). This is what almost all web developers want; almost all Ajax libraries implement this.

Better Feed Handling for Firefox 2

I just saw Ben's post about an experimental feature landing on the Firefox 2 nightly. Basically, Firefox 2 will have a better way to handle feeds.

Currently in Firefox 1.5, there are two ways.

ajaxWrite: No Better

After trying out ajaxWrite because of all the hype, my conclusion is: it's disappointing.
It's not compatible with Internet Explorer. It works only on Firefox 1.5. It's written in XUL.

Syndicate content