26
Mar
2008
 

Cocoa Tutorial: awakeFromNib vs applicationDidFinishLaunching

by Marcus Zarra

When developing an application in Objective-C and using Cocoa, there is a lot of “magic” that happens in the background. As we get more comfortable with the language and the APIs, we begin to discover the source of that magic and understand not only WHY it works but HOW it works.

One of those areas is the initialization and callbacks from the nib files to my code. Normally, when I want a controller to do something after the NIB/XIB has loaded, I add the method -(void)awakeFromNib and know that I will receive a call when all of the connections into the NIB/XIB are complete. But on what object does this get called and how?

(more…)

 
18
Mar
2008
 

Git and .mac: A Match Made In Purgatory

by Marcus Zarra

Last year, I made the switch from subversion to Git. After 9+ months of using Git, I can comfortably say that it was a very good choice. While branching is easy in subversion, merging is just as bad as it was in cvs. Git is a significant improvement over that. In addition, since Git is a true distributed source control system, I can easily do branches and merges on my local machine without an internet connection and just “push” my changes to my off-site server when it is convenient.

I am also a user of .mac. I like the service and the iDisk is probably my favorite feature. Therefore, I wondered, like chocolate and peanut butter, could I put these two together and come up with something better than the individual parts?
(more…)

 
11
Mar
2008
 

MacBook Air: Thoughts and Issues

by Marcus Zarra

For those of you who only read this blog for coding suggestions and tutorials — please hit next on your feed reader :)

For those who are also interested in our development environments, hardware, etc. then please read on.
(more…)

 
8
Mar
2008
 

Cocoa Tutorial: How to Crash Cocoa

by Marcus Zarra

This article is designed to serve multiple purposes. First, it is to educate which I hope that it will. Secondly, it is a personal memory so that if (when!) I run into this issue again, I will be able to use Google to find this post and remember why I am an idiot and why the default settings for things are not always the best settings.MenuCrash.zip

First as always, here is the project that goes with this article.

If you run this application you will see that it does basically nothing. The interesting part of this app is how it crashes. To crash this application, perform the following steps:

  1. Open the application.
  2. Select the Application menu.
  3. Select the About window.
  4. Close the About window.
  5. Open the Application menu again.

(more…)

 
7
Mar
2008
 

iWeb Buddy has been released!

by Marcus Zarra

iWebBuddyIcon.pngiWeb Buddy has gone Gold Master!

Marcus S. Zarra of Zarra Studios, released iWeb Buddy on March 6, 2007.

Do you like using iWeb but wished it had some advanced feature that you simply need for your website? Perhaps you want Google Analytics on your site or you want to add Social Bookmarks to your blog posts? Perhaps you just want to have more than one Domain file.

iWeb Buddy solves all of these issues for you! With iWeb Buddy you can “process” the pages generated by iWeb and add those pieces of html code or javascript that you need to make your site complete.

iWeb Buddy has the following features:

  • Multiple Domain files that open properly in iWeb.
  • Google Analytics injection.
  • Social Bookmarks (Digg, Slashdot, etc.)
  • Haloscan comments injection.
  • Mint site tracking.
  • RSS Feed redirection (for use with FeedBurner, etc.)
  • RSS Feed linking on blog entries.
  • Custom HTML body code
  • Custom HTML header code
  • And a lot more…

To find out more information about this new product, visit its product page.
(more…)

 
4
Mar
2008
 

MacDevNet Podcast: MDR005 Data

by Marcus Zarra

I had the pleasure recently of being on an episode of the Mac Developer’s Roundtable with Kevin Hoctor, Aaron Hillegas and Steve “Scotty” Scott. In this latest episode, Scotty introduced the topic of data, how to store it, access it, etc. To kick it off, Aaron delivered a fantastic history of Core Data or as it was originally called, Enterprise Objects.

I highly recommend this episode to anyone who is interested in Core Data and Cocoa in general.

You can get the episode from MacDevNet.com.

(more…)

 
3
Mar
2008
 

Core Animation Tutorial: Wizard Dialog with Transitions

by Marcus Zarra

A question that I have seen pop up a few times is how to build a Wizard in Cocoa. Having thought about that question a bit I realized that a better answer to it is — how to build a wizard in Cocoa using Core Animation.

The basic concept behind this project is to present a window to the user that will walk them through a list of options. To accomplish this task, I created a number of NSViews that will be presented to the user in order so that they can make the decisions needed. To make this a little easier, I have extended NSView to create MSZLinkedView. The added functionality in this subclass is that the view has a reference to the previous and next views in the wizard. These references are set in interface builder directly so that I do not have to worry about them in code.

(more…)

 
1
Mar
2008
 

Does Objective-C Perform Autoboxing on Primitives?

by Marcus Zarra


This article is inaccurate.


The writer was smoking crack or something when he wrote it and has not been able to duplicate his tests since. This article is left here for historical reasons.

One of the things about Objective-C that I find extremely useful is the ability to resolve a method call at runtime. In addition this same functionality allows us to do some fairly creative things with callbacks, passing messages between threads, etc.

However there is a bit of a trick when it comes to passing primitives though some of these methods. For example, one method that I use quite frequently is performSelectorOnMainThread:withObject:waitUntilDone:. How exactly does one pass a BOOL or an int to this method?
(more…)

 
20
Feb
2008
 

Cocoa Coding Practice: Old School vs New

by Marcus Zarra

Garbage Collection

This post is in response to a few queries that I have received regarding my last post showing an NSOperation example. One of the questions raised that I will focus on is my -(void)dealloc method in the NSOperation subclass. The questions boiled down to:

Why are you using releases at all. Garbage collection is the future!

and

You should be just doing [self setVar:nil] instead of that [var release], var = nil; crap.

(more…)

 
16
Feb
2008
 

Cocoa Tutorial: NSOperation and NSOperationQueue

by Marcus Zarra

Light BulbThreading is hard in any language. And what is worse, when it goes wrong, it usually goes wrong in a very bad way. Because of this, programmers either avoid threading completely (and refer to it as the spawn of the devil) or spend a LOT of time making sure that everything is perfect.

Fortunately, Apple has made a lot of progress in OS X 10.5 Leopard. NSThread itself has received a number of very useful new methods that make threading easier. In addition, they have introduced two new objects: NSOperation and NSOperationQueue.
(more…)