Victor Ng's Radio Weblog : armed with cocoa, an ibook and too much spare time
Updated: 4/4/03; 12:20:45 AM.

 

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.


dotMac


Categories

Cocoa


Friends


Site Meter
 
 

Tuesday, November 19, 2002

Funny looking kid

"I'm so simple that only a Mac can help me." Yo Yo Ma

Maybe it's just me, but I don't like it when things are marketed for dummies.

All those books like "Martial Arts for Dummies" - they scare me. What are dummies doing with martial arts anyway?

And these switch commercials from Apple. I don't get it. How stupid am I supposed to be before I have to switch? I don't get it.

Will somebody please explain to me why all these ads are aimed at people who couldn't get a clue if they were doused in a barrel of clue musk?


6:27:23 PM    


BlogApp has exited due to signal 11 (SIGSEGV).

By far the most common error I've been making in Objective-C is forgetting to retain objects that are autoreleased.

Case in point - I tried executing some SQL onto a database connection and the ObjectiveC runtime immediately crapped out on me with the above error.

What I had done is in the init block, I had code that looked like this:

static SQLDatabase* database

...

database = [SQLDatabase databaseWithFile:path];

The database object is in the autorelease pool since I didn't explicitly invoke the alloc/init mesage handlers. Crap.

The fix is simple of course:

database = [[SQLDatabase databaseWithFile:path] retain];

and all is well in the world.

This isn't quite the same as a NullPointerException in Java though. I forgot to make the database connection at all initially, and I only saw the problem because a unit test failed - invalid number of returned rows. Why? Because Objective-C handles null objects properly so any method I invoked on nil just becomes a no-op.

So - what does this mean?

Note to self:

1. write more unit tests. 2. learn from stupid mistakes faster
5:59:03 PM    


Cocoa implements time according to the Network Time Protocol (NTP) standard, which is based on Coordinated Universal Time. The current private implementations of NSDate follow the NTP standard. However, they do not account for leap seconds and therefore are not synchronized with International Atomic Time (the most accurate). [Apple]

Huh?

I looked up Java's Date representation and I couldn't figure out if it used leap seconds or not. There's a really long winded discussion about leap seconds in the java.util.Date javadoc, but it seems to imply that it depends on the underlying operating system.

Thing only get more confusing when reading up on Dan Bernstein's weblog on TAI and UTC time. Aiyeee!!!
3:31:00 PM    


© Copyright 2003 Victor Ng.



Click here to visit the Radio UserLand website.

 


November 2002
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Oct   Dec


AIM: vng1@mac.com
MSN: v2ng@hotmail.com
ICQ: 30390174

NetNewsWire: More news, less junk. Faster