Welcoming 2009 with some Goals

Posted January 6th, 2009 by Chris

A belated happy new year! I’ve been reading a lot of ‘lifehacker’ blogs recently - the original LifeHacker, ZenHabits and unclutterer.com being the main three - and am hoping that 2009 will be a good year to declutter (both digitally and in the real world!). I thought it best, then, to outline some goals at the start of the year and see where I get with them over the remaining 359 days.
Read the rest of this entry »

Tags: , , , , , ,
Posted in Personal | No Comments »

Signed up to Twitter

Posted December 11th, 2008 by Chris

Having resisted for so long, I finally signed up to Twitter.

Tags: , ,
Posted in Personal | No Comments »

How to stop rsync overloading your wireless/LAN

Posted December 1st, 2008 by Chris

I am currently using rsync as a backup solution between two computers and an external backup drive, all operating across my wireless LAN. However, every so often - and always when syncing a lot of files - rsync has knocked out my wireless internet. Today, I decided to find out what was going on, and found the solution:


rsync --bwlimit=500 ...

It turns out that rsync was overloading my router with data, causing it to reset the connection. Setting a bandwidth limit (in kBPS) to one nearer that of the router prevents overloading, and allows the scripts to complete.

Tags: , , ,
Posted in Business, Dissertation, Personal, Programming | No Comments »

Cast a String to Timestamp in PostgreSQL

Posted August 20th, 2008 by Chris

If storing a date/timestamp in a varchar or text field in postgres, the to_timestamp() function will let you access the value as a ‘real’ date. The second parameter tells the function the format of your string:

SELECT to_timestamp('2008-08-01', 'YYYY-MM-DD') AS date;

Tags: , , ,
Posted in Personal, Programming | 2 Comments »

Cocoa Bindings and NSPopUpButton

Posted July 29th, 2008 by Chris

A frustrating problem I came across today when I tried binding an NSPopUpButton’s selection key to an NSArrayController’s selection was that the NSPopUpButton would always display a ‘ghost’ object -one of the opaque classes internal to Cocoa/Core-Data Bindings(<_NSControllerObjectProxy… or similar).

It turns out that NSPopUpButton does not record the user’s selection, so even if I had been able to get rid of the ghost object, I wouldn’t have been able to access the selected object.

The solution is to manually maintain a currently selected object in the window controller - File’s Owner in Interface Builder; in this case, selectedPackage:

In MyWindowController.m:


- (void)setSelectedPackage:(NSManagedObject *)package
{
// ... checks ...
selectedPackage = package;
}
 
- (NSManagedObject *)selectedPackage
{
return selectedPackage;
}

In Interface Builder, the NSPopUpButton should be bound to the NSArrayController (Packages) and the File’s Owner as:

Content: Packages.arrangedObjects
Content Values: Packages.arrangedObjects;modelPath=packageName
Selection: File’s Owner.selectedPackage

A default selection can then be provided by calling the setSelectedPackage: method.

Tags: , , ,
Posted in Programming | 1 Comment »