qmchenry's tutorials

OS X: Edit a file using TextEdit as root or superuser

Contributed by qmchenry on June 24, 2010 under Mac system administration

Editing some files on an OS X system requires superuser or root permissions. Typically, this is accomplished using sudo (which lets authorized users assume superuser powers, cape and tights optional) and vi. To the uninitiated, vi can cause intestinal distress and hair loss. An alternative is the use of TextEdit, the graphical text editor application, but under normal circumstances, you can open a system file like hosts but cannot save it. Following the steps in this recipe, you can edit a system file using TextEdit and put off learning vi for another day.

30 comments Continue reading... 
 

Create NSIndexPath for UITableView in iPhone/iPad App

Contributed by qmchenry on April 2, 2010 under Computer programming

Once you get past basic table view applications on the iPhone or iPad, you may run into the need to create an instance of NSIndexPath. NSIndexPath is an interesting class that stores the path to get to something in a nested set of collections. In an iPhone UITableView application, NSIndexPath is central as it provides a reference to the section of the table and the specific row of interest. There is a trick to creating an instance yourself. Read on to find out how.

3 comments Continue reading... 
 

Cocoa: Convert number to comma-separated NSString

Contributed by qmchenry on January 30, 2010 under C programming

At some point in your Mac, iPhone, or iPad development you may find the need to express a long number (1000000000) as a comma-separated string (1,000,000,000) to make life easier on your users. The NSNumberFormatter class is a rich tool for converting numbers to strings supporting different types of currencies and localizations. It’s also the perfect class to leverage for our comma-ing task.

4 comments Continue reading... 
 

Our first iPhone game GreenThumb available in the App Store

Contributed by qmchenry on October 11, 2009 under Games

We are giddy to announce the availability of our first game for the iPhone, GreenThumb. View the game at iTunes or try a full-featured, ad-supported FREE version! GreenThumb is an original, one-thumb casual game for the iPhone and iPod Touch. It is easy to pick up yet challenging to master.

5 comments Continue reading... 
 

Using iPhone 3G S and iPhone 4 Voice Control Commands

Contributed by qmchenry on June 24, 2009 under Apple iPhone

Apple’s latest hardware upgrade for the iPhone line, the iPhone 3G S, adds voice control capabilities. Without looking at the device, using voice control you can easily dial the phone using numbers or a contact’s name, and control the iPod with various commands. (Updated as these can be performed with iPhone 4 as well) Here are the details:

42 comments Continue reading... 
 

iPhone SDK: Solve [UINavigationController pushViewController:] unrecognized selector sent to instance

Contributed by qmchenry on January 16, 2009 under Apple iPhone

I adore coding to the iPhone SDK. It’s the most joyful coding I’ve done in the quarter century (gasp!) I’ve spent coding various computer systems. It’s a combination of Objective-C (elegant) and Cocoa (beautiful). There is one exception I keep getting and just infrequently enough that I forget why I get it. I thought someone might benefit from this because it’s an easy trap to fall into.

17 comments Continue reading... 
 

Cocoa: Explode or break an NSString into individual words

Contributed by qmchenry on October 20, 2008 under Computer programming

Breaking apart a string of text into component words is a requirement for performing searches in text and other text processing. This task is easy in Cocoa/Objective-C, although it requires digging through a few class references in the documentation. If you need a more complicated expansion of a string, at least this code will give you a starting point.

3 comments Continue reading... 
 

iPhone Programming: Set UITableView Accessory Arrow Style

Contributed by qmchenry on October 12, 2008 under Apple iPhone

The iPhone SDK provides an easy-to-code standard for creating consistent user interfaces. The UITableView class is used in many iPhone applications. Most applications that present information to you in rows that you can tap to slide a new page over to see details use a UITableView to do the magic. Once you have a UITableView setup, you can easily add the little accessory arrow icons to the right side of the table cells by following the steps in this Tech-Recipe.

13 comments Continue reading...