Python Screen Grab Code

The following code listing is for a cross platform method for grabbing the screen in Python. It uses PIL on Windows, and ImageMagick on other platforms.

import PIL
import os
import platform

def grab_screen(fname):
    if platform.system() == 'Windows':
        PIL.ImageGrab.grab().save(fname, "JPEG")
        cmd = "import -window root %s" % fname


Database options with Delphi XE Starter

I’m slightly annoyed at the lack of ADO components in DXE starter. I’m not familiar with BDE or Interbase, and the documentation for these appears rather lacking. As I’d prefer to use MS SQL Server Express because it’s free and it’s what I’m familiar with, I thought I’d look at ADO but Embarcadero have elected not to ship the ADO DB components with DXE starter.

Given that I’m not going to do any serious DB work in Delphi, the simplest alternative is to use SQLite. There’s a set of Delphi components for accessing SQLite databases called DISQLite3. It’s simple to use; TDISQLite3Database and TDISQLite3Statement and we’re rocking. A personal version of DISQLite3 is free for non-commercial use. As an added bonus, applications using DISQLite3 don’t depend on the SQLite DLL.

What’s not to like?

Delphi Sampling Profiler

There’s an excellent, free Delphi profiler called “Sampling Profiler”. It does exactly what it says on the tin, launch your application in the profiler and when it’s done you get a report detailing the parts of your program that are consuming the most CPU time. Unlike GProf, you even get the offending line that is taking up all your CPU time.

It’s simple, it works and it’s free. Get it from


Initial thoughts about Delphi XE Starter

It’s been a very long time since I had any interaction with Delphi. We did a  lot of Delphi at university, and since then the Delphi world has changed a lot. These are well documented elsewhere so I won’t go into that here.

Instead, I discovered earlier this week that Embarcadero (Delphi’s current owner) has finally released a cut down version of Delphi for hobbyists and start-ups that’s priced very reasonably at about £120 for the upgrade. Most developers should qualify for the upgrade as you only need to use any of the free IDEs such as Visual Studio Express or Eclipse to qualify.

Now back to Delphi XE Starter. It’s a cut down version, so what did they cut out?

Quite a lot actually.

I’ve not spent too much time with it, but the notable omissions are:

  1. Class viewer. This panel hosting a tree control that lists all classes and methods are the staple of every IDE including the free ones.
  2. Code Insight. If you’re not familiar with Delphi (like me) then this would mean nothing to you. It the ability to go from declaration to definition (i.e. F12 in Visual Studio) and is very useful when attempting to navigate a source tree.

I’ve also started being slightly annoyed by the Pascal language that’s starting to feel like a dinosaur especially after spending years in languages like C++/C#. You cannot declare variables on the fly, the language is not case sensitive (n is different from N) and it’s very verbose.

This is just from a few hours use, so things might look up once I become more familiar with the product.