Tag Archives: Computer

A Boring Observation About the New iMac

The new Apple 27″ iMacs announced last month ships with a monitor with the insanely high resolution of 5120-by-2880. When you sit down in front of one of these you are looking at 5120 pixels wide * 2880 pixels high * 4 bytes per pixel = 56Mb of data.

To put that in perspective, the first computer I bought with my own money was a Commodore Amiga 500 in 1990. For the time it was an advanced machine with a special chip (the blitter) that could copy (according to Amiga Hardware Manual) almost 4 megabytes per second if you set things up juuuuust right and the wind was behind it.

That means that an Amiga working flat out could just manage to clear a retina display in slightly over 14 seconds, whereas the iMac can draw a whole frame every 60th of a second. Computing has come a long way in 24 years.

(adjusted for inflation, the iMac is probably cheaper as well)

Stuff from my Old Hard Drive

I don’t usually keep a lot of files around. When I get a new computer I don’t tend to copy all my documents across – anything I haven’t looked at for a couple of months is probably not worth the fraction of a millimetre it takes up on the platter. On the other hand, some things I can never bring myself to delete. Here is something I rediscovered the other day:

This is one of the first MODs I wrote back on the Amiga. I never had a sampler or a very large collection of instruments, but I loved mucking around with MED trying to get a pleasant sound out of the 4 channel 8-bit sound. It is often said that there is a lot of crossover between programming and music, and the soundtracker clones of the 90s made that explicit which is possibly why I enjoyed it so much. Now days I can fire up GarageBand any time I want with any number of sampled instruments. I could say that I regret not having the time to produce music as an adult but the truth is that the inspiration isn’t there any more – my interests have moved in other directions.

Although none of my MODs ever sounded anything like as good as the music from the games and demos of the time, I am still pretty pleased with this one. It must date from form 6 (I was 16) which makes it vintage 1991. Listen to the sound of 20 years ago…

Jungle Drums MP3
Jungle Drums OGG

A Better Boost Book

Boost is a excellent resource for C++ programming, but suffers from inconsistent documentation and a daunting array of sub-projects. Trying to make sense of it all is a fairly serious undertaking. I tried to get my head around it by writing my occasional series of boost blog posts, but now I see that somebody has done a much better job.

The Boost C++ Libraries is a free book that clearly explains some of the more generally useful boost libraries, with lots of useful examples. It even covers advanced libraries like ASIO in an approachable way. I highly recommended bookmarking it if you do any C++ programming.

UIButton.titleLabel is not as useful as it looks

I have been doing some iPhone development lately. Nothing too amazing, just some test apps to get a feel for the system. Now, some people will tell you that Cocoa Touch is an API sent from God and frankly it is pretty good (especially given what passes for UI on other embedded devices), but that doesn’t mean it doesn’t have some annoyances.

Here is something that tripped me up for a while. The UIButton class has a property called titleLabel which (obviously) returns the UILabel that is used to display the text of the button. You can use this property to modify the parameters of the label, like so:

m_addButton.titleLabel.font = [UIFont systemFontOfSize: 7];
m_addButton.titleLabel.textColor = [UIColor blackColor];		 
m_addButton.titleLabel.textAlignment = UITextAlignmentRight;

What you can’t do is this:

m_addButton.titleLabel.text = @"Add Stuff";

Although nothing I have found in the documentation says so, the text of the button cannot be set from the titleLabel property. What you have to do is this:

[m_addButton setTitle:@"Add Stuff" forState: UIControlStateNormal];

Setting the title this way works, and has the advantage that you can specify different text for different states:

[m_addButton setTitle:@"Add Stuff" forState: UIControlStateNormal];
[m_addButton setTitle:@"Add Stuff (not now)" forState: UIControlStateDisabled];

This is perhaps not that interesting for text titles, but is an excellent way to control the image the button shows based on whether the button is enabled, highlighted, and/or selected.