OS X: Flush or Clear the DNS Cache
The command used to flush the DNS cache changed in OS X 10.5 Leopard and later versions. The new command is just as easy to run, if not to remember. This article has been updated for all current versions of Mac OS X.
Category Apple Mac, Mac system administration
How to Create a Basic MySQL Table
Creating tables in databases is an important first step for storing data. The CREATE TABLE statement is rich and sometimes confusing. This tech-recipe with an example describes the basics of creating a table in MySQL.
Category MySQL
OS X: Edit a file using TextEdit as root or superuser
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, […]
Category Mac system administration
Create NSIndexPath for UITableView in iPhone/iPad App
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 […]
Category Computer programming
Cocoa: Convert number to comma-separated NSString
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 […]
Category C programming
Our first iPhone game GreenThumb available in the App Store
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.
Category Games
Using iPhone 3G S and iPhone 4 Voice Control Commands
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 […]
Category Apple iPhone
iPhone SDK: Solve [UINavigationController pushViewController:] unrecognized selector sent to instance
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 […]
Category Apple iPhone
Cocoa: Explode or break an NSString into individual words
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 […]
Category Computer programming
iPhone Programming: Set UITableView Accessory Arrow Style
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 […]
Category Apple iPhone
Open vim editor to first occurrence of search term
I don’t want to admit how long I’ve been using vi as my go-to editor (although if vi had been born then, it would now be old enough to drink and vote). One of the things I love about vi is that you only need to know a few things to use it, but it […]
Category UNIX
How to empty or clear the contents of an existing UNIX file
If you want to empty the contents of a UNIX file, you could delete it and recreate it, but, as is typical of UNIX, there are more elegant alternatives. Here are a couple of ways to dump the innards of a file. If you know of any others, add them to the comments.
Category UNIX