katratxo on Software Development

tail -f /var/log/brain | grep -i software

Development tips – Part I

with 5 comments

This is the first one of a series of posts about development tips that I use in a daily basis. I think that you can benefit from them, and speed up your daily work. There are some one-line commands that you can use to execute several things in one shot. Those is targeting GNU/Linux users.

Speeding up Firefox

I have found a few tips that can improve its performance.

Use different profiles

Add-ons could decrease the performance of your browser. One example of decreasing performance add-on is Firebug. It’s just a great tool to debug JavaScript, CSS, HTML, monitor requests, etc, but it has a known issue:

“… If you have Firebug installed you are probably not getting fast Javascript. Firebug doesn’t have to be active on your current page …”

That’s why is a best practice to use Firebug in a different profile.

I have a profile named “debug” where the only add-on installed is Firebug and made a simple bash script ffbug to open Firefox with that profile:

firefox -no-remote -P "debug" &

The -no-remote parameter allows you open a new instance of Firefox and not just a new window linked to the current running one. The -P is to define which profile you want to use.

VACUUM the SQLite databases

You can improve the performance of Firefox by vacuum your bookmarks, history, etc. databases.
Close all your running Firefox instances and execute:

~ $ for i in $(find -name '*.sqlite'); do sqlite3 $i VACUUM; done;

Useful one-line commands

Updating the source code of the modules your working on

In some cases you work with several modules at the same time, and you want to get all the changes made by your colleagues. You can update your local repositories by executing this line inside your modules folder:

for i in $(ls -1); do cd $i; hg pull -u; cd ..; done;

Example of the output of this is:

~/src/openbravo/working/pi-reference/modules $ for i in $(ls -1); do cd $i; hg pull -u; cd ..; done;
pulling from https://code.openbravo.com/erp/mods/org.openbravo.base.seam
searching for changes
no changes found
pulling from https://code.openbravo.com/erp/mods/org.openbravo.client.freemarker/
searching for changes
no changes found
pulling from https://code.openbravo.com/erp/mods/org.openbravo.client.kernel/
searching for changes
no changes found
pulling from https://code.openbravo.com/erp/mods/org.openbravo.service.datasource
searching for changes
no changes found
pulling from https://code.openbravo.com/erp/mods/org.openbravo.service.json/
searching for changes
no changes found
pulling from https://code.openbravo.com/erp/mods/org.openbravo.userinterface.selector
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 13 changes to 13 files
13 files updated, 0 files merged, 0 files removed, 0 files unresolved
pulling from https://code.openbravo.com/erp/mods/org.openbravo.userinterface.smartclient
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 3 changes to 3 files
3 files updated, 0 files merged, 0 files removed, 0 files unresolved

You can easily hack this line by executing another Mercurial command, e.g. See what’s the status on each repository:

for i in $(ls -1); do cd $i; hg st; cd ..; done;

Update and build the latest pi

Assuming that you want to use the latest stable revision from pi, you can check our continuous integration framework and see what’s the latest revision that passed all the tests, then you can update your local repository to that revision and rebuild your system. Or you can copy this bash script (pi-update), and execute it inside your pi working copy:

REVISION=`wget -q -O - http://builds.openbravo.com/job/erp_devel_pi-full-pgsql/lastSuccessfulBuild/changes | awk -F: '/https:\/\/code\.openbravo\.com\/erp\/devel\/pi\/rev\// {print substr($3,0,12)}' | head -n1`
hg pull
echo "Updating to rev $REVISION"
hg up -r $REVISION
ant smartbuild -Dlocal=no

This script uses wget and awk to get the latest revision from the last successful build page, pulls all the changesets of PI and updates your working copy to the detected revision, then updates your database and compiles the application.

Cleanup your working copy

The hg status command will tell you which files Mercurial doesn’t know about; it uses a “?” to display such files …

I often want to clean my working copy and remove all unversioned files. You can rid of those file by executing:

 hg st -nu | xargs rm -rf

That’s all folks! I’ll come back with more tips in the future. Disclaimer: I’m not a bash expert so I know that some of this commands could be simplified. I would also like to thank iarwain for simplifying some of this commands.


Written by katratxo

January 15, 2010 at 11:21 am

Posted in Openbravo

Tagged with ,

5 Responses

Subscribe to comments with RSS.

  1. Thanks for the tips Iván. I think that it would be also great to have these tips published in the Openbravo wiki site too.


    Adrián Romero

    January 18, 2010 at 12:22 pm

  2. katratxo,
    Do you have any other suggestions other than that “Use different profiles” outlined in this article and concerning to “Speeding up Openbravo in Firefox 3.5”?

    thanks in advance


    Conrado Peraza

    January 21, 2010 at 12:18 am

    • Hi Conrado,

      I think that the speed of Firefox with a ‘plain’ profile (I mean without any add-on) is OK, obviously is not Chrome but is OK. The main reason of a slow Firefox using Openbravo is Firebug. Make sure that you have it in a different profile. As i stated in the post, you could speed a it by executing vacuum of your sqlite databases. You could try the Mozilla Links that usually post tips for Mozilla products.




      January 21, 2010 at 10:23 am

  3. Hi Iván,

    Just a tip I’ve just discovered about Hudson. Almost every page has a XML API [1], and it allows XPath selection in the URL [2].

    This way you don’t depend on the interface changes.

    Juan Pablo

    [2] http://builds.openbravo.com/job/erp_devel_pi-full-pgsql/lastSuccessfulBuild/api/xml?xpath=/*/changeSet/item%5B1%5D/node


    May 4, 2010 at 7:47 pm

  4. […] a comment » In Part I I explained how […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: