Highlights From SXSWi 2008

I'm back from the SXSW Interactive conference, which offered a pretty decent selection of panels and good times. I ended up attending about 20 panels over three and a half days, and about as many bars and after-parties. Here were some of the personal highlights, for anyone who's interested.

The first session I attended on Saturday morning was High Performance Web Sites (panel info) by Steve Souders. I've read Steve's book, so there wasn't really anything new there for me. For those out of the loop, there's a summary of the rules in his book on the Yahoo! Developer Network. Apart from his YSlow add-on for Firebug, he also mentioned HttpWatch ($295) for IE, which seemed pretty cool. What was more interesting for me though was meeting Steve the next day at the O'Reilly Media booth, where we discussed the success of his book (which I believe was the best selling tech book on Amazon last year), working with O'Reilly Media and specifically his editor Andy Oram (who also edited Mastering Regular Expressions, among other top-selling O'Reilly books), and the upcoming Velocity conference that Steve will co-chair. At one point I asked him why he moved from Yahoo! to Google. His response was that he'll be able to focus more on open source and green computing, which are issues he's passionate about. The probable pay raise and that fact that he now knows about pretty much everything that both Yahoo! and Google are doing for web performance can't hurt either. I also learned that he's working on a sequel to his book (as opposed to a second edition), which will include a range of additional front-end performance tips and insight.

Another early Saturday panel I attended was Accessible Rich Media (panel info, podcast). Developing rich yet accessible internet applications seemed to be one of the focuses for SXSWi this year, but the main reason I'm mentioning this panel here is to point out some of the tools they highlighted: NVDA (an open source, Windows screen reader), Colour Contrast Analyser, the iCITA Firefox Accessibility Extension, and Fangs (a screen reader emulator). They also talked up WAI-ARIA and the accessibility built into Dojo's Dijit control library.

From there it was on to 10 Things We've Learned at 37signals (panel info, podcast), which as I've mentioned previously was one of the highlights for me. Co-founder Jason Fried covered some of the overarching principals at 37signals, including ways they try to improve productivity within their team, as well as the usefulness and simplicity of their software.

Following are the main points he discussed, as described on the accompanying slides. Listen to the podcast for more details.

  1. Ignore the great unknown
  2. Watch out for red flags (by this he meant words such as need, can't, only, fast, and easy, which often lead to project delays)
  3. Be successful and make money by helping other people be successful and make money
  4. Target nonconsumers and nonconsumption
  5. Question your work regularly
  6. Read your product
  7. Err on the side of simple
  8. Invest in what doesn't change
  9. Follow the chefs (this was about becoming famous and successful by giving away your knowledge)
  10. Interruption is the enemy of productivity
  11. Road maps send you in the wrong direction
  12. Be clear in crisis
  13. Make tiny decisions
  14. Make it matter

It turns out they've learned a few more than 10 things.

Skipping right along to the Keynote Interview with Mark Zuckerberg (panel info, podcast, video)… um, yeah, it was salvaged only by the crowd's reaction, which has been much written about. Many people seem to agree that the interviewer was fairly self-centered and didn't understand her audience.

The only discussion that might have gotten more laughs than the Zuckerberg interview was LOLWUT? Why Do I Keep Coming Back to This Website? (panel info), which chronicled I Can Has Cheezburger? from its inception to its massive success, subsequent buyout, and further expansion. It turns out that lolcats pay the salaries of nine people these days, including four developers. Another important thing I learned was that there's a loldog site at I Has a Hotdog. The folks behind those sites are also working on a new political photos site, which they introduced with an awesome image of Hillary Clinton shouting "THIS IS … SPARTA!"

Side note: One cool thing at the convention center was the number of Rock Band and Guitar Hero 3 sets available. If you include the Interactive trade show, ScreenBurn arcade, and a secondary Microsoft booth in one of the hallways, there were at least five Guitar Hero 3 setups plus four more Rock Band sets. At one point, Guitar Hero world champion Freddie Wong was showing off at the main Microsoft booth, where he racked up an over 100-note streak playing at expert difficulty with the guitar behind his head. After pretending to play some rock music myself, I ended up talking to a number of folks at the Microsoft booth. The big things they were pushing were Silverlight, Deep Zoom, Live Search (especially for multimedia), Live Maps, and Expression Web. They also had a setup where one of the Microsoft people was demoing Project Maestro, a Minority Report -style system where a pair of wireless gloves were being used as the input to move, stack, rotate, and zoom in and out of photos using simple hand gestures. Pretty slick, but it would've been cooler if they'd let you try it out for yourself. Oh, and the Sun booth was giving away free blu-ray movies.

L-R: Chris Wilson, Arun Ranganathan, Charles McCathieNevile, and Brendan Eich

Then there was Browser Wars: Deja Vu All Over Again? (panel info) with Brendan Eich, Mozilla CTO and inventor of JavaScript; Chris Wilson, Internet Explorer Platform Architect and chair of the HTML Working Group; and some dude, from Opera. Just kidding, Charles McCathieNevile is Opera's Chief Standards Officer and an all-around web standards titan.

Joined by moderator Arun Ranganathan (previously of Netscape), the three browser representatives fielded questions on the mobile web (a particularly big deal for Opera), Silverlight, ECMAScript 4, SVG, etc. A podcast of the session should eventually be available from 2008.sxsw.com/coverage/podcasts, and will probably be worth checking out. The discussion was attended by a full-capacity crowd, with many who didn't get a seat early being turned away at the door. My friend and coworker Ryan Christie was one of the people turned away, but that worked out because outside the doors he struck up a conversation with fellow shut-out John Resig, who mentioned that Mozilla was hosting a mini-party at a nearby grill later that afternoon.

I didn't want to miss the Mozilla get-together, so Ryan and I headed over shortly afterwards. It was a lot of fun hanging out with the Mozilla people—Brendan Eich, John Resig, Aza Raskin, Melissa Shapiro (who was exceptionally friendly and outgoing, btw)—and all the other people who stopped by. The only downside was that because they had a full bar serving free drinks, I probably downed a few too many.

John Resig (right) and I at Moonshine Grill

Along with free food and drinks, there was plenty of schwag to go around including Mozilla Labs t-shirts, stickers from Mozilla Japan, badges, fake tattoos, and of course screaming monkeys that could be launched slingshot-style across the room. I proceeded to do just that as much as possible. The Mozilla crew also had a competition going for the best Firefox add-on idea, which would net three winners a set of the coolest gear on hand: a nifty Firefox-branded backpack, stuffed animal Firefox, and Mozilla beanie. I submitted some of the worst ideas I could think of (e.g., an email and phone number harvester that would automatically sell the data it gathers as you browse the web to Russian spammers), but the rest of the ideas must have been pretty silly too because I ended up winning first place for a Firefox 3 add-on which would leak memory to remind you of the old days. The idea was actually a collaboration with Ryan, so he took first dibs on the winnings (making off with the stuffed animal). Runner-up winner was a token useful add-on that would show you phishing websites and the sites they were spoofing side by side, I guess as an educational experience. Third place winner was I SERVED U AN AD BUT I EATED IT, which would replace all ads with lolcats.

After the prize handouts, Brendan Eich came by and encouraged me to submit an ES4 ticket on the regex behavior for backreferences to non-participating groups which I've previously mentioned here and on the ES4-discuss mailing list. I think it's something he'd like to see change as well. He also mentioned something about the /x (extended) and /y (sticky) modifiers being among the best ES4 regex extensions, which I wholeheartedly agree with (ES4's /y is similar to but better designed than Perl/PCRE/.NET/Java/Ruby's \G token). Of course, Brendan is someone I deeply respect and admire, so just the fact that he remembered me from the mailing list was pretty cool.

One panel I missed that I would've loved to attend was Secrets of JavaScript Libraries (panel info, slides) hosted by John Resig (jQuery) along with Alex Russell (Dojo), Sam Stephenson (Prototype), Andrew Dupont (Prototype), and Thomas Fuchs (Scriptaculous). Unfortunately, my Tuesday flight left a little too early, but I'll be looking out for the podcast.

So those were most of the highlights for me. Here be a few final observations:

  • Core Conversations is a bullshit format. Seriously, get some mics next time.
  • The porn industry is well represented at SXSWi.
  • Austin seems to be comprised of little more than office space, hotels, and bars.
  • 80% of the world's MacBook Pros and iPhones showed up for the conference.

(Photos by Ryan Christie and his POS Motorola RIZR.)

SXSW Interactive 2008

Despite flight cancellations and a last-minute work crisis, I've been in Austin, Texas with a couple work buddies since late-Friday to attend the packed-out South by Southwest Interactive conference. It's been a lot of fun so far. 11 panels into it, the standout for me has easily been 10 Things We've Learned at 37signals by 37signals co-founder and CEO Jason Fried. I'll try to post more about the conference sometime after leaving, but hey, if anyone reading this is here in Austin and wants to meet up, grab some drinks, hit an after party, play Rock Band at the ScreenBurn arcade, whatever, send me an email: steves_list [at] hotmail.com.

Regular Expressions As Functions

Firefox includes a non-standard JavaScript extension that makes regular expressions callable as functions. This serves as a shorthand for calling a regex's exec method. For example, in Firefox /regex/("string") is equivalent to /regex/.exec("string"). Early ECMAScript 4 proposals indicated this functionality would be added to the ES4 specification, but subsequent discussion on the ES4-discuss mailing list suggests it might be dropped.

However, you can implement something similar by adding call and apply methods to RegExp.prototype, which could help with functional programming and duck-typed code that works with both functions and regular expressions. So let's add them:

RegExp.prototype.call = function (context, str) {
	return this.exec(str);
};
RegExp.prototype.apply = function (context, args) {
	return this.exec(args[0]);
};

Note that both of the above methods completely ignore the context argument. You could pass in null or whatever else as the context, and you'd get back the normal result of running exec on the regex. Using the above methods, you can generically work with both regular expressions and functions wherever it's convenient to do so. A few obvious cases where this could be helpful are the JavaScript 1.6 array iteration methods. Following are implementations of filter, every, some, and map that allow them to be used cross-browser:

// Returns an array with the elements of an existng array for which the provided filtering function returns true
Array.prototype.filter = function (func, context) {
	var results = [];
	for (var i = 0; i < this.length; i++) {
		if (i in this && func.call(context, this[i], i, this))
			results.push(this[i]);
	}
	return results;
};
// Returns true if every element in the array satisfies the provided testing function
Array.prototype.every = function (func, context) {
	for (var i = 0; i < this.length; i++) {
		if (i in this && !func.call(context, this[i], i, this))
			return false;
	}
	return true;
};
// Returns true if at least one element in the array satisfies the provided testing function
Array.prototype.some = function (func, context) {
	for (var i = 0; i < this.length; i++) {
		if (i in this && func.call(context, this[i], i, this))
			return true;
	}
	return false;
};
// Returns an array with the results of calling the provided function on every element in the provided array
Array.prototype.map = function (func, context) {
	var results = [];
	for (var i = 0; i < this.length; i++) {
		if (i in this)
			results[i] = func.call(context, this[i], i, this);
	}
	return results;
};

Because the array and null values returned by exec type-convert nicely to true and false, the above code allows you to use something like ["a","b","ab","ba"].filter(/^a/) to return all values that start with "a": ["a","ab"]. The code ["1",1,0,"a",3.1,256].filter(/^[1-9]\d*$/) would return integers greater than zero, regardless of type: ["1",1,256]. str.match(/a?b/g).filter(/^b/) would return all matches of "b" not preceded by "a". This can be a convenient pattern since JavaScript doesn't support lookbehind.

All of the above examples already work with Firefox's native Array.prototype.filter because of the indirect exec calling feature in that browser, but they wouldn't work with the cross-browser implementation of filter above without adding RegExp.prototype.call.

Does this seem like something that would be useful to you? Can you think of other good examples where call and apply methods would be useful for regular expressions?

Update: This post has been translated into Chinese by PlanABC.net.

Happy Valentine’s Day

Some Valentine's-Day-themed geekery from around the intertubes…


A Halo Valentine from II HYPNOTiiQ II and Xbox.com

Grunts are red; plasma grenades are blue. My Warthog has a seat that's open for you!

A hexadecimal / Zero Wing / Valentine / shirt
mashup from ThinkGeek

Roses are #FF0000; violets are #0000FF. All my base are belong to you.

Rosette Nebula


← The Rosette Nebula, Astronomy Picture of the Day for February 14, 2008, from Nasa.gov.

The Rosette Nebula (aka NGC 2237) is not the only cosmic cloud of gas and dust to evoke the imagery of flowers. But it is the one most often suggested as a suitable astronomy image for Valentine's Day.


Then there are heart surface and heart curve formulas from Wolfram MathWorld. And romantic Perl code poetry—geek love at its finest.

I guess my old expression of regex love is also appropriate here, if anywhere ↓

(you)?
(?(1)
	\u2665
	((?:reg(?:ular\s+expressions?|ex(?:p|e[ns])?))++)
|
	(?!)
)
(?>\1\2)

10 Reasons to Learn and Use Regular Expressions

10. Regular expressions are everywhere

Here's a short list of programming languages and tools that support regular expressions. The links are to their regex documentation.

9. Regular expression mastery can help you stand out from the crowd

Regular expressions might be everywhere, but many experienced programmers are intimidated by them. Knowing how to use regular expressions effectively is a valuable skill that can quickly make your peers take notice.

8. Wielding regular expressions can make you feel like a mighty wizard

Regular expressions can be difficult to master, but doing so is that much more rewarding as a result. Writing a line of cryptic letters and symbols that does what might otherwise take hundreds of lines of code can feel pretty cool.

7. If your search is simple, regular expression syntax is simple

Want to match the word "cat"? The regex is simply cat. ^cat matches "cat" at the beginning of the string, cat$ matches at the end, and cat|dog matches "cat" or "dog". Most regex syntax is very simple once you get the hang of it.

6. Regular expressions are portable

That's a bold lie, yet it's usually true for people who stick to the basics or intentionally write their regexes in a portable way. The majority of regex syntax works the same in a wide variety of programming languages and tools.

5. Regular expressions can help you write short code

This can be especially helpful in JavaScript, where keeping code length down is important for people with slow Internet connections. And although regexes can be hard to read, I'd rather spend a minute stepping through the logic of a regex than doing the same thing with a page full of code. Of course, like with most things in life it's important to find a good balance.

4. Regular expressions save time

Even for newcomers who still struggle with the syntax, regular expressions are often the fastest way to get the job done.

3. Regular expressions are fast

Although typical backtracking regex engines have so-called pathological cases which can take a very long time, regexes written with performance in mind will be fast enough for your needs in almost all cases. To ensure that's true, it's a good idea to at least get a feel for the basics of regex performance optimization.

2. Regular expressions can match just about anything

In other words, regular expressions are powerful. A regular expression guru can find many appropriate uses for regexes where the untrained user might not think to look. As the authors of Programming Perl wrote, "if you take 'text' in the widest possible sense, perhaps 90% of what you do is 90% text processing."

1. Regular expressions are fun

Like any good challenge, regexes can be a lot of fun. Tools like RegexPal can help remove a lot of the guesswork, so you can concentrate on solving problems.

… Feel free to add your own reasons why you think regexes are awesome^2 or the worst idea since unicycles.

Update: This post has been translated into Portuguese (by Fábio Luciano) and Spanish (by Fernando Briano). Thanks guys!