IE6 submit-click on text input submit

September 26th, 2008

Found this fun bug in IE6 today. If you have a text input and submit input unassociated with a form, then submitting the text input (by hitting return or enter when focused) will cause a click event on the submit input.

The solution is simple and intuitive: eliminate unassociated submit inputs and submit buttons.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/DTD/strict.dtd">
<input type="text"/>
<input type="submit" onclick="this.value='clicked';" />

Demo (IE only)

Chocolate-covered almond biscotti

September 9th, 2008

Almond-crusted mascarpone-filled kumquat marmalade- and créme de cacao-glazed blackberry and raspberry tarts

August 11th, 2008

Can Haz Wallet?

August 3rd, 2008

I found this today on University between 10th and Vermont in San Diego.

Custom Wikipedia CSS & Javascript for iPhone

August 2nd, 2008

This afternoon I made a custom stylesheet and script to format Wikipedia nicely for me when I am logged on from my iPhone. If you have a Wikipedia account, you can easily use them by adding them to your own monobook.css and monobook.js. Screenshots below.

Hidden Categories in Wikipedia

July 12th, 2008

While searching for a list of unwatched articles in Wikipedia (which isn’t published as far as I can tell), I found the category of hidden categories. Interestingly, the “hidden categories” category itself is not a hidden category[1].

[1] Wikipedia Signpost: Role of hidden categories under discussion

What’s wrong with Yelp?

May 3rd, 2008

Imagine for a moment that you were a point in multidimensional space, and your nearby neighbors in this space are people that share your preferences for restaurants, bars, and clubs. In this model, a bar you like is very near to you (e.g., by a Euclidean metric), while some place you hate is far away.

This model rules Yelp. A review on yelp is a measurement of the distance between the reviewer and the reviewed. The review will be favorable if and only if the reviewer is nearby the reviewed in the model.

A restaurant (e.g., Bite) gets good reviews because the people that review it know or can guess, before they go there, that they will like it. If they didn’t, the place wouldn’t have such stellar reviews.

So why do some places get terrible reviews? I see cases that would cause this. First, if a new nightclub (e.g., Universal) is still “figuring itself out,” it might attract a lot of people expecting one thing and getting another. In other words, they are not near the place in the model, but they visit it anyway because they think they might. Likely, because the place is so new, many people are testing it out, so you can expect the reviews to be unfavorable, even by the people who are supposed to like it, because the presence of outsiders ruins the whole experience.

In another case, a super-exclusive bar might only cater to a very narrow range of clientele. In other words, you have to be unusually close to this bar in the model in order to like it. Perhaps it only supports one or two cliques of regulars, and everyone else is shunned.

In this example, the radii correspond to the ability of a bar or restaurant to support a wide or narrow section of people.

Dangers of Anonymous Function Closures

April 7th, 2008

John Resig’s jQuery uses a standard technique of anonymous function closures to namespace its internal functionality.

(function(){
  // jQuery stuff goes here...
})();

This is all well and good until you want to inline this code under some of your application code, as I did while working on Eventful’s MySpace application. Consider this example, written in standard Javascript style.

var foo = function(bar) {
  console.log("foo");
  return bar;
}

(function(){
  console.log("bar")
})();

What do you expect this code to print? If you say “bar”, you’re wrong. It prints “foo bar” because in this context the anonymous function closure becomes a call to the function that prints “foo” and returns the function that prints “bar”, which is then called.

Most of us probably wouldn’t notice what just happened because we are so used to Javascript interpreters automatically inserting semicolons after function definitions.

The danger is assuming, as John Resig and hundreds others have, that your anonymous function closure is the first token in a new line. In my case, it wasn’t. The solution? Either start meticulously sprinkling semicolons in your application code, or just add a single semicolon before your parenthetical block, guaranteeing it’s the first token in the line.

;(function(){
  // jQuery stuff goes here...
})();

Tortilla Soup

November 25th, 2007

Semester Conclusion

December 17th, 2006

I haven’t written anything in a few months because there is no time during the semester to work on anything fun. This semester was good, but challenging. I took three graduate classes, each culminating in a final project. For bioinformatics, I did some biclustering research based on some earlier work by my thesis advisor. In digital image processing, I designed a method to detect brake lights for autonomous vehicles. Lastly, Michael Jolson and I made this cool general-purpose distributed computing system based on a market model for database systems.