Archive for the 'Programming' Category

S.M.A.R.T. data visualization

Today, I got worried about two consecutive changes of the ‘ECC Recovered Errors’ parameter reported by SMART on my desktop machine:

Device: /dev/disk/by-id/scsi-SATA_ST3200827AS_4ND2DF00, SMART Usage Attribute: 195 Hardware_ECC_Recovered changed from 67 to 66


Device: /dev/disk/by-id/scsi-SATA_ST3200827AS_4ND2DF00, SMART Usage Attribute: 195 Hardware_ECC_Recovered changed from 66 to 65

That prompted me to see if there have been any similar events recently. Two lines of shell script were more than enough to reassure me that nothing bad was going on:

grep ECC /var/log/messages | egrep -o 'from [[:digit:]]+' | cut -f2 -d' ' > data

And then with gnuplot:

gnuplot> plot 'data' with lines

I got this:


SMART values graph

SMART values graph

C++ static analysis

Yesterday I was looking for a free C++ static analysis tool that I could use on Wesnoth code base and found cppcheck. It’s actually quite nice and supports running tests in parallel (much appreciated quality in the increasingly multi-core world). I’m yet to compare it with other tools, but thanks to cppcheck I’ve already fixed this, this and this.

Sadly, compared to Java there are very few similar tools that support C++…

git

I started to use git a few days ago. I’m still a fan of Mercurial, but git turned out to be “a must” due to the number of “Battle of Wesnoth” developers switching to it, and thanks to rather seamless integration with Subversion.

The other reason is that I’ve been looking for a DVCS tool to use as a front-end to an SVN repository I use at work, with a possibility of converting at least one other open-minded guy to that paradigm. Of course, in this case solid integration with the existing (and mandatory…) tool is a must, so git scored an another point.

So far, it seems to work, and reasonably fast at that. Getting it to run on Cygwin was a pain in the neck, though, because for some reason git opens its internal files in text-mode (ugh), which leads to problems with index getting corrupted (CRLF/LF) if Cygwin file systems are not mounted in binmode. Careful there.

I’ve also hit a problem with Subversion import, most likely caused by some branching mess in our development history (empty directories being created in branches/ with no data, then being deleted, then being recreated as proper branches). Don’t ask why it’s like that. I probably have a bug to report, once I have it tested on a simple test case. As it is, inspection of the branching history shows branches where nothing has been branched, and merges when a branch was created. Ouch.

Prototyping

As my masters thesis is nearing completion, I dared to let my mind off it, and started to play a little bit with some ideas that kept haunting me for at least one year.

The ideas of a game – a space themed tactics in a mix of turn-based and real-time genre. I’ve been experimenting with user interface concepts that I have envisioned and the results are promising, as it turns out that my ideas are possible to implement, and quite easily at that! The final product, should it ever get “completed”, is going to be written in Python and PyOpenGL. The prototype uses pygame instead of PyOpenGL, because it’s faster to develop in and I need no fancy features to test simple concepts.

This little experiment reminds me what a great language for prototyping Python is!

Popular wisdom

If the code and the comments disagree, then both are probably wrong.

– Norm Schryer

The world’s most…

…scalable, available and most reliable database1:

*** ERROR from SQL [-1311]: The text of the view definition is 2018 bytes too long.

*** ERROR[15037] The maximum fragment length of a statement in SQL/MX is 4096. Please retype your statement with a newline embedded in it.

1 – according to its developer

QtConcurrent

I’m not going to discover America, but it looks like the evolution of (personal) computers in terms of raw CPU power and GHz values has slowed down to a crawl, while the overall processing power increases thanks to additional cores. Intensively parallel computing may be an exciting vision, but writing software that could make use of many CPU cores is challenge. It’s not a secret that multi-threading is harder than sequential programming, with all related algorithmic and hardware problems like deadlocks, race conditions, cache ping-pong, locking contention and so on – no wonder some people predict that Erlang is going to be the next Big Thing – concurrent programming based on message passing is more scalable and seems easier to get right.

Having all these things in mind, I’ve recently stumbled upon an interesting addition to the Trolltech’s Qt library (which I like very much): QtConcurrent is a project that makes multi-threaded programming with Qt much easier (on all supported platforms!). Not only does it implement asynchronous function calls and Google’s Map-Reduce algorithm, but also, according to the website, is capable of determining the number of available processors/cores and adjusts the number of threads accordingly! Neat.

I’m definitely going to use it in a little Secret project of mine (WIP).

“Wesnoth” in Google Summer of Code 2008

This is already old news, but Google Summer of Code 2008 is underway and this year “Battle for Wesnoth” is a mentoring organization as well! This is very exciting to everyone of us and I really can’t wait to see what project students will be able to come up with this year. The number of slots isn’t known yet, but we hope to get at least 3 projects rolling…

There’s some development on the AI front waiting to happen, mainly around the newly integrated (trunk only) Formula AI branch – an attempt to create a domain-specific functional programming language, that would enable content developers to tweak AI behavior in many new, interesting ways. Another project could be teaching the AI the most efficient opening moves for the set of standard multiplayer maps, similar to what chess programs have been doing.

Other possible developments include reimplementation of the statistics gathering engine (old one written by Rusty Russel is available at http://stats.wesnoth.org) and creation of a fully-fledged campaign editor – either as a stand alone application or integrated with the editor as it is now.

All of this makes me really anxious to see how much work will get sponsored by Google, especially since a number of students have already got quite involved with the project.

Life bugs

There’s a vending machine in my workplace – a typical one with a keypad that lets you select the snack or beverage you want. There are 3 slots with Pepsi (numbered 53, 54, 55) and I’ve just realized that I always punch 54 in to avoid off-by-one errors… That left me feeling sad for some reason. ;-)

Python Magazine

Today, I noticed that someone brave has started a serious attempt at publishing a Python Magazine. While I’ve heard the news way back in the past, it’s today that I stumbled across a free, downloadable copy of October edition (login required), decided to give it a try and, oh boy, it’s really nice! As I really like Python very much and wanted to subscribe to some kind of a professional magazine – I decided to buy a year worth subscription of the PDF edition, starting with the December issue. It’s way better than most of the stuff that I can find published in Polish.

Next Page »