Our DNA is written in Swift

Category Archive for ‘Tools’ rss

Transfer App Data Back to Your Mac

If you are saving data in your apps then you are saving them to your app’s sandboxed documents directory. In simulator files you can easily inspect the contents of the directory if you just browse there with finder or cd there in terminal. Note that there is a space in the path, so you need to put exclamation marks around it if you use it with cd in terminal.

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog(documentsDirectory);  // output documents directory to debug console

Copy this path, open terminal and go:

MacDrops:~ Oliver$ cd "/Users/Oliver/Library/Application Support/iPhone Simulator/User/Applications/AAC8D0E8-C134-4A94-ACA9-88C7A58DCE1C/Documents"

Or if you prefer Finder then use the handy option “Go To Folder …” and paste the path there. Bear in mind that with every new build the documents directory gets moved to a new application ID. The contents will persist, but the path changes. If you navigate to the ../User/Applications folder you will find that the newest directory is the one that belongs to your just-built app.

There are some rare cases though when you find that Simulator behaves differently than a device. How can you inspect the files there?

Read more

Excursion: Follow 900 Twittering iPhone Developers

After having started this blog a trainee of mine recommended I get started with twitter because I was trying to get connected to other iphone developers. I figured it would probably be useful if you had a network of, say, a thousand guys who are also interested in coding iPhone apps.

Read more

"AppRanking for FREE" by Michael Dorn

NOTE: AppRanking has been deprecated in favor of Applyzer.

Michael Dorn (my collaborator on LuckyWheel) just couldn’t stand having to dig through iTunes to find how our game is doing in 62 iTunes countries. So he took it upon himself to create a nifty tool that allows you to conveniently look up rankings of any app. He wrote it in RealBASIC as an OSX desktop app in less than one day.

AppRanking Screenshot

Michael makes it available to all readers of Dr. Touch because it’s just soooo useful. And for free, that’s how nice he is!

AppRanking for FREE (No longer available, see above note)

It’s a ZIP file with an Mac APP inside. Again, like all free software this comes without any warranty. Use at your own risk.

SSD Impressions: I’m Supercharged!

Lately we saw prices for SSDs beginning to drop because of increased competition between manufacturers of RAM chip based products. Once a colleague of mine showed off his mid-2008 MacBook running on an SSD my envy-bone was tickled.

Doing due diligence I found a couple of sites advertising lower prices, but only Amzon actually had the OCZ APEX 120GB in stock. So I headed over to Amazon.com to purchase one. Actually I went to the German site, where I shelled out 370 Euros, users in the US have to pay even less. So the OCZ APEX currently blows the competition out of the water in terms of price/performance.

Before installing I used XBench to gather a few stats on the original HDD in my mid-2008 MacBook Pro. Also I timed a couple of other usual tasks to have a basis for comparison. What good is having an impressive machine if nobody knows about how great it is? 😉

At first I was enthusiastic to install it myself but without the proper tools I was not able to remove the final bracket holding down the drive. Over night my charger died and I feared the worst because I was no longer able to boot my MBP with empty battery. So I took it all to an authorized Apple Support Center in Vienna, asking for a repair and while they where at it, to also install the SSD. With the Guide at iFixIt anybody can make the upgrade themselves, provided they get the necessary tools in advance.

I had to pay a full hour work plus 50% extra for express service, the charger exchanged for a new one for free. But at least I got my MBP back the same day, SSD installed and a basic Leopard 10.5.6 on it. It took me a while to copy back all files and settings from the SuperDuper image I had created the day before, but the next day I was ready to evaluate the performance difference.

The OCZ APEX model has an internal RAID 0 with two chips working as one which effectively doubles the throughput which goes over the SATA 2 interface. This is compatible with the SATA 1 in my MBP, which rates at 1.5 Gigabits, or about 150 theoretical Megabytes per second. OCZ claims a read rate of up to 260 MB/s and up to 160 MB/s for writing for the APEX series. This is why I chose it because I wanted to max out both the reading and writing throughput possible over SATA 1 at the lowest possible price for 120 GB.

So much for marketing, here come the real life results:


All of the numbers speak rather clearly. On average it is fair to say that the SSD is four times as fast. But even more impressive than benchmark numbers is how much faster those many standard tasks become. This is what you actually notice.


Most of the time of the booting process is unrelated to the performance of the harddisk but is spent checking the RAM, loading the EFI etc. Once the turning wheel appears it is only a few seconds before the desktop is visible and fully active. Shutdown is most impressive, but who really shuts down his Mac anyway? MacBooks are the only laptops I know where you can close the lid to standby and open it to immediately continue working.

Opening apps generally is three times as fast, building times with XCode are effectively halfed.

The other side effects of coding on an SSD-based MacBook Pro are almost as obvious:

  • Shock Resistance. If you smash your MacBook to pieces (up to 1500G) the data on the SSD will still be intact. This goes hand-in-hand with the next point.
  • Data Safety. You eliminate a single point of failure from your development system as head crashes are still the worst total failure possible. And they do happen. How valuable is the code you write while on the road without being able to back it up?
  • Power Consumption. Reduced. Maybe. Slightly. A few minutes.
  • Noise. There is no clicking to hear if you put your ear on your top case. You now have to rely on the fans to know that your MBP is still alive and has not become an undead vampire.
  • Less time spent waiting. If you consider all those reduced waiting times for the multitude of small tasks involved in created an app, all those Seconds will add up to days until the end of your life.
  • Bling Bling. If you happen to mention that you have changed to SSD most people will either think you are rich or the Uber-Geek.

If only I could get my hands bionically enhanced then this would also tripple the amount of code I can write while sitting on the train. But until I do I have to be content with the advantages outlined above.

Was that you that I just overtook in cyberspace? 😉

3 Tools for Better Mobile Coding Endurance

Control your Fans

We trainers and programmers might have many geek groupies, but this time I am not talking about those. 😉 The second thing to take control of is the fans that keep your CPU cool. Those rotating fans have motors that are putting a small but constant load on your battery.

Using the “About this Mac” page I was able to determine the difference between full fan speed  and lowest fan speed to be up to 100 mA. Compared to the regular energy use of around 1300 mA this gives you up to 15 minutes more working time.

Fan Control

My favorite tool to help you take control has the obvious name “Fan Control” and is available for free from Lobotomo. With this you don’t set the speed directly but with three sliders you adjust the red line which determines the RPM to use for a given CPU temperature.

Real Geeks Undervolt

While playing with settings like fan speed might have an impact on available idle time there is little you can (usually) do to extend battery time when doing something useful. Typing code lets your CPU idle most of the time anyway.

The last bastion to tackle if you posess the strong determination of geeks is undervolting your CPU. We all know that Watt = Volt times Ampere. So if we can manage to decrease the Volts necessary for the CPU then also the energy usage under load will decrease.

The tool for this purpose is CoolBook Controller which gives you such control for the price of $10. At the maximum load the CPU is using 1.1375 Volts default. CoolBook Controller has a built in testing facility that allows you to decrease the Volts for a given frequency. This way I found that my MBP can also work with 2500 MHz with as low as 1.01V, but then it would get unstable.

CoolBook Controller

In real life you would only decrease the voltage by two or three steps to not risk the system becoming unstable under stress. The makers have achieved up to 14 degrees of difference in temperature under stress. Less temperature also equals less cooling required.

But like all things concerning over-clocking or under-volting this is not for the faint of heart.

Warranty Replacement Battery Tool

According to Apple the 15″ MacBook Pro Battery is designed to retain 80% of its factory capacity after 300 loading cycles. If you are using your MBP daily and constantly like me then this number equates to approximately 6 months.

The original capacity of my (early 2008 model) MacBook Pro Battery was 5400 mAh but as of this writing it is decreased to 3112 mAh. This is way less than the 80% (4320 mAh) that are normal.

Ordinarily it would be difficult to prove to Apple that you get much less than the 3 hours of working time advertised. If it weren’t for the fabulous and free tool Coconut Battery which makes it crystal clear.
Coconut Battery Tool

Having only slightly more than half the original capacity starts to cause me problems because this means that my two hour train rides are no longer fully covered. Obviously I am going to go to my Apple authorized dealer later and send it in for warranty exchange.

Finally a Piece of Advice

Once you have gotten a new battery then you should try to discharge it fully before fully loading it. This helps to retain the maximum possible capacity. These days many people use a MacBook as Desktop replacement keeping it constantly connected to the power adapter.

The jury is still out whether such practise is good or harmful for the battery. Modern battery management should be able to minimize impact and the latest models of MacBooks don’t even allow for removal of the battery out of paranoia.

But what you should do in any case is this: at least once a week is to fully discharge your battery before fully loading at again. This “battery training” exercise allows the battery management system to calibrate and “keeps the battery juices flowing” (Apple lingo, not mine)

And all of this will increase your mobile coding stamina to its maximum, pumping those heavy Cocoa objects. Maybe just enough to have a syntax orgasm the next time you are coding on a train or plane. Good Luck!