/dev/random

Reality has a liberal bias

/dev/random random header image

Entries Tagged as 'Programming'

New version of theme is available

September 6th, 2006 · 3 Comments · Programming, Web

I’ve uploaded the new version of my Random Image theme. You can download it here.
Blogged with Flock

[Read more →]

Tags:

My life just got more difficult

September 5th, 2006 · Comments Off · Macintosh, Programming

My company switched their source control from Visual SourceSafe (which I accessed using SourceOffsite) to Team Foundation Server (VSTS). Since XCode has no built-in support or plugins for either system, I always worked locally, did a checkout of any files changed locally, and then checked in my changes (after merging, if necessary). It was easy [...]

[Read more →]

Tags:

Mac OS X Internals

July 7th, 2006 · Comments Off · Macintosh, Programming

My copy of Mac OS X Internals: A Systems Approach arrived today. I’ve been buried in it most of the day. This is the first book I’ve seen that really goes deeply into how OS X works.

[Read more →]

Tags:

A Tip for QA

May 25th, 2006 · Comments Off · Programming

“It Doesn’t Work” is not a useful bug report.

[Read more →]

Tags:

Busy week

April 30th, 2006 · Comments Off · Programming

I had a very busy week trying to implement a feature and this week will be more of the same. Tomorrow morning I have a conference call at 9AM.
I curse the person at Netscape who invented proxy auto configuration. You can’t simply read & parse a .pac file - you need a javascript interpreter to [...]

[Read more →]

Tags:

Python

March 16th, 2006 · 1 Comment · Programming

I’ve started learning Python, which I’ve wanted to do for a long time. One thing that always bothered me about it is that whitespace is significant. Unlike most languages where blocks are delimited by begin..end or {…}, in Python a block is delimited by all statements being indented the same amount. Am I the only [...]

[Read more →]

Tags:

A real stumper

March 16th, 2006 · Comments Off · Programming

I’ve run into a puzzling problem that’s kept me stumped for several days. I have a command-line tool that simply can’t be debugged. I’ve built it with optimizations turned off and debugging symbols enabled, but it won’t stop at any breakpoints, even if I put a breakpoint at the first line of main().
Someone suggested adding [...]

[Read more →]

Tags:

GP2X Development Tools

March 2nd, 2006 · Comments Off · Programming

I finally set up a working GP2X development environment on my Intel Mac. I’ve uploaded the build script & libraries here. The libraries won’t build cleanly on a Mac, so I built them on my Linux box.

[Read more →]

Tags:

Developing GP2X software on an Intel Mac

February 28th, 2006 · Comments Off · Programming

I spent most of the weekend building Intel native GP2X development tools using ooPo’s build scripts. Most of it wouldn’t build as is, so I had to do lots of manual tweaking to get it to build. I finally got a working set of tools, and my next step was to hack the script so [...]

[Read more →]

Tags:

MacIntel hacking

February 8th, 2006 · Comments Off · Programming

CAUTION: extreme geekiness ahead…
I’ve been attempting to build WINE on my iMac Core Duo. I’m just using the raw wine source code, although someone has Mac patches for it. I ran into difficulty with context_i386.c, which contains functions that obtain the register contents from a process using ptrace. Unfortunately the register structure & PT_GETREGS isn’t [...]

[Read more →]

Tags:

Starting Gp2x development

January 23rd, 2006 · 2 Comments · Programming

I now have my GP2X development environment set up using DevKit gp2x MacOS. I managed to find the appropriate SDL libraries and I was able to build and run most of the sample code I’ve tried.

[Read more →]

Tags:

CPU Usage update

December 5th, 2005 · Comments Off · Drupal, Programming

The changes I made to MacMegasite seem to have helped the CPU usage situation. It’s reduced the CPU usage by each execution of PHP.CGI by at least 50% as well as reducing the overall CPU usages. Here are the resource usage stats for the last few days, only counting CPU usage by PHP.CGI.

Date
Total CPU time
# [...]

[Read more →]

Tags:

Lightweight Drupal home page

December 2nd, 2005 · 1 Comment · Drupal, Programming

I’ve cleaned up my code for MacMegasite’s new page by breaking it up into separate include files for the left & right sidebars. The entire code is less than 50 lines and uses only a single database query and no calls to Drupal code.

Continue reading for the full code

[Read more →]

Tags:

Random Image Theme

November 8th, 2005 · Comments Off · Programming, Web

I’m still getting lots of email about my random image theme, so I’ve added a lot more information here explaining how it works and how to modify it. I’ll probably add a link to that page somewhere.

[Read more →]

Tags:

New category & feed

October 18th, 2005 · Comments Off · Macintosh, Programming, Web

I’ve created a new category, Mac x86 for all of my posts about porting to Intel. You can also subscribe to a feed for that category only here

[Read more →]

Tags:

Porting to Intel V

October 18th, 2005 · Comments Off · Programming

For any networking code, make sure you’re using htonl & htons when building a socket address structure. If you look at the structure you’re passing to connect(), the IP address & port should appear reversed. Dealing with these byte ordering issues can be very confusing. Always be aware of what byte order is expected for [...]

[Read more →]

Tags:

Porting to Intel IV - W00t!

October 14th, 2005 · Comments Off · Programming

I got a major part of my application working on the Intel Mac.
Here are a few macros I came up with to handle the byte ordering issues when reading & writing binary data from a file:

#define W(w) ((unsigned short)w)
#define WSWAP(w) (W((W(w) << 8 ) | (W(w) [...]

[Read more →]

Tags:

Porting to Intel III

October 12th, 2005 · Comments Off · Programming

The XCode debugger (and gdb) will confuse you with word & long values. For example, I have an IP address & port stored as the bytes 00 50 c0 a8 0 64 (that’s 192.168.0.100:80). Displaying memory in the debugger will show it as a8c05000 00006400 if you use the default word size of 4. [...]

[Read more →]

Tags:

Porting to Intel II

October 11th, 2005 · Comments Off · Programming

Never assume Macs are big-endian. I found code which uses #ifdef __MAC__ to decide whether byte order swapping is required - that’s just plain wrong.

[Read more →]

Tags:

Porting to Intel

October 7th, 2005 · Comments Off · Programming

An IP address is not a long int - it’s 4 bytes. Doing something like this is bad:

sprintf(buf,”%ld.%ld.%ld.%ld”, (ip>>24) & 255, (ip>>16) & 255, (ip>> 8 ) & 255, ip & 255);

[Read more →]

Tags: