Ferry Boender
Programmer, DevOpper, Open Source enthusiast.
Why are there so many programmers who don’t know what state is, much less the impact it has on programming? Recently I was having a discussion online and some programmers kept misinterpreting everything being said by me and other programmers because they had no or little grasp of the concept of state. This is not […]
(TL;DR: To the solution) I was mucking about with the Python bindings for libtorrent, and made something like this: import libtorrent fname = ‘test.torrent’ ses = libtorrent.session() ses.listen_on(6881, 6891) info = libtorrent.torrent_info(fname) h = ses.add_torrent({‘ti’: info, ‘save_path’: session_dir}) prev_progress = -1 while (not h.is_seed()): status = h.status() progress = int(round(status.progress * 100)) if progress != […]
For the longest time, I’ve searched for a way to run terminal emulators in Vim buffers. As a kind of work-around, I created Bexec, which allows you to run the current contents of a buffer through an external program. It then captures the output and inserts/appends it to another buffer. Although Bexec works reasonable, and […]
A programmer once built a vast database containing all the literature, facts, figures, and data in the world. Then he built an advanced querying system that linked that knowledge together, allowing him to wander through the database at will. Satisfied and pleased, he sat down before his computer to enjoy the fruits of his labor. […]
Stop reading your local manual pages when programming/scripting stuff, and use the POSIX standard instead: Online POSIX 2008 (EEE Std 1003.1-2008) standard There are four main parts: The Base Definitions (XBD): The basics of a POSIX-compliant system. The System Interfaces (XSH): What POSIX-compliant systems offer to programs. I.e. programming in C (stdlib) The Shell & […]
I ran into a little pitfall with Python’s UnitTest module. I was trying to unit test some failure cases where the code I called should raise an exception. Here’s what I did: def test_file_error(self): self.assertRaises(IOError, file(‘/foo’, ‘r’)) I mistakenly thought this would work, in that assertRaises would notice the IOError exception and mark the test […]
I’m in the process of writing a tiny tool. What it does is not important, only that it’s nothing big. I’ve almost finished writing it, and it currently weighs in at about 260 lines of code. The bizarre thing is that it took me three days to write. By my estimates, it shouldn’t have taken […]
Note: The latest version of this article is always available from the Writings page in HTML, PDF, ePub and AsciiDoc (source) format. My interest in Evolutionary Algorithms started when I read On the Origin of Circuits over at DamnInteresting.com. I always wanted to try something like that out for myself, but never really found the […]
If you’re working with PyWebkitGTK, and you get the following error: Traceback (most recent call last): File “./webkit.py”, line 7, in import webkit File “/home/todsah/webkit.py”, line 18, in class BrowserPage(webkit.WebView): AttributeError: ‘module’ object has no attribute ‘WebView’ … make sure you haven’t named your script ‘webkit.py‘, and there is no other script with the same […]
I needed an easy way to set timers on my desktop PC. All I really want is to set a countdown in hours, minutes and seconds, and have it alert me when that time has elapsed. I couldn’t find anything simple with some exceptions that wouldn’t compile (anymore) due to missing libs (which weren’t available […]
Search this blog:
The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.