OSX Lion: Refresh Launchpad Contents

I recently came across a problem. The contents of the launchpad, somehow, got corrupt. I was seeing files that shouldn’t be there. So… how did i fix it?

Open this folder:

~/Library/Application Support/Dock

(CMD + Shift + G… and paste that!). Once you’re right there… you’ll need to delete delete the “.db” file. Last step… relaunch the dock!

killall Dock

That’s it!

CoreGraphics: Drawing Dashed Lines

Suppose you wanna draw a dashed line all around a control. What should we do?. Well… simple. We need to invoke some CoreGraphics dark magic… it’s pretty self explanatory. The catch to it is that it’ll draw a dashed line. Play with it..!

static CGFloat const kDashedBorderWidth     = (2.0f);
static CGFloat const kDashedPhase           = (0.0f);
static CGFloat const kDashedLinesLength[]   = {4.0f, 2.0f};
static size_t const kDashedCount            = (2.0f);

- (void)drawRect:(CGRect)rect
{
    [super drawRect:rect];

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetLineWidth(context, kDashedBorderWidth);
    CGContextSetStrokeColorWithColor(context, [UIColor grayColor].CGColor);

    CGContextSetLineDash(context, kDashedPhase, kDashedLinesLength, kDashedCount) ;

    CGContextAddRect(context, rect);
    CGContextStrokePath(context);
}

Old School Mac

So… we’re stuck in 2012. While technology moves forward in a fast pace, the human aspect of our society gets worse as well. If you think about it … it’s wicked. We have all of this cool tech, yet, people die of hunger all over the world.

Not too long ago… everyone thought that tech would change the world. Say.. back in 1984.

Guess what!. If you miss that epoch… and don’t feel ashamed about it, you can skin your OSX to make it look as the ooooold Mac System. It’s pretty cool, and you can get it for free right here.

Current Selector’s Name

So… suppose you wanna log the name of the ‘current’ method. You could hardcode the method name, right there… virtually everywhere… or you can do this:

NSLog(@"[ %@ ] did something", NSStringFromSelector(_cmd));

It’s simple. Yet, its something i didn’t know… three days ago!.

Coda 2 for OSX

Time has come to write few lines about Panic’s fellows. This week they have released an awesome tool named ‘Coda‘. For those who never heard about it, it’s an html editor. I’ve tested TextWrangler, TextMate, BBEditor, Sublime, just to name few. But this one has everything already in there.

It has svn / git integration, and it’ll also allow you to upload your new websites to Amazon S3, or any webhosting you might be using.

Furthermore, if you buy it through the AppStore, you’ll get iCloud Sync. Which means that your website-credentials are gonna be stored safely in Apple’s backends.

These days i’m not thaaaat into HTML editing. But i’m using this dude to do my svn commits (i don’t like Xcode’s svn integration… haven’t you noticed?).

If you’re looking, by chance, for an HTML editor for OSX… just give coda a try. You won’t regret it. They even have an iPad version..!