This page looks plain and unstyled because you're using a non-standard compliant browser. To see it in its best form, please upgrade to a browser that supports web standards. It's free and painless.

Paul's Time Sink

| Main | Albums |

iPod USB Retractable cable

Paul Westbrook | 05 March, 2006 02:11

El-IuaApple has a created a huge racket with their iPod.  When you buy an iPod for $300-$400, it comes with a USB cable.  But if you want a dock, you will have to pay about $40 for the Universal Dock.  If you want to use this dock on a different computer than where you have connected the iPod included cable, you will have to get another $20 cable since the Universal Dock doesn't come with a cable.

I didn't want to pay $20 for this cable, so when I was at Fry's, I saw this $10 retractable iPod cable from Macsense.  It works perfectly.  (In fact, the dock connector itself seems to grip the iPod better.)  I can imagine that this cable could break before the Apple one would, as there are moving parts in the retracting mechanism.

Technorati Tags: , ,

rendering images in Cocoa

Paul Westbrook | 05 March, 2006 00:51

I was having a problem getting image files to render in Cocoa, using Objective-C.  Here is the code that works for me:

    NSString *shortPath = @"~/Desktop/DCP_4146.JPG";
    NSString *absolutePath = [shortPath stringByExpandingTildeInPath];
    NSImage *image = [[NSImage alloc] initWithContentsOfFile: absolutePath];
    
    NSSize imgSize;
    NSRect dstRect;
    NSRect imgRect;
    
    // how much room do we have to play in?
    NSRect bounds = [self bounds];
    
    imgSize = [image size];

    // Should really be a while loop to scale down truly huge pictures
    dstRect.size.width = imgSize.width;
    dstRect.size.height = imgSize.height;
    
    imgRect = NSMakeRect(0, 0, imgSize.width, imgSize.height);

    [image drawInRect:dstRect fromRect:imgRect operation:NSCompositeSourceOver fraction:1.0];
    

Technorati Tags: ,

Powered by LifeType
Design by Book of Styles