Opening the Mobile Web

Jean-Yves Perrier has published the plan for prising open the mobile web – evangelism of individual sites and frameworks is a big component, along with spec work and technical changes to Firefox Mobile.

I don’t think I exaggerate when I say that the tasks on that page are some of the highest priority non-coding tasks we have at Mozilla. A WebKit-only web is not much better in the long run than an IE-only web. If you have time to help, please pitch in. Contact Jean-Yves if you aren’t sure where to start.

Particularly if you are someone who doesn’t want Firefox to implement webkit-prefixed properties: working on these tasks is how you can avoid us having to do it, or reduce the amount of it we have to do.

Disabling Private Browsing Mode in Firefox

This subject has been discussed before on this blog. I support the right of parents to review what their children have been looking at, both morally in terms of my understanding of the way God has given parents authority over their children, and for the pragmatic reason that it’s likely that, with such an ability, they will give their children greater access to the web than they would otherwise have. So I think it should be possible to disable PBM. However, I’m not really interested in having that discussion again – this post is about the best way to do it, not whether it’s a good idea.

William Wood has written a program, “Incognito Gone”, which turns off private browsing or the equivalent in Chrome, IE and Firefox. However, his page says:

Note: While Incognito Gone completely removes the private browsing function from Google Chrome and Internet Explorer, in Mozilla Firefox only the option for private browsing is removed. In other words, if you know the keyboard shortcut for private browsing in Firefox, it is still available.

Technically, Chrome and IE support this disabling using a registry option and, if your Windows computer is set up correctly with user accounts for each person, then this is an effective method, and it’s what William’s program uses. For Firefox, he just drops in a userChrome.css to hide the menu item, which is clearly suboptimal.

Is it possible to have an “uninstallable extension”, under the same conditions (user account separation) as IE and Chrome have “unchangeable registry entries”? If so, that seems like it would provide parity with Chrome and IE.

If we added a private browsing pref, does “pref locking” still work, and could that be used? There are docs about it on the web, but no clear info as to whether it currently works and can be done in a non-defeatable manner. Are any EWG participants using it?

Language Popularity by Wikipedia

As you know, I have a spreadsheet which tries to work out which languages we should focus on when trying to start new l10n teams, by looking at the world Internet population by country, and what languages are spoken in each. This leads to a current top 5 target languages of:

  1. Tagalog
  2. Vietnamese
  3. Malay
  4. Azerbaijani (Azeri)
  5. Urdu

However, chofmann suggested we could cross-check our results by using the size of a language’s Wikipedia as a rough proxy for how popular that language was on the Internet. The data is here; if we take that, remove all the languages we have Firefox in already, and sort by size, we get a top 5 target languages of:

  1. Nepal Bhasa
  2. Azerbaijani (Azeri)
  3. Aromanian
  4. Haitian
  5. Tagalog

The Vietnamese and Malay Wikipedias are tiny. The Urdu one is a bit bigger, but still 1/3 of the size of the smallest one in the top 5.

So perhaps we should consider this second list of languages as our top priority list?

Open Sourcing Local Minimum

I can’t remember who said it (Simon Phipps?), but a while back this idea stuck with me.

If a company tries to open source a project, but gets nervous about it and tries to retain too much control, they can end up at a sort of open sourcing local minimum, where they are getting the disadvantages of open source with none of the advantages. In other words, they incur all the expense and hassle of setting up an open source project, without getting the increased community involvement and eyeballs which are the reward, because potential contributors can see that it’s not a project they can have a real ownership stake in.

Sometimes, half-done can be worse than not done at all.

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

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.

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 :-)

Being Open vs. Enabling Useful Participation

At the last Mozilla Foundation get together, we had a session thinking about “How to work open”. (Matt Thompson led the session, and has already done his writeup.)

One important distinction that appeared during the discussion was between ‘Being Open’ and ‘Enabling Useful Participation’. If you think in terms of ‘Being Open’, you end up throwing all sorts of half-finished things out into the community and saying “what do you think?”, which normally results in minor feedback or bikeshedding, and a sense of disempowerment in the community when their feedback is ignored because it wasn’t really what you were looking for.

If you instead think about each question through the filter of how you can Enable Useful Participation in your project, you end up not just with much more useful answers, but with much better questions as well. Ask: how can someone else make a useful contribution to what you are doing, and what tools and information do you need to give them in order for them to do that?

‘Being Open’ thinks “we need to publish this half-finished draft of a press release right away, because if we don’t, then we aren’t being open enough.” ‘Enabling Useful Participation’ thinks “Hmm. If people are going to give me useful feedback on this, they need to know what I’m trying to achieve. Let me write up my goals, plus a short list of the bits I’m not sure about yet to direct people’s attention, and then publish.”

‘Being Open’ thinks “stick it in the code repo; now we’re open”. ‘Enabling Useful Participation’ thinks “Can people actually install it? Do I need to write instructions for that? What’s the roadmap? Do people know how to contact me to ask what to work on?”

‘Being Open’ thinks “as long as we publish the results of all our decisions, we are open”. ‘Enabling Useful Participation’ thinks “how can we bring other people into the decision-making circle?”

So, ask yourself today: how can someone who currently knows nothing about my project make a useful contribution, and what tools and information do I need to give them in order for them to do that?

Brain Patents in Bangladesh

How would it feel if someone told you they had a patent on the way part of your brain worked, and you were not allowed to use it without paying them money?

I have recently been on a trip to Bangladesh. The main language in Bangladesh is Bangla, which they take very seriously. I wrote the first draft of this blog post on 21st of February, which is “Shohid Dibosh“, Language Martyrs’ Day, in Bangladesh. Back in 1952, Bangladesh was East Pakistan – Pakistan then being one nation in two parts, separated by a thousand miles of India. At least five Bangladeshis were shot dead during a protest about wanting Bangla to be the national language of their part of Pakistan, rather than everyone having to learn Urdu, the language of West Pakistan. (Bangladesh became independent in 1971.) Bangladeshis see their right to use Bangla as one paid for in blood.

So, with the coming of computers, Bengali people wanted to use their computers in their language. But Bangla has its own script (the alphabet has about 60 characters, but no case distinction), and there was no way to type it. A keyboard layout and software was needed. The first popular system was created by a Bengali named Mustafa Jabbar, who had a publishing company. He came up with a layout and software to translate the key presses into code points, and some fonts to display them. This system is known as Bijoy. As businesses switched to computer-based publishing, they adopted Bijoy.

In 1989, Mr Joppa was granted a copyright on his keyboard layout, and in 2004, a patent. That meant that all Bijoy keyboards sold required a license from him, and they all came with his software – for Windows or Mac. Patents in Bangladesh have long expiry times – 50 years from the death of the inventor. (In the US and Europe, the time is 20 years from the date of filing.) For a long time, this was the only system available – so many people learned it. Even when others were invented, Bijoy came bundled with every keyboard and matched the markings on it – so there was little incentive to purchase anything else.

However, the original Bijoy software output character codes in the ASCII range, like all of those incompatible ISO charsets from the 1980s. This causes a number of problems, the biggest being that you need the right font to read the result, and if you don’t have it, you’ll see a load of gibberish.

With the coming of the Internet, this became a serious problem. There was no way of communicating over the Internet in Bangla with any certainty that the recipient’s computer had the right fonts and could read what you are writing. The solution to this problem is Unicode – a system where every character in every writing system in the world is uniquely identified by a number, instead of different scripts all sharing the numbers less than 256. Yet no version of Bijoy supporting Unicode was forthcoming – and there was nothing at all for Linux. And no-one else could solve this problem because of the patent.

To get around this Ankur, the Bengali open source organization, made a new layout, called Probhat, which was semi-phonetic. (Two T-like sounds were mapped to T and Shift-T, and so on.) But it was not very popular. Most people still used Bijoy.

Mr Joppa has actively defended his keyboard patents, claiming that they extend even to similar keyboards. Mehdi Hasan Khan, an undergraduate student, made another keyboard system which was fully phonetic – i.e. type Bangla sounds with Latin letters (e.g. “Shohid Dibosh”) and it would produce the right Bangla characters (“(শহীদ দিবস”). This is how Bengalis had been communicating on the net anyway, so they were used to it. He called it Avro, and (after a while) made it free and open source. But he also included in his system “Unibijoy” – a layout like Bijoy but with 8 keys different, and which output Unicode characters, so people who knew Bijoy could also start typing Bangla on the Internet without reprogramming their entire brain.

Mr Joppa sued him, claiming that Unibijoy was a copy of Bijoy. The case was settled out of court in mid-2010, and Mr Mehedi had to remove Unibijoy from his software.

In 2008, the Bangladesh National Election Commission produced over 10,000 computers to be used for a census of Bangladesh. They used the Avro software with the Unibijoy layout, because the Bijoy licensing fee was too high – so Mr Joppa sued them too. (That case is still proceeding.)

The only organization too big for him to sue is the Bangladesh government. The Bangladesh Computer Council – BCC – designated a form of Bijoy (also slightly modified) as the national keyboard layout. As yet, they have not been sued.

Finally, in 2010, Mr Joppa did produce Bijoy for Linux, which outputs Unicode – but it is closed source.

So now, today, there are not one but at least four ways of writing Bengali – Avro, Probhat, BCC and Bijoy. (For reference, at the bottom of this page I have made a list of how you activate each in Ubuntu Linux.)

If you learnt how to type Bengali any time before 2003, you probably have Bijoy burned into your brain. And switching keyboard layouts is hard. Latin language users – ever tried the Dvorak keyboard? Or Americans/Brits – ever sat down at a computer in France, discovered the top row of keys begins AZERTY, and been reduced to hunt-and-peck? Having the layout you know taken away from you cripples your ability to interact with a computer. Yet Mr Joppa claims he has a patent on your brain working with his system, and if you want to use it, you have to pay him and use his software.

This patent would probably not be classified as a software patent. But it still sucks. There are some types of thing which should not have owners – and human-computer interfaces are definitely one.

The World Intellectual Property Organization website has another telling of this story, with quite a different slant. According to them, all of this constitutes a great success.

Appendix

As far as I understand it, the ways to use each keyboard system in Ubuntu are:

  • Avro – go to the Avro site and install his package for your distribution. Switch your input method system from iBus to SCIM, then pick the newly-installed Avro input method and the Avro keyboard layout.
  • Probhat – change your keyboard layout to the Probhat keyboard, which comes with Ubuntu. You don’t need an input method editor.
  • BCC – change your keyboard layout to the “Bangladesh” keyboard layout, which comes with Ubuntu. You don’t need an input method editor.
  • Bijoy – if you want to use free software, you have a problem. Mr Joppa’s opposition means there are no good solutions for using Bijoy in Linux with free software. Your best bet is probably to use BCC, and learn the differences.

Thanks to Mahay Alam Khan and Shabab Mustafa for checking draft versions of this post. Any errors remain my own.

Google Calendar Tab: Two Enhancements

Dear lazyweb,

I have been using the awesome “Google Calendar Tab” to have my calendar in Thunderbird. However, if I restart Thunderbird, I have to remember to open the tab again – and if I forget, I don’t get reminders. Also, because I have my message pane set to use a fixed-width font, the Google Calendar also appears in a fixed-width font, which is pretty ugly.

So I’d really like two features added – “start when Thunderbird starts” and “ignore message pane formatting preferences”. I emailed clarkbw, the extension’s author, but it turns out he only accepts feature requests in the form of pull requests into his source repo on github :-|

I have rather a lot on my plate right now but if this blog post inspires someone to add those features, that would be awesome!

Dotzler’s Law of Smartphone Assimilation

Update: It has been pointed out to me that I just reinvented “Raymond’s Rule of Smartphone Subsumption“. While I prefer the Borg-esque overtones of “Assimilation”, I have to admit he got there first. And he does have a couple of useful qualifiers on his rule which deal with edge cases noted in the comments.

I present Dotzler’s Law of Smartphone Assimilation, which is:

The smartphone will assimilate the functions of any electronic device smaller in size than itself.

Devices that this has happened to already include:

  • Mobile phone
  • Pager
  • PDA
  • GPS
  • Camera
  • Music player
  • Portable gaming console
  • Portable WiFi hotspot
  • Dictaphone
  • Calculator
  • Torch
  • Radio
  • Guitar tuner

It has even happened to some non-electronic devices, such as:

  • Compass
  • Spirit level

Resistance is futile… Can anyone suggest any more assimilated devices?

JS Total Deminifier?

Patrick Walton has written a “JS Deminifier“, which undoes some of the work of minification to make your production JS easier to read.

What if, though, the minifier were to dump out its internal state, in the form of mappings from long names to short names and whatever other info was necessary, in a way a deminifier could understand? And you could then load that file into the deminifier in your browser, and it could apply it in reverse during the deminification process?

You could debug production websites, using the production minified code, but actually be able to read it in view source, and even perhaps in Firebug! :-)