28 March 2008 - 23:22Why I Worked On Firefox

Perhaps being stressed out and tired and after having some drinks isn’t the best time to write blog posts, but this is something I’ve been thinking about over the last few days. And I suppose in other conditions, I definitely wouldn’t be as open about this as I probably will be. I’m not accustomed to talking about personal things in person and especially not blogs. I tend to focus on objective things that “gets things done.”

So why did I work on Firefox?

Maybe I like to help people. Maybe I just like making things better when I see a problem that I can fix. Maybe I just want the world to be a better place. Or maybe I just like to work long hours. I do all this even if I don’t get much out of it. I suppose good thing about Firefox is that it’s open source and anybody can contribute and there are many people to help.

I recently sent Gerv an after-summer-of-code update and only then realized how much I’ve worked on. How much I wanted to help those people have a better experience. How many problems I saw that I could fix.

Both the download manager and location bar were being changed for the better, but there was so much more work to be done. Just to list a few things, I’ve added better download manager functionality with cross session resumable downloads, auto-pause/resume on sleep/wake, auto-resume on browser restart/crash, various fixes for saving files and some download status bar work.

Additionally, there’s the redesigned download manager UI work with the full listing of downloads and the ability to do multi-word search against any text shown in the list, and providing a way to display download progress / speed / times consistently as well some localization support for plural forms.

And of course there’s the work to make the location bar awesome. I wasn’t happy with the location bar return seemingly random results, so I decided to make things better. I started with the adaptive learning, but along the way I added in multi-word searching across urls, titles, and tags as well as word boundary matching. I also pushed patches for emphasizing all matches and cleaning up the display to be more compact as well as correct for foreign characters. There are also performance fixes to make results come back faster and render with less work.

Unfortunately, there were costs in making things better for everyone else. I haven’t been concentrating on my coursework, and my assignments have been partially completed when I turned them in. I’ve been tired and feeling burned out.

Just last week, I easily spent over 100 hours on Firefox stuff for my 1-week spring break. I wasn’t catching up on my assignment that was due the week before. Why not? There are still many things that I feel should be fixed.

I suppose I finally couldn’t take the stress from keeping things in, so I talked / cried / discussed with my Ph.D. advisor about things. He has been very good to me even though I haven’t focused as much on my research as I should have. Especially that he’s paying for my research assistantship and my tuition waiver. So I suppose unofficially, all my work on the Download Manager and the AwesomeBar has been funded by my advisor. (Apparently the download manager, location bar, and download manager again are the top 3 favorite features of Firefox 3 at mozillalinks, so I hopefully his money didn’t go to too much waste.)

But just working long hours isn’t really that bad. And I never really minded before, so I guess there must be something else.

It might be related to the improportionate amount of effort that I put in and what comes out. For those who followed the adaptive learning work to make the location bar into AwesomeBar, you might have noticed the code was pretty much ready when I first wrote about it in my blog early November. It wasn’t until a quarter of a year later (and almost 20 versions of the patch — mostly unbitrotting) that the patch got the appropriate bits twiddled so that it was high enough on the priority list to be reviewed and make it into Firefox 3.

I don’t think I did anything wrong in the process. I followed the rules and even provided extensive testcases. Perhaps there’s an issue with the code / review / approval path? For some reason, it just seems strange to me that only after people have done all the work writing the code, creating testcases, and getting reviewed does a final approval decision say yes or no.

It might also be that I try to fix too many things at once. I tend to have 10-20 patches on my mercurial queue stack, and the bases keep changing as things eventually get reviewed and modified. Maybe I’m creating artificial work unbitrotting myself, but that needs to be done when certain patches are deemed to be more important and I need to pull it from one end of my stack to the other.. Conflicts galore.

I realize it’s time to ship and changes need to cut back, so the process will have more hoops to jump through. But maybe I wasn’t expecting so many.

I still have a number of patches ready that add some neat things to the AwesomeBar such as being able to restrict searches to history or bookmarks and forcing matches against the url/title (additionally, you can set it up to force your queries to match against the url by default or only search non-bookmarked items). There’s also showing keyword queries and searching for strings as well as ignoring the protocol (e.g., “h” doesn’t match Http). Of course there’s tweaks to the adaptive learning to make it even better. But I suppose those will likely get to Firefox Next.

But back to unexpected hoops and tightening of the review process.. Earlier today, I was trying to make it easier to write download manager *test* code by adding a notification, and it was a very simple change to the download manager code. I simplified and cleaned up one of the testcases, but apparently it’s not good enough to review without at least 10 more testcases.

Also, I was trying to add in support for multiple-selection in the download manager so you can easily select multiple downloads to delete, pause/resume, etc. I even had a testcase locally that makes sure only selected items were deleted, but apparently the minimum number of things to test would be at least 20 more testcases.

But it’s getting late, and I suppose I’m feeling better already.. a little. Perhaps enough to even stick in an emotion 😉 . Maybe I’ll feel good enough by the morning to finally post about the new awesomeness of the AwesomeBar for Beta 5.. definitely with more pictures too. 🙂

11 Comments | Tags: AwesomeBar, Mozilla, UIUC

11 March 2008 - 23:43Using the AwesomeBar

How are people using the AwesomeBar in Firefox 3 Beta 4 [mozilla.com]? (Please comment. [ed.agadak.net])

There have been a lot of positive comments already: searching for multiple words like the domain plus title, adaptive learning that immediately brings previously selected results to the top.

But there are a few that say the desired results aren’t showing up. I’m not sure if they haven’t tried Beta 4, or if they’re just commenting based on previous versions. Or maybe they’ve installed extensions that revert the look of the location bar and haven’t really tried the new features.

Common complaints include typing “news” and getting results that match in the title instead of the url. However, that should be instantly fixed when the user selects the desired result from the list after typing out more of the url. Next time typing “n” will have the previously-selected page at the very top.

Below is a sample thought process that could only be possible with the AwesomeBar*.

I’m trying to find a news article I read yesterday..

Searching for “news”

The first result has news matching at the beginning of the url

Oh, it’s matching a lot of pages that I’ve tagged. I know it’s something in my history that I haven’t bookmarked.

Searching for “news ^”

Restrict results to non-bookmarked pages

Much better. I actually see some Firefox results that I was looking for to begin with. Let’s filter out the pages I don’t want.

Searching for “news ^ fire”

History pages that match the url and title

Beta 2? Beta 3? I just want beta 4 news articles!

Searching for “news ^ fire “beta 4″

String matches for pairs of words like “beta 4”

Perfect! I love the awesomebar! Hehe, thanks shaver. 😉

* The screenshots were taken with a trunk build (win32, os x, linux [build.mozilla.org]) that contain some patches: 393678, 419656, 417441, 415397, 421315, 407946, 415403, 418257, 392143, 249468, 395161, 407204, 406257, 420437, 414326 [bugzilla.mozilla.org]. Feel free to try it out and see if it finds results better or just looks better (6 rows and smaller font size).

* edited downloads to include word boundary matching

36 Comments | Tags: AwesomeBar, Mozilla

3 March 2008 - 16:56Beyond Awesome

It’s been exactly four months since I first wrote about the AwesomeBar [ed.agadak.net], and how it would become awesome with adaptive learning, which makes Firefox give you the pages that you want with just a single letter typed in the location bar.

Firefox 3 Beta 4 will have this feature. 😀 Everyone will be able to play with it in just a couple weeks.

Adapted dropdown

Adaptive learning puts your most selected results first

The adaptive learning even works for the drop down menu without typing any words. So those who prefer using the mouse can benefit as well. But if you ever do select a page after typing some words, it will also learns to show those results when you click the auto-complete drop-down.

But that’s not all that’s new in Beta 4. There has been many improvements to the location bar since Places landed, and here’s a short list of changes since the first beta.

Beta 1: Search page titles and urls – not just the start of a domain; Match page tags
Beta 2: Two line view with title first; Emphasize first match in title then url
Beta 3: Global frecency for better ranking; Search bookmarked pages; Emphasize first match in both title and url; Unescape url-encoded URLs

Outside of adaptive learning for Beta 4, there’s also the ability to search with multiple words [ed.agadak.net]. I first wrote about the feature letting you find pages that match the domain and a word from the title.

It’s even better. You can also match against the tags you’ve added to pages, so you can just treat the tags as extra text in the page’s title, except they’re common across multiple pages. This means you can type a tag, a domain, and part of the title to get the exact page you want. As a bonus, the pages are treated like any other page, so they aren’t specially placed at the top of the list, and you don’t even need to type out the whole tag in the same order you tagged the page to match it. 🙂

So what else is there?

Well, it’s already Beta 4, and there isn’t much time left to keep adding features. But I’ve got some neat things that are somewhat geared towards more advanced users. Whether or not they make it in for the final version of Firefox 3 is in the air. I’ve already implemented them, so we’ll just need to see if people have time to review and approve the changes.

Show tags and restrict to starred

Only search pages with a star

First up is being able to restrict search to certain pages [bugzilla.mozilla.org] such as those that you’ve bookmarked, which have a star in the drop-down. You can type a single “*” at the beginning of the search and do the multi-word search as normal, except only bookmarked pages are searched. Also, you might notice that pages will show which tags they have [bugzilla.mozilla.org] and where they match.

Restrict to history

Only search through history

On a similar note, you can also use “^” to find pages only from your history — pages that have not yet been given a star. I find myself using this type of search without additional search terms to find pages that I’ve frecently visited, and perhaps I would want to bookmark and tag them. One last special search is with “+” that restricts the search to tagged pages. Of course you can customize the character you want to type for the special search, so you can make it “!” or even “z” or more verbose “tags”. 😉

Keyword search

Show the keyword search

Another feature helps show a powerful feature of Firefox. Keyword searches. 🙂 Basically, they’re special bookmarks that you can create by opening the context menu on any search box of a website. You give the search a keyword, and then in the location bar, you type that keyword and the terms that you would have put into the box on the web page. You can easily search for content such as Wikipedia pages, YouTube videos, IMDB movie information, and more.

Except now, you get a keyword auto-complete entry [bugzilla.mozilla.org] showing which page you’ll be going to. Additionally, you can even reuse the same keyword for multiple searches because now you can pick which one gets used.

String searches

Search with phrases

Sometimes treating each word as a separate search isn’t quite enough, and what you really want is two words right next to each other. Perhaps you want to find that page that tells you how to bug mozzy (… 😛 ), but all your searches for “bug moz” finds bugzilla bugs! Just put the phrase in quotes and you can search quoted strings [bugzilla.mozilla.org]!

Emphasize all search terms

Emphasize all matches for all words

You might have noticed in the previous screenshots, multiple parts of the result get emphasized. For Beta 4, it’ll only emphasize words that match as the phrase, so most of the time, if you type multiple words, it won’t emphasize anything. The screenshot above shows “amatching in all places [bugzilla.mozilla.org], not just the first. Additionally, all words/phrases [bugzilla.mozilla.org] are treated separately when showing matches.

For the very observant crowd, you might have already noticed the screenshots have a smaller font size for the page title [bugzilla.mozilla.org]. But additionally, the number of rows has been reduced from 10 to 6 [bugzilla.mozilla.org]. Hopefully, being able to find pages with multiple words against the title, url, and tags in additional adaptive learning will lessen the need to show 10 results by default. There will be fewer results for you to scan, but you can also filter pages more easily by typing another word that you know to be in the title or url.

We’ve come a long way since Firefox 2, and we’re getting really close to shipping Firefox 3. But hopefully there’ll be some time to get in at least some of these features. 🙂

23 Comments | Tags: AwesomeBar, Mozilla

27 January 2008 - 12:54Plurals, Downloads, Statuses for Yous

Now that the bug to show days, hours, minutes, seconds for download times [bugzilla.mozilla.org] has landed, there’s some new neat things to use to help support localization of plural strings [ed.agadak.net] as well as making download progress texts consistent.

PluralForm for Developers
To get the correct plural form of a word in Firefox or an extension, the javascript file just needs to import the module and call a method.

// Load the module at the top of the javascript file
let Cu = Components.utils;
Cu.import("resource://gre/modules/PluralForm.jsm");
// Get "word" or "words" based on the number
let word = PluralForm.get(number, "word;words");

In this English example, there’s only two words, but other languages might need fewer or more. More information about what string to give to PluralForm.get() for various languages is on the devmo wiki page Localization and Plurals [developer.mozilla.org].

So anywhere in your code you’re doing something like..

let string = number == 1 ? singular : plural;

.. you might want to consider using the PluralForm module.

PluralForm for Localizers
To help localizers make sure they’re correctly localizing the plural strings, I’ve created a pluralForm Checker extension [ed.agadak.net xpi 3.6 KB].

pluralForm Checker v0.3

Strings can be checked to have the right word for a corresponding value

With this tool, localizers can list the property files and properties that have plural forms to check. Each string is split up into its appropriate plural form and there’s a sample output display at the bottom for the first few numbers of each plural form.

Notice that “words” don’t necessarily have to be a single word.

pausedDownloads=One paused download;#1 paused downloads

Of course, for a language that has multiple values that are treated as singular (1, 11, etc.), the first paused string can’t be hard coded to “One”.

DownloadUtils
In fixing the bug, there is now also a DownloadUtils.jsm module [mxr.mozilla.org].

This provides some useful methods for downloads such as displaying file sizes, transfer times, and download locations. Once again, it’s loaded just like PluralForm.jsm using Cu.import(), and it can be used in Firefox or extensions.

For example, right now the automatic updates dialog still uses the old download strings from long before: “1.2 of 8.4 MB at 146 KB/sec; 00:32 remain”. We could use DownloadUtils to make it consistent with the redesigned Download Manager for Firefox 3 to be “32 seconds remaining — 1.2 of 8.4 MB (146 KB/sec)”. This mean it would also get the benefits of being able to display “days, hours, minutes, seconds” and “GB, MB, KB, bytes” as well as time smoothing. (Hopefully updates never take that long or are that big.. 😉 )

This DownloadUtils.jsm module helps simply implementing download related displays such as the new download activity summary in the status bar [bugzilla.mozilla.org].

Download Activity Status Bar
Thanks to Michael Schonfeld, we can now monitor downloads from the status bar! 😀

Michael first uploaded a patch to the bug [bugzilla.mozilla.org] out of nowhere about a month ago. I had him wait on me because he would be running into issues with plural forms and download strings. After I landed the patches for PluralForm and DownloadUtils, Michael was able to quickly update his patch in about an hour to be ready for the l10n string freeze. (Additionally, the original patch went from 22.13 KB to 5.76 KB just to show how much the modules simplified things. 🙂 )

Download Activity Status

A brief summary of downloads for easy user monitoring

Personally, I’ll be turning off the preference that shows the download manager when a download starts. I can now open files without having an extra window pop up while still knowing how much time it’ll take. As for saving files, I can easily alt-click links to save many files at once without being interrupted with the download manager flashing.

5 Comments | Tags: Mozilla