Apple breaths new life into AppleScript on Mavericks

by john on October 28, 2013

Don Southard on AppleScript and Mavericks: Once I started to sink my teeth into some of the power-user features, though, it didn’t take long for me to really get sucked into trying out every new geeky addition, specifically all of (…)

Read the rest of this entry »

Cocoa turns 19 years old, a little history

by john on October 28, 2013

Graham Lee on the history of Cocoa: First there came message-passing object oriented programming, in the form of Smalltalk. Well, not first, I mean first there was Simula 67, and there were even things before that but every story has (…)

Read the rest of this entry »

Bitfields in C

by john on August 9, 2013

Given space is often at a premium when writing applications for mobile devices, I want to show you how to use bitfields to manage a series of values that need only on/off status. The upside is that you can store (…)

Read the rest of this entry »

Using XOR to Toggle an Integer Between 1 and 0

by john on June 12, 2013

If you ever come upon a need to toggle an integer value between 1 and 0, consider using the bitwise exclusive-OR (^) operator in C to get the job done. In a recent application I wrote a method with one (…)

Read the rest of this entry »

Introduction to Protocols

by john on April 26, 2013

What follows is a quick introduction to working with protocols. This is good background information to understand as protocols are common in various Cocoa frameworks. A protocol is means to define a list of required and/or optional methods that a (…)

Read the rest of this entry »

Basics of Notifications

by john on April 14, 2013

What follows is a brief guide to working with Notifications in Cocoa. I’ll cover the basics, including registering an observer and posting notifications, just enough to start using notifications in your apps. There is an instance of NSNotificationCenter available to (…)

Read the rest of this entry »

Xcode Code Completion

by john on March 5, 2013

What follows is a quick review of how I use code completion in Xcode. Chances are that options and features exist beyond what I’ll cover here, so comments and suggestions are welcome. Let’s say I want to insert a CGRectMake (…)

Read the rest of this entry »

Gotcha: GCC and Unused Values

by john on April 6, 2009

Subtle typos and the problems they bring, it’s enough to drive one nuts. Let me share a recent experience that will shed some light on my most recent experience. Below is a short snippet of code that show something similar (…)

Read the rest of this entry »

Xcode Code Completion Macros

by john on March 26, 2009

In the previous post I described the basics for working with code completion in Xcode. In this post I will show how you can use built-in text macros to insert various code fragments. As an example, begin by entering ifelse (…)

Read the rest of this entry »

Safari 4 Beta

by john on March 1, 2009

A little off topic, but a good tip none the less… Apple recently released Safari 4 beta and if you haven’t given it a try, I highly recommend you do.

Objective-C Object as a C Structure

by john on March 1, 2009

Okay, so figuring out how to unwind an Objective-C object into its base representation goes against all that is object-oriented programming, however, it’s interesting none-the-less. In Objective-C there is a directive, @defs(), that outputs (at compile time) the list of (…)

Read the rest of this entry »

Open Source Screen Capture Tool

by john on February 23, 2009

I’ve been on the hunt for an open source screen cature tool for the Mac. I finally found what I was looking for, a tool that in which you can specify the exact size of the capture window. Let me (…)

Read the rest of this entry »

Xcode Expert Preference Settings

by john on February 19, 2009

Beyond the settings you can access from the Preferences menu of Xcode, there are a number of configurable options that can be set using the defaults command from a terminal window. Two of the settings that I have configured are (…)

Read the rest of this entry »

Change Company Name in Xcode

by john on February 1, 2009

Although covered many other places on the net, I recently had to make a change to the name that Xcode automagically inserts when creating new files, so I figured I’d also pass on this tip to readers of this blog (…)

Read the rest of this entry »

Date Formatters – Part 3

by john on January 16, 2009

While working on an iPhone application recently, I needed to convert a date read from an XML stream that was in the following format: 20081122 to a nicely formatted string for display on the device: Saturday November 22, 2008.

Date Formatters – Part 2

by john on January 9, 2009

In the first post on working with dates several of the examples use the “old style” date format syntax. The examples work, however, I want to show an additional example that uses the ICU (International Components for Unicode) library for (…)

Read the rest of this entry »

Date Formatters – Part 1

by john on December 30, 2008

Sometimes all you’re really looking for is a basic chunk of code to get something done. For example, I was working on an application yesterday and needed to display the current date in text format: October 29, 2008. A simple (…)

Read the rest of this entry »

Xcode FIXME and TODO

by john on December 23, 2008

In a previous post I introduced how to use #pragma mark to help navigate source files within Xcode. There are several additional tags that can be used within a source file to call out specific code or content.