Recovering deleted files

Today I accidentally deleted all files in my /home/Documents directory and had to recover some of them.
Luckily, there’s an easy way with the extundelete program.

First of all, umount the target partition:
sudo umount /home

Note: if you get the ‘device is busy’ message, you can add the lazy option:
sudo umount -l /home

Then install extundelete (if you don’t have it already):
sudo apt-get install extundelete

Now recover the files that were deleted from that directory, for which you need to specify the mount point (use df -h for that):
sudo extundelete --restore-directory /home/Documents /dev/sda5

This will create a RECOVERED_FILES directory with all the file structure of the deleted directory, containing the files that could be restored.

Finally remount the target partition:
sudo mount -o remount,rw /dev/sda5 /home

That’s it!

How to check processes bandwidth consumption

With nethogs you can monitor network bandwidth usage on a per-process basis. Just install it from source to avoid a socket error:
wget -c https://github.com/raboof/nethogs/archive/v0.8.5.tar.gz
tar xf v0.8.5.tar.gz
cd ./nethogs-0.8.5/
sudo apt-get install libncurses5-dev libpcap-dev
make && sudo make install

And execute it as sudo, pointing to the network interface you wish to monitor, for instance:
sudo nethogs wlan0

nethog

Human or Machine?

favicon

We’re conducting a quick survey in order to (sort of) replicate a previous study on digital signatures¹ but this time focused on stroke gestures. Can you guess which gestures were drawn by a human and which gestures were drawn by a machine? The test can be completed in 30 seconds or less, at the end of which you’ll see your score. So, how well did you perform?

____
¹ Galbally, J., Plamondon, R., Fierrez, J., Ortega-García, J., 2012. Synthetic on-line signature generation. Part II: Experimental validation. Pattern Recogn. 45 (7), 2622–2632.

Enabling SSL in Nginx

Last year I quickly commented how to enable SSL on Apache. Now I’ll do the same for Nginx, which has been my primary HTTP server choice since then, BTW.

First, create the certificates:
cd /etc/nginx/
sudo openssl genrsa -out localhost.key 1024
sudo openssl req -new -key localhost.key -x509 -out localhost.crt
sudo chmod 600 localhost.*

Then edit /etc/nginx/sites-available/default and put the important parts:
server {
listen 443 ssl default_server;
ssl_certificate /etc/nginx/ssl/localhost.crt;
ssl_certificate_key /etc/nginx/ssl/localhost.key;
}

Finally reload Nginx:
sudo service nginx reload

That’s it!

PS: These tips are for development pruposes. In production you’ll need a chained certificate (aka certificate bundle).

How to use Type 1 fonts in a multilingual LaTeX document

Recently I had to deal with a font encoding issue in our MobileHCI’14 paper about phrase sampling methods. The thing is that we wrote some example sentences in 10 different languages, and LaTeX seemed not to like the Russian ones to begin with.

The first approach was to put this in the preamble:

\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}

This generated a “valid” PDF via pdflatex, although it was using Type 3 fonts. So I received a kind email from Sheridan Printing (Lisa M. Tolles, we miss you!) saying that Type 3 fonts are not allowed in material appearing in the ACM DL. The paper must use exclusively Type 1 fonts.

Therefore I had to google for a while until finding the following solution. BTW, this was tested on Ubuntu 14.04 with Tex Live 2013.

First, install the UCS package:

sudo apt-get install texlive-latex-extra

Then put this in the preamble:

\usepackage[T2A,T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[russian,english]{babel}
\usepackage{pslatex}

And enclose with \textcyrillic{} the corresponding text.

Finally, you can proceed this way:

latex file.tex
dvips -P pdf -o file.ps file.dvi
ps2pdf file.ps

That’s all, folks!

Spain, no country for postdocs

It’s been about two years since I got my PhD from the Universitat Politècnica de València (UPV) and nothing has changed, research-wise. I was hired in tranScriptorium as research support staff, where I keep doing the same things as before graduation. Don’t get me wrong, I love what I do and am pleased to work with a really competent and skilled team at the PRHLT research center. However, at the UPV there are no possibilities of promotion or tenure. Not at all. And it seems to be the case for most of Spanish universities as well.

Gone are the glory days when your PhD gave you direct access to a tenure track. Currently, Spanish researchers who retire are no longer replaced. That’s insane. As a result, the vast majority Spanish postdocs are basically wasting their time. This is the fate of most people that get their PhD today in Spain. Simply put, Science is not a priority in Spain.

I don’t know what would be the best solution for this pressing problem. Moving to another country? Perhaps, but this decision should be optional for the brave postdocs, not mandatory because they have no choice. Actually, this is leading to a massive brain drain, which is bad for science and therefore bad for everyone. Running a startup or a spin-off? Perhaps (actually that’s what I did), but not all researchers are ready for entrepreneurship. In my opinion, good researchers should be given the opportunity to get some kind of internal promotion. For instance, being able to lead some research project or appearing as principal advisor in master’s theses, PhD theses, or final degree projects.

PS: As a side effect of all of this, there are many departments filled with affluent peers that no longer do research. But that’s a story worth of another blog post.