GSoC 2011 Project List

The Google Summer of Code kicked off a week ago, and I am pleased to list the projects being done under the Mozilla banner. The name of each student is linked to the location where they will be posting weekly updates on their progress, if you want to follow along with a project you are interested in. And I’m sure they would appreciate any help or advice you have :-) Please make them feel welcome!

Project Student Mentor
Non-solid border rendering improvements Anil Shanbhag fantasai
WebCL add-on Adrien Plagnol Anant Narayanan
Implement JDK7 InvokeDynamic in Rhino Phani Rohit Mullangi Hannes Wallnöfer
Further Scalarization of Trace Segments in Tracemonkey Igor Rafael David Mandelin
HTML Speech API implementation Roshan Vidyashankar Olli Pettay
Full offline mode for Lightning Mohit Singh Kanwal Ludovic Marcotte
Improvements for the New Calendar Wizard Lennart Bublies Philipp Kewisch
Integrate Transifex l10n platform for Extensions Tim Babych Zbigniew Braniecki
Javascript implementation of the XMPP protocol Varuna Jayasiri Florian Quèze
JPEG XR Library Chris Harding Jeff Muizelaar
MediaWiki parser in Python Peter Potrowl Erik Rose
Tilt: a WebGL-based 3D visualization of a web page Victor Porof Rob Campbell

OpenTech Interview

I was interviewed at the OpenTech conference by visionon.tv about Mozilla, and the importance of the open web:

(This should be an HTML5 WebM embed if your browser supports it. Join the YouTube HTML5 beta to get more vids in HTML5.)

I had no prior knowledge of what the questions would be and so was shooting from the hip in a couple of cases. Some of my market share figures are perhaps a little off – I underestimated Chrome and overestimated IE. And when I say “it sucks to be South Korean right now”, of course I meant in the very limited context of having freedom of choice in browsers :-))

HTML5 Email Address Regexp

Most Recent Update: 2013-03-26: If you found this page by searching, the HTML5 email address regexp you are looking for is:

/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$/

(This should be all one line.) This regexp works unchanged in either Perl or JavaScript.

Version history: this version improves upon the previous, shorter version which was here from Feb 2012 to March 2013 in that it restricts domain labels to 255 characters and prevents them beginning or ending with a “-“. That prior version differed from the version originally calculated in May 2011 in the blog post below, in that it stopped using \w and started using non-capturing parentheses.

Original post follows:


Summary: can anyone help me out by confirming I’ve correctly calculated the regexp to match the HTML5 email address format spec?

The regexp to match official RFC2822 email addresses is:

(?:[a-z0-9!#$%&’*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&’*+/=?^_`{|}~-]+)*|”(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*”)@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

HTML5 realises this is ridiculous, and proposed a more limited format for email addresses. Having read the spec, and followed the logic below, I think the regexp form of the spec is this:

/^[\w.!#$%&’*+\-/=?\^`{|}~]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/i

Am I right?

Logic:

HTML5 says:

“1*( atext / “.” ) “@” ldh-str *( “.” ldh-str ) where atext is defined in RFC 5322 section 3.2.3, and ldh-str is defined in RFC 1034 section 3.5.”

Mining those RFCs:

atext           =   ALPHA / DIGIT /    ; Printable US-ASCII
"!" / "#" /        ;  characters not including
"$" / "%" /        ;  specials.  Used for atoms.
"&" / "'" /
"*" / "+" /
"-" / "/" /
"=" / "?" /
"^" / "_" /
"`" / "{" /
"|" / "}" /
"~"

<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
<let-dig-hyp> ::= <let-dig> | "-"
<let-dig> ::= <letter> | <digit>
<letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
<digit> ::= any one of the ten digits 0 through 9

That leads to the following, if I’m not mistaken:

/^[a-zA-Z0-9.!#$%&’*+\-/=?\^_`{|}~]+@[a-z0-9-]+(\.[a-zA-Z0-9-]+)*$/i

which can be reduced, by using ‘\w’, to:

/^[\w.!#$%&’*+\-/=?\^`{|}~]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/i

Don’t Build Your Business On iOS

From iFlowReader.com:

Apple has made it completely impossible for anyone but Apple to make a profit selling contemporary ebooks on any iOS device. We cannot survive selling books at a loss and so we are forced to go out of business. We bet everything on Apple and iOS and then Apple killed us by changing the rules in the middle of the game. This is a very sad day for innovation on iOS in this important application category. We are a small company that thought we could build a better product. We think that we did but we are powerless against Apple’s absolute control of the iOS platform.

(This is becoming a theme – see “Don’t Build Your Business On AdSense.)

Monopoly control of a platform, be it an OS or the web itself, is bad for everyone but the monopolist. That’s why it’s so important to keep the web free and open.

Code Provenance in Github

Mozilla is making more use of Github. One of the things legal-minded Mozillians care about when people are putting together Mozilla code is legal provenance – where it came from, and whether the people contributing it have sufficient rights to do so. Github is designed to allow code to be pulled in, mixed up and exchanged between many different people. Leaving aside for the moment how well provenance tracking works in the current system, let’s posit a few scenarios:

  • A Mozilla member wants to prove, for CV purposes, that they wrote the original version of an interesting algorithm now used in Firefox
  • A suggestion is made that some code we are shipping is part of a proprietary codebase, and the legal team want to investigate
  • We are using some code under licence X, but the known upstream is (now, at least) licence Y, which is incompatible with our iicences, and the project contacts us and tells us to stop

How would you deal with these sorts of issues in a Github-based project? How do you track provenance?

There’s No Money Left

“I’m afraid to tell you there’s no money left” was what was written on a note left by the previous Chief Secretary to the Treasury for his successor when the UK government changed after the last election in May 2010.

Since then the new government has been attempting to rein in spending, although he hasn’t been doing a great job of it – over this parliament the national debt will still rise by over £500bn, or £19,000 for every household in the country. Interest on this debt – money the Government has to collect in taxes but can’t spend on services – will more than double to almost £67bn, surpassing spending on the defence, transport, home office and justice departments combined.

Even so, some people think the relatively mild spending cuts, which restore government spending to where it was as recently as 2007, are an unbearable travesty which will take us back to the dark ages.

That’s why I’m attending the Rally Against Debt in London this Saturday, and I urge my UK readers to do the same. Here’s my placard slogan: “The Borrower Is Slave To The Lender” — Proverbs 22:7.

Domesday Screencast

Domesday is, as readers of this blog will know, the software I am writing to drive a Mozilla community phone book. I’ve done a screencast which demonstrates the Domesday user interface, and explains some of the key design principles and the features which support them:

(Ogg Vorbis video preferred to WebM because that’s the original format and the quality is better.)

In hindsight, the narration may sound a bit patronising; I hope you’ll excuse me. It’s not as high-energy as the Firefox videos :-) I’d love to hear your feedback. And if you are interested in Domesday, sign up and we’ll tell you when we’ve got something you can test.

Generic Metrics Software

Dear lazyweb,

I want to track some metrics about something. I want to download a particular URL at a particular frequency, apply a regexp or do a count to extract a number from the returned info, and store it in a database. I then want to do pretty charts and graphs, all the usual metrics stuff.

So for example, I might want to do:

  • Daily; https://api-dev.bugzilla.mozilla.org/latest/count?component=BzAPI; /data: (\d+)/
  • Daily; http://hg.mozilla.org/mozilla-central/shortlog; count: /diff/
  • Weekly: https://wiki.mozilla.org/index.php?title=Special:RecentChanges&days=7; count: /hist/

And so on. Basically, a generic metrics gathering and display engine. (Or two bits of software, one for each part.) Does this software exist? If not, anyone want to build it?

OpenTech 2011

To all UK-based geeks: OpenTech 2011 is in London on Saturday 21st of May. Come along to hear talks from a wide range of geekinesses, from maps to open data to hardware hacking to digital advocacy. You can also hear me talking about Join Mozilla and other new Mozilla initiatives. Only £5 on the door. Put it in your diary now :-)