Multi-process Firefox on the N900 ?

I’m really glad fennec/firefox RC 1.0 came out for maemo! If you’ve got an N810 or N900, but haven’t installed firefox on it yet, rush to from your device browser and click “download”. With it, you’ll be able to unleash all the great plugin power you were used to with the desktop version! Try it.

Here’s a snapshop I did with the “load-applet” app available on the Maemo Select repository. I’m still amazed at the N900 processing power. it lets me surf google maps as I used to on my desktop firefox!

I’m even editing this blog entry with fennec/firefox running on my N900 !!

I’m currently working on the Electrolysis project (multi-process firefox) and so, I can’t keep thinking of all the implications a multi-process fennec would have on the N900. Watch for more news.

Tagged , , , , ,

An introduction to dual debugging

As a firefox/electrolysis developer, I recently hit a little snag with some harder-than-usual part of the code. I had written a code patch for it, and found very difficult to see the associated effects of my patch compared to the expected non-patched results. Dual-debugging was really indicated here and I therefore spent some time formalizing a win32 dual-debugging method of my own to increase my efficiency.

But first, what’s dual-debugging ?

“Dual-debugging” simply means debugging two versions of the same application *at the same time* (usually a patched and a non-patched versions). The major advantage is that it lets you easily see the tiny differences that your patch brought up (by stepping through the code on both debuggers). The main drawback is that this method requires more ressources from your system (usually two codebases and two profiles).

I’m developing on Windows with the very stable and mighty Microsoft Visual Studio 2008. The following is a step-by-step tutorial explaining how you can easily setup a dual-debugging environment. I’ll take “electrolysis” as an example, but you can apply those principles to almost any other application.

dual-debugging HOWTO :

1. Duplicate your working tree

To trace into your code on both debugguers, you’ll have to duplicate your code directory in a similar, parallel location. For example, let’s say your code is located under :


let’s just copy the whole “codebase” directory to this new location


2. Duplicate your MSVC projects and solutions

Same thing here. Your MSVC project files contain important information about sources files that are going to be debuggued. You must duplicate all the *.sln and *.vcproj. For example :

D:\WORK\MSVC\*.*  -->   D:\WORK2\MSVC\*.*

3. Duplicate your profile for the debuggued application

Many applications use user preferences for various runtime checks. One of those is to make sure the application is not already instanciated when you run it. This is the case with firefox and electrolysis. If you keep a single user profile, you won’t be able to debug two instances of it in parallel because it’ll say : “Firefox is already running in the background…” To solve this problem, just create another profile. For firefox, or electrolysis, this is easily done by :

./firefox -P dummy

Using the little firefox profile GUI, create another profile with a different name.

Then run the application once with the newly created profile. For electrolysis, with a newly created profile called “electrolysis2”, do the following :

./firefox -no-remote -P electrolysis2 -chrome chrome://global/content/test-ipc.xul

4. Modify the duplicates properly

Now, you have to make all the duplicated projects and code files point to the new directories and duplicated files.

  • With MSVC’s “Find and Replace In Files” dialog (CTRL-SHIFT-H),  change every “\WORK\” by “\WORK2\” …
  • For the duplicated working tree directory.
  • For the duplicated MSVC project directory
  • In MSVC, change the debugging command arguments to use the newly created profile. For example, if debugging electrolysis, do :
  1. Open the duplicated solution (.sln)
  2. Right-Click on the startup project’s “properties” pop-up menu item
  3. In the “Debugging” menu item, under “Configuration Properties”, change  “-P electrolysis”  for “-P electrolysis2”.

Tutorial : Development setup for Electrolysis (E10S)

Over the last month, I’ve exhaustively documented different development aspects of Electrolysis (E10S), the multi-process firefox. This step-by-step documentation can be found here.

The Mozilla Codebase is especially huge and complex, and because of its general scarcity of comments in the code and its lack of a single centralized documentation, it can be overwhelmingly hard for a newbie to setup his development environment and successfully tackle his first task. This is especially true for the electrolysis (e10s) project, where many processes run the mozilla codebase concurrently.

This documentation was written in an attempt to provide the new E10S hacker with basic knowledge about setting up, building and running the E10S project on any of the usual platforms, namely, Linux, Maemo and Window.

Tagged , , , , ,

Configuring pidgin to work with BIP

I’ve been using pidgin for some time now, as a mean to centralize all my IM communications. I really think it’s a great tool mainly because you can easily add ANY type of IM account to it… XMPP/Jabber, ICQ, MSN, Google Talk, IRC, etc… and also because it’s really cross-platform! The only problem is when I started working with Collabora and realized I was bothering people bad by constantly logging in and out of every automatic channels I had registered in pidgin. My situation is not unique, as I’m sure every developer/engineer with cross-platform tasks and/or multiple virtualized systems must encounter this frequent need for rebooting, thus, making the whole IRC community annoyed with /join and /quit messages.

The Collabora people I’m working with are in favor of using BIP, a nice IRC proxy. That being said, I thought I could offer the web a little tutorial on how to configure pidgin to work nicely with BIP, because there are some non-obvious parameters to set both on the bip and pidgin sides. I assume hereafter that you’re wise enough to read thoroughly and understand fairly the provided bip documentation. So the following tutorial will assume you’ve configured your “bip.conf” to something acceptable and that you’ve tried setting accounts in pidgin to point to your bip IRC proxy on the chosen port with proper passwords.

get ready :

IMO, the biggest challenge any pidgin user will experience when configuring his client for IRC Proxy is to overcome the sudden but painful understanding of the following fact : pidgin won’t let you create multiple IRC accounts unless they have different ‘server’ AND ‘user’ fields !  But of course, the problem is that all of your BIP-IRC servers (set in bip.conf) must be accessed using the same server (the host on which you’re running bip) and of course, you wanna log into your channels using the same username and/or nick !  So at first, I was stunned to realize that pidgin wouldn’t let me create my different accounts and considered them duplicates !! You gotta face the “an account already exists with the specified criteria” message many times to understand my despair.

But there is actually a very nice solution to this. Let’s make use of the BIP “ignore_first_nick” option! The following steps assume you’ve got a decently-configured BIP sitting (not running) on <>, and that you’re about to create, let say, 2 IRC server accounts in pidgin. Do the following :

  1. In piding, go to your accounts by striking Ctrl-A and add the first account by pressing the “Add…” button.
  2. Choose the IRC protocol
  3. Here, instead of typing your preferred username (which will become your nick if no other options are set), type a significant name that will identify the IRC server, e.g., “mozilla” if the intended IRC server is to be
  4. Enter your BIP server, i.e. the host on which BIP will run. For example,
  5. Typein your special BIP password (you’ve read the bip documentation, haven’t you !?) which is made up of three things separated by colons:  <the bip-username>:<your secret BIP password>:<the chosen BIP connection from your bip.conf connection list>. Now let’s say you have previously added a “connection” sub-section named ‘mozilla’ in your server-side bip.conf under the “user’ section named “erik23”. You would then enter “erik23:<mypassword>:mozilla.
  6. Click the “advanced” tab and enter the chosen port number which appears in the coresponding “network” section in bip.conf.
  7. Leave the “Username” and “Real name” blank. Bip’s gonna take care of that.
  8. Check “SSL” if your host needs it to be accessed. Click “Save”.
  9. Do the same steps for all your IRC servers, changing all the appropriate fields in concordance to what’s set in bip.conf. Remember to choose relevant usernames to identify the connections.

Once you’ve setup your accounts, the one thing you wouldn’t want is to log in your channels under the nick ‘mozilla’ or ‘freenode’ !!  So edit your bip.conf file :

  • In your “user” section, for all your “connection” sub-sections, add the following line:
ignore_first_nick = true;
  • in your “user” section, add the following lines
default_nick = <your chosen nickname>;
default_user = <your chosen username>;
default_realname = <your real name>

This will ignore on connect whatever username/nick your entered in your pidgin accounts and force it to those fields you entered in bip.conf. So now, you can have many meaningful pidgin accounts that all point to the same proxy server without having to use different username/nicknames.

The last thing I consider important while using proxy IRC servers with pidgin, is to enable the “persistency” of all your channels. That way, when you close your channel window, you stay logged-in. This is pretty simple :

  1. In your pidgin “Buddy list”, cclick the [Buddies] menu and then “Add Chat…”
  2. type in your #channel name, alias if needed. (it’s better to set channel passwords directly in BIP, so leave this one out). Choose a group for that Chat room.
  3. Check BOTH “autologin” AND “Remain in chat after window is closed”.
  4. click “Add”

and you’re good to go !  Happy ircing !

Installing Collabora gtimelog under Windows XP

My first week at Collabora was mainly stuffed with acclimating tasks (reading wikis) and getting all set with my three-platform system. One annoying thing every cross-platform developer come across at some point is setting up clients and programs once for each platform and for each box in the office.  My office’s got 2 main machines with 3 OS each. So do the maths !  Even if I tend to speed things up by installing programs with already-copied config files, the installation process must be done manually (I don’t want to ghost my disks !) for each platform/system.

One program I had to install, amongt others, was Collabora’s version of gTimeLog.  This home-hacked version enhanced this renowned timeloging client by adding server-side features and standardized tasks lists. My task, hereafter, is to offer the web a clear mini-tutorial of the how-to for installing TimeLog under Windows XP.

  • First, you need a good linux-like environment and a native software port. I like to use MinGW for that. You can easily get “MozillaBuild” which includes MinGW and Msys along with a bundle of tools, from “Mozilla’s build prerequisites” page under the MozillaBuild header. At the time of writing this paper, the newest version was 1.4, available here.
  • Start by downloading gtimelog sources (For those working for Collabora, download the git repository instead, as explained here).
  • Run a new MinGW shell by double-clicking on C:\mozilla-build\start-msvc8.bat  (for those who have Microsoft Visual C++ 2005 – if you’ve got another version, choose the .bat accordingly). You should get a black shell. You can close it for now.
  • Install the PyGTK dependencies
    • Download and install the most recent GTK+ bundle for Windows found here. At the time of writing this article, the newest gtk+-bundle was 2.16.4. (To fully install this bundle you need to uncompress its contents in a folder and manually add the bin subfolder to the system path by adding “SET PATH=%PATH%;C:\<path_to_your_GTK+-bin_dir>” to your start-msvcXX.bat file and restarting the minWG shell)
    • Download and install the most recent version of PyCairo and be careful to choose a version that matches your current Python version (see the XX in C:\mozilla-build\pythonXX for version info)
    • Download and install the most recent version of PyGObject and be careful to choose a version that matches your current Python version (see the XX in C:\mozilla-build\pythonXX for version info)
    • Download and install the most recent version of PyGtk and be careful to choose a version that matches your current Python version (see the XX in C:\mozilla-build\pythonXX for version info)
    • Download and install the most recent version of libGlade
  • Install the gTimeLog dependencies
    • Download and install the right M2Crypto toolkit for your python version from here.
  • Build and install gTimelog by opening another minGW shell and by typing :
cd <dir_to_gtimelog_sources>
python build
python install
  • You should find no error messages in the associated output. If you’ve got something like “The application has failed to start because libglib-2.0-2.dll was not found”, then be sure to add “SET PATH=%PATH%;C:\<path_to_your _GTK+-bin_dir>” to your start-msvcXX.bat file and restart the minWG shell
  • If you’re using the Collabora’s hack of gTimeLog, don’t forget to update .gtimelogrc to the example found at before restarting the whole thing!

Enjoy !

Working with Collabora

Last week, I started working on the Elecrolysis project with Collabora. I’m really excited and the fun thing about it is that I’m going to be hacking on the Fennec side (not firefox). So, from my last contract with the Mozilla people working on fennec performance, it’s almost as if I didn’t stop working!