• Tutorial: recover lost saved session in Firefox

    Have you noticed that sometimes the saved sessions in Firefox are lost after a crash, leaving you with a clean, default homepage when launching it?

    However if this happens to you, you’re not alone! There is a quite simple way to recover it.

    The Saved Sessions are saved in a file called sessionstore.js under your ~/.mozilla/firefox/yourprofilename.default-backup-crqashrecovery-date

    Your profile name has a series of letters and it finishes in “.default”. For example: mcwubzdq.default

    Now if you list the files in ~/.mozilla/firefox you will see various of these files, ending with a date and time (for example: mcwubzdq.default-backup-crashrecovery-20140217_075716). The trick here is to save an old sessionstore.js file and overwriting the empty one in your profile.

    So first of all close Firefox and go to your profile directory and rename sessionstore.js:

    cd ~/.mozilla/firefox/profilename.default

    mv sessionstore.js sessionstore.js.old

    and now let’s assume that you want to use the session from the 17th of February 2014:

    cp ~/.mozilla/firefox/profilename.default.default-backup-crashrecovery-20140217_075716/sessionstore.js .

    That’s it! Now you can launch Firefox and enjoy your saved session tabs!

  • Tools to benchmark JavaScript

    If you are a JavaScript programmer, web enthusiast or just curious, you may want to test your browser JavaScript performance. Every test uses different approaches and tells you a different part of the story. If you are really interested in understanding which one would be good for your intentions I would strongly recommend to go through all of them and check their pages to read all the details.

    This is the most up-to-date list I could compile, to ease your hunger of benchmarking:

    SunSpider

    Apple’s Webkit team is behind this popular benchmark. It provides you with a link to your results once the test is completed.

    Octane

    New version of the old V8 Javascript Engine. It has been developed by Google and is a part of the Chrome browser.

    Dromaeo

    Dromaeo has been created by John Resig (JavaScript Tool Developer at Mozilla). It’s actually a collection of a number of benchmarks which are broken up into two main categories – JavaScript and DOM. It reiterates the calculations at least five times to grant more accurate results.

    Acid3

    Acid3 is not a real benchmark. It’s a compliance test created by the Web Standards Project to understand if a browser is capable of properly display (render) certain instructions.

    The maximum score is 100 and anything lower than this will basically says that your browser has failed the test.

    Kraken

    Mozilla Kraken Java Benchmark uses predefined test cases and run them in your browser giving the results in milliseconds. Lowest results are better.

    RoboHornet

    It’s another Google creation, still in alpha state, it aims at creating a super complete set of real life situations to replicate in the tests. It asks collaboration from the community to improve its standards and sets.

    If your interested at testing your own code speed, I would suggest two different websites:

    Jsperf
    BenchmarkJS

    but this is already interesting for another article…

  • Migrate between Ubuntu distro or change desktop environment?

    One of the most visible changes (but not the only one!) between different Ubuntu distro is the Desktop Environment.

    Looking at the official information page about Ubuntu derivatives we can see many distributions like Lubuntu, Kubuntu, Xubuntu and so on, all officially maintained by Canonical.

    The beauty of any linux distro is that you can customize it as you want. Ubuntu is shipped with Unity desktop environment, however if you want to test (or remove) another environment, it’s quite easy:

    Install Ubuntu Unity:
    sudo apt-get install ubuntu-desktop

    Remove Ubuntu Unity:
    sudo apt-get purge ubuntu-desktop

    Install LUbuntu LXDE:
    sudo apt-get install lubuntu-desktop

    Remove LUbuntu LXDE:
    sudo apt-get purge lubuntu-desktop

    Install Ubuntu GNOME:
    sudo apt-get install ubuntu-gnome-desktop

    Remove Ubuntu GNOME:
    sudo apt-get purge ubuntu-gnome-desktop

    Install KUbuntu KDE:
    sudo apt-get install kubuntu-desktop

    Remove KUbuntu KDE:
    sudo apt-get purge kubuntu-desktop

    Install XUbuntu XFCE:
    sudo apt-get install xubuntu-desktop

    Remove XUbuntu XFCE:
    sudo apt-get purge xubuntu-desktop

    Remember that when you install a desktop environment you normally install extra software like games, accessories, etc, therefore once you have removed one using the “purge” option, you can then run:

    sudo apt-get autoremove --purge
    To clean up all the extra software. This is because the extra software is not uninstalled when you uninstall the main environment.

    Another option is to skip the installation of extra software by slightly tweaking the command. For example to install KUbuntu KDE environment just add –no-install-recommends as shown below:

    sudo apt-get install --no-install-recommends kubuntu-desktop

    Finally I have noticed that even if you remove completely the desktop environment associated to your distribution (for example you remove Unity from Ubuntu) leaving another one installed, as soon as a new version of the distribution is available, the original desktop environment is installed and set as default again. Therefore I’ve learned that the best way to migrate your Ubuntu distribution to another distribution is to download and burn the ISO of the next version (or even the same version!) and launch the installer.

    LUbuntu installation screen

    LUbuntu installation screen

    As you can see from the screenshot, by using this method you can migrate your distribution to another, without worrying about losing your settings or reverting back to the original one.