FamilySearch, the online arm of the Family History Library, has a new beta search service that lets the public dig around to find documents and facts on their relatives and ancestors. It’s a pretty huge index of data, and it’s free. More »
Monthly Archives: April 2010
FamilySearch Beta Finds Historical Records on Your Family [Genealogy]
Pdfcrowd Converts Web Sites and HTML Code to PDF Documents [Webapps]
Online service Pdfcrowd turns any web site into PDF format easily with a variety of options, including the ability to set margins, encrypt files, or disable copying and printing. More »
UITableView and Memory
The UITableView class is a wonder of efficient memory management, if you use it correctly.
Here’s the standard template code that Xcode generates when you create a subclass of UITableViewController:
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
return cell;
}
The keys here are the CellIdentifier variable and the call to dequeueReusableCellWithIdentifier, which enable the iPhone OS to reuse existing instances of UITableViewCell whenever possible.
(Don’t create a unique reuse identifier for each row as I’ve seen some developers do. Yes, it’s much easier to deal with asynchronous download of images for each row if you know how to uniquely identify the cell, and you know that the cell is still in memory. But that totally defeats the efficient memory management that UITableView is capable of.)
Under normal circumstances a UITableView will create one instance of a UITableViewCell per row that is visible on the screen. As you scroll, the cell instance that just rolled off the screen will be reused for the cell that is about to appear.
To verify that this memory management is working as it should, add a log statement each time a new cell is created:
if (cell == nil) {
DLog(@"creating a new cell");
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
When you run your app and start scrolling your table view, you should not see any creation of cells beyond the initial list (plus one). If you see “creating a new cell” log statements scrolling off the screen as you scroll the table view, you’ve got a problem.
If you just follow the standard Xcode template above, you should be fine. However if you’re loading a Nib for a custom table view cell layout using Apple’s recommended way, there’s an important detail you must not forget. (Tip of the hat to Jeff LaMarche for inspiring this blog post.)
Here’s the typical NIB loading code from Apple:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CheckedTableViewCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
DLog(@"creating a new cell");
// Load the table view cell from a Nib file.
[[NSBundle mainBundle] loadNibNamed:@"CheckedTableViewCell" owner:self options:nil];
// The checkedTableViewCell property is just a temporary placeholder for loading the Nib.
cell = checkedTableViewCell;
// We don't need this anymore, so set to nil.
self.checkedTableViewCell = nil;
}
return cell;
}
The key here is that the CellIdentifier value must also be entered into Interface Builder, like this:

If you don’t do this, then UITableViewCells will not be reused. (A telltale sign of this is that you’ll see lots of “creating a new cell” log messages.) There is no compiler or runtime warning if you fail to enter this critical piece of information into Interface Builder. So that log statement can be a useful warning.
(BTW, if you’re wondering what DLog is, then see this post: The Evolution of a Replacement for NSLog.)
Post from iPhone Development Blog Copyright © 2009 Nick Dalton – iPhone Developer
Recover Data Like a Forensics Expert Using an Ubuntu Live CD [Step By Step]
Plenty of utilities can recover deleted files, but what if you can’t boot your computer, or the whole drive has been formatted? Here’s how to dig deep and recover the most elusive deleted files, or even whole partitions. More »
How to Seamlessly Run That One Windows App You Need on a Mac [Virtual Machines]
Love OS X but have that one stubborn app you can only run on Windows? With the right tools and setup, you can run individual Windows apps seamlessly on your Mac desktop, as though they were always meant to be there. More »
Spinning RGB LED Ball II
Laserpointerforums member FireMyLaser built this most excellent Spinning RGB LED Ball II, using a bit of junk from his scrap pile and lots of ingenuity. He mentions that it uses a total of nine slip ring contacts, which is no mean feat considering that the whole thing was made by hand and spins at quite a fast speed. [Thanks, Matt!]
Entrustet Secures Your Accounts After Death with Legal Backing [Deathhacker]
The fate of your house, car, and Action Comics collection after your death can be planned for in legal documents. Your Gmail and Facebook accounts? That’s a bit murky. New legacy service Entrustet aims to help create legally sound post-mortem password vaults. More »
Turn Live SkyDrive into a 25GB Dropbox-Style Sync Space [Online File Storage]
Convert Your Toilet to a Dual Flush with a Retrofit Kit [DIY]
Dual flush toilets, despite the amount of water they save, used to be quite costly to obtain (around three hundred dollars). Nowadays, though, you can convert the toilet you already have for about thirty dollars and a half hour of work. More »
Top 10 Hard Drive Upgrades and Fixes [Lifehacker Top 10]
You should never feel like your hard drive is holding out on you. Anyone should be able to back up, recover files, boot multiple systems, upgrade, or otherwise improve their storage space. These tips explain the possibilities and procedures. More »







