Author Archive


Posted by Vitalie Ciubotaru

For those who don’t know me, my name is Vitalie Ciubotaru and welcome to my blog.

I post about my hobbies, primarily computers, gardening and a bit of economics. I know this is an unusual combination, and it is unlikely to get much attention, if at all. However, as I don’t aim for much attention, I feel free to write whatever I want (including all those boring memos I don’t want to keep my mind), and whenever I want (which means seldom, rather then often).

PCC on Ubuntu

Posted by Vitalie Ciubotaru

Previous posts on this topic:

* * *

As my patch for Portable C compiler (PCC) was accepted, pcc can do __builtin_popcount() and I can use it to compile my pet projects written in C (bitfield, bitfield-eca, bitfield-io, bitfield-rule30).

I updated my ppa repository at Launchpad. Now it provides a recent (20170524 snapshot) version of pcc for a wide range of Ubuntu series.

PCC on Ubuntu 12.04 (update)

Posted by Vitalie Ciubotaru

Previous posts on this topic:

* * *

Good news from the Portable C compiler (PCC): their latest snapshot supports multiarch. This means pcc will compile and work out-of-the-box on Debian and Ubuntu. I couldn’t resist sharing my debs, so I learnt how to use Launchpad and set up a dedicated repo. Feel free to use and comment.

* * *

Follo-up posts on this topic:

PCC on Ubuntu 12.04

Posted by Vitalie Ciubotaru

The developers of PCC (the Portable C compiler) released version 1.1.0 of the compiler and compiler library, so I decided to give it a run on my computer.

Source packages are available at To get a working compiler, one needs to build both pcc and pcc-libs. I followed the instructions for earlier versions of Ubuntu, with some modifications.

First, for uniformity reasons, everything will be installed in /usr instead of the default /usr/local. All libs go to /usr/lib instead of libexec. So, the ‘configure’ command looks like ./configure --prefix=/usr --libexecdir=/usr/lib.

for both packages. The order probably does not matter. I started with ‘pcc’. If ‘flex’ and ‘bison; are missing, the ‘configure’ script will not complain, but the build will fail. So we need to ‘sudo apt-get install flex bison’ before going any further. Compilation is lightning fast, but you can accelerate it a bit by using

make -j[number of cpu cores/threads]

Next, we install the compiled files to their places under /usr. Instead of doing ‘sudo make install’ I did ‘sudo checkinstall’.

The install of ‘pcc’ failed because of a conflict in /usr/share/man/man1/cpp.1, so I had to rename the man file and repackage the deb (here is a good guide).

The install of ‘pcc-libs’ went smoothly, but when trying to build a helloworld.c, pcc executable complained about not finding ‘crt1.o’ and ‘crti.o’. It turned out that it’s a well-known problem not yet solved in 1.1.0 (see discussion here). I just copied these files (together with ‘crtn.o’) from /usr/lib/i386-linux-gnu to /usr/lib/pcc/i686-pc-linux-gnu/1.1.0/lib, and repackaged this deb, too.

To add the final touch, I rebuilt both packages with ‘pcc’ instead of ‘gcc’ (by passing CC=pcc to the ‘configure’ scripts). Here are the packages for i386:

And here are the packages for amd64:

* * *

Follow-up posts on this topic:

The current state of Share-on-Diaspora plugin

Posted by Vitalie Ciubotaru

Previous posts on this topic:

* * *

Here is an update on what changed in the plugin codebase since my last post.

As of this writing latest stable version has just reached 0.5.7 (this time last year it was 0.4.1). During this year a number of major improvements were made. First of all, with the help of Diaspora enthusiasts the plugin was translated into Italian, Japanese, Portuguese, Romanian, Russian, Serbo-Croatian, Spanish and French. Now it is possible to use a custom image as a share button. The blog owners can add their own pods to the list. The list of active pods is synced with data provided by

Some more ideas are brewing and will probably be included in the forthcoming version 0.6.0:

  • Button presets — a number of predefined designs (shapes and colors) of the ‘share’ button for blog admins to choose from.
  • More ‘magic’ in button customization, like a visual color picker and live prevew.

Special thanks go to all people who helped localize the plugin: Vostok (Brazilian Portuguese), Andrew Kurtis and David Charte (Spanish), Sandro Kensan (Italian), Borisa Djuraskovic (Serbo-Croatian), Stef20 and Se7h (French)!

Although I consider myself a seasoned Seamonkey user, I regularly bump into the same problem: after I set up a new mail account, it fetches all mail from the server and happily deletes the originals. It is not much of a problem, because I delete them from time to time, but I still felt somewhat uneasy to see them deleted. Same thing happened yesterday. Recently I switched to my own mail server and, as have full control over it, I figured that this time I should be able to put my mail back. Here’s how I managed to restore all deleted mail.

Step 1. Find your local mailbox

Seamonkey stores its local mailbox somewhere like ~/.mozilla/seamonkey/8fde346h.default/Mail. In case you fetch mail from several addresses, there will be several sub-directories here (one for each source of mail). Locate the directory that corresponds to the mailserver you need, cd to it, and find the file called Inbox.

Step 2. Upload your mailbox file to your mailserver

scp Inbox

Step 3. Transfer the messages into your mail account

This is the most important part. Once your mbox file is on the server, you need to parse it and move every message into your mail account. I did it with

formail -s /usr/lib/dovecot/dovecot-lda -d username < Inbox

Wait for the transfer to end (it may take quite some time, depending on the mailbox size), clean up (delete the Inbox file).


  • The dates will be broken (the date of transfer instead of the date when the original mail arrived).
  • Because of the issue above, your mail client will download all messages again.

Let’s assume we have three sibling elements (list items in this example, but it can be anything), like this:

<li id="1">One</li>
<li id="2">Two</li>
<li id="3">Three</li>

We want to cycle through them by pressing up/down keys. We want the “active” item to be highlighted somehow (say red text instead of black. All we need is some JavaScript:
var active_id = '1';
Element = document.getElementById(active_id); = 'red';

document.onkeyup = KeyCheck;

function KeyCheck(e) {
var old_id = active_id;
var Key = (window.event) ? event.keyCode : e.keyCode;
switch (Key) {
case 40:
case 38:
if (active_id < 1) active_id += 3; if (active_id > 3) active_id -= 3;
Old = document.getElementById(old_id); = 'black';
New = document.getElementById(active_id); = 'red';

Done. This code listens to keypress events, “filters” the Up/Down arrow presses and reacts to them by coloring our list items.

Demo on jsfiddle.

A later update: to loop through clickable links, just change < li > tags to < a href= > and add New.focus() at the end of KeyCheck(e) function.

Previous posts on this topic:

* * *

It has been almost four months since the initial release of this plugin. Here is a brief wrap-up of what was done in this time and an outline of my plans for the future.

At this point, the latest stable version is 0.4.1. Compared to 0.1, the plugin was improved in a number of ways. Both the button and the pod list are now customizable. A customizable button means that you can change the way your share button looks (shape, size, color, mouse-over effects, text on the button etc). Customizable pod list means that the blog admins can hand-pick the pods that readers are likely to use, and hide the unnecessary ones.

Some more improvements are underway and will probably be included in the forthcoming version 5.0:

  • Internationalization support is added. All strings from version 4.1 are internationalization-ready.
  • There is an ongoing effort to translate the plugin into other languages. At this point, Portuguese (Brazil), Romanian, Russian and Spanish translations are ready, with the Italian and German versions likely to follow soon. Special thanks go to Vostok, the admin of DIASPORA* BRAZIL, who contributed the Portuguese translation and to Andrew Kurtis from, who contributed the Spanish translation.
  • It will also be possible to replace the button with a custom image. Some great button images can be found at Domestic Empire blog, all licenced under CC-BY-NC-SA (Note: A perfect license for end-users, but less so for plugin developers).

Ideas for the future include integration with other social buttons (to give readers more choice), color-profiles (to make it easier for bloggers to choose the right color combinations), further localizations (to widen the user base), customizable text for the reshared posts etc.

* * *

Followup posts on this topic:

Inspect localStorage objects

Posted by Vitalie Ciubotaru

After announcing the Share on Diaspora plugin on, I received a comment from Marc Jay Cobbs who “managed to save a wrong pod URL”, which renders the button unusable. Because I did not read carefully the javascript function that saves URLs (I reused it from another button), my answer was misleading. Time to correct the errors.

The button can lock the user into resharing to one single Diaspora pod. The lock is pretty strong — instead of saving the preferred pod into a cookie, it saves it into a localStorage object, which proved to be very difficult to get rid of. It might be better to save it into a cookie, but I decided against this “functionality”, so I’ll be removing it in future releases.

In the meantime I wrote a little tool to inspect (and delete!) the localStorage objects. Apparently, there’s nothing like this available, or at least nothing I could find. It’s in my GitHub repo, feel free to use it: It’s very easy to use: save the file somewhere, open it with your browser and delete the unnecessary objects.

My first WordPress plugin: Share on Diaspora

Posted by Vitalie Ciubotaru

Not that I’m planning to write plugins for WordPress on a regular basis, so the first attempt may very well be the only one. Anyway, that is it: I wrote a plugin for WordPress.

This plugin adds a “share on D*” button to the bottom of my blog posts. D* stands for Diaspora, a free and open-source distributed social network (basically, a network of independent, but interconnected, servers). While we can see an entire zoo of share buttons for Facebook, Twitter and the like, Diaspora buttons are really hard to come by. The existing buttons are mostly limited to one host, while the code of the “properly cooked” ones can not be used out of the box. My plugin is nothing but an effort to collect the good code and package it.

This is how it looks in the `Twenty Thirteen’ theme, under the default `Hello World’ post:

Share on Diaspora button

Share on Diaspora button

"Share on D*" button

Choose a Diaspora pod from the list or type it in the text field.

Share on Diaspora button

Share on Diaspora button

The plugin is written according to Diasporial quidelines — it allows the user to select his/her pod. Its code is hosted in my Github repository. Version 0.1 of the plugin has passed the official WordPress screening and was accepted into the WordPress Plugin Directory (plugin page). Everybody is welcome to use, distribute or improve it.

* * *

Followup posts on this topic: