Monday, 28 December 2015


Thanks the the forums for the raspberry pi, this keyboard + track pad combination just got a lot less irritating. Disable tap to click.  For Logitech K400 keyboards, hold down FN, left click on trackpad - disables the tap to click. 

HDMI auto detection seems to choose the highest resolution possible, regardless of how bad that actually looks on the TV

Override in config.txt



Saturday, 25 April 2015

The Rest Will Follow

The LLVM + Clang compiler toolchain 3.6 release can be downloaded as prebuilt executables for Windows. So far, so good, so what? The interesting and practical part of this is the source and ABI compatability with Microsoft Visual C++ and the integration with Visual Studio. This means that choosing to use the Clang front end and LLVM backend is as simple as choosing the relevant toolchain in the VS properties (ideally, at the configure step of using CMake to generate the VS project!). This painless process means it is trivial to try out Clang without needing to be steeped in Linux, or owner of the expensive dongle for OSX aka some sort of Mac computer hardware.

Reality is, of course, that this does not yet provide an actual satisfactory outcome. Clang + LLVM on Windows for the VS ABI is still a work in process, with respect to not handling all of the extensions to C++ present in the Windows SDK and MFC headers, and the lack as yet of any support for C++ exceptions.

None the less, the compiler functions as a useful and valuable linter of C++ code previously restricted to building with MSVC due to heavy usage of MFC and Windows headers. 

Tuesday, 24 June 2014

Silent Scream

Stopping KDE applications printing useless and distracting debug text to stdout / stderr and polluting the terminal window used to invoke them.  Charmingly described as stopping KDE apps from vomiting all over your Xterm. 

In short; run kdebugdialog and click the deselect all all button.

Tuesday, 28 May 2013

A Moment Of Luck In The Sea Of Misfortune

The latest update to Microsoft Visual Studio 2012 gives the ability to build C++11 programs for versions of Windows from XP upwards. For that build configuration, the static analysis tools are disabled, as are some other areas of less used functionality (HLSL compilation, remote debugging, direct x debugging). Note the new v110_xp mode is the only supported one for targeting XP.

This new update requires updates to tools around MSVC e.g. CMake 2.8.11 is required to use the new mode. 

Updating MSVC also brings new advice about what compiler options are sensible, and what options are newly harmful. /Za is bad in MSVC 2010+, and is discussed in the boost warning guidelines.

Thursday, 4 April 2013

Final Chapter: Thus Ends...

The reason why gdb would not work on Ubuntu: a deliberate policy by the OS developers. Cheers, guys. At least the stack overflow(s) make finding why easier.

There is a lot of good looking "web stuff" around. 

Sublime Text 2 is good in part because of packages (installation, usage). Also as it works in Linux, Windows, and OSX.

Nostalgic returns to operating systems of the past require the opening of disk images as floppy drives are in the past (as indeed, the disks...). A RISCOS disk module to make disk images appear as mountable disks exists, and is useful in ARCEM.

Once again, I content myself to computing on OSX and Windows, leaving Linux again except on the Raspberry PI. The usability issues are never addressed adequately. Its an open question if the pain points of the past are addressed before it becomes irrelevant e.g. CD/DVD burning may finally work well, but do I care any longer? Some old and fun rants on Linux usability (or the lack thereof).

The Nature of Code is a fascinating book. 

IDE testing is not so often blogged about.

Word games are popular, but need dictionaries! Here is a game with swedish and english dictionaries in Sqllite DB files. (May be a good game, don't know!)

Monday, 3 September 2012

Not Ready Yet

Fired up my copy of iA Writer, got pandoc to make some HTML from markdown, and wrote up my toy interpreter with its byte code to OpenCL compilation. Pandoc is nifty, and can generate pretty code snippets in HTML with syntax highlighting and line numbering.

Sunday, 26 August 2012

The More I See

It is possible to use printf inside an OpenCL CPU kernel on OSX; however, remember to cast the string literal operand to (char const*) pointer to get it to compile.

Further, when running an OpenCL using program it is possible to force error logging to stdout (e.g. for .cl compile errors) via 

    CL_LOG_ERRORS=stdout program Args 

Wednesday, 22 August 2012


There is an offline compiler for OpenCL included in OSX 10.7, at /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/openclc 

This is pretty much a standard clang executable, and accepts common clang options. Sample arguments of interest, 

    -O3  -x cl -triple i386-applecl-darwin -S <

Shows the assembly code for an OpenCL kernel.

    -x cl -triple i386-applecl-darwin -emit-llvm <

Shows the LLVM textual-IR for a kernel.

The official documentation and example of this suggest the use of generating LLVM bit code offline, for 32 and 64 bit CPU and 32 bit GPU. More useful advice included in the OpenCL Mac programming guide.

Wednesday, 11 July 2012

Enough Space

The point of a RaspberryPI is, largely, to program it. Getting your code from the PC onto the PI, building it, and getting it back from the PI to PC can be done easily with hg (aka mercurial), the distributed version control system. This makes headless usage of a PI over a network via ssh a bit easier. Mercurial is readily available to debian based linux on the PI via    
    sudo apt-get install mercurial
There are two aspects of this: getting code onto the PI, and from the PI, pushing the code / build artefacts back to the original machine. It seems sensible not to trust a cheap SD card overmuch.
Mercurial includes a builtin webserver that can permit remote access to your code, both read access and write access.
Assuming you have already an hg repository created, you can serve this as follows (from the hg repository directory) on your development PC
    hg serve
You can then view the repository in the web browser at http://localhost:8000

This is also now visible to the PI (and any other machines on the same network, not a secure practice!). 
The initial clone can be done as follows
    hg clone destdir
Subsequently, changes made on the PC can be fetched via hg as well, from within the hg repo dir on the PI
    hg pull
Since the PI is a full Linux machine, its quite practical to make changes locally on the PI (say, from an ssh session or remote X11 setup). By default, however hg will not let a push occur to a repository served via hg serve

This is possible, however. On the PC (in the .hgrc or Mercurial.ini file, depending on OS) add the following section.
   allow_push = *
   push_ssl = false
Changes made on the PI can then be pushed via hg, from within the hg repo dir on the PI
    hg push

Thursday, 21 June 2012


The RaspberryPI is a small, credit card sized, ARM based PC that can run Linux. Love2D is a game framework for 2D games in Lua, with physics via box2d and all round quite nice for writing small games in across Windows, OSX, and Linux. 

I have built the current Love2D on the RaspberryPI using the current suggested release of Linux for the pi (based on Debian Squeeze). This was just following the instructions on building Love2D from source at the Love2D wiki. There is an outdated build of Love2D in the debian repo but this is 0.5.0 vs the current 0.8.0 release.

Current status: the demos seem to run, just very, very, slowly. This is probably attributable to softfp being used throughout the whole OS build, and non-optimized X11 drivers on the PI. With luck, all that is needed to make Love2D good for use is the system being built with hardfp as is done on the raspbian project.

Tuesday, 13 March 2012

Having a blast

Random notes on the installation of Linux - if using a rotated screen, and can get an Xterm from the live-CD/installer, then you can use 
  xrandr --output VGA1 --rotate left

to not hurt my head + neck - except when it boots or in the BIOS.

If it complains about a missing bits/predefs.h in building anything, go back and install libc6-dev

   sudo apt-get install gcc-multilib libc6-i386 lib6-dev-i386

Of all the fractured X11 GUI nonsense in Linux atm, I really don´t know which one I got in Linux Mint - other than its some variant of GNOME 3. I guess that I don´t care means it works better than Ubuntu unity...

Thursday, 2 February 2012

The Game Has Changed

LLVM is described as "a collection of modular and reusable compiler and toolchain technologies". While true, this description is insufficient:

It is modular, insofar as one can pick and choose from the collection of technologies present within LLVM at a given moment in time. Either from a stable release, or a snapshot of the SVN trunk. Neither approach is satisfactory.

The LLVM project encompasses a set of libraries to manipulate program representations (e.g. LLVM IR), tools to operate on programs in IR form, compiler backends to translate IR to target specific machine code, and with the Clang subproject, a compiler front end to translate programs written in C, C++, Objective-C, and OpenCL into IR. Within this system, some new behaviours may be added through addition of submodules to add, for example, a new pass over IR.

The pace of change in the LLVM SVN trunk is rapid. This includes changes in aspects from the naming conventions for APIs to fundamental alterations in the IR type system shared throughout LLVM, to deprecation of entire compiler back-ends, APIs, and the replacement of those. The laudable goal is to rapidly advance the quality of LLVM, and not to be hampered by approaches found insufficient in some aspect, nor by code lacking an active maintainer. Like any active development project, regressions will and do occur, and the trunk stability fluctuates in any metric from correctness, performance, quality of generated code, or buildability: regressions are intended to be found by testing on build bots, and minimised by a review process on commits either before or after commit.

Periodically, at about 6 month intervals, the code is stabilised and a new "stable" release is made after a period of testing and regression fixes. This code, once tagged as "RELEASE N", is then not updated. Not for trivial bug fixes, not for serious bug fixes, nor the addition of entirely new functionality.

Thus, the choice for a user of LLVM (a user being either a developer using the LLVM compiler suite simply as a compiler, or a developer building upon LLVM to create compilers or other language tools) is to live with a stable release, that rapidly falls behind the current version, or a current version that constantly changes and makes no quality guarantees.

Finding a bug in a stable LLVM release is hopefully rare. It is not impossible, however. The problem is then, when a bug is found, a fix for it is not applied to the stable release. Instead, it is applied to trunk (if present there as well) and becomes available in the next release at some point in the future. If you want that fix on the current (or a previous stable release) you need to cherry pick the fix, and backport it. The difficulty is probably proportional both to the size of the fix, and the duration of the interval between the release date of the release(s) affected and the current date.

So, if a bug is found, a fix will not become available in a simple update to a stable release. There are no patches. There is no LLVM 3.0.1 to follow 3.0. Nor will fixes be backported to previous or older releases, which themselves may not be very old e.g. in a codebase less than 1 year diverged from the tip of the SVN trunk.

Further, while LLVM and related projects are modular, and build on one another, they are tightly coupled. The releases of Clang are tied to the equivalent releases of LLVM. (The trunk build of Clang and LLVM will typically fail to compile if permitted to get of sync). This will assuredly also apply to other LLVM subprojects such as LLDB. You cannot mix and match between releases. You cannot have a new Clang release, with new language features e.g. C++11, and an older LLVM backend (e.g. Alpha just got removed, the C backend is increasingly unmaintained). This would require at least a commitment to a stable API - which LLVM will not provide. (A stable ABI between C++ libraries is an inherent challenge in any case).

To add a new module e.g. a backend, you choose a version of LLVM at a moment in time and implement code generation in the context of that LLVM. If you choose trunk, you will have a constant stream of mostly minor changes to deal with, with the exceptions of subsystem APIs being iteratively improved or changed, minor build system issues such as makefiles being broken, fixed, and changed, and entire modules being removed. If you choose a stable release, you forgo ongoing bug fixes and improvement: and face a massively disruptive change in porting to the next stable release, unless you stick with your old version. The LLVM release notes indicate both major changes and removed features, and the internal API changes: even incomplete listings of these are lengthy, and adaptation of existing code to a new release can be anywhere from trivial to exasperating.

The LLVM infrastructure permits many ways of adding new behaviour to LLVM - plugging in a new pass, adding a new backend: but it is impractical to add all desirable changes in a clean manner by plugging in a new module, as the number of hooks via which change can effected in this manner is limited. At times, changes need to be made within LLVM components (either as dirty hacks, or as the sole means to achieve some legit technical goal). Preserving these changed components is hard: the code in which changes are made will evolve over successive releases, and the modified component cannot be dropped in to a different LLVM release. 

To sum up: it would be desirable if LLVM provided a) backports of bugfixes to stable branches, instead of periodic release snapshots of code and b) stable APIs between components, to less tightly couple the components of LLVM to one specific LLVM release.

The modularity of LLVM + related projects is impressive when compared to the monolith of GCC: LLVM posesses a decent architecture, implementation language (tasteful C++ subset), and a t least one portable and relatively comprehensible build system (via CMake). It would be nice if point releases were made to patch known bugs, and API design was undertaken to loosen inter module dependencies and ease ports of subsystems between LLVM release versions. 

None of the above are insurmountable obstacles to the use of LLVM - but I blench at the prospect of porting changes, features, and fixes forward repeatedly, again - or of living with constant API and design churn.

Sunday, 14 August 2011

Hanger 18

Back to early 90's - XCOM aka UFO returns (via an open-source remake). Happily, nearly trivial to build on OSX.

Grab the source. Github has a nice OSX client, and the webpages have a wee button to spawn the OSX client and make the git clone process painless.

Get a packaging system for install Unix packages on OSX - the new hotness is Homebrew, in addition to fink or macports. Homebrew has the relevant dependencies, so it works (tm).

brew install yaml-cpp
brew install sdl
brew install sdl_gfx
brew install sdl_mixer

set the pkgconfig tools environment variable to find the installed stuff.

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

In the src directory of OpenXcom


And tis done. Copy the games data files to the relevant location, and all is well.

Tuesday, 9 August 2011

Terminal Illusions

Flocking makes for a nice screen-saver - see here for a nice JS demo, and this pseudocode for a nice, dirt simple explanation. Managing so many objects interacting in space, even 2D, calls for some spatial data structures. The approach of buckets in 1D, and sorting + binary searching in the other dimension seems to work well for my flocking screen saver. 64 bit in Lion (hmm. and Snow Leopard?) break 32 bit screen saver modules (bah!) and also Saver Lab. Can capture screenshots with another OSX command line tool, screencapture.

Simple Flocking ScreenSaver
GDB in Visual Studio - they are working on an Android NDK version,
which could be a great improvement on current tools, if it worked.

The C++ language has plenty of odd corners; but so do the standard libraries, and the cross platform variations. The std::string class can surprise on some platforms with its Copy On Write semantics and the sharing of underlying memory buffers.

Every new version of Windows breeds a new bit of software to handle disk images, see WinCDEmu for Windows 7.

Getting a visa to travel to the states can be done online. The EU should reciprocate with US visitors until this nonsense gets stopped. 

Consider Lockharts lament; replace "maths" with "programming", and ponder on education now. And recall how maths was taught, too. Ick.

The HunSpell spell checker has many dictionaries. The executable can be controlled via pipes from Java. There is a Swedish dictionary from "The Big Swedish Wordlist".

Tuesday, 28 June 2011

Not Ready Yet

ConstCPP - C++ with optional mutable state aka const by default.

This blog posting ui is nearly unusable on iPhone - been a while since I found a site with this sort of issue.

Thursday, 17 February 2011

Sleepless Nights

To quote a colleague
I want gdb to die in a fire. If thats possible.
A sentiment I can only agree with, to be honest. However, it remains in its spread of variably buggy obsolete forms embedded within the development tool chains of too much of the world to avoid. Some notes on living in the land of the clone of the Unix tools from the 1980s. A link to a GDB reference card. Programmable systems (debuggers like GDB, editors like emacs, typesetting systems like LaTeX) have been universally dire in user experience, in _my_ experience. The intended bonus of programmability becomes a curse of necessity; the burden is placed on the user to make the tool usable in the first place. In essence, I want to write programs to solve _my_ problems; not to solve problems in the tools I use; and _not_ to write programs in the debugger while debugging the interesting program or to debug program errors in a document processor.

A set of optparse documentation for common tasks since, as it notes,
we start new project so seldom, it is difficult to remember all those recipes that we come up with, every time we add a new command line option. This article is an attempt to bring together such recipes.

Python can query its environment for the functions in the current module (which is done slightly differently than for _other_ modules). This is useful for auto-testing, saving the need to write out a function list explicitly. Can embed these gist things into a blog post, too.

After the GDB rant, I confess I don't program gdb much and have not (yet) needed a .gdbinit file to customise GDB in a semi-permanent manner. However, I have some user defined commands to not forget in case I need to stay in GDB a little longer...

JGrowl implements growl style notifications in a web page. Cool, if not immediately useful. Also, drop shadows via CSS.

Can fork multiple threads (well, processes) in bash and then join (wait) for the completion of them. Good for parallelism of shell script controlled processes.

cmd_A &
cmd_B &

Monday, 31 January 2011

Left Unfinished

Can build a simple and useful unit test system in python exploiting first class functions, dynamic checks on the names of functions, and a naming convention.

See for coloured src and a sample run, or github for a "gist" with highlighted source.

### Begin unit test code

def test_function1():
    # Do some test code
    # return True on Pass, False on Fail

def test_function2_EXPECTED_FAIL():
    # Do some test (more) code
    # return True on Pass, False on Fail

def test_functionN():
    # Do some test (more) code
    # return True on Pass, False on Fail

# Build a list of test functions to run
# as test cases
tests = [ test_function1
        , test_function2_EXPECTED_FAIL
        # as many as you like...
        , test_functionN

def main():
    failed  = []
    # Invoke each test case in turn
    for t in tests:
        if not t():
            # Can check names of test functions 
            # to detect expected fails
            if t.__name__.endswith("_EXPECTED_FAIL"):
            # Record fails for later report
            # Can stop on 1st fail if desired
            # return 1
    # Print the list of tests that failed, if any
    for f in failed:
        print "FAIL:",f
# Invoke the test runner
if __name__ == "__main__":

### End unit test code

Tile based game development tutorial.

A series of blog articles on Maze generation algorithms.

A C pre processor (cpp) in python. A programmers text editor Kod for OSX based on the google chrome tab UI.

Tuesday, 25 January 2011

Lore of the Arcane

Compilation of Offload C++ code for the Cell BE processor and the Linux OS entirely within a Linux environment is complicated by the fact that the Offload C++ compiler ("offloadcpp") is a Windows executable. This compiler compiles programs to run on the Cell processor by first compiling Offload C++ code into Cell specific C code; the C is then compiled for the Cell processor using a Cell BE GCC tool chain (GCC and associated utilities) on Windows, via Cygwin. The result is that, on Windows, the compiler can generate a Cell Linux executable with embedded SPU sub-programs automatically.
The below process (described by Paul Keir, thanks!) outlines how the Offload C++ compiler can be used to compile for the Cell from within Linux using Wine. The first stage is to compile the Offload C++ code (your original program) into C code targeting the Cell. The second stage is to compile that generated C code on the Cell using the Cell SDK on the PS3 running Linux.
Note that depending on how your Linux PS3 is setup, it is possible to create a script (e.g. via scp and ssh) to push the generated code onto the PS3, and to subsequently invoke the PS3 compilation process on the PS3 automatically.                                 
--------------  Stage 1: Linux/Windows ------------

1.  Install Wine on your Linux system.

2.  Copy the Codeplay Offload C++ installation directory from Windows to somewhere convenient on your Linux system.
3.  On Linux, set the SIEVESDK environment variable to the offload-cell-linux-sdk directory contained within the installation directory.

4.  Offload may install a Cygwin-compatible Cell Toolchain. By default it will be installed in C:\cygwin\opt\cell .
Place the entire cell directory tree within the /opt/ directory of your Linux system. The Cygwin-compatible PS3 toolchain is also available here:
The toolchain.7z file there also contains the /opt/cell/... directory tree.

5.  The Offload compiler is now ready to run, though only with the -nomake switch. If you have placed the Offload installation directory at $HOME/apps/codeplay, offloadcpp may be used to compile hello.cpp using the following command:

$ wine $HOME/apps/codeplay/offloadcpp.exe -I$SIEVESDK/include -I/opt/cell/toolchain/include/c++/4.1.1 -I/opt/cell/sysroot/usr/include -I/opt/cell/toolchain/lib/gcc/powerpc-linux/4.1.1/include/c++/powerpc-linux -I/opt/cell/toolchain/lib/gcc/powerpc-linux/4.1.1/include -nomake hello.cpp

An alias may be useful, say "oll":

$ alias oll='wine $HOME/apps/codeplay/offloadcpp.exe -I$SIEVESDK/include -I/opt/cell/toolchain/include/c++/4.1.1 -I/opt/cell/sysroot/usr/include -I/opt/cell/toolchain/lib/gcc/powerpc-linux/4.1.1/include/c++/powerpc-linux -I/opt/cell/toolchain/lib/gcc/powerpc-linux/4.1.1/include'

$ oll -nomake hello.cpp

6.  The result will be a directory called "outputc". This directory must now be transferred to the PS3, before issuing the make command, as described in Step 3. below.

--------------  Stage 2: PlayStation 3 ------------

1.  Copy the offload-cell-linux-sdk directory to the PS3, and set the SIEVESDK environment variable to that location.

2.  Mars should already be installed (mars-1.1.4-1.ppc.rpm), but the development libraries are now also needed, so:

$ wget
$ rpm -ivh mars-devel-1.1.4-1.ppc.rpm

3.  An "outputc" directory, obtained as in step 5. above, contains a makefile. To complete the compilation of hello.cpp:
$ cd outputc
$ make
$ cd ..
$ ./hello

Thursday, 30 December 2010

What comes around

Lichess is a cool online chess site. Although, it is not, as it claims, open source: it places non-commercial use restrictions on the code, for example, failing the open source definition.

Its easy to write simple web applications quickly with Webpy. Can parse C99 with open source parser (pycparser) implemented in Python, and display the generated syntax tree in a web browser via JSTree. Hence a very semi-working OpenCL lint tool (just needs, hmm, a proper preprocessor, symbol table, type-checker to do this right: not going to do that outside the day job, obviously!).

The graphics support in browsers is getting better: Graphviz display in the browser via canviz, and some ease of use APIs over the HTML5 canvas (EaselJS) element.

Maze generation. Nifty CS assignments I wish I had on my course. Key events in JavaScript. If this script works, and the web-service it uses is any good, finding plane tickets should be easier.

With the somewhat more extreme climate around, weather seems more interesting. See also wview.

For journalism, and print media that 'gets' the internet, the Economist is pretty good; a print subscriber gets the same content online, and in an iPhone App, and in audio. It's rather like distilled BBC Radio 4.

Wednesday, 17 November 2010

Cloning Technology

Concurrent Programming with Revisions and Isolation Types from Microsoft Research (here) is an approach to concurrent programming looking extremely similar to Sieve C++ (described herehere and  here) developed at Codeplay.

How to setup virtual box shared folders to access host data from the Linux OS inside the VM after installing the guest addons; it works, but is very much slower than a real machine.

Intel have released an alpha OpenCL implementation (for X86).
There is also an interesting performance guide, SIGGRAPH slides, noting that transformations to code beneficial on GPU are not optimisations on X86 (e.g. exploitation of hierarchical memory spaces via __local etc).

Sunday, 7 November 2010

Crashing Around You

One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day.
Less and less remains until you arrive at non-action.
When you arrive at non-action,
nothing will be left undone.
The above is a commit message: I wish it had been informative, not pretentious.
Its time for operating systems to prohibit the space character in file and directory names. Too much breakage with respect to quoting even today, and this is a classic known issue in programming since before I was born.
Ubuntu 10.10 installs pretty straightforwardly in VirtualBox, but you need to install the "Guest Addons" from Virtual Box to teach it that there is a monitor capable of more than 800x600 resolution. Sony Vaio laptops need the virtualisation of the hardware enabled in the BIOS to let VirtualBox run the VM it creates: thats the first BIOS I have seen in, four? years or more. F2 gets the BIOS up at boot, and the enable virtualisation option is there. Note that this is after the BIOS update, that obsoletes all the dangerous hacks on the net that talk of unofficial BIOS updates / patches, that are now sitting around on the web to break careless readers.

Wednesday, 27 October 2010

Ain't it Fun

Teaching modern C++, as opposed to warmed up C in Modern C++.

Scripting user interfaces with images in Sikuli. Interesting, if inherently brittle.

Isometric in browser game development in JS and HTML5 canvas,

Pyparsing - some or all of the power of Parsec without the brain hurt of Haskell. MARS : a MIPS assembly IDE and simulator in Java, also usable as a cmdline emulator for a compiler tester.

The half float type - 16bit floating point, somewhat uncommon to find, but present in OpenCL. Conversion routines between float and half here, and here and here.

Saturday, 20 February 2010

Mirror Mirror

Embedding a Flash MP3 player in web pages is nifty. Yahoo also. Tips on the use of mercurial. Free web hosting on bit-bucket, via hg. Some actual content on the web. SQL in your web browser.

Wednesday, 10 February 2010

Enjoy the Silence

Folklore about computers. Guess they've been around long enough.

OSX continues to surprise with little command line tools that wrap the features of the underlying frameworks e.g. sips - scriptable image processing system. Useful in combination with pdftk.

Online PDF and MP3 of language learning courses.

Sunday, 31 January 2010

Starting Over

The site has a great overview of JavaScript best practices. Makes dealing with cookies pretty painless and easy.

Always good to get more usable icons.

Python has built in templates, good for a start before bothering with a full blown template engine.

Thursday, 31 December 2009

A Cry from the Crypt

Breaking into a running python program using pdb and Unix signals.
2d vectors in Python.

Learning Swedish. More learning Swedish, with online mp3 files. Mercurial hosting on bitbucket.

Cool tutorial on 2D games.

OpenGL Red book online. Basic introduction to vectors.

Open source OCR software, and papers about that. Cloth simulation. Again. Processing physics. GCD. Flixel.

Friday, 9 October 2009

Next in Line

The stdbuf program is now in GNU coreutils. Trying to handle buffered stdout in programs controlled via pipes is awkward.

Friday, 21 August 2009

Forget to Remember

A stylish introduction to the novelties of HTML5.

General collection of programming related 'stuff' - docforge looks interesting.

The Django framework in Python is quite nice, but needs, like all dynamic languages, a good way to debug for typos. The scratch module looks to be the simplest possible way to write a non DB backed web service, albeit with absolutely no support for safe concurrent data access as designed.

Planning a trip to MARS in a Cell. To read about Cell Execution and performance on Cell.

The HIPR Image processing textbook online.

Wednesday, 12 August 2009

The Unforgiving Blade

Cell Linux development is oft discussed on the cbe-oss-dev list.

Jeremy Kerr writes Cell Linux code for IBM.

IBM hosts the developerworks Cell Broadband Engine resource centre.

The Cell Performance forum has interesting articles.

The CorePy system can program SPUs.

A blog on Cell Programming.

How to setup a webserver on OSX. Dynamic DNS makes it visible to the world via a name (provided the computer is left on ;-))

Sunday, 2 August 2009


Shoes - ruby in a box, with a simple to use UI library. Nice enough, but bundling its own version of ruby makes it awkward to integrate 3rd party libraries wanting a different minor version of Ruby. It has an excellent, and amusing, set of documentation.

Compilers for one language targeting another are nothing new, but translating ANSI C into higher level programming languages is interestingly nutty to perform. Clue targets Lua, Java, Perl, and Javascript.

The clojure language discussion of state discusses some of the problems of using an Actor and message passing approach to concurrency.

Jerome K. Jerome's idle thoughts can be read via Project Gutenberg.

An explanation of the FFT.

Games need artwork. Free artwork is a good thing. Good free game artwork is a very good thing. General program art is also good, especially for icons.

Applescript is evil. Langauge bindings for AppleScript are nifty. Enter appscript. Don't forget the tools needed to understand the AppleScript API being bound to, e.g. iTunes.

Ambulance driving and paramedic work - how to be under appreciated, overworked, and covered in bodily fluids all in one day's work - and in a free ebook, Blood, Sweat and Tea.

VirtualBox is a free VM, ala VMWare or VirtualPC. Also, free for 'personal' use, which does in fact permit commercial usage. User manual.

Flipcards, in python. Pyglet, OpenGL and sprites and animation and sound and stuff for games, in a nice package. Unlike pygame, easy to install. Pymunk, a pythonic wrapper around the chipmink 2D physics library. 1.1.3 needs a fix for crashes related to timers, caused by sound playing. Centering windows tip.

Google's protocol buffers make python data persistence easy, and should provide support for evolving data schema.

Friday, 27 March 2009

Tuesday, 24 March 2009

Crash Test

Automated testcase reduction is way cool. Lithium is a very nice python tool for that, easy enough to modify (to for example, attempt to not reduce only in chunks that are powers of two in size)

Hand in hand with automated testcase reduction is automated testcase generation. There is a little GNU tool (named spu) hiding away in the GDB sources to do just that.

EA have a custom STL replacement. (EASTL). WxCocoaDialog, and CocoaDialog.

High precision timers for Cell Linux.

Monday, 16 March 2009

Look for the Truth

Terry Pratchett defines why I read SF & Fantasy.

Just when C++ seems understandable, some new examples of what can be done show up, and present interesting bafflement.

How to program securely in C/C++, avoiding integer overflow via templated operator overloads and allowing testing of objects in boolean contexts without unintended integral promotions.

Test case reduction - using Delta and a book on Why Programs Fail.
Delta debugging.

Monday, 2 March 2009

Welcome Home (Sanitarium)

The shape of code. Interesting. A book giving a cultural commentary on the C language. The C language is relatively small - the commentary comes to 1600 pages - if he wrote it for C++, then would it ever end?

Microsoft have, as expected, a
proprietary name mangling scheme for symbols output from their C++ compiler. It is irritating that they cannot find it in themselves to fully and publically document the naming scheme, resulting in a series of more or less incomplete or obsolete 3rd party attempts scattered across the internet. Even if they promise to, and do, completely revise the scheme each version of the MS tools, it would still be preferable to the current unknown, unknowable, and murkily mutable world of trying to interoperate.

Not that purveyors of open source are much better off - you can point fingers at the quality of the code, you can cry at the state of the documentation - or rather, the lack of (good) documentation about the internals - not just the user manual. Fear of infringing on license terms leads to a reverse engineering process, just like proprietary software, even with open source. Still, some other people do occasionally write docs - leading to the question, are those correct for any or all versions in the range from obsolete, current and bleeding edge.

The impact of economics on compiler optimisation.

Computer chess. Fast, and pretty. The grep command takes a -v argument to invert the meaning of the match - e.g. to drop matching limes, rather than non matching. Random numbers in batch files via %random%

Friday, 20 February 2009

The Line Begins to Blur

The 7zip tool has a command line program to go along with the GUI integrated into Windows explorer. This is well documented here.

High performance fractal viewer written in Java - beautiful images, and good performance. Seems scalar loops in Java get good performance, and you can write a portable GUI on top and have arbitrary precision maths support from the libraries. The symmetry in chaos book describes interesting fractals. Its a sign of changing times that the example programs were written in QBasic.

Some C++ objects are non-copyable. Some patterns recur. Heh.

Tuesday, 17 February 2009

Out Of The Shadows

The sphereflake - nice procedural model generation and raytracer in ~100L of C++. Sorting algorithms have a .com web site.

Tuesday, 10 February 2009

Wake Up

Someone, somewhere, is complaining about the offensive content of the internet. And sending cease and desist letters, to chilling effect.

Someone, somewhere, is wishing a file format they need to process was documented. People write books about things lacking documentation. Like Windows 2000, and its assorted development tools. Someone (who?) may be programming Windows applications in assembler.

John Levine's Linkers and Loaders book is available online in draft form.

Finally, online hex to binary/decimal converters are useful.

Friday, 6 February 2009

The Thin Line Between Love and Hatred

Visual Studio 2005 has a nice debugger; I spend quite a lot of time there. It is certainly an improvement over gdb. Some of its nicer features are the visualisations of the programs data structures - STL containers, arrays of characters as strings. The visualisation of data structures can be customised, and this is good; Sadly, it is not a documented feature. The autoexp.dat file contains the relevant specifications.

It can be used to provide custom views of data structures specific to programs and libraries. One example is the Chromium browser from google. (and links 1,2,3,4,5). It can also be used to auto expand watched data.

The parser and evaluator for these leave much to be desired. Syntax errors are silently ignored (the preview, or child view, the visualiser for a given type is unchanged) leaving the display unchanged. If not ignored, they are reported in a single modal dialog. If an error is not syntactic, the debugger will crash. Possibly immediately, possibly subsequently in the middle of a debugging session on inspecting certain values.

Beyond the implementation quality issues, the lack of documentation is the main problem. The syntax, while not good, would be improved by a smattering of documentation on the MSDN.

Its a shame, because it is obviously a (potentially) useful feature. It certainly was useful for substituting names for numeric codes in data views (when it didn't crash...)

The Visual Studio command line options are documented on MSDN - some obscure but useful ones. Possibly the most useful is /debugexe - to invoke the debugger on a program from the command line.