Category Archives: Software

Setting up Java in Debian the right way

I’ve been using the OpenJDK, but I had some problems with it: Android Studio and PyCharm are tested with Oracle’s JDK, and as such there are known bugs and crashes with OpenJDK. To fix my instability issues I had to take the hint and switch to Oracle’s. Here’s the official doc for setting this up in Debian:

Following the explanations, I was able to convert Oracle’s tarball to a deb package using make-jpkg, and with the update-alternatives examples I could set the default version to use correctly. (Before this I was setting JAVA_HOME and PATH by hand, which is dirty, don’t do it.)

Overriding TMPDIR when you don’t have enough space on /tmp

Sometimes you might not have enough disk space on the /tmp directory but need it badly. For example when creating a deb package from a Java tarball in Debian using make-jpkg, there’s no command line parameter or any other apparent means to specify an alternative working directory for temporary files.

Check-mate? Luckily, no! I could force a different directory using the TMPDIR environment variable like this:

TMPDIR=/some/where make-jpkg  jdk-7u45-linux-x64.tar.gz

Solaris got goood (version 5.11)

Looking through my old drafts in this blog, posts I never published, I found this piece.

I recently installed the new OpenSolaris, version 5.11, released in 2008 December, I think. From the live CD. On my laptop. Earlier versions used to be quite painful, and I would definitely not consider putting on a laptop. (Ah, that’s a lie. I did actually install 5.10 on my ThinkPad X31…)

5.10 used to require a LOT of disk space. I remember failed installations on a virtual machine with a 10G virtual disk, running out of space. The new 5.11 system installed from the Live CD is only 2.4G now, much better!

But enough talking, let’s get to technical stuff. What compelled me to post this entry is the ease at which I could do things that used to be difficult, such as:

  1. Setup sudo. In the past I had to install sudo and visudo myself. Now, they are included in the system by default.
  2. Install vim. This used to be tricky too, now it’s installed by default, with all the modern features such as syntax highlighting. Oh joy.
  3. Setup sudoers. In the default configuration users in group “wheel” can execute all commands. Solaris doesn’t have a group called “wheel”, but it has a group called “staff” with GID 10, which is the usual GID for “wheel”. After making this change I was going to add my user to this group, but then, I found it was already member of this group, which makes perfect sense, as this is the first user I created during installation.

And so on and so on. These are little things, but it’s great to see real UNIX systems becoming free and so much more usable than in the past.

I don’t know why I didn’t post, back in 2009. I guess I wanted to write more cool things. I’m posting now, because it made me want to install OpenSolaris again ūüôā

Adding udev rules for USB debugging Android devices

USB debugging of my Google Nexus 4 phone used to work just fine from my Debian desktop. Until someday it just stopped working. The symptoms looked like this:

$ adb logcat
- waiting for device -
$ adb devices
List of devices attached 
???????????? no permissions

That is, adb logcat was just waiting forever even though my phone was connected, and adb devices was giving permission errors. There was no easy answer on stackoverflow, but lots of clumsy ones, suggesting to make the adb binary setuid, or adding udev rules with 0666 permissions. I really had to get to the bottom of this myself.

These are the steps to properly debug, understand and resolve the issue.

1. Find the bus and device id assigned by the kernel:

$ lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 045e:0053 Microsoft Corp. Optical Mouse
Bus 004 Device 003: ID 0566:3002 Monterey International Corp. 
Bus 001 Device 008: ID 18d1:d002 Google Inc.

I bought my device from Google, so it’s probably the last one.

2. Check the permissions of the device file

$ ls -l /dev/bus/usb/001/008
crw-rw-r-T 1 root root 189, 8 Nov 10 18:34 /dev/bus/usb/001/008

The path comes from the output of lsusb: 001 is the Bus, and 008 is the Device.

The problem is clear: the file is owned by user root and group root, which I am neither. The elegant solution is to add a udev rule so that the device will belong to a reasonable group, like plugdev, of which I’m a member.

3. Create a udev rules file, let’s say:¬†/etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d002", MODE="0660", 
GROUP="plugdev", SYMLINK+="android%n"

Here, idVendor and idProduct come from the output of lsusb: 18d1:d002. Do similarly for your own device. The rule specifies that a matching USB device should be created with permissions 0660, with group plugdev, and a symlink conveniently pointing to it.

Now that everything is ready, simply plug the device out and back in to confirm the result:

$ lsusb | grep oogle
Bus 001 Device 010: ID 18d1:d002 Google Inc. 
$ ls -l /dev/bus/usb/001/010
crw-rw-r-T 1 root plugdev 189, 9 Nov 10 18:37 /dev/bus/usb/001/010
$ ls -l /dev/android7
lrwxrwxrwx 1 root root 15 Nov 10 18:37 /dev/android7 -> bus/usb/001/010
$ adb devices
List of devices attached 
01d1e2510d9c6d28 device

PS: no need to restart udev, the changed rule should be picked up automatically.

Adding all unknown files in a Subversion checkout

Adding all unknown files in a working tree is usually very simple in other version control systems, for example:

git add .
bzr add

Not so simple in Subversion:

$ svn add .
svn: warning: '.' is already under version control

But if you add the --force flag, that will do!

Keep in mind that this is not the same as:

svn add * --force

That would add not only unknown files, but ignored files too, which is usually not you want. Make sure to specify directories explicitly, avoid using * with this command.

Released new version of Wine Notes on Android

The new version (1.1) of Wine Notes is now on Google

What’s new?

  • Fixed the broken EURO sign
  • Now you can select the currency
  • The last used currency becomes the default currency
  • Wine names you enter are now automatically “title-ized”
  • Changed to a bright theme in most dialog screens
  • Replaced the text buttons with image buttons in tag editor dialogs
  • Removed the pointless Quit menu option
  • Many minor usability and ergonomic improvements

Check it out, and I hope you’ll enjoy!

Feel free to tell me about problems and feature requests on GitHub:

This app is still a work in progress, with many more features planned but not implemented yet. If a missing feature is important to you, feel free to drop me a line, and I’ll try to make it happen.

Added voting and other improvements on

I took my time, but finally here are a bunch of improvements I just released on, check it out!

Now you can upvote or downvote one-liners using the familiar interface of


And since now that there are votes, it’s natural to sort one-liners not only by date, but by votes too. So I changed the one-liner listing pages to switch between different ordering using a tabbed user interface:


Speaking of tabs, the profile page was quite awful, with too much information cluttered on a single page. So I broke that into multiple pages, again using a tabbed user interface:


There are many other, smaller improvements since the last time. I’ll let you discover those by yourselves.

The voting feature is only the beginning. Just one of the essential steps for full-blown gamification. I’m pretty sure I won’t be able to do this all alone though, so I hope to find partners soon.

Finally, I revised all the texts on the site. Take a look, and note the strong emphasis on the educational aspect. The site is about high quality and well-explained bash one-liners. Not just any random ugly scripting hacks. I want all those one-liners there to be perfectly written, and nicely explained so everybody can understand them, and learn something useful.

If you have a scripting question, the best place to go is probably and¬† I love those sites. But you know what, they don’t encourage perfect answers. They don’t encourage combining multiple good answers into a single great answer. That’s the void I’d like to fill. That’s the direction I’d like this project to evolve into.

Released Computer Quiz on Android

androidI just released the first version of¬†Computer Quiz.¬†It’s a simple multiple choice quiz app for computer fans, professionals and geeks.

Questions are spread out over multiple categories and difficulty levels:

  • Hobbyist level: 100 questions
  • Professional level: 106 questions

There are different “game” modes, such as “score as you go”, “sudden death” and “score in the end”. You can change the number of questions per game in the settings menu.

The app doesn’t require any permissions at all, doesn’t use internet, doesn’t collect data about you and has no advertisements. I intend to keep it that way.

At the same time I also upgraded the Programming Quiz. Both apps have exactly the same features, but different database of questions, with some inevitable overlap. The questions in the Programming Quiz are designed specifically for professional and aspiring programmers, while the Computer Quiz can be interesting for casual computer fans too.

If you like these apps, please remember to rate, +1, tweet, or review them, and spread the word. Thank you!

You can report problems and feature requests on this page:

How to enable developer options on Android Nexus 4

I spent a couple of long minutes looking for the developer menu on my shiny new Nexus 4. I was looking for the options normally called USB debugging and Stay awake, normally under Applications / Development. I could not find them anywhere on this otherwise beautiful piece. Strangely, the menu is disabled by default. You can enable by following these steps:

  • Open your phone settings—swipe down on the phone, click on the button in the top-right corner, click Settings
  • Click About phone, it’s at the bottom
  • Click on Build number, 7 times (!!!),¬†it’s at the bottom

What the hell… Who would have known? After this the Developer options¬†menu becomes available, right next¬†About phone.

I found the tip here:



Released Programming Quiz on Android

I just released the first version of Programming Quiz LITE.

It’s a simple multiple-choice quiz to test your programming skills. It aims to be interesting, fun and educational. You could even use it to prepare for programming job interviews, regardless of whether you are an interviewee or an interviewer.

Questions are spread out across multiple categories and difficulty levels:

  • Hobbyist level: 51 questions
  • Professional level: 116 questions
  • Expert level: 61 questions

Question categories are designed along the lines of the “programmer competency matrix”¬†¬†There are 228 questions in total for now, I plan to more soon, making it at least 100 on all levels. The questions are 100% original I create them together with my programmer friends.

You can “play” in two modes: normal mode and sudden death mode. In normal mode you can postpone answering a question and you can navigate back and forth in the questions. In sudden death mode you have to answer N questions in a row. You can customize the number of questions in both modes.

To report problems or feature requests, you can either email me directly or use this page:

Project homepage:

This is the LITE version: it is FREE with NO ADS. There will be a paid version soon, which will be identical to this one, but it will have a price of 1 euro just to give you a way to say “thank you” and support my efforts if you want. If you like the app, please remember to rate it, +1 it, tweet it, review it, and spread the word. Thank you!