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.

Google Treasure Hunt: Last problem

The last and fourth problem from Google Treasure Hunt deals with consecutive prime numbers. Its basic form is:

Find the smallest number that can be expressed as
the sum of m consecutive prime numbers,
the sum of n consecutive prime numbers,
the sum of o consecutive prime numbers,
the sum of p consecutive prime numbers,
and is itself a prime number.

For example, 41 is the smallest prime number that can be expressed as
the sum of 3 consecutive primes (11 + 13 + 17 = 41) and
the sum of 6 consecutive primes (2 + 3 + 5 + 7 + 11 + 13 = 41).

In the case of m, n, o, and p, there are four conditions, although there can be more. The example of 41 has only two conditions, for instance.

Again, my solution was written in Python and is designed to scale to a variable amount of conditions, as seen in the primes.py I wrote:

Google Treasure Hunt 2008

Google Treasure Hunt seems to be fairly interesting. There are three puzzles released so far; a fourth one will ensue at 1212448500 (that's new Date(1212448500 * 1000) for you JavaScripters). The first two are dubbed "robot" and "zip" by Google, the former sponsored by the Sydney office, the latter sponsored by the Mountain View headquarters. The latest one, which I call "route" (there is no official name for it yet officially named "network"), is sponsored by the San Francisco office.

A Better main.py for Python-Cocoa Apps

Although Apple describes both Python and Ruby as "first-class citizens" under a Leopard development environment, I feel that Apple meant it more programmatically than documentationally. Sure, both PyObjC and RubyCocoa are mature bridges, but both lack documentation from Apple (you have to rely on the community for gotchas) and RubyCocoa seems to receive more attention than PyObjC when it comes to tutorials for starters.

Moreover, the starting templates for Cocoa-Python apps and Cocoa-Ruby apps are not created equal. For example, while Apple encourages the scripts to be put into Resources, only a Cocoa-Ruby bootstrap file generated by Xcode (called main.rb) would automatically require them. A Cocoa-Python bootstrap file generated by Xcode (called main.py) would not import them, and this problem would manifest itself when you first attempt to do bindings in Interface Builder.

First, observe a generated main.rb:

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 org.mozilla.javascript.tools.shell.Main, 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.

Snippet: Font Detection with Prototype

This is essentially a clean house implementation of the font detection method described at lalit dot lab using Prototype 1.6. Another method described at maratz.com seems very interesting, since it uses Flash.

This is only usable after the DOM is ready. Call Font.detect with a string containing the name of the font to be detected. If it's detected as present, true is returned, otherwise, false.

Firefox 3, Now With Array Inconsistency

Alex Russell has pointed out that Firefox 3 has some quirky issues with JavaScript arrays, namely, an array made from a literal has a different constructor than an array made from instantiating the global array object. Long story short, the below is true:

[].constructor != new Array().constructor

Update

It seems like this is a Firebug-specific issue. If you try to evaluate the above in Error Console, you'll get false.

Kenpachi's Zanpakutō

If you don't read or watch Bleach, this post will seem like nonsense to you. Otherwise, read on.

DROP Continues GHOP's Beat

After the Google Highly Open Participation (GHOP) contest ended, we've got a huge influx of new contributors in Drupal. The positive influence the GHOP brought was truly amazing. To keep the beat rolling, DROP was created. Standing for Drupal Really Open Participation, we continue the goodness of a task-based system and pancakes.

This is a really brilliant idea. It serves as an incentive for regular contributors. It interests new contributors. It gives recognition. These are all successful traits of GHOP that DROP wishes to carry on. I've personally already claimed one task and plan to work on more once I have the first one cleared.

So what can you do to help? Read on.

Object Destructuring Shorthand: New in Firefox 3 Beta 3

One of the changes in Firefox 3 Beta 3, which has just been released, brings the object destructuring shorthand to JavaScript 1.8. Why would you need object destructuring in the first place? Commonly when you need to pull certain values out of an object structure, as demonstrated here. The introduced shorthand sprinkles a bit more of syntactic sugar into object destructuring assignments. Read on for concrete examples.

Syndicate content