Archive for February, 2010

Categories – Best thing since sliced bread.

So here I was trying to make a Mac produce the little endian binary format that the Momento needs and so I thought I’d better extend NSMutableData to give it some LittleEndian “append” capability. So, I set up my class and the inheritance from but I kept getting an error that -length was only enabled for the abstract class. Then I discovered categories.

You can declare a new class as a category of an existing class (the convention is to name your files baseclass+category.{m,h}:

@interface NSMutableData (endian)

- (void)appendLittle16:(const uint16_t)value;
- (void)appendLittle32:(const uint32_t)value;

@end

As long as you import this header and link the implementation, your NSMutableData objects suddenly have this extra capability.

Instead of doing things with [super] as you normally do with an inherited class, you operate on [self].


@implementation NSMutableData (endian)

- (void)appendLittle16:(const uint16_t)value
{
uint16_t little16 = CFSwapInt16HostToLittle(value);
[self appendBytes:&little16 length:sizeof(little16)];
}

This makes the code to create packets for the Momento much simpler:

NSMutableData *data;

data=[[NSMutableData alloc] initWithCapacity:20];
[data appendLittle32:2];
[data appendBytes:&UUID length:sizeof(uuid_t)];

No Flash, No Problem

Well, it seems that another of my predictions is coming to pass. Content providers are moving away from Flash to deliver to customers. Hulu is apparently working on a Flash-Free application to allow iPad users to be able to access their content. With video-rich providers moving to other means to deliver and other technologies making the animation side of flash obsolete… As a mac user I find this wonderful. Flash has been leg-burningly horrid on the Macbook Pro for too long. Click to Flash was a godsend and I’m finding that I have to click less and less as people use other mechanisms to deliver their rich content to the masses.

Sideshow becoming more than a sideline?

Trawling the interwebs is a hobby of mine and I love to hear about new tech. I recently discovered a company is trying to create something more useful for sideshow to do than tell you how many mails you have.

Threemote Blog.

It seems they’re planning to put sideshow onto a range of devices and in a two-way full implementation so that you can use your smartphone as a remote for your computer.

I’m going to keep my eye on them. I’m not entirely sure about the “Golden-i” they mention… It’s bad enough with bluetooth earpieces. Threemote reminds me of the old Salling Clicker tool for the mac, but all widgety.

Ordinarily a toy for Windows would be about as useful to me as a chocolate teapot. I don’t actually own a physical windows box any more and I only recently booted Vista just to make my momento work. I wonder if I could do anything interesting with it on the mac? iPhone’s Remote app is great if you just want to do iTunes and there are other apps to control specific functions, and even apps to allow the phone to be a mouse/keyboard.

What if you could do several remote things in one app, and not just on the iPhone. That may be interesting to more people.