Install this theme
Mac OS Time Machine - Custom Backup Intervals

Being that I hate every hour backups (well, not the backups, but I hate the volume level of my external drive), and I’m fine with a backup running once a day – here’s how to set Time Machine with a custom interval:

1) In the Time Machine preferences, turn it OFF

2) (We’re built on Unix, yea?) Set up a cron to run backupd-helper (Which is equivilent to the ‘back up now’ selection when you control-click the dock icon)… If ‘crontab -e’, and the vi editor are foreign to you, I’d probably stop, or do a ‘man 5 crontab’ or something from a terminal session. If not, here’s my daily 3am backup:

0 3 * * * /System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper

Every 2 hours, at 15 past the hour would be:

15 */2 * * * /System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper

Xcode & Me - Not friends today!

First time using Xcode 4 to submit my Mac App to the store today … Did a lot of work to make it play nice w/ Mountain Lion, App Sandbox, Developer ID, …

1) Build and Archive - and realize I don’t have an App Bundle created, but a generic Xcode archive. You can’t submit those to the store.

2) Found this great article on stack overflow about how child/dependent projects need to have “Skip install” set to yes in their application build settings for the project to be created as a normal Mac App Bundle. I change it, compile my project, and errors everywhere (which seem like stuff I’d see if my provisioning profiles were zapped, or info.plists removed…)

3) Freaking out a bit, I go to my projects build summary page, and am surprised to see the icon for my MAS target is not set anymore, I’m missing my app category, the bundle ID is different (?), build isn’t a build number anymore but a “1.0”.. I fear my project was just destroyed.

4) Time Machine to the rescue! I move my entire project to the trash, pull up time machine, find a version from early this morning, and restore… Tick, tock… ERROR. “The operation can’t be completed because you don’t have permission to access ‘name-of-config-file-in-my-project’”. Huh? Does that mean I can’t write to the directory? Read from my backup disk?

5) I manually copy the directory from my backup disk to my Desktop (which works), and then make a copy of that and put it in my projects directory… Fire up Xcode, and get a ton of errors about how my project is locked - do I want to unlock? I click ‘yes’, and then get errors saying my “project.pbxproj” file is locked.. Xcode won’t even close for me; I’m forced to force-quit it at this point.

6) After repeating step 5 a few times, I find this awesome post which clued me in about ACLs (most importantly, how to identify they were at play and how to get rid of them). Did that, and bam - I can now get access to my project again.

7) Back in Xcode. Verify all the settings on my target summary page look fine, go to build settings of my subproject, set “Skip Install” to YES, build+archive.. Sucess, but huh? My archive is missing an icon, and it fails validation. (Because category wasn’t set, my bundle id didn’t match the store’s idea of what it was, … essentially describing the issue in #3). I go back and look at settings, and they’re gone again!

8) Closed Xcode, deleted my project dir, pulled over the copy off my desktop, repeated step 7 a few more times. Failed just the same.

8.5) Checked the Mac App Store - surely there’s an update to Xcode. Nope. I’m on the latest.

9) Repeated step 8, … but this time, I took screen captures of the “before”, and just re-set everything up again. Build and archive, success… Archive file looks good.. Verifies… DONE!

10) Pour stiff drink. Maybe a couple.

Dock Tile Plugins - No More?

WTF is this about? I sure hope Apple didn’t just make the playing field even more uneven… While submitting this app to the Mac App Store tonight, it seems what I’ve done in the past is now wrong.

From TFAD:

The Dock tile plug-in must be placed inside the Contents/PlugIns directory of your application’s package. The plug-in is associated with the application by adding a NSDockTilePlugIn key to the application’s information property list. The value associated with this key is the name of the plug-in’s bundle, which must end with a .docktileplugin extension.

iCal/iCloud Reminders - Due Time API Hell

Apple - please give some serious attention to the mess you’re creating with your Calendar APIs and apps, please. I could complain about the mess you caused by duplicating calendars when people upgraded to Lion to be able to support Reminders outside of event calendars, or I could complain about how you’ve yet to provide a way to use your CalendarStore framework to sync directly to iCloud and still require iCal to do this, but I won’t. 

I will, however, complain loudly about the mess and inconsistency shown with your current implementation of Reminders. (Specifically, the concept of “due times”, which you fail to properly implement in 2/3 of your own calendar apps). It is impossible to create a Reminder due on a certain time with Lion’s iCal, or even iCloud.com!

I’m going to create one for tonight in a few hours at 9pm (2100) using the Reminders app on the iPhone…

 

Okay. Due times are a new thing to Reminders (previously known as To Dos, previously known as Tasks). A few minutes later, thanks to the magic of the iCloud, I see my Reminder in iCal!

Okay. Good so far. However, a trip to iCloud.com, and we start to see issues:

This task isn’t due yesterday. (GMT, maybe, but not my system time zone)

This isn’t my largest complaint. This is the start of inconsistency. I need to remind myself to make a mixed drink tonight at 10pm. But this time, I’ll create it in iCal. The first thing I notice, is that the overdue icon shows on this new reminder, but the event is “due” an hour AFTER the first reminder I created!

What I’ve learned: iCal doesn’t support due times on Reminders the same way as the Apple Reminders app does. The “time” on the due date property can’t be set from iCal, but it IS set in Reminders iOS app.


iCloud.com’s view of things - it matches iCal, sorta, with some questionable UX choice… Reminder is due today, and remind me “22 hours after”. Em, okay.

Of course, it’s impossible to create a proper reminder with a due time using iCal or iCloud.com .. 

So, maybe the problem is only specific to the UI in iCal and iCloud.com not letting you specify a time on a dueDate? The docs say this should support both… So, here’s a CalTask object that I save, which still breaks.

CalTask <0x1c7b250> {uid = 3E01D80A-85DF-4322-87B3-0163E40AE4B1; dateStamp = (null); title = Another drink; notes = (null); URL = (null); calendar = CalCalendar <0x4e054e0> {UID = 337F8BC4-D7C1-4132-9E16-931E0436E8E1; title = Reminders; notes = ; color = NSCalibratedRGBColorSpace 0.443137 0.101961 0.462745 1; type = CalDAV; editable = 1}; alarms = (

    “CalAlarm <0x1cd53a0> {action = AUDIO; URL = (null); sound = Hero; emailAddress = (null); relativeTrigger = 0.000000; absoluteTrigger = 2012-01-10 05:00:00 +0000}”

); dueDate = 2012-01-10 05:00:00 +0000; completedDate = (null); priorty = 0}

(I’m GMT-0600 , so this should be 11pm. iCal still shows an overdue task, iCloud shows one due “23 hours after”, and Reminders app doesn’t show a due time)

Oh, back to iCloud.com… Remember the option to alert you “22 hours later”? Or, seeing the dropdown above, being able to set a specific time on a day? Try doing that with a new Reminder, and you’ll find that those options don’t exist for you!

NSTextView Auto-Resizing Text

Had fun trying to get an NSTextView to resize its text so as to not scroll or anything. It works good now… Thought I’d share. Here’s the end result:

… the code:


- (void) didChangeText {
	// this method will reduce size of text to fit nicely inside a NSTextView.. Subclass NSTextView and drop this in it.
	// the max size is taken from whatever is initially set (so this won't "grow" the text, unless you tell the NSTextView
	// to set its font to 200pt or something... 
	[super didChangeText];

	float maxDesiredHeight = self.frame.size.height - 28; // this is the "padding" on top and bottom.. should probably be changed to use insets or something.
	
	// Start evaluating at the biggest this field has ever seen, and go down.. 
	static float originalLargestFontSize = 0; 
	originalLargestFontSize = MAX(originalLargestFontSize,[[self font] pointSize]);
	
	float newFontSize = originalLargestFontSize; 
	[self setFont:[NSFont fontWithName:[[self font] fontName] size:newFontSize]];
	
	BOOL keepGoing = YES;
	while(keepGoing) {
		NSLayoutManager *layoutManager = [self layoutManager];
		unsigned index, numberOfGlyphs = [layoutManager numberOfGlyphs];
		float maxHeight = 0.0f;
		
		NSRange lineRange;
		for (index = 0; index < numberOfGlyphs; ){
			NSRect r = [layoutManager lineFragmentRectForGlyphAtIndex:index effectiveRange:&lineRange];
			maxHeight = MAX(maxHeight,r.origin.y+r.size.height);
			index = NSMaxRange(lineRange);
		}
		
		if(maxHeight > maxDesiredHeight) {
			newFontSize -= 0.5;
			[self setFont:[NSFont fontWithName:[[self font] fontName] size:newFontSize]];
		} else {
			keepGoing = NO;
		}
	}

}

Um, this looks wrong:

Jul 19 09:32:24 JayKayBeeMacOS Safari[32875]: Periodic CFURLCache Insert stats (iters: 432) - Tx time:0.028139, # of Inserts: 5, # of bytes written: 16844, Did shrink: NO, Size of cache-file: 182755328, Num of Failures: 0

Bonjour, QuickCal!

Bonjour, QuickCal!