MacBook Pro: First Impressions

After testing the Mac waters for a year or so on my Mac Mini, I decided to get serious about OSX and iPhone development and ordered a MacBook Pro to be my new development machine.

I decided on the 17″ model because I figured long ago that 1600×1200 is the absolute minimum resolution that I can work on for long periods of time without causing eyestrain. My workhorse laptop until now has been a 15″ IBM ThinkPad and if I could have gotten a 15″ laptop with a 4:3 aspect ratio, I would have. Unfortunately, no one seems to make those anymore.
Read more »

Dynamic C++

A while back, I started building a PDF parser in C++. I had been using the Adobe PDF IFilter to extract text from PDF files in order to index the content, but I wanted to be able to be able to also extract formatting information so I dug into the PDF format. The PDF format itself is fairly easy to parse, but the contents can be quite complex.

The PDF format consists of a series of objects, expressed in a simple syntax based on PostScript. There are primitives such as strings and numbers, and there are collections (arrays and dictionaries) which can contain both primitives and containers. You can see how things quickly become complicated when you have dictionaries containing arrays containing other complex objects.

Read more »

<XAML fest>

I just finished XAML fest, a two day introduction to SilverLight, XAML and Expression Blend.  The event was held at Microsoft’s New England R&D  Center in Cambridge,  Massachusetts. The class centered around building a small web app using SilverLight. A lot of time was spent learning how to use Blend to build user interfaces.

Having spent a good portion of my career building Windows apps, I’ve had the opportunity to create UIs using the Win32 API, OWL, MFC, WTL and wxWidgets. I’ve dabbled in WPF but never did much with it since I’ve been spending most of my free time tinkering with Cocoa and Cocoa-Touch. What I really like about using XAML is that you can lay out an entire interface, including a lot of behavior without writing a single line of code.

Read more »

A Python snippet for reading binary data

I’ve been experimenting using Python to read data from binary files and started to notice the following pattern in my code.

  1. Read a block of binary data.
  2. Use struct.unpack() to break out individual fields.
  3. Create a dictionary from those fields using the appropriate key names.

Read more »

Returning multiple values from a function in C++

Ideally all functions should return just one value. There are many times, however, when returning more than one value makes a function so much more convenient. The classic example of this convenience is file input. When we read data from a file we want to know two things: Did we reach the end of the file? and if not, what is the next piece of data from the file.

Sometimes, we can encode multiple return values into one. For many of us, the first C idiom we learned from K&R is processing input a character at a time:

int ch;
while ((ch = getchar()) != EOF) {
    // do character processing...
}

This works because the EOF macro was set to something outside the range of valid characters (usually -1). While this approach can work fairly well for simple cases, it quickly breaks down as the types we wish to return get more complex.

Read more »

Next Page »