Roland's homepage

My random knot in the Web

Older articles (2/20)

  1. Playing a sound when the battery is low

    Although I have a battery indicator on the bottom of my laptop screen I don’t alway check that often enough. That’s why I wanted to add an extra warning in the form of an audio signal. So even if I’m turned away from the laptop, it should still catch my attention.

  2. Generating barcodes with “BWIPP

    Originally I looked for a Python module to generate barcodes, and I found the treepoem module. This used Pillow to create bitmaps, and I preferred to have PDF or other resolution independant formats. Looking through the README, I found that treepoem is a wrapper for bwipp. This is a set of PostScript procedures to generate barcodes.

    Since I’m familiar with using PostScript, I decided to use bwipp directly.

  3. On the nature of GUI programs

    This is based on an answer I gave on stackoverflow. That answer is specific to the tkinter toolkit that comes with Python. The principles apply to other GUI toolkits and languages as well but the terminology used (like mainloop and idle task) may be different.

  4. Command-line versus GUI program


    When you are exploring a problem, in general first write a command-line program whenever possible.

    It will take less effort to write then a full-blown GUI.


    Recently I wrote a program to remove the protection from ms-excel files.

    The original version was written as a command-line program. Later I re-used the relevant code for a GUI program for use on ms-windows. This was mainly for the benefit of some colleagues who are not comfortable with using the command-line.

    In this article I want to contrast the two programs.

  5. How convenient is multithreading compared to multiprocessing?

    There are basically two ways in which one can make use of a modern CPU with multiple cores for computationally intensive work.

    1. Using multiple threads within one program (multithreading).
    2. Using multiple (single-threaded) programs that communicate (multiprocessing).

    In the first case, all data is implicitly shared. In the second case, data must be explicitly shared or communicated.

    The first option is often said to be more convenient. I would like to make the case that this usually makes the task more difficult, because of the need to manage all shared data.

  6. Roll back a FreeBSD port with svnlite

    Sometimes I’m too hasty with updating ported applications, and I need to roll them back to a working version. Since I use svnlite to manage my ports tree, this is relatively easy. But since it is different than I’m used to (since I mostly use git), I thought I would document it here for convenience.

  7. Including binary data in Python scripts

    Sometimes I need to use some binary data (e.g. a bitmap image) in a Python script. In a package, you can store this data portable in a data subdirectory of a modules using the package_data argument of setuptools.setup. This won’t work in a standalone script. You can of course make your script into a package, but here I want to show an alternative solution.

←  Page 1 Page 2 / 20 Page 3 →