Restoring playback of Sound Effects in Lion (ex: iChat doesn’t play alert messages)

I recently switch my full time OS from SL to Lion and one of the bugs I have noticed is that anytime I let Lion put my Mac Pro to sleep I loose playback of all sound effects. For instance doing a screen capture (Apple Key (CMD) + Shift + 3) does not play the shutter sound, and iChat does not play any sound effects (ex: incoming or sent messages, buddies coming online, requesting an audio chat, etc),

This is even more strange when considered in conjunction with what does work! For instance, in the iChat preferences, if I edit the sound effect played for any event the sound plays correctly. Yet when an actual event occurs in that should play that sound effect … nothing. Of course, I verified that all of my audio output selections and volumes were correct (and all sound plays correctly when verifying these items).

After a lot of googling I came across this post about iChat not playing alert sounds which had the solution, at least in my case. To test and see if you have the same issue, open System Preferences > Sound > Sound Effects and change the alert sound. If it does not play, you likely have the same, or very similar issue, that might be resolved following these steps.


Possible Solution:

To resolve my iChat alert and system wide sound effects not playing problem I performed the following steps:

  1. Open System Preferences, click on the Sound pane.
  2. Select a new “alert sound”
  3. Change the “Play sound effects through” device selection
  4. Restore both to their original values

Example Original settings:


After changing alert sound and output device:


After restoring original settings:


That Didn’t work!

If the above steps do not work, it is suggested that you might be able to correct the issue by deleting the file:


and then restart your mac. Note that this is the /Library preferences and not ~/Library preferences.

Got A Solution?

If anyone knows either why this happens in Lion after waking the machine from a sleep state, or (even better) how to prevent this from happing, please post a reply!

Posted in Help, OSX | Leave a comment

How to manage iOS Provisioning Profiles

How to manage iOS Provisioning Profiles
While the process of managing iOS Provisioning profiles continues to be refined by Apple, it still is not a totally obvious process, especially when it comes to some of the finer details like updating profiles, ensuring you have all the data associated with signing like your public and private keys for the certificates and how to create a setup that is easy to backup and maintain.
Here I am going to share with you how I manage my provisioning profiles, and it’s my hope that doing so will make it easier for you to manage yours. Using this setup I am able to manage and use a number of different accounts without confusion between them (i.e., I am able to ensure client privacy and confidentiality) and with only a slight headache due to Xcode’s not providing a way to specify which keychain to use for a project, even though the actual program Xcode uses for signing takes a keychain parameter.
NOTE: I highly recommend turning off Xcode’s auto-management of profiles! While this does work well for single person development, it creates confusion when multiple developers are wanting to manage signing profiles and application ids. It’s better long term to take a bit of extra time to setup an organized system for creating and updating this information vs letting xcode handle it, as this will save a lot of time down the road when it comes to managing more applications, developers, and devices. (i.e., instead of having to have 10 developers add a new device to their profiles, you can add it once to a single profile).
Preliminary Setup
We want to keep things organized in a way that lets us manage all aspects of the provisioning setup, so the first step is perform some setup:

  1. Create a unique keychain to store your certificate signing information in. Even if you do not want to use a unique keychain for development (it does add an extra step and can be somewhat of a pain), you do want to use a unique keychain during the setup process so that you have a clean storage bin for the signing keys and certificates. Without this it can be quite difficult to locate your keys for instance Also, once done, you can copy all the items to your login keychain and just save the unique keychain as a backup.
  2. Create a folder named AppStore in your documents folder, or anywhere else that gets backed up by Time Machine or whatever backup solution you are using. You are using some type of backup solution, right? (I also create an alias to this on my desktop for ease of access, but that’s up to you.)
  3. Create an alias to the provisioning profiles folder on your desktop. The provisioning folder is located at “~/Library/MobileDevice/Provisioning Profiles” (where ~ is your user folder, for example “/Users/jsmith”). We do this because it allows us to determine which profiles are what, as apposed to the automated install process).

Generating a Certificate Signing Request (CSR)
OK, now we are ready to start the typical setup for the store. I am going to assume that you have not done this already, or that you are willing to start from scratch. If you already have any certificates, you need to revoke them from both the development and distribution tabs before beginning!
The first step is to create a signing certificate. For the sake of completeness, I am including the section from Apple’s docs on this below, with minor modifications for improving management of the resulting data:
To request an iOS Development Certificate, you first need to generate a Certificate Signing Request (CSR) utilizing the Keychain Access application in Mac OS X Leopard. The creation of a CSR will prompt Keychain Access to simultaneously generate your public and private key pair establishing your iOS Developer identity. Your private key is stored in the login Keychain by default and can be viewed in the Keychain Access application under the ‘Keys’ category. To generate a CSR:

  1. In your Applications folder, open the Utilities folder and launch Keychain Access.
  2. From File menu, select “New Keychain…” and create a new keychain located in the default location (~/Library/Keychains). I suggest naming the keychain something like “AppStore_MyCompany” so it’s easily identifiable. Choose a password that you do not mind sharing should the need arise to share your AppStore login information. This is handy, for instance, in cases where the CEO of a company is the store agent but the CTO is the one that will actually be creating the AdHoc and AppStore builds.
  3. Your new keychain will then appear in the keychain list on the left side of the keychain window. Click on it to select it, and then from the File menu choose the last item, “Make keychain <your keychain name> default”. This will set your new keychain to be used as the first place to look for keychain data or for storing new information. The main benefit is that the public/private keys used for the certificate you are about to create will be easily found.
  4. In the Preferences menu, set Online Certificate Status Protocol (OSCP) and Certificate Revocation List (CRL) to “Off”.
  5. Choose Keychain Access -> Certificate Assistant -> Request a Certificate from a Certificate Authority. Note: If you have a noncompliant private key highlighted in the Keychain during this process, the resulting Certificate Request will not be accepted by the Provisioning Portal. Confirm that you are selecting “Request a Certificate From a Certificate Authority…” and not selecting “Request a Certificate From a Certificate Authority with <Private Key>…”

  6. In the User Email Address field, enter your email address. Please ensure that the email address entered matches the information that was submitted when you registered as an iOS Developer.
  7. In the Common Name field enter your name. Please ensure that the name entered matches the information that was submitted when you registered as an iOS Developer.
  8. No CA (Certificate Authority) Email Address is required. The ‘Required’ message will be removed after completing the following step.
  9. Select the ‘Saved to Disk’ radio button and the ‘Let me specify key pair information’ checkbox, then click ‘Continue’.
  10. You will be prompted for a location and filename to save your CSR. Use the default filename, and save it to the “AppStore” folder you created during the setup steps.
  11. In the following screen select ‘2048 bits’ for the Key Size and ‘RSA’ for the Algorithm. Click ‘Continue’.
  12. The Certificate Assistant will create a CSR file in your AppStore folder.

Requesting Your Certificates
Next you need to submit your CSR to the Apple iOS Provisioning Portal for approval. Using your agent login information, perform the following steps:

  1. Log in to the iOS Provisioning Portal, navigate to ‘Certificates’ > ‘Development’ and click ‘Request Certificate’.wpid-pastedgraphic6-2011-04-5-10-43.png
  2. Click the ‘Choose file’ button, select your CSR and click ‘Submit’. If the Key Size was not set to 2048 bits during the CSR creation process, the Portal will reject the CSR.
  3. Upon submission, Team Admins will be notified via email of the certificate request.
  4. As the team agent, your requested certificate will be automatically approved one it has been issued, unlike requests from admins or developers where each request must be approved by the agent or by an admin.
  5. Repeat the process in the Distribution tab. (Development profiles are used for debugging and profiling, while Distribution profiles are used for AdHoc (testing) and App Store (submission to Apple) builds.

Downloading and Archiving Your Certficates and Keys
After your certificate has been issued, which should take only a minute or two but sometimes longer, you need to:

  1. If you have not already done so, download the WWDR intermediate certificate.
  2. Download both the distribution and development profiles. These will be downloaded to your default download folder, and named (at the time of this writing) ‘developer_identity.cer” and ‘distribution_identity.cer’.
  3. Copy both signing certificates and the WWDR intermediate certificate to your AppStore folder, along side the signing request file. I also highly recommend renaming your two signing certificate files by prefacing each with your name, for example ‘jsmith_developer_identity.cer’, so that you can distinguish them from other identity certificates you may request or download in the future.
  4. Add the WWDR intermediate certificate and your two signing certificates to your AppStore keychain created in the setup steps. The easiest way to do this is to select the AppStore keychain in the Keychain Utilities application window, and then drag each file from the finder into the keychain listing window (which at this time should only have the public and private keys generated during the creation of your CSR).
  5. Once you have added the certificates, I recommend you export the public and private keys to your AppStore folder as a backup. To do this, right click on each and select “Export…” from the popup menu. Again, I recommend prefixing the saved file name, for example “jsmith_Public.pem” and “jsmith_Private.p12”. (Note that the public and private keys are exported in different formats.)

Generating an App ID
Next you will need to create an application ID, if you have not already done so. The following is from Apple’s How To on the subject, however before jumping into that I would like to advise paying close attention to the wildcard references. Specifically, unless you have an actual need, you should only use a single Bundle Seed ID for all of your app id’s. In addition you should create a ‘company wildcard’ app id, that looks something like “*”, and can be used to sign any of your applications that do not need specific id’s (ie, for instance to use Push Notifications, In App Purchase or Game Center).
Note that if you use * to create a wildcard that looks like “8E549T7128.*” then that app id can be used to create a profile that will sign any application, useful for instance if you are a developer working on another company’s application as you do not need a signing profile from that company (you can use yours). However, such a signing profile can also cause issues, as it can override desired signing profiles! In other words, the full wildcard is powerful, but also dangerous so use with caution.
An App ID is a unique identifier that iOS uses to allow your application to connect to the Apple Push Notification service, share keychain data between applications, and communicate with external hardware accessories you wish to pair your iOS application with. In order to install your application on an iOS based device, you will need to create an App ID.

Each App ID consists of a universally unique 10 character “Bundle Seed ID” prefix (generated by Apple) and a “Bundle Identifier” suffix that is entered by a Team Admin in the Provisioning Portal. The recommended practice is to use a reverse-domain name style string for the “Bundle Identifier” portion of the App ID. An example App ID would be:

If you are creating a suite of applications that will share the same Keychain access (e.g., sharing passwords between applications) or have no Keychain Access requirements, you can create a single App ID for your entire application suite utilizing a trailing asterisk as a wild-card character. The wild-card character must be the last character in the App ID string. Example App IDs for this situation could be:* or R2T24EVAEE.*

In these wild-card situations, you’ll simply replace the asterisk with whatever string you wish in the CF Bundle Identifier field in Xcode.

  1. Team Agents or Team Admins should navigate to the ‘App ID’ section of the Provisioning Portal.
  2. Click ‘Add ID’.
  3. Enter a common name for your App ID. This is a name for easy reference and identification within the Provisioning Portal.
  4. Enter a Bundle Identifier in the free-form text field. The recommended usage is a reverse-domain name style string, e.g., com.domainname.applicationname. For a suite of applications sharing the same Keychain access, you should use a wild-card character in the Bundle Identifier (e.g., com.domainname.* or *). This Bundle Identifier will need to match whatever CF Bundle Identifier you use for your application in Xcode.
  5. Click ‘Submit’. At this time, the 10 character Bundle Seed ID is generated and concatenated with the Bundle Identifier you entered. This resulting string is your App ID. Note: The Bundle Seed ID does not need to be entered into Xcode.
  6. Generate a new App ID for each set of applications with shared Keychain Access needs. If you are creating a suite of applications that will share the same Keychain access (e.g., sharing passwords between applications) or have a set of applications with no Keychain Access requirements, create a single App ID for all applications utilizing a trailing asterisk as a wild-card character.

Creating Your Provisioning Profiles
The final step is to create the actual provisioning profiles you will use to sign your applications. Provisioning profiles are created by associating application ids with devices and determining which developer certificates are allowed to sign the profile. Typically you will want to have all of your developers able to sign each development certificate. A copy of Apple’s How To guidelines for doing so are below.
Note that for security purposes Apple only allows the team agent to sign AdHoc and AppStore provisioning profiles. While this does make sense and I believe was a good decision on Apple’s part it is not always the case the agent will either be able to or want to create app builds. By creating a separate keychain for the AppStore we simplify the secure sharing of the information needed to sign AdHoc and AppStore builds with another person or persons within the company.
A Provisioning Profile is a collection of digital entities that uniquely ties developers and devices to an authorized iOS Development Team and enables a device to be used for testing. A Development Provisioning Profile must be installed on each device on which you wish to run your application code. Each Development Provisioning Profile will contain a set of iOS Development Certificates, Unique Device Identifiers and an App ID.

Devices specified within the provisioning profile can be used for testing only by those individuals whose iOS Development Certificates are included in the profile. A single device can contain multiple provisioning profiles.

  1. In the ‘Provisioning’ section of the Portal, Team Admins should click ‘Add’ on the Development tab.
  2. Enter a name for the provisioning profile. I recommend the following naming convention here (where, if you are creating a wildcard profile MyApp would be Wildcard): “MyCompany_MyApp_Dev_001”
  3. Specify which devices will be associated with the provisioning profile. You must specify a device in order for that device to utilize the provisioning profile. If a device’s UDID is not included in the provisioning profile the profile and your application cannot be installed on that device.
  4. Specify which iOS Development Certificates will be associated with the provisioning profile. You must specify an iOS Development Certificate in order for the application code signed with that same certificate to run on the device.
  5. Specify a single App ID for the Development Provisioning Profile. Each Development Provisioning Profile can specify only ONE App ID, therefore, if you have applications requiring different Keychain access, you will need to create a separate Development Provisioning Profile for each of those applications. If you are installing a suite of applications with the same required Keychain access or have a set of applications not requiring access to the Keychain, use an App ID containing the wild-card asterisk character to build all of your applications.
  6. Click ‘Submit’ to generate your Development Provisioning Profile.


Repeat the process for your distribution builds, noting that you need to create one for both the AdHoc and AppStore for each App ID you wish to use. I recommend the following naming convention here (where, if you are creating a wildcard profile MyApp would be Wildcard):

  • AdHoc: “MyCompany_MyApp_AdHoc_001”
  • App Store: “MyCompany_MyApp_Store_001”

Downloading and Archiving Your Provisioning Profiles
Once you have created your development, adhoc and appstore profiles you need to download them. Typically by the time you have completed creating the distribution profiles your development profile will be ready, and by the time it’s done downloading your distribution profiles will be ready. After these are downloaded, move them to your AppStore folder created during the setup steps. Assuming your user name is “jsmith”, you have created only one AppID, “Wildcard”, and that your company name is “MyCompany”, you should have the following items in your AppStore folder at this point:

  • CertificateSigningRequest.certSigningRequest
  • jsmith_Private.p12
  • jsmith_Public.pem
  • jsmtih_developer_identity.cer
  • jsmith_distribution_identity.cer
  • MyCompany WildCard AdHoc 001.mobileprovision
  • MyCompany WildCard Dev 001.mobileprovision
  • MyCompany WildCard Store 001.mobileprovision

In your AppStore keychain you should have the following items:

  • Jeff Smith (public key)
  • Jeff Smith (private key)
  • iPhone Developer: Jeff Smith (certificate)
  • iPhone Distribution: MyCompany (certificate)

Backup Your Data
Before you do anything else, take the time now to archive your AppStore folder and keychain! That way, if anything goes wrong you have something to recover with.

Installing Your Provisioning Profiles
Now, instead of installing provisioning profiles in the Apple recommended way I instead recommend installing them manually. The reason I do this is because the automated installer will rename the files, making it difficult to later determine which files belong to which profiles. Of course, you can manage all of that in Xcode’s Organizer, so this is strictly a ‘nicety’ feature that I have found useful.
Installing profiles manually is actually very easy, especially if you have created the “Provisioning Profiles” alias recommended in the setup steps. To do so, simply copy the profiles you wish to install from your AppStore folder (i.e., the “.mobileprovision” files) to the Provisioning Profiles folder alias. Easiest method is to select the files, start dragging them to the alias and while doing so press the option (i.e., alt) key which will cause the drag operation to display a plus (+) indicator to let you know the files will be copied instead of being moved.

Updating a Provisioning Profile
Once a provisioning profile is created you will often find the need to update it to renew the profile (development profiles expire after 3 months, AdHoc and AppStore profiles expire after 12 months). This can be accomplished by following these steps:

  1. Log in to your iOS Developer account and go to the iOS Provisioning Portal (a link should be found in the upper right of the main page)
  2. Click on the Provisioning side tab, which will display the provisioning view (which has a development and distribution tab, plus history & how to)
  3. For each profile you want to update, click on the “Edit” link on the right side of the window (next to the Download button). This will display a pop-up menu with two options, “Modify” and “Duplicate”. You want to choose the “Modify” option.wpid-pastedgraphic7-2011-04-5-10-43.png
  4. On the Modify screen you can update who can sign the profiles (i.e., which certificates to use) and what devices the certificate will work with. Typically you never want to change the AppID but you can do so if needed. Finally, a step I have found incredibly useful is to always update the name to indicate a new “version” is being created. I do this even if I am just going to renew the profile (although in this case you have to check the new button first). If you used the naming convention I provided in the setup steps, you might change the name from “MyCompany Wildcard Dev 001” to “MyCompany Wildcard Dev 002” for instance. Of course, you can use any naming style you wish (ex: a, b, c) but updating the name each time will allow you to easily determine if a developer, tester, reviewer, manager, etc., is using the correct profile when they have installation issues, or when you have signing issues in Xcode.

Using Provisioning Profiles With a Single Account

  1. If you only have one developer account to worry about, then the easiest way to use your provisioning profiles will be to copy the items from your company keychain (your private/public keys and development/distribution certificates tied to those keys) to your login keychain. This can be done just as it is in the finder, by dragging the items while holding down the Option (alt) key from the AppStore keychain to the login keychain. Of course you will need to open the AppStore keychain in the Keychain Access application before you will be able to do this. You should be able to double-click on the keychain to open the Keychain Access file, but you may have to use the “Add Keychain” item from the File menu (of the Keychain Access application). Your added keychain will show up in the “Keychains” list on the left side of the Keychain Access window (the left side should have a Keychains and a Category list).

Using Provisioning Profiles With Multiple Accounts

  1. If you have more than one iOS developer account you need to develop for (i.e., you have multiple clients for instance) there are two methods that can be used to do so cleanly, and which one you use would depend on you situation:
  1. Use a Wildcard profile – While I don’t consider this very useful anymore, if you only need to make debug/release (i.e. development) builds, never need to build AdHoc or AppStore releases, and either are provided a profile or have your own iOS developer account but never create your own apps, then you can use a wildcard profile for all of your development. Such a profile would use an AppID of ‘*’ (displayed as something like “8E549T7128.*”) and will work no matter what the App’s bundle identifier is. The downside is that this ID is likely to be used for all signing, preventing you from signing an AdHoc build in another project for instance, and possibly being used in other projects where you would not want it. Note: this wildcard profile is different from a company wildcard profile! A company wildcard looks like “*” and can be used to sign any company app, but will not work for signing apps from other companies/clients.
  2. Use multiple keychains — this is the method I use personally, and it works pretty well. It would actually work perfectly if Apple would update Xcode to allow specifying which keychain to use in a project (i.e., as part of the personal data associated with a project). But that’s not the case, so it’s a bit messy: to use this method you have to use Keychain Access and set the desired keychain as the “Default” before Xcode will use the information it contains. And, because of that, your AppStore keychain is likely to become cluttered with un-related entries like iChat certificates, etc. So you want to set the “login” keychain back to being the default as soon as possible.
  3. Multiple keychains + a Wildcard profile – I actually keep a wildcard provisioning profile for my personal account around for cases where I don’t have any credentials for a client’s account. In this case I’ll temporarily add the wildcard profile to my Provisioning Profiles folder to allow me to create builds of their application, and then remove it again when no needed so that it doesn’t get in the way of other development.
  4. That’s it, hope this helps!

Posted in iOS | Leave a comment

iPhone 4 Reception; better than any before or worthy of a lawsuit?

So, unless you have been living in a cave for the past few weeks, I’m sure you’ve seen a lot of reporting going on about the new iPhone 4 and it’s reception issues, maybe you’ve even read a few of them.

Update: Apple’s press event doesn’t seem to have had much effect. Most everyone is still saying that the iPhone 4 is defective, and, like Consumer Reports, using test that measure db loss to prove this fact. These people are still ignoring the real issue; does the phone handle calls as good or better than previous iPhones? All the subjective (ie, non-scientific) tests seem to indicate that yes, it does. In fact most of those tests indicate it does better than most other phones. So, how is it defective?

I’ve had my iPhone 4 now for a couple weeks (no thanks to Fed-X), and I can say with certainty that it’s reception is an improvement over my old iPhone 3G. I’m not sure what the bars are on either, I’ve known for years now that those are mostly meaningless as an indicator of a cell phone’s reception capabilities. I have found they can be used as somewhat of an indicator of changes in otherwise static reception, or to find the best location to make a call inside a building, etc.

What I find a bit confusing, somewhat comical, and to a large extent troublesome, is the ongoing issue of calling on Apple to “fix” the reception of the iPhone 4’s “reduced reception” while being held, especially if the two metal bands that serve as the antenna are bridged by the user’s hand. The reason being that according to all of the tests I can find, like this one, the iPhone 4 has better reception than any previous iPhone in any reasonable definition. Fewer dropped calls, ability to use the phone in places you can’t use previous iPhones (ie, due to poor reception), clearer connections, etc.

So why, in the very same breath, do all these sites demand Apple provide a “solution” for the metal antenna issue? Sure, the measured signal db lowers a fair amount, but if in every usable measure the phone improves the ability to make and complete a phone call, why should any user care? What I want is to have a cell phone that makes a call when I want to do so, doesn’t drop the call and maintains a clear conversation. The iPhone 4 does this better than any previous iPhone, which is exactly what Apple advertises.

Look, if you are all hung up on measuring db’s and just can’t stand the thought that you are not getting the absolute best signal you can, then there are plenty of solutions available, from holding the phone differently to getting a cover for the phone. And really, if you are this person aren’t you going to get a cover, bumper, skin, etc. to protect that device anyway?

My final take is that Apple promises improved “reception” with the iPhone 4, and delivers. They didn’t promise improved db attenuation, because that is not what it important. Suggesting Apple should be forced to supply a solution is absurd; it’s like saying that Apple should supply an external hard drive to go with the phone because they didn’t deliver the absolute most NAND possible.

It’s like this; no matter what technology (or, for that matter, any product) you purchase it could always be better! So quit bitching that Apple only greatly improved your shiny new tow and didn’t massively improve your toy to absolute highest level possible.

NOTE: I do want to point out that my opinion on this is not limited to Apple or the iPhone; it’s just the latest case I’ve noticed of this trend, and feel I know enough of the details about to post about it and not seem like a total ass (just half of one). My point is that a majority of the population today (not just in the US, but worldwide) feels entitled, and the focus is on themselves.

Appreciate what you have. Drive with consideration for others. Say Please and Thank You … and mean it!

Posted in Rants | Tagged , , | Leave a comment

FedEx ruins my iPhone 4 day :(

So I was lucky enough to get in (after a lot of trying mind you!) and order my iPhone 4 via Apple’s website before the Jun 24th delivery date got pushed back. Hurray!


Everything was looking fine, and yesterday it even looked great, because FedEx tracking had my status as “Delivery on Jun 23rd by 4:00pm“, with this tracking info:

Jun 23, 2010 7:08 AM At local FedEx facility GARLAND, TX

Jun 23, 2010 5:28 AM At dest sort facility DALLAS, TX

Jun 23, 2010 4:46 AM Departed FedEx location INDIANAPOLIS, IN

Jun 23, 2010 1:15 AM Arrived at FedEx location INDIANAPOLIS, IN

Seeing as I live in Garland it looked like I would be one of the lucky few thousand to get their iPhone 4 a day early. So I eagerly waited for the FedEx truck, and sure enough about 9:30am a doorbell singled it had arrived! Strangely, the driver was already heading back to his truck by the time I got to the door. Confused, I looked down to see a box… and I though “Shouldn’t I have had to sign for that?“.


Alas, the reason I didn’t have to sign for the package was because it wasn’t from Apple, but OWC (a nice Raid case, but no iPhone 4). So I kept waiting, thinking maybe it would arrive on another truck later in the day.


But no… because FedEx hates me! Today I went to check the delivery status on the FedEx site only to discover that there is now no delivery status … no date, no destination, nothing, nada, zilch!


So what happened? Maybe the updating tracking information holds a clue:

Jun 24, 2010 9:59 AM Arrived at FedEx location MEMPHIS, TN

Jun 24, 2010 9:17 AM Departed FedEx location NEWARK, NJ

Yep… FedEx decided that someone in friggin’ New Jersey deserves my iPhone 4 more than me. Rotten Bastards! (FedEx, not any of you NJ mob guys! You guys rock!)


-lane, stuck with his iPhone 3G for a while longer 😦


OK, so how f’n technology spoiled am I to consider having a iPhone 3G being stuck? I mean, in the not too distant past I was giddy about having a Nokia N95 … a phone that had a ton of applications (even an office suite, with WP, SS, etc). Of course the only good part of the phone was the camera (which was better than my actual digital camera!), and the iPhone blows it away on every front, including every aspect of development (common Nokia, if Apple can get a profiler working on device you should be able to as well, you’ve only got a decade’s lead time!).

Posted in Rants | Tagged , | Leave a comment

When it rains it pours!

So I’d been looking for my next opportunity for a while, being quite picky about the opportunities I pursued. I found several very interesting opportunities, and one in NY (which has numerous posts on iphone/cocoa dev lists) that seemed really positive but after the interview experience I’m glad never happened.

As it happened, and which is a reoccurring theme in my experience, I found a great gig only to get offers from three others I was very interested in the next day! I want to send my thanks to those companies, esp. Gendai Games. I think it would have been great to work at any of those companies had the timing worked differently.

Funny how that works, eh? When it rains it pours, as they say!

So, where did I end up? What have I been doing these past couple weeks?

I am now working from my home office as the Lead Consulting Engineer (first time I’ve ever held that title!) at Digital Fish, Inc. where I am working on the Mac OS X version of a major application that, until recently, was thought to have been abandoned on the platform. That application is Quicken Essentials!

This title is of particular interest to me, as I recently completed an exhaustive search for a replacement to Quicken Home & Office 2010 under Windows, without success. There were some decent candidates, but they all had limitations (mainly with regard to online banking, and not interfacing with all my financial institutions) that prevented me from switching. I want to move off Windows completely, and Quicken is the only software that prevents me from doing so, plus the 2010 update moved the software even more toward a web 1.0 user interface (cells are not clickable, you have to click the text links? How…retro), has became extremely sluggish, didn’t solve any of the online banking problems as promised in their sales material, and introduced a host of online banking bugs (like unlinking transfers, ie: savings->checking became savings->savings and the checking entry was not linked to anything anymore).

As for the Mac OS X version, since the last release for Mac, Quicken 97 I believe, the entire project was re-engineered, and as such the current product is very much a solid 1.x release, meaning that it has all the required main features but not ever feature possible (or even all the features in the last version). On the code front, all the previous code dating back to System 6 days was replaced with modern Mac OS X 10.5+ code, so once again I am working 100% in Objective-C / Cocoa. It is great to never have to fire up Windows or Visual Studio, although I will admit to missing a few features in Visual Studio I wish XCode had, and I really miss TortoiseSVN!

If you haven’t tried Quicken Essentials yet, I encourage you to do so. The product is under active development, has solid support from management and is improving all the time with frequent updates. I still can’t replace Quicken Home & Office (as Quicken Essentials doesn’t deal with the “Office” portion at this time), but it is exciting to be working on a product that I actually need and can thus poke, prod and guide toward becoming that product 🙂

Plus, it’s a great team with developers that are not only knowledgeable but also easy to work with. I’m looking forward to helping both the project and the team over the coming months, and hopefully even years.

Posted in Personal | Tagged , , , | Leave a comment

OOP != classes, but may == DOD

Object-oriented programming (OOP) is a programming paradigm that uses “objects” – data structures consisting of datafields and methods together with their interactions.

I was reading an interesting article today about a design methodology that I’ve been practicing since 1982, “Data Oriented Design”, or DOD for short. Since I have been using this (although, in typical fashion, without knowing it had an actual name) for quite a while the article was mainly interesting in the comments that many programmers had.

There were two serious misconceptions I saw expressed multiple times:

  1. DOD can not co-exist with OOP
  2. OOP == classes

Concerning item 1, I want like to point out two fundamental flaws:

  1. DOD -> Design && OOP -> Programming; two different but related parts of the solution
  2. There is no reason an “Object” can not be “Data Oriented”

Basically, using principles of DOD during your design phase for your data needs followed by using OOP principles during your design phase for your code needs should give you the best of both worlds. DOD should, in general, help your OOP goals.

Now, that said, there are going to be times when the two conflict. You may have cases where the best way to layout data does not meet with the best way to design your objects. In most of these cases it should be a simple matter of deciding which is most important, and which can be sacrificed.

I’d summarize the use of DOD + OOP as “Think about how the system will use your data, and design your objects so that their data is optimized for highest performance”.

Concerning item 2, I see a lot of C++ programmers making this mistake:

  1. An Object is not a class! (but a class should be an object!)

For instance, here is part of a comment from the above referenced article on DOD:

This is actually the same as OOP, except the function call is on the other side:

output = myfunc(input);
output = input.myfunc();

This statement is fundamentally incorrect, as OOP does not determine the syntax of objects to any degree or in any manner! Object Oriented Programming is a methodology, a design principle, programming paradigm, a concept, a practice, etc. It is not a language!

In other words, in the above reply, both function calls may or may not be conforming to OOP principles. Just because you have a class doesn’t mean you implemented OOP, and just because you don’t have a class doesn’t mean the code is not implemented with OOP.

Think of it this way; you can take any C++ code and translate it into C code (and, in fact, for many years C++ was actually implemented as just a pre-processor that output C code that the C compiler then compiled). Further, you can take the C code and create byte code from it (ie, LLVM for instance), or assembler or machine code. So, to say that you can not perform OOP in C, or assembler is quite silly. Same can be said for any other language as well.

Now, it is true that performing OOP in some languages may not be as pretty, or easy, etc. as it is in C++ in certain regards, but the fact is that it is possible. In fact, there are a lot of programmers who can legitimately argue that other languages, such as D, Objective-C or Ruby, are better at implementing OOP than C++.


I have been practicing OOP since the mid-80’s, and I didn’t start programming in C until 1990, before that all I used was assembler. If you look at any of the early id code (like Keen), you would find it’s very much DOD and a bit OOP, but in a very C manner (in some cases quite horrible to read).

Posted in Development | Tagged , , , | Leave a comment

The Bank is available on iTunes!

Our latest title is available on iTunes. It took one week to get it approved, and that included the entire time iTunesConnect was closed down! Anyway, here’s the info on the game:


The economic recession of 2008 was not the result of Wall Street leverage and the housing bubble. It was in fact a deliberate and highly complex plan conceived by a clandestine organization and carried out thought the fluid channels of greed so pervasive in Americaís financial sector.

Through a grass roots investigation led by Nick Hammer and a team of net-hacks, this complicated plot was uncovered. It was determined that Sun Valley Bank, of Bells, Montana, was the nexus of this conspiracy.

Your mission is to attack the headquarters of this insidious plot and destroy the new inhabitants before they escape to waiting pods. This will not be easy, but with my special flying car named “Sally”, unique weapons, full 3D gameplay, and thumbsteering, anything is possible.

Do you have what it takes to restore economic stability as we know it today?
Good luck and God speed!


  • Completely integrated storyline.
  • Advanced graphics engine designed to take advantage of the power of Apple’s mobile devices.
  • Full 3D assets and effects.
  • Intense and fast-paced gameplay.
  • Multiple weapons
  • In-game instructions.
  • Music and sound effects included.

Get it now on the iTunes App Store!

Posted in Announcements | Tagged , , , | Leave a comment

Christmas Wish List

For any of you still looking for something to get me for Christmas, here are a few ideas:

Acura NSX


Someday I will have one of these!

Kepler Motion


This would look great next to my S!

Lotus Evora

Tesla Roadster


Actually, either would do

Mazda RX-7 3rd Gen


Another must-have vehicle!

Posted in Personal | Tagged , , , | Leave a comment

How to background load and cache UIImageViews images

It’s often the case that the apps I am working on are required to download quite a couple, or even a few dozen, images and display them in a UIImageView. In looking online I found a few different methods of loading image data for a UIImageView in the background, and a few examples of caching image data, but they were all overly complicated for my needs, and none that combined the two ideas.

So, I’m posting here my very simply extension of the UIImageView class that provides a way to load an image in the background. It also provides an extremely simply caching system, which works great if you are displaying a list of thumbnails but would need better memory management for a true cache.

You can download the [download id=”6″] here.

The header file is pretty straight forward, it simply defines our additional methods for the UIImageView class.
// UIImageView+Cached.h
// Created by Lane Roathe
// Copyright 2009 Ideas From the Deep, llc. All rights reserved.

@interface UIImageView (Cached)

-(void)loadFromURL:(NSURL*)url afterDelay:(float)delay;


Note that both methods assume you already have a UIImageView to work with. While it would be fairly easy to add a method to create a UIImageView as part of the load, I chose not to because all of the places where I wanted to use this were defined in Interface Builder (IB) and hooked up to an instance variable. I do as little interface design in code as possible, even laying out all of my table cells in IB. For me it makes development a lot faster, and interface tweeks and updates not just simpler, but requiring fewer iterations.

loadFromURL: simply takes a URL to any supported image file and sets up for loading the image in the background. When the image finishes loading the UIImageView’s setImage: method will be called to update the view’s image.

loadFromURL:afterDelay: simply delays calling loadFromURL: for the amount of time (in seconds) given as the delay. I’ve used this in programs where I wanted to optimize other parts of the program to display first, but still put the image load call in the same code section (ie, typically in viewWillDisplay in my apps).
Now for the actual code, which is quite small for both a background loader and caching system.
// UIImageView+Cached.h
// Created by Lane Roathe
// Copyright 2009 Ideas From the Deep, llc. All rights reserved.

#import “UIImageView+Cached.h”

#pragma mark –
#pragma mark — Threaded & Cached image loading —

@implementation UIImageView (Cached)

Note here that I have hard-coded my cache for a maximum of 50 images. Typically cache systems are limited in the amount of RAM used instead of a count, but for this quick category it fit my needs. Again, if you are loading small images (like icons or thumbnails) then this will probably work fine for you as well, otherwise you probably want to Google for a real caching solution 🙂
#define MAX_CACHED_IMAGES 50 // max # of images we will cache before flushing cache and starting over

I used a static variable in the cache getter to simplify the code. I don’t really like this, but it does mean that I don’t have to worry about calling an init or doing any heavier extension of UIImageView so all in all while it’s not the best solution, it does what it needs quite well.

The method simply checks to see if we have already allocated a dictionary we can use to cache our image references, and if not allocate said dictionary. The method returns the dictionary reference.
// method to return a static cache reference (ie, no need for an init method)
static NSMutableDictionary* _cache = nil;

if( !_cache )
_cache = [NSMutableDictionary dictionaryWithCapacity:MAX_CACHED_IMAGES];

return _cache;


This is the meet and potatoes of the code here. The first thing it does is look to see if the requested image is in our cache. Note that it does this by the URL ‘string’ returned by the NSObject description method. This is about as simple a check as you can do, because it does not handle any cases where the image changes on the server, there are two identical images with different URL’s, two URL’s resolve to the same image (https and http for instance), etc.

If we don’t find the image in the cache, we setup an allocation pool because we are going to assume that we are not on the main thread, which is true if either of the public methods for this extension are called. We then use the standard NSData method to load the file from the URL and pass that to UIImage to translate that data into something the system can use (ie, the UIImage). After we load a new image, we first check to see if we have available room in our cache, and if not clear the cache out (again, very simple caching here!). Then in either case we can add the image to the cache.

Finally the method calls the UIImageView’s setImage: method to update the view with the new image data. We don’t call it directly because again we are assuming that one of the public API’s were called, in which case we would not be on the main thread, and making any UI calls is therefore bad. Thus, we use the performSelectorOnMainThread: method to call setImage: so that it can be done safely.
// Loads an image from a URL, caching it for later loads
// This can be called directly, or via one of the threaded accessors
UIImage* newImage = [[self cache] objectForKey:url.description];
if( !newImage )
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSError *err = nil;
newImage = [[UIImage imageWithData: [NSData dataWithContentsOfURL:url options:0 error:&err]] retain];
if( newImage )
// check to see if we should flush existing cached items before adding this new item
if( [[self cache] count] >= MAX_CACHED_IMAGES )
[[self cache] removeAllObjects];

[[self cache] setValue:newImage forKey:url.description];

NSLog( @”UIImageView:LoadImage Failed: %@”, err );

[pool drain];


if( newImage )
[self performSelectorOnMainThread:@selector(setImage:) withObject:newImage waitUntilDone:NO];


And finally, the public methods. Each is very simple; loadFromURL: uses performSelectorInBackground: to call the cacheFromURL: method above on a different thread. This allows the main thread (which is running the UI and main loop of your app) to continue on uninterrupted. This slows down the loading a bit, but keeps the user interactions and interface updates nice and smooth, resulting in a better end user experience.

The loadFromURL:afterDelay: method simply uses the afterDelay version of performSelector: to call loadFromURL: after the specified delay. The only purpose here is to provide a way to organize downloads in a very simple, yet usable fashion.

For instance, let’s say I am going to present a list of home for sale, which requires downloading 20 images, and at the same time make 20 web page requests for descriptions of the homes, their prices, etc. We could wait for everything to load, but that is not good end user design (imo). Instead, I can request the UIImageView’s for those 20 homes update their images, but delay that load for 2-3 seconds. Then, I can grab the text data from the website (which typically comes down very fast), and present the view to the user. Thus the user can start reading about the properties and as images come in the view will automatically update the images the user sees.
// Methods to load and cache an image from a URL on a separate thread
-(void)loadFromURL:(NSURL *)url
[self performSelectorInBackground:@selector(cacheFromURL:) withObject:url];


-(void)loadFromURL:(NSURL*)url afterDelay:(float)delay
[self performSelector:@selector(loadFromURL:) withObject:url afterDelay:delay];


OK, that’s it. In case you missed it above, you can download the [download id=”6″] here.

Hopefully this will prove helpful to someone 🙂
Update: Take a look at Michael Amorose’s additions to UIImageView’s if mine isn’t your cup of tea.

Posted in iOS | Tagged , , , , , , , | Leave a comment

It sure does snow in Kansas!

This week I am visiting my Grandmother in Kansas. Monday night I arrived at the farm just as the first snow was falling, and by Tuesday morning I couldn’t have left if I wanted to. Here are some pictures of what things looked like the first couple of days I was here!


Snow Barn


Kitty tracks on the snow


Back porch before the blizzard


Back porch after blizzard. Taken through screen because all of the windows were completely covered with either snow or frost!

Here is the Facebook photo album if interested.

It took a front loader to clear the driveway so I would be able to get out if I needed, although as of Friday night I had not even attempted it since we have plenty to eat in the house, and the electricity, heat and internet are all working. Grandma’s cat is not at all happy having to wade through snow to go to the bathroom! (Plus, I imagine it’s rather difficult to find any ground that isn’t frozen … probably has to go all the way to the barn, which in good weather is nothing but in snow deeper than the cat is high I noticed he didn’t even try (well, at least I didn’t see any cat tracks going out that way).

Posted in Personal | Tagged , , , , | Leave a comment