Archive for December, 2008

White Indeterminate Progress Indicator (AKA: White NSProgressIndicator)

Posted by Dallas on December 28, 2008
Cocoa, Objective-C, Programming / 1 Comment

If you have ever wanted to use a Indeterminate Spinner NSProgressIndicator on a dark background you have probably been upset to find that there is no way to get a white spinner.
That is where WhiteIntermProgIndicator comes into play.
WhiteIntermProgIndicator, is based off of AMIndeterminateProgressIndicatorCell by Andreas at Harmless Cocoa.

Screenshot:
whiteintermprogindicator

Download: WhiteIntermProgIndicator.zip

Tags: , ,

Mac/iPhone: Show Available Usable Disk Space

Posted by Dallas on December 27, 2008
Mac, Objective-C, Programming, iPhone / 4 Comments

If you have an application that allows users to upload content to the app, you might want to show the user how much space is available for them to use.

This is especially true on the iPhone where it is not as easy for the user to quickly check if they have enough room to upload a given file.

You may also want to check if there is enough space before you start the upload, so you can inform them that the file wont fit.

That brings you to the task of figuring out how much free space there is, and more importantly how much free space is left that you as an unprivileged program can access.

The following code is based towards the iPhone, however all that would be needed to change it to be used on the Mac is the location you are checking for free space, and the setting of the label.

NOTE: The below “shown” code is old. The updated code is in the zip file at the bottom

#include <sys/param.h>
#include <sys/mount.h>
NSString *sizeType;
 
float availableDisk;
 
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 
struct statfs tStats;
 
statfs([[paths lastObject] cString], &tStats);
 
availableDisk = (float)(tStats.f_bavail * tStats.f_bsize);
 
if (availableDisk > 1024)
{
	//Kilobytes
	availableDisk = availableDisk / 1024;
 
	sizeType = @" KB";
}
 
if (availableDisk > 1024)
{
	//Megabytes
	availableDisk = availableDisk / 1024;
 
	sizeType = @" MB";
}
 
if (availableDisk > 1024)
{
	//Gigabytes
	availableDisk = availableDisk / 1024;
 
	sizeType = @" GB";
}
 
diskSpaceLbl.text = [[@"Available Disk Space: " stringByAppendingFormat:@"%.2f", availableDisk] stringByAppendingString:sizeType];

This will give you something like the following:

availablediskspace

UPDATE:
I have gone a step further and made this into an easy to use class, that works out of the box with the iPhone and the Mac.

FSStats.zip

Tags: , , , ,

The App Store Effect

Posted by Dallas on December 27, 2008
App Store, Apple, Programs, iPhone / No Comments

Great article over at Inside iPhone. Very worth the read.

http://blogs.oreilly.com/iphone/2008/12/the-app-store-effect.html

Snapper-brand lawn mowers are expensive. Many Snapper products cost thousands of dollars, and even their simplest push mower is hundreds of dollars more than some competing products. Snapper lawn mowers are not cheap. What they are, however, is reliable. They’re manufactured well and designed to last for years. Snapper believes that a premium-quality product can command a premium price. They’ve built their business around that idea, and that business has been around for nearly 120 years.

In 2002, as CEO of Snapper, Jim Weir went to meet with Walmart executives. Walmart has thousands of stores in the US, and millions of customers walk through their doors each day to purchase nearly a billion dollars in goods. Yet Weir went to Walmart’s Arkansas headquarters to tell them he was pulling his products from their stores.

The problem for Weir, and Snapper, was the very essence of Walmart itself. Walmart sells customers disposable goods at the cheapest possible price. At the time, Walmart had six different push mowers for less than $200, while the cheapest Snapper listed for $350. These low prices change expectations across the board, and leave customers wondering what they could possibly be getting with a Snapper to justify the much higher price. With no expert salespeople to educate them on the tradeoffs between price and quality, most consumers opt for the lower-priced product. Over time, higher-quality goods are forced to lower both their prices and their standards in order to compete. The quality level of an entire market is eroded, ratcheted downward more and more.

Weir chose to break this cycle by pulling his products from Walmart entirely. Snapper instead focused on the knowledgeable independent dealers who could educate consumers on Snapper’s legendary quality and explain just why the higher price was worth it. Even without Walmart, Snapper has grown since 2002, and they’ve managed to maintain their identity as a premium-quality manufacturer.

Weir’s story brings to mind a comparison between Walmart and the App Store. The reasons behind it aren’t identical, but just like Walmart, the App Store is driving down prices of applications across the board. The price floor isn’t $5 as I predicted back in June, but $0.99, the very lowest price it’s possible to charge for an application in the App Store. If developers could charge a price lower than 99 cents, there’s no doubt that some would, and the price curve would shift even lower.

On the face of it, these low prices may seem like a good thing. The more affordable iPhone apps are, the more customers will purchase, leading them to try out many different products. When price is no longer tied to a developer’s costs, however, the market is unstable. The first application to cut its price and successfully rocket to the top of the App Store sales charts will see an enormous jump in sales. As we’ve seen, this cycle repeats over and over, and those developers who reach the sales charts do very well. As the average price is driven down, however, a negative-feedback loop is created. A low price is required to get a top sales spot, and only the sales volume that such a slot brings makes development sustainable. Fewer and fewer customers will pay a premium price, so all developers are forced to slash prices to chase a top sales spot.

While there are dozens of new applications each day, the number of slots in the Top 100 is, obviously, unchanging. As consumers come to expect ultra-low prices, more and more developers will wind up earning less for their software than it costs to develop. That will lead to developers ending development of existing products or simply opting out of the platform entirely. The low prices the App Store has led to will directly affect the quality of what’s available in the App Store.

Certainly, some developers are attempting to counteract this App Store effect, by providing higher quality products at a higher price. SimCity, currently the #2 selling app, has a $9.99 price tag. However, that’s a game with an established brand; top sellers have by and large been $0.99 applications. It’s difficult to look at iFart Mobile, which has sitting at #1 in the App Store for nearly a week, and view this as a quality, stable marketplace for developers or consumers. The App Store, like Walmart, has been reduced to selling disposable goods at the lowest possible prices.

Unfortunately, unlike Weir and other vendors of premium products, iPhone developers have no other way to get our products to customers. We can’t sell direct to customers, or via any other stores. At this time, our options are to be in the App Store, or to not sell our software on the iPhone. This makes it very difficult to command any sort of price over $0.99.

The math is simple. It costs more to make an application with depth and quality. In short order, the App Store effect will prevent the development of these deeper, higher-quality applications for the iPhone. When developers can’t charge a higher price to cover a higher investment, these applications simply won’t be made at all.

Fix Mercurial Case Folding Collisions

Posted by Dallas on December 23, 2008
Mercurial / 3 Comments

I switched awhile ago from SVN to Mercurial and I am loving it.

One pain is if you create a file, check it in, and then later change the case (from ‘a’ to ‘A’ for example) and check that in, when you try and checkout the latest version you will get the error:

“abort: case-folding collision between myFile.m and MyFile.m”

This is one error/abort that doesn’t tell you how to fix it.

After some research I have found the following to work.

Note: Notes are in Italic. Items you should replace with your own info are in Italic and Bold.

  1. hg clone https://username@myrepo-location.com/hg/index.cgi/MyProgram
  2. cd MyProgram
  3. hg debugsetparents 11 (the revision number you need to fix)
  4. hg debugrebuildstate
  5. hg rm -A MyFile.m (mark missing file as deleted)
  6. hg ci -m “fix case collision”
  7. hg manifest tip   (confirm that the collision is gone)
  8. cd ..
  9. rm -rf MyProgram
  10. hg clone https://username@myrepo-location.com/hg/index.cgi/MyProgram

You should now have a clean clone of the repo.

Note: It is possible that after doing the above you will be presented with the same error, but on a different file (if there are multiple conflicts). If that happens just do the above again for each conflict.


Tags: ,

Using Your iPhone Sim On The Android Dev Phone

Posted by Dallas on December 14, 2008
Android, iPhone / 4 Comments

If you have AT&T (with say an iPhone) and get the Android Dev Phone, you can use your iPhone’s Sim with the G1 as it is both hardware and software unlocked.

When you insert your Sim and then start up the Dev Phone for the first time you will come to the first page of the setup.

Click on the Menu button and click Add APN.

Now enter in the following information:

Name: att
APN: wap.cingular
Password: CINGULAR1

Leave all the other fields blank.

Now click on Menu again and choose Save.

That should be it! You can now use your Android with your AT&T account.

Tags: , ,

Android Dev Phone

Posted by Dallas on December 14, 2008
Android, iPhone / No Comments

I received my Google Android Dev Phone this weekend.

If you don’t know the Dev phone is a G1 that is fully unlocked (hardware, and software) and allows itself to be loaded with unsigned firmwares.

Here are some pictures as well as a few comparing it to the all mighty iPhone.

img_4918img_4920img_4922

img_4923img_4928img_4930

img_4931img_4933img_4938

img_4941img_4942img_4943

img_4946img_4947img_4948

img_4950img_4951img_4953

img_4954img_4955img_4957

img_4960

Tags: ,

Pi Presentation: SQLite

Posted by Dallas on December 04, 2008
Cocoa Touch, Objective-C, Programming, SDK, iPhone / No Comments

Last night I gave a presentation at the Phoenix iPhone Developers Group (Pi) on SQLite.

I am posting the presentation and sample code here for anyone who is interested.

Please note that this is by no means the “proper” or only way of doing things. This is simply one way of doing it, and is for reference purposes only. The code uses the FMDB SQLite Wrapper.

Example Code: (example.zip)

Keynote Presentation (sqlite-presentation.zip)

Tags: , , ,

Developers and the App Store

Posted by Dallas on December 02, 2008
Apple, Jailbrake, Programs, iPhone / No Comments

Most of the following was in response to the blog article by Layton Duncan of Polar Bear Farm.

iPhone developers were happy to see the AppStore come to life as it gave us a official way to release our app to the world. Little did we know that people would freak out about having to pay even $1 for apps, when before the App Store we were selling to the Jailbrake community for $10 or so, without complaint.

The $1 app issue is unfortunately not one that I think Apple can fix, as it’s not them causing it. It’s the consumers. Consumers seem to have it in their head that it is ok to pay $5, $10, $20 and up, for desktop applications, but that an iPhone app for some reason shouldn’t cost more then $1. Maybe they are stuck in the mind frame of old school cellphone apps/games that were absolute crap and not worth more then $1 (if even that), or if they just don’t understand what it really takes to make a beautiful, stable iPhone application.

Personally I think it is a combination of those 2 and that when the app store opened people were not sure what to charge, and some of the bigger name companies came to the AppStore with free and low price apps, and this set the consumers in a mind frame that free or almost free is what is expected. Who knows, maybe they are just cheap. The only way around this that I can see is for all or at least a large amount of developers to “ban together” and start charging a fair (to both sides) price.

No doubt it will hurt sells at first but perhaps we can get passed the misguided mentality.

Tags: ,

Mapple and Steve Mobs on the Simpsons

Posted by Dallas on December 01, 2008
Apple, Fanboy / 1 Comment

Update: YouTube took down the video claiming Copyright infrigment (even though it was a 3min clip). Search YouTube for “Simpsons Mapple” and I am sure you will find others.

Tags: , ,