Solution: Converting a series of pictures to a PDF

So with my last presentation given in a not really mature presentation tool I still wanted to provide PDF slides for people to look at. So I took screenshots of every single slide and then wanted to put those into a PDF. But how to do it? I started out with Libreoffice and inserting images there maximizing them – but that’s way too boring, repetitive and time consuming. So a quick google search came up with this instead which worked instantly. You got to have imagemagick installed (on Linux at least it should already be installed as many packages depend on it, otherwise do sudo apt-get install imagemagick). With imagemagick you can just do the following on the console:

convert image_pattern*.png my_presentation.pdf

Or for me personally it was:

convert Screenshot\ from\ 2013-08-14\ 10\:4*.png shoes.pdf

Et voila a beautiful PDF with all my slides.

Hope this helps you!

Setting up PostgreSQL for Ruby on Rails on Linux

So every once upon a time I run into the situation, that I have a newly set up machine and have to configure my system again to use PostgreSQL and play nicely with Ruby on Rails. And I don’t want to have to google the set up every time, hence this post (and of course to help people with similar problems). Why PostgreSQL? Well many people like it and you need it for instance for deploying on heroku and your development environment should be as close to your production environment as possible.

What I do here is a way that works for me on my Linux Mint Debian Testing machines. Be aware that this is my development set up – I don’t use this in production.  I’m no PostgreSQL expert so, this just works for me and I hope that it will for other people as well :-). Suggestions/Improvements are welcome as always.

Let’s get started! So at first we have to install PostgreSQL:

sudo apt-get install postgresql

After we’ve don this we need to create a user in PostgreSQL. So we use the user account of PostgreSQL to create a user with sufficient rights. I just take my own account and grant it sufficient rights with PostgreSQL. Don’t forget to substitute my username with yours!

tobi@speedy ~ $ sudo su postgres
[sudo] password for tobi:
# the behavior of createuser seems to have changed in recent postgresql versions
# So now do the following (-d says allowed to create databases):
postgres@speedy /home/tobi $ createuser tobi -d # replace tobi with your user acc name
# In older versions it used to work like this:
postgres@speedy /home/tobi $ createuser tobi # (substitute with your username)
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n

At this point it would be good to install the pg gem – which is the adapter for the PostgreSQL database. So simply add

gem 'pg'

to your Gemfile. Also make sure to replace existing database gems – like sqlite. Now run:

bundle install

to update your dependencies. That should go smoothly, otherwise you are probably missing dependencies.

Now you still need to modify your config/database.yml. Most of all you need to change the adapter to “postgresql”. Here is the development part of my database.yml for reference:

  adapter: postgresql
  database: ArbitaryDatabaseName
  pool: 5
  timeout: 5000

Make sure that the different environments (development, test and production) have got different databases (meaning the database property should be different). Otherwise they will influence each other and you don’t want that.

In order to finish the set up you need to create all the databases, which should work flawlessly by now:

rake db:create:all

When this is done you should be able to “rake db:migrate” your database as you are used to (and be sure to do so).

I hope this post helped you with setting up PostgreSQL for Ruby on Rails on Linux. If something didn’t work for you, you feel that a step is missing or you just have a useful tip – please feel free to comment!

Automatically compile CoffeeScript on Save with gedit

CoffeeScript is a nice layer on top of JavaScript that takes away quite many of JavaScripts quirks and rough edges. I really like it as it makes development much more enjoyable to me. It compiles directly to JavaScript which is awesome for compatibility reasons. However that means whenever you change a file and want to test the changes you have to recompile the file. Some editors do this automatically. gedit however doesn’t have CoffeeScript support out of the box.

That’s relatively easy to fix however. At first you should go ahead and install syntax highlighting for CoffeeScript. So now we got some nice syntax highliting, looks better right?

The auto compile problem is also easy to fix. gedit comes with the External Tools plugin which makes it fairly easy to fix this when CoffeeScript is already installed properly (for installation information click here).

At first you need to activate the External Tools plugin. Go to Edit->Preferences and then select the Plugins tab. It should look like this:

External Tools in gedit
The plugins menu in the gedit preferences

Make sure that the box before External Tools is checked. Now you can go to Tools->Manage External Tools… Click on the + on the bottom left in order to add a new tool. Name it however you like and insert the following in the code box:


Now you can choose whatever shortcut you would like for this command. If you make sure to set the applicability to CoffeeScript files only and set Save to “Current Document”, then you can even set the shortcut to Ctrl + S. That works beautifully for me.  The option to set the applicability to CoffeeScript only might only be available after installing the syntax highlighting for gedit mentioned earlier. Here’s what my settings for my compile CoffeeScript tool look like:

External Tools Settings
The External Tools Settings for making CoffeeScript compile automatically on save

This should do it. If it doesn’t work, feel free to leave a comment so we can sort that out 🙂

Happy coding everyone!

PS: This should also work with pluma, a fork of the old gedit editor from the MATE project

Autostarting applications in Linux Mint Debian Edition

A few days ago I finally made the step to switch from Linux Mint main edition (Linux Mint 10 was getting old) to the all new Linux Mint Debian Edition Release Candidate with the new Cinnamon desktop. It’s been great so far.

However I was really missing a feature of the main edition. There you could simply right click on a menu entry and say “Launch on startup”, which has been the most convenient way to add an autostart that I’ve ever seen. Browsing the settings and the web I at first didn’t find a way to autostart applications. I found lots of descriptions involving files and directories that don’t seem to exist in my Linux Mint Debian Edition. Well enough babbling.


Simply run:


You can do this in the terminal or with Alt + F2 (gnome do). There you have a list of all your startup applications and you may add applications by specifying their command (like: “thunderbird” or “firefox”) but you may also remove startup applications. This looks something like this:

This should work with all Gnome based desktops (Gnome 2, Gnome 3, Mate, Cinnamon), I haven’t tested it though. It’s fairly easy but embarrassingly took me long enough to figure out, so I figured that it’s better to blog about it and maybe save somebody else some time.