Archive for the ‘objc’ tag
Goals are good + a Cocoa app to help you stay on track
Goals are good; regardless of how they work out, working at them gives you something to show for the time spent. Read the last 13 words again. If you don’t have something tangible to show, you just wasted your time. So, always try to produce something tangible.
With a ~/Code folder full of projects ranging from “twinkles in my eye” to “just need one more day”, I will be the first to admit I suck at this. I tell myself it’s because I have overcome the core technical problem and the only thing left to do is polish and release. It’s really easy to get sucked in by this, especially when you get another idea (and you will). Or, you may get embroiled in feature creep; you add feature after feature after feature. It’s also easy to say “I really learnt xyz even if there was no releasable product” and let it go at that.
However, all these reasons suck. The first gets you in the habit of abandoning projects 80% of the way, the second is tricky balancing act, but the third is merely mental hand waving; the experience that counts, where you actually learn something, is when you have a working product *that people can use*. It doesn’t matter how close something is to being released. Anyone can make things that kinda work; if it wasn’t released, you probably haven’t learnt the most important things or solved the hardest problems.
With this little epiphany that I need to finish projects, I decided to kill 2 birds with 1 stone by writing an application that keeps me on track with projects (no, I didn’t miscount, that’s 2 things). I also set a deadline of starting and finishing it in one day so I could beat feature creep.
Consequently, let me introduce Commit, a OSX app based on the wisdom of Jerry Sienfeld’s productivity secret. Basically, you set up various goals that you commit to doing everyday. The motivation to keep the chain from breaking pushes you over the humps when you really want to take a break. Instead of thinking “I will just miss today” you start thinking “I can’t break the chain today”. If that isn’t enough, you get *A GOLD STAR* for everyday you live up to your commitment
![]()
Commit also generates graphs to help you track your progress:
- All time graph shows you a graph of all days since you started this goal. The dips are the days you missed !
- The weekly graph lets you see what days of the week seem to be problem areas.
- The monthly graph, like the weekly graph, lets you determine patterns of when you slip up, but at a higher level.
So those are some things it currently does. It was hard not to keep on tacking on new features. But, the limit of the one day release really helped, even though I pushed it a bit
Things I decided to forego for now: optional twitter/facebook updates on milestones, group commits(group of people commit together, it tells you who is lagging), more graphs, better interface.
So download Commit now and start collecting gold stars
Easy session management
I hardly ever shut my laptop down as I don’t want to bother opening up all my applications again.
So, I just hibernates/wake up instead. The last time I actually rebooted was Sept. 2009. Unfortunately, this hasn’t had a good effect on my battery.

I did a few quick searches but couldn’t find a simple session management app for OSX.
And since I haven’t written anything for cosmcoa, I figured this is the perfect excuse to start.
So, let me present the aptly named “sm” a simple session management app for OSX.

Setup sessions as you want. When you launch a session, all apps in that sessions will be started. Restore your workspace with minimum hassle. You can do so as shown below through the status bar menu, or through the “Manage Sessions” list (select the app or session you want to launch and press “Launch”)

Should be good on 10.5+, but I’ve only used it on Snow Leopard. Download now.
Possible improvements I may add later: ability to provide customer arguments to apps, timed session start-up, strict mode (only apps in the currently running session are allowed to run), auto-update, auto-start on boot. But, its functional enough for now
p.s: this is the first OSX app I have tried to write. If it crashes etcs, don’t get mad. Instead, send me a bug report and I’ll fix it
Jiggly goodness
This is barely worth the effort of making a post for. However, since it took me more than a couple doc. references to figure this out, I figured it will help someone else.
Situation:
I have a text field inside a custom UITableViewCell. When a user tries to edit the text when it is disabled, I want to make it obvious. So, I decided to have the whole cell jiggle back and forth prettily when this happens.
Fix:
Add jiggle animation to the pertinent layer when the cell is selected.
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
if (!textField.enabled && !first){
[self jiggle:self.layer]; // send in textField.layer if you just want the text to jiggle
}
first = false; //hack: setSelected is called when the table is loaded...
}
-(void) jiggle:(CALayer*) layer{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
[animation setFromValue:[NSValue valueWithCGPoint:CGPointMake(layer.position.x-2, layer.position.y)]];
[animation setToValue:[NSValue valueWithCGPoint:CGPointMake(layer.position.x+2, layer.position.y)]];
[animation setDuration:0.1f];
animation.repeatCount = 3;
animation.autoreverses = YES;
[layer addAnimation:animation forKey:@"positionAnimation"];
}If you want to know more about CABasicAnimation, start here.