Archive for March 2007


Odd Web Traffic

March 29th, 2007 — 11:51am

Looking at my web stats I noticed a lot of downloads. While normally this would be a good thing there was something suspicious about the hits.

  • The rest of the site traffic was normal.
  • Many were multiple requests from the same addresses.
  • Many of the sessions went straight to the download without looking at any other pages.
  • The user-agent was “CFNetwork”
  • They were HEAD requests (so they weren’t really downloads).

Through some digging and poking around, I realized it was AppFresh. For those who don’t know, AppFresh is a program that basically is Apple’s Software Update for non-Apple software. It uses various mechanisms to figure out how to check on the latest version of your app. I’m glad someone decided to take this on and I’m interested to see how it progresses. Nonetheless, it’s prerelease and has a few wrinkles that need to be ironed out (such as not setting the user-agent so us devs could figure out what was happening). The developers seem responsive though so feel free to drop them a line.

The point of all this is that there are other devs that are just as confused or alarmed as I was about the traffic. Hopefully this will save some time and effort in trying to investigate this. This also fulfills my public service requirement for my PWI (Programming While Intoxicated) conviction last year.

On a side note, the topic of HEAD requests opens up a whole slew of lewd titles that I could have used for this post. Feel free to laud or chastise me for my restraint or sheepishness.

[Update: Just got a note from the AppFresh guys indicating they’ve released Preview 3 which now sets the user-agent, among other things. The quick turnaround is quite commendable. ]

Comment » | Uncategorized

Hazel Family Pack now available

March 23rd, 2007 — 4:49pm

I know I’m late to the party with this but I’ve finally made available a Family Pack. Install Hazel on up to 5 computers in the same household for $29. Direct link to the store.

The ice is thawing. Flowers are beginning to bloom. I can think of no better time grab a pack and get a headstart on your spring cleaning.

2 comments » | Hazel

A Different Kind of Bug Database

March 22nd, 2007 — 11:03am

When it comes to debugging, programmers become a bit like doctors. You look at the symptoms. You run some tests. You poke. You prod. You get your code to turn and cough. With any luck, you come up with the correct diagnosis and address the problem.

Of course, we aren’t always right or we forget how we fixed that one bug last year. As a result, we spend much more time on a bug than is necessary as we have to “re-learn” it.

Now, I’ve heard that doctors have access to databases where they can look up cases and cross-reference symptoms and diseases. Why not something similar for programmers? It’s a bug database, but not the type of database you normally use. It would be a meta-bug database of sorts. It would list bug “symptoms” from which you can find explanations of the problem, lines of investigation and possible solutions. It’s like a bug database after you’ve done a post-mortem on a problem.

Here’s a simple example:

Symptoms:
“selector not recognized”

Explanation:
An object is being sent a message that it does not implement.

Further Steps/Solutions:

  • You may have misassigned it. Make sure the object being called is of the class you think it is.
  • You may have freed the object and its memory location subsequently has been populated with something else. Check your memory management.
  • You may be accessing an uninitialized variable. Compile with -Wuninitialized.

Now, the last one I listed there was not something I would think of immediately, which is the point of this. In addition, I’m sure there are also other cases I didn’t list.

The database would draw upon the collective experience of programmers and would help to guide and expose new avenues of investigation. So, the idea is to start a colloborative, wiki-like bug reference database. I don’t know the how, who and where but I thought I’d put the idea out there to see if it gets any traction. Maybe it already exists in which case let us know about it.

9 comments » | Debugging, Programming

Mystery Bug: Heisenberg’s Uncertainty Principle

March 7th, 2007 — 6:59pm

I’ve spent the past couple hours going crazy over a bug. It’s the type of bug where it breaks except for when you look at it, in which case, it works all the time. Don’t believe me? Compile the following program:

#import <Foundation/Foundation.h>

int main(int argc, const char *argv[])
{
    NSAutoreleasePool     *pool;
    NSString              *path;
    NSDictionary          *dict;
  
    pool = [[NSAutoreleasePool alloc] init];
    path = [NSString stringWithUTF8String:argv[1]];
  
    dict = [[NSFileManager defaultManager] fileAttributesAtPath:path
                                         traverseLink:NO];

    // The busy flag will be NULL if you comment out the next line.
    //NSLog(@"DICT: %@", dict);

    NSLog(@"Creation: %@", [dict objectForKey:NSFileCreationDate]);
    NSLog(@"Busy: %@", [dict objectForKey:NSFileBusy]);
}


By the way, I know I’m not releasing the pool.

Now, take a file and set its busy flag. You can do this as follows:

/Developer/Tools/SetFile -a Z some file

Then run my little program with some file as an argument. Notice how the busy flag is null?

Well, let’s see what’s in the dictionary passed back to us to find out what’s going wrong here. Edit the program above to uncomment the NSLog statement. Run it again. Notice how the busy flag is now set?

It appears that the dictionary is half-initialized until you happen to call certain methods (-allKeys works as well as -description). I haven’t tested every key but it does seem to be peculiar to NSFileBusy.

For the time being, I’m going to switch to Carbon to do this but I’d love to hear theories (or even facts) on what’s going on here. Let the wild speculation begin.

Oh, and since I brought up Heisenberg, I can’t let an opportunity to include an artful rendering of a dead cat pass by so here:

dead cat

6 comments » | Carbon, Cocoa, Debugging, OS X, Programming

Hazel 2.0 alpha ready for testing

March 5th, 2007 — 8:18pm

Hazel IconIt’s been a bit of a wait for a lot of you but Hazel 2.0 alpha is ready to be downloaded and tested. Now, it is alpha so most, but not all of the features are there; be gentle. I have stopped using launchd in favor of a homebrew scheduler. As a result, those of you hitting the “Hazel stops working after logging out then back in” bug will be happy. Hazel also features new icons from Fernando Lins (featured here). A bunch of other stuff is in there so if you’re curious, check it out.

This is a semi-public pre-release, so you have to jump through a couple hoops to get at it. Details are on the beta forum but you must be registered on the forums to view it. I know it’s a bit tedious but I want to make sure all testers are tuned into the forums.

Oh, and for those of you wondering, 2.0 will be a free upgrade. I’ll have a Hazel 2.0 FAQ up at some point.

1 comment » | Hazel, Noodlesoft, Software

Back to top