Monthly Archive for May, 2006

The State Of App Stop On Intel Based Macs

Many users have come to me saying App Stop isn’t working on their new intel Macs. I’m aware of this problem but I’m unable to do anything about it. Their is a bug in the intel build, but I can’t find it since I don’t have a intel mac to debug on. If you have any experience with Xcode/Objective-C and have a intel mac please email me, I could really use your help (If you have a spare MacBook or intel MacMini laying around that would work too :) ).

Mounting The ISO-9960 Partition Of A Hyrbid CD On OS X

Instructions on how to accomplish this are not easily found on the web at all. It took me alot of googling to find a solution that works. Since I spent 1/2 hour googling to find that link, I figured I’d post it up for anybody else who is trying to accomplish this same task.

Upgraded To WordPress 2

Yup, this site is now running WordPress 2.02. I was holding off upgrading because of one of the plugins I used alot, Code Highlight. It still doesn’t have WordPress 2 support, but I found a code highlighter that uses the exact same syntax (and has support for more languages!), Code Snippet. The upgrade process was real easy, took me about 10 minutes. Most of the changes are in the admin panel and I have to say, the admin panel is much nicer. I highly recommend upgrading if you haven’t done so already.

What Does NSString’s Length Method Really Return?

You would think that it returns the number of characters in the NSString, but it doesn’t. Instead, it returns the number of

unichars

(1 or 2 byte characters). So as far as

-[NSString length]

is concerned every 4 byte unicode character (the double flat, for instance) counts as 2 characters even though it’ll only be displayed as one character on screen.

This isn’t a bug per-say in

-[NSString length]

, but it’s not the behavior I was expecting. To count the number of characters in NSString use the following function adapted from AGRegex:

int utf8charcount(NSString *string) {
    char *str = [string UTF8String];
    int chars, pos, len = [str length];
    unsigned char c;
   
    for (pos = chars = 0; pos < len; pos++) {
        c = str[pos];
        if (c <= 0x7f || (0xc0 <= c && c <= 0xfd))
            chars++;
    }
   
    return chars;
}

Splitting & Merging Binary Files

Yesterday I had to upload a huge file (1.4GB tar.gz file) to my web-server and uncompress it once it was uploaded. Even my new fiber optic (FIOS) internet connection couldn’t handle a file that big (it dropped out at around 900mb). So I figured I would split the file up into manageable chunks, upload the split files to server, join them together, then uncompress them. Since I’m no unix shell guru I googled “splitting and merging binary files unix”; nothing useful came up, I tried changing the search terms a little bit to get different results, still nothing.

Using ManOpen I found the

split

utility. Looked like exactly what I was looking for. I split the huge tar.gz file into 100mb chunks using the following command:

split -b 100m bigarchive.tar.gz

This worked perfectly, so I searched for a

join

command to merge the files together once they were on the server. There is indeed a join command, but it’s description is a “relational database operator”; not exactly what I was looking for. After a little bit of searching and experimentation I learned that the

cat

command doesn’t just work with text files, it works with binary files too. So I used the following command to join the file chunks together and uncompress the resulting archive (I was able to use * instead of the filenames of the chunks since there weren’t any files in the directory besides the archive chunks):

cat * | gunzip | tar xf -

It actually ended up to be a pretty simple operation, but it wasn’t documented on the web anywhere!

Sliced Dock!

Yesterday my Dock decided it didn’t like the finder, so it cut it off from the Dock.
Mousing over or clicking on the Finder icon wouldn’t cause anything to happen. Pretty weird, I’ve never seen this before. A simple

killall Dock

fixed it, so it must of been a obscure bug with the Dock.