Wednesday, August 10, 2016

Getting Started with x86-64 Assembly on Linux

In this post we will learn how to assemble and link a simple "Hello World" application written in x86-64 assembly for the Linux operating system. If you have experience with Intel IA-32 assembly and you want to quickly get adjusted to the x86-64 world then this post is for you. If you're trying to learn the assembly language from scratch then I'm afraid this post is not for you. There are many great resources online on 32-bit assembly. One of my favourite documents is Paul Carter's PC Assembly Language, which I highly recommend if you're moving your first steps into the assembly language. If you then decide to come back to this post, you should be able to read it with no problems, since the tools that I will employ here are the same used in Carter's book.

Saturday, June 25, 2016

The Nest of Heliopolis PPA repository on Launchpad gets updates after a while

Recently I managed to find the time to update a couple of new packages from my Personal Package Archive (PPA) on Launchpad. For those of you who don't know where to find it, click here. If you want to automatically get updates as they come out, you can install it on your Ubuntu by simply issuing

$ sudo apt-add-repository ppa:phoenix1987/ppa
$ sudo apt-get update

from your terminal. In brief, the changes involved Sopcast Player Plus, a fork of SopCast Player by Jason Scheunemann, and gtumbler, the application I have developed in the Summer 2012 as part of the first edition of the Ubuntu App Showdown. So let me now give you the details of what has changed with this new releases.

Tuesday, January 21, 2014

How to convert a SIM into a MicroSIM

Until a few days ago, all my mobile phones were capable of hosting an ordinary SIM card in their belly. And since I'm talking about 5 years old technology residing in my pocket, it was the time for a change and get some new hardware. As I didn't really follow the recent developments of telephony (5 years are, indeed, a long time span if you compare it with the way shorter characteristic time in Moore's law), I came to know that my future Android mobile will only be able to swallow MicroSIM cards.

So how can I put a SIM card into my new masterpiece of technology right away? After consulting Mr Google for a few advices, two possible solutions popped out: either your phone company will be happy to replace your SIM with an MicroSIM (or a NanoSIM. Yes, there are NanoSIM as well if you, like me, didn't even know about the existence of MicroSIM), or ... wait for it ... you can make your own MicroSIM out of your old SIM!

Tuesday, December 25, 2012

How to fix a double clicking Logitech MX1000 wireless laser mouse

I've got an almost 7 years old Logitech MX1000 wireless laser mouse. After a few years from the purchase I started experiencing a rather annoying issue: every now and then a single click was followed by a quick misfired second double click. So it became hard to accomplish simple tasks like moving or resizing a window with this mouse. Now I have decided that I had enough and I started looking for a solution. Googling around it turns out that this is a very common problem among Logitech mouse users, e.g. [1, 2]. As you can read from those posts, you have basically two roads: either your mouse is still covered by the warranty period and therefore you can ask for a replacement, or you fix it by yourself (of course you can always choose to throw your Logitech mouse away and go for a replacement, but I won't discuss this option here :P)

Saturday, July 21, 2012

gtumbler - A New Graphical PDF Manager for Ubuntu

I am delighted to announce the first stable release of gtumbler (formerly gistiller), a new graphical PDF manager completely written in Python. It is distributed under the terms of the GNU GPL v3 license (the pyPDF python modules shipped with the app are distributed under a modified version of the BSD license). If you want to give it a try you can get it directly from my PPA "The Nest of Heliopolis" hosted by Launchpad. If you are using Ubuntu 12.04 Precise Pangolin, you can add my PPA to your APT sources list by simply typing

sudo apt-add-repository ppa:phoenix1987/ppa
sudo apt-get update

Then you can install gtumbler with the command

sudo apt-get install gtumbler

or directly from the Software Center.

The major features of gtumbler are:

  • convert PostScript documents to PDF format;
  • merge multiple PostScript/PDF documents into a single one
  • extract pages from document;
  • modify the bounding box of each page in a document (e.g. to crop white margins)
  • pattern renaming of a list of documents You can also modify each document by invoking a PDF editor directly from gtumbler. By default gtumbler uses Xournal.

    Here is a screenshot of the application in action

  • Tuesday, November 29, 2011

    How to make your wireless card work with Network Manager after Debian 6.0.3 "squeeze" installation

    I have a pretty old HP Pavilion dv1000 laptop with a Intel Pentium M Processor 740 at 1.7 GHz. I have always used Ubuntu along with the pre-installed version of Windows on that machine, but as new releases became more resource-hungry, I started to experience an unacceptable slowdown. Of course you can use a lighter window manager, such as Xcfe, but since I'm too affectionate to GNOME 2 I decided to make a new start with Debian. I then downloaded the latest 6.0.3 stable release and burnt it on a CD-RW (the other option is to boot the installer from the net, since it seems that you can't boot anything from removable USB media).

    The installation process of my new OS went just fine, but in order to download updated packages from the internet I had to use my cable connection, since the Intel wifi adapter needed proprietary firmware that wasn't shipped with the first Debian CD. So I configured my ethernet card, and this turned out to be a source of problems, maybe the one you are experiencing now if you are reading this little guide. During the installation I had configured my ethernet to a static IP address, and everything went fine, Debian booted beautifully, fast and clean.

    The first thing I did then was to install the Intel wifi adapter firmware in order to make my wifi card work properly. I have then enabled the non-free part of the official Debian repositories in my sources.list file and executed the following command

    # apt-get update && apt-get install firmware-ipw2x00 wireless-tools

    Then I have restarted the networking service and Network Manager with

    # /etc/init.d/networking restart
    # /etc/init.d/network-manager restart

    At this point I configured my wireless connection with the graphical frontend to Network Manager (accessible through the icon in the notification area, usually near the clock on the top-right corner of the desktop) and...surprise! The association with the access point went just fine, but I couldn't ping my router nor any other machine on the local network. Weird, uh?

    It turned out that this issue was related to the previous network configuration, the one carried out during the OS installation process, since in that case the installer wasn't supposed to use Network Manager to manage the connection. The solution is then pretty simple, I just had to edit my /etc/network/interfaces to look like the following minimal example

    auto lo
    iface lo inet loopback

    and after rebooting my wifi adapter started working like a charm again.

    As a final remark I'd like to inform you that with Intel Wifi ipw2200 adapters you might need to use the firmware version 3.0 for the WEP security encryption. So the best thing to do is probably to move to a more secure encryption protocol, like WPA or WPA2.

    Sunday, June 26, 2011

    Google Books plugin for Referencer

    I'm going to break this rather long silence with a post on a plugin for Referencer.

    Referencer is a GNOME application especially designed for scientists, for it organizes any type of documents BiBTeX can handle, and ultimately allows you to export the whole collection into a single BiBTeX file (see this article @ Wikipedia and the project homepage for more details). Among the capabilities of Referencer there is the possibility of adding references from ID like the DOI code or the arXiv identifier. One feature that is still lacking is that of adding documents from web urls, although you can create an empty reference with only the field "url" filled. Since I'm currently working on my thesis for my Master's degree in Theoretical Physics, I need a plugin that instructs Referencer how to fetch books metadata from a web page containing the description of books. One of such sites is the fabled Google Books and in what follows I'm going to explain why I've chosen this particular site. If you search a book on Google Books, go on its details page (if you're in the preview page, just click on "About this book" on the left) and scroll down to the bottom of the page. There you'll find three buttons that will allow you export the bibliographic metadata in three different format. Fortunately one of such formats is BiBTeX, and Referencer is able to fill a document metadata from a bibtex file. I then wrote a plugin that allows to fetch this bibtex file from Google Books by pasting the address of the book into Referencer.

    How to install the plugin:
    1. download the plugin file from here;
    2. put into directory ~/.referencer/plugin (you might need to create this folder);
    3. run Referencer and enable gbooks if not already enabled.

    How to use this plugin:
    1. run Referencer and go to menu entry Documents->Add reference with ID...
    2. select Web URL from the dropdown menu
    3. paste the Google Books url in the text field and press OK

    Sunday, January 16, 2011

    pyGtkPlot: yet another graphical front-end for gnuplot

    The main window of pyGtkPlot.
    As the title of this post suggests, I'm going to introduce to you a new graphical interface for gnuplot. The name of the project, pyGtkPlot, surely synthesizes the programming language employed and the target window manager: python and gnome/gtk+ respectively. This project has a (not so) old C ancestor, the gtkplot project at (a C++ translation was on its way, but was never released to the public, and probably it'll never be). Since the development of the C and C++ version was becoming very slow due to the fact that the team of developers was composed of only one member (:P), that very same one member decided to turn his head towards python. This important decision took some time to become reality, because basically that implied the choice between performances and development speed, but now the pyGtkPlot has officially came to life, and it is hosted at There are no stable releases at the moment, but you may consider each new revision as a release candidate. This is because pyGtkPlot embeds the gnuplot x11 terminal inside its graphical interface (for this to work you must have the latest version of gnuplot installed on your linux machine), still retaining all the original interactiveness of gnuplot. Moreover you have the opportunity of sending commands to gnuplot directly, as though you were running it from a console. The only difference is that you have some additional aids at your disposal coming from the surrounding gtk+ widgets of the interface, which will increase in number at each new code revision pushed on Launchpad.

    Basically, you start with a new gnuplot session with default settings and add new plots by configuring the panel at the left and then clicking o the + (Add) button in the toolbar, or the Edit -> Add menu entry (keyb. shortcut: Alt + a). You can save the current session for later uses or load a previously saved session in order to modify it or export the plots in different formats, actually in all the terminal supported by your installation of gnuplot (of course you may not want to choose a terminal that does not write to a file, like wxt or x11 :P). You can embed mathatematical formulae too using LaTeX syntax and export in png format directly (check the menu File for this). But, as ever, the best way to learn how to use pyGtkPlot is by playing around with its commands.

    Monday, January 3, 2011

    How to implement a non-blocking two-way pipe in Python

    I was surprised by the lack of a way to read from a stream without blocking in Python, and this is the main reason why I'm writing this post. Some years ago I had the urge to open a two-way channel of communication between the program I was writing and an external command-line program (actually a GUI). I had solved this problem in mainly two different ways in C and C++ on Unix, by using pseudo-terminals in one case, and duplicated file descriptors in the other. Here we are going to create an object which inherits from a preexisting class which is provided by one of the modules for Python.

    Monday, December 27, 2010

    sopcast-player: a graphical frontend for sopcast

    SopCast is P2P way of broadcasting video and audio contents over the internet. The main line of development revolves around the Windows platform, but there is a unix command-line alternative. Jason Scheunemann has developed a graphical frontend for Gnome known as sopcast-player, today at version 0.4.1. I wanted to add some useful features to this great application, so I started editing the version 0.3.3. The result has been released as a branch of the main program at launchpad, where you can find more details about the differences and the source as well.