stickeenote

Indentation with spaces and the tab key in Eclipse (3.5 aka Galileo)

28 May, 2010 - 00:29
Categories:

Indentation with spaces and the tab key in Eclipse. I've pulled quite some hair on this one and now that I found the solution, I decided to write it down, so I don't have to loose my precious hair anymore.

Everybody has its own preferences, but I like 2 space indentation for PHP (code style of Drupal) and 4 space indentation in Python. And when I press the tab key, I want to increase the indentation level, not insert a tab character. Doesn't seem like much to ask, but it took a long and frustrating process to get this working in Eclipse (3.5 aka Galileo at the time of this writing), Aptana Studio actually, with PDT for PHP development and the excellent Pydev for Python development.

Read more...

Keyboard shortcut for code completion in Eclipse on Mac OS X

30 April, 2010 - 18:39

Finally! I found how to get the keyboard shortcut for code completion working in Eclipse on Mac OS X. At work, on Linux, I use CTRL-SPACE all the time in Eclipse. Unfortunately that did not work on my MacBook: CMD-SPACE triggers the spotlight search widget and CTRL-SPACE is tied to the Quicksilver launcher in my case.

Read more...

Audio format conversion cheat sheet (aka how to)

2 December, 2009 - 14:17

In my day job, I regularly have to convert/transcode/re-encode audio data from one format to another. Because I typically have to do this in batch jobs, I'm mostly dealing with command line tools (on Linux) like Lame, SoX (Sound eXchange), MPlayer and FFmpeg. Having a cheat sheet of how to invoke them with the desired options has proven to be very useful, so here is mine. Note that I only cover the operations I mostly need, like format conversion, sample rate conversion, conversion to mono and trimming/cropping. If you need more/other functionality, look in the man pages or ask your favorite search engine.

[Update] also see a follow up blog post about an execution time comparison between SoX, FFmpeg and MPlayer.

Read more...

Showing the running command in a bash script with "set -x"

29 May, 2009 - 09:03

Bash scripts are handy for putting a bunch of longer running jobs in one batch. In some occasions it can be useful to know which command is running at the moment, especially when the commands do not generate output themselves or this output is redirected to files.

Bash has a simple setting to achieve this:

set -x

which, according to help set, enables the following feature:

-x Print commands and their arguments as they are executed.

Disabling it just takes a mere

set +x

You can play with it from the bash command line itself, or put it in a bash script of course.

Read more...

Ignore whitespace in Subversion diffs

20 May, 2009 - 15:24

When you're working on a software development project where not all parties use the same code style conventions or editor setting (like tabs vs. spaces, removing trailing spaces, etc), the signal to noise ratio of a source code diff can be a bit frustrating. Luckily, most diff programs have an option to ignore whitespace changes, for example -w or --ignore-all-space in GNU diff or colordiff.

The internal diff engine of Subversion also offers this option (since version 1.4 if I'm not mistaken), but it looks a bit weird to use it:

svn diff -x -w ventrolucator.cpp
Read more...

Setting global XFig defaults for working with LyX/LaTeX

15 May, 2009 - 10:26

When making a document with Lyx (or LaTeX), I often create figures and diagrams in XFig. I know, Xfig's user interface sucks big time. (I tried the Java port JFig, but that one even feels worse to me.) However, the main reason I bite the bullet is that it enables a work flow where the text you add to the XFig figure is typeset by LaTeX when you compile the document. This way, the text in the figure is in the same font as the normal text in the document and, maybe more importantly, you can use all the fancy LaTeX commands, e.g. to put mathematical expressions, symbols and formulas in your figure.

To make this work, one of the required things is to enable the "special" flag on the text objects in XFig, and use a LaTeX font. These things are disabled by default and manually setting for every text object is a bit tedious. To changes these defaults, you can start xfig from the command like with the following options:

Read more...

Subversion: undo committed changes

12 May, 2009 - 15:08
Categories:

How to undo/rollback a Subversion commit? A fairly basic question, but every time I need the answer, I can't manage to remember it from the previous time I did it. Asking Google helps eventually, but the signal to noise ratio of the top hits is a bit disappointing. This time I couldn't resist the urge to throw my own bot snack in the intertubes.

Say you just made a commit (revision 123 for file apple.py), you discovered (after the fact) that it was just crap and you want the previous version (revision 122) back.

Read more...

Flag a PDF file as binary for Subversion

11 December, 2008 - 01:05

Sometimes, Subversion thinks that a PDF is a text file, instead of binary data. This can hurt during commits or diffs, because Subversion tries to do textual diffs with binary data.

Solution: you can explicitly flag the file as PDF data and Subversion will handle it as binary from then:

svn propset svn:mime-type application/pdf yourPDFfile.pdf

localhost webdev: virtual host setup on Mac OS X with MAMP

23 October, 2008 - 11:28

Reminder to self: how to set up a virtual host for localhost webdevelopment on OS X with MAMP

  1. DNS setup: add an entry for the local domain name in /etc/hosts, e.g.
    127.0.0.1     foo.localhost

    and flush DNS cache with

    dscacheutil -flushcache

  2. Apache config (/Applications/MAMP/conf/apache/httpd.conf): add a virtual host entry like
    <VirtualHost *>
      ServerName foo.localhost
      DocumentRoot /Users/eddywally/Sites/foo/localhost-dev/drupal
    </VirtualHost>

    and restart webserver, e.g. with

    /Applications/MAMP/bin/apache2/bin/apachectl restart

  3. Connect to http://foo.localhost:8888 (don't forget the nonstandard port number, unless you configured MAMP to use standard port 80).
Read more...

Blender: background rendering

23 May, 2008 - 10:24

Yesterday I had to render a 3d animation for a colleague working on 3D television. He needed a short street-view video with depth map. Because there were some problems with some real world footage he wanted to use, he asked me to create an artificial video in Blender. After I created a simple scene with some models from www.katorlegaz.com, I wanted to render the whole animation overnight on one of the computers in our lab. I had some trouble with getting the command line arguments right and wanted to share this, in case someone else has the same problem.

I first tried

blender -b -a foo.blend

the option -b is for background mode, so I could log out from the computer after I started the job, the options -a is for (according to the command line help):render frames from start to end (inclusive), only works when used after -b I thought this was the bare minimum to get the job done. However, nothing happened but this:

Compiled with Python version 2.5.
Checking for installed Python... got it!
ERROR: No camera
 
Blender quit

Huh, no camera? There was an active camera, the scene rendered just fine from the UI, I checked my file over and over and everything seemed all right.

Read more...