Blogs

Had je 10 miljoen, wat zou jij dan doen?

18 January, 2007 - 17:03


Had je tien miljoen wat zou jij dan doen
een feestje bouwen en je geld op doen?
Ik kocht liters limonade, honderd kilo chocolade
om aan iedereen uit te delen!
...
Had je tien miljoen wat zou jij dan doen
een feestje bouwen en je geld op doen?
'k Zou een kermis laten maken,
en ik schreeuwde van de daken,
kom maar allemaal met me spelen!

Gert Verhulst, die al een veelvoud van 10 miljoen verdiend heeft, mag zijn belofte wel eens nakomen. Gelukkig zijn er mensen die hem daaraan helpen herinneren: www.gertje.info.


Niets vergeten, Gert Verhulst?

Get name of current function and caller with Python

11 January, 2007 - 15:22
Categories:

With the python module inspect, one can inspect (no kidding) the run-time python stack. Among other things, this makes it possible to get the name of the current function or callers. Handy for logging or debugging purposes. A simple script to illustrate:

import inspect
# functions
def whoami():
    return inspect.stack()[1][3]
def whosdaddy():
    return inspect.stack()[2][3]
def foo():
    print "hello, I'm %s, daddy is %s" % (whoami(), whosdaddy())
    bar()
def bar():
    print "hello, I'm %s, daddy is %s" % (whoami(), whosdaddy())
johny = bar
# call them!
foo()
bar()
johny()

output:

hello, I'm foo, daddy is ?
hello, I'm bar, daddy is foo
hello, I'm bar, daddy is ?
hello, I'm bar, daddy is ?
Read more...

Links are so uncool

24 November, 2006 - 11:23
Categories:

Why use a super standard, easy, one-click-compliant hyperlink when you can use some stupid, ugly widget loaded, two-clicks-needing annoyance instead?

Fortis choose language UI

Even the world famous good-UI-design-superstar does a weird thing for its Belgian front page:

Apple choose language UI

Look, it's not so difficult:

Belgium.be choose language UI

Download offline version of dynamic pages with Wget

24 November, 2006 - 10:43
Categories:

Remainder mainly to myself: short list of useful options of wget for recursive downloading of dynamic (PHP, ASP, ...) webpages (because wget's man page is too long):

  • --no-clobber: do not redownload pages that already exist locally.
  • --html-extension: append extension .html to webpages of which the URL does not end on .html or .htm but with things like .php or .php?q=boo&bar=4.
  • --recursive: turn on recursive downloading.
  • --level=3: set the recursion depth.
  • --convert-links: make the links in downloaded documents point to local files if possible.
  • --page-requisites: download embedded images and stylesheets for each downloaded html document.
  • --relative: only follow relative links, not absolute links (even if in the same domain).
  • --no-parent: do not ascend to parent directory of the given URL while recursively retrieving.

Rising spam level on my UGent email account

17 November, 2006 - 11:45
Categories:

Almost two years ago, UGent implemented anti spam measures that reduced the amount of spam messages in my UGent email account considerably from 20 something each day to zero. But recently the daily amount of spam that reaches my inbox is growing again in an unfavorable way:

graph of spam messages per day and weekly average

Today Mt. Hood Was Stolen!

9 November, 2006 - 15:02
Categories:

I can't believe Mt. Hood was stolen! I am speechless! It was stolen by a giraffe who drove away in his Cadillac Seville very nonchalant!!

from http://tryruby.hobix.com/

Using custom LaTeX document classes in LyX

21 September, 2006 - 10:23
Categories:

For writing with LaTeX I prefer using LyX because it hides the ugliness of LaTeX source code behind a pseudo-WYSIWYG frontend (the developers call it WYSIWYM: what you see is what you mean). Including mathematical expressions, however, is very LaTeX minded and comfortable: you type LaTeX math constructs (stuff with _, ^, \sum, ...) and LyX directly visualises it as a pretty printed formula. For the advanced LaTeX constructions not available in LyX's interface one can always fall back om "raw LaTeX" input fields. In short, I think LyX is a very handy compromise between the power of LaTeX and the user friendliness of a WYSIWYG system.

Sometimes, for example when writing an article for a conference, one need to use a custom LaTeX document class, recommended by the conference author guidelines. The procedure to make LyX using this custom document class is non obvious and a bit involved. It is broadly explained in the LyX manual (Part Customization, Chapter 5 Installing New Document Classes, Layouts, and Templates), but here is the short version (for teTeX on Linux or related systems, I don't know about Windows):

Read more...

Making a video from frames with transcode

20 August, 2006 - 11:51
Categories:

Making a video from a set of frames can be done with transcode as follows.
Disclaimer: this is mainly a reminder to myself, based on these instructions for making animations from frames, with some extra's.

First make a file with the filenames of the individual frames (in the right order of course). E.g. if the frames are named /tmp/0001.png, /tmp/0002.png, ..., /tmp/0100.png:

$> ls /tmp/0*.png  > framelist.txt

Also, indentify the size of the input frames. E.g. with ImageMagick's identify:

$> identify /tmp/0001.png
/tmp/0001.png PNG 400x300 400x300+0+0 DirectClass 65kb

Then invoke transcode with the frame list as input:

$> transcode -i framelist.txt \
   -x imlist,null -g400x300 --use_rgb -z \
   -y xvid,null -f25 -o frames.avi -H 0

the meaning of the different arguments:

  • -x: the input video format (imlist) and audio format (null)
  • -g: the size of the frames (400x300 in this case)
  • --use_rgb: to indicate that the input color space is RGB
  • -z: to flip the input upside down (I need this to get the output video right)
  • -y: the output video format (xvid) and audio format (null)
  • -f: the frame rate
  • -o: the output video file
  • -H 0: disable autoprobing for the input format

Feh, yet another image viewer for Linux

1 August, 2006 - 10:12
Categories:

Some years ago, when I solely worked in Windows, I happily used Irfanview as image viewer. Under Linux I didn't found a real replacement for it, yet. I already tried Gwenview, Kuickshow, Kview, ImageMagick's display, xv and maybe some others, but all have their little quirks and annoyances concerning speed or usability.

Here's a new candidate for my image viewer list: Feh (available for Ubuntu in the universe repository). Linux.com has a short overview of feh. It's a command line application, so it has it shortcomings on the usability front, but it quite fast and has nice features (hot keys, different view modes, mouse control, directory traversal, ...).