Roland's homepage

My random knot in the Web

Articles about programming

  1. ImageMagick: convert vs Wand

    The ImageMagick suite has been in my software toolbox for years. It is my go-to tool for manipulating bitmap images. Over the years I have written several front-ends for specific tasks for in Python.

    In general, I have used the subprocess module to launch convert or mogrify from Python.

    With the release of Wand 0.5.0 which supports ImageMagick 7, I decided to try that by porting one of my scripts (foto4lb) to it. This turned out to be slower than using convert directly.

    But now it is 2021. Py-wand is at 0.6.7 and it is time to try again.

  2. Database scheme for resin recipes

    This document explores how an SQLite database could be used to store data for the resin-calculator. Normally, the recipes are a dictionary keyed to the name of the resin. The value of each recipe is a list of (component, parts-by-weight) tuples. Since a database only contains tables, where each row has the same form, how do we store such infomation in a database?

  3. Doing calculations with Python

    As an engineer I do a lot of calculations. These can be done with pen and paper and a calculator, in an IPython notebook or in a throwaway spreadsheet. All of these methods have shortcomings, though.

    Pen and paper is hard to share and (in my case) hard for others to read. In IPython you can assign the results of calculations to a variable, but you have to perform a separate action to display them. And spreadsheets in general show you the results but not the calculations.

    So I wrote a simple function in Python to help me with that. Using this function I can print both simple assignments and relatively complex calculations. And it shows both the calculation and the result.

  4. Structures in Python

    Sometimes I miss the C’s plain old struct in Python.

    Of course Python has dictionaries, but I prefer to write a.b over a['b'].

    Here are several ways of doing something akin to a struct in Python.

  5. Using gnuplot from Python

    According to my revision control systems (rcs in those days), I’ve been using gnuplot to make graphs since at least 2002. And I’ve got it set up via a custom gnuplotrc to match the style of the TeX documents I often use the graphs in.

    At work we have an Instron 3369 machine for material testing. Recently, I wanted to visualize some tensile test data in ways that I couldn’t get into the test report.

  6. In programming, small and simple is beautiful

    If you would look over my github repositories, you’ll see that most of my programs are pretty small. And in general they are command-line applications. And that is good, because small is beautiful and simplicity is a virtue.

    date: 2016-07-05
    reading time: 1 min.
    category: programming
  7. Parallel execution with Python

    With Python it is relatively easy to make programs go faster by running things in parallel on multiple cores. This article shows you how.

    We sill concentrate on a type of problem that is easy to parallelize.

    date: 2016-06-28
    modified: 2022-02-06
    reading time: 7 min.
    category: programming
    tags: python3

←  Page 2 Page 3 / 4 Page 4 →