If you’re trying to install the lovely Firebug browser debugger, you’re probably finding that getfirebug.com is down. The team is moving to new hosting, but in the interim, there’s a supported build available at the official add-on site for Firefox.
On Referers
Yes, I know it’s spelled "referrer." However, the authors of the HTTP spec apparently did not; they spelled it without the second r.
A silly mistake? Sure, but consider this: how many bytes-on-the-wire have been saved by this little spelling mistake?
Do I have a point? Nope. I just think it’s cool.
Object cannot be created in this context, Code: 9 revisited
I did some more digging and finally figured out what we were doing to tickle this error in Firefox. Short story: passing a null to dojo.getComputedStyle(). In particular, we were making calls like dojo.marginBox(dojo.byId("a-bad-id")) which in turn calls into dojo.getComputedStyle() to do it’s work, and hence, the error. I updated the repro case and the original blog post to reflect the findings.
Dojo’s little gems
I really enjoyed Mitch’s article on YUI Lang’s little gems and thought it might be handy to see how to do the same things with Dojo. Here’s the translation:
Trim
var trimMe = " trim me please "; //YUI var trimmed = YAHOO.lang.trim(trimMe); //Dojo // - exactly the same trimmed = dojo.trim(trimMe);
Substitute
var processText = function(key, value) {
return value.toUpperCase();
};
//YUI
YAHOO.lang.substitute('Hello {world}', { world: 'earth'}, processText);
// Dojo
// - Named placeholders are prefaced with a $
// - No support for extraValues from Mitch's example
dojo.require("dojo.string"); // not in base distribution
dojo.string.substitute('Hello ${world}', { world: "earth" }, processText);
Later
// YUI
// - Docs indicate this return type void, which is a timer object?
YAHOO.lang.later(200, foo, "method", [{ data: "bar" }]);
// Dojo
// - No abstraction for timers in Dojo
// - Can use hitch to set calling scope for function
setTimeout(dojo.hitch(foo, "method", { data: "bar" }), 200);
// or
setInterval(dojo.hitch(foo, "method", { data: "bar" }), 200);
Merge
var defaults = { color: "red", answer: 42 };
var config;
//YUI
config = YAHOO.lang.merge(defaults, { color: "blue" });
//Dojo
// - mixin takes a variable number of arguments
// - Values are written to the first object, hence passing {}
// - Later values have precendence
config = dojo.mixin({}, defaults, { color: "yellow" });
Commands
My contribution to the meme:
blowery@hermes:~$ history 1000 | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
170 cd
78 ls
55 sudo
31 svn
18 scons
18 nm
12 less
9 grep
8 rm
8 make
As for why these, here are some rough guesses:
cd- obviously we use a lot of directories and I end up moving around quite a bit.
ls- implicitly tied to cd usage I think. And I have a lousy memory for what file names in what dirs.
sudo- This meme caught me while I was setting up a new working vm instance, hence all the sudo. Normally, I don’t think I use it quite so much.
svn- svn is our source control management tool of choice
scons- scons is our build tool of choice
nm- nm lists the exported symbols in a library. I was tracking down a problem with MySQL and a broken exported symbol during the aforementioned instance install.
less- less is my pager of choice
grep- handy for finding things
rm- handy for removing things. I think this was related to MySQL causing me grief
make- everyone else’s built tool of choice and I was installing a lot of everyone else’s stuff