Friday, September 25, 2009

Quotes

Love is never wanting to lose faith, never wanting to give up, and never truly moving on. Love is knowing and praying in the deepest part of what's left of your heart that they feel the same.


CourtneyJo Wright
17 year old girl
more famous quotes

Thursday, September 24, 2009

Apple’s 1.5 billion apps and why you should care

Apple’s 1.5 billion apps and why you should care
By Harinder SIngh


Apple kicked off Tuesday morning by releasing some of the latest download numbers from the App Store. You may be thinking that’s just another press release slinging a bunch of numbers around, but you should really stop and take a look at these.

Let’s get the reported numbers out of the way first. Apple says it has more than 1.5 billion downloads with more than 65,000 apps and more than 100,000 registered developers in the iPhone Developer Program.

And that is all within the first year the store has been open.

Consider this. Apple sold its 1 billionth app on April 23, 2009 and at that time it had 35,000 apps in the store. That took nine months.

In the next two and a half months it sold 500 million apps and almost doubled the amount of apps available for download to 65,000. That is an incredible amount of growth in a short period of time.

So even if Apple continues on as it is right now, it will be on course to sell 1 billion apps every five months. And that’s without factoring in the incredible growth it is continuing to see.

Apple’s CEO Steve Jobs summed up the company’s success in two quick sentences. “The App Store is like nothing the industry has ever seen before in both scale and quality,” said Jobs. “With 1.5 billion apps downloaded, it is going to be very hard for others to catch up.”

It will definitely be very hard for others to catch. During his WWDC keynote address, Apple’s Phil Schiller listed the amount of apps available for each of its main competitors. Android had 4,900; Nokia was at 1,088; Palm had 18; and the BlackBerry just passed 2,000 last week. The App Store had 50,000 at that time.

What this means in the broader scope of things is that Apple took on an entrenched cell phone industry and completely changed it with its hardware and software. It also revolutionized the way apps are bought and sold.

In fact, Apple has done it so well that its competition is trying to copy everything it does. Sadly, for RIM, Nokia, Android and Palm, copying another company’s successes is no way to build a business.

Apple is on the leading edge with the iPhone and App Store, and they have proven they can maintain the momentum. Now the question is, what will the competition do?

Retain, release. A guide to Cocoa Memory Management

Retain, release. A guide to Cocoa Memory Management

Intro to Cocoa memory management

For those coming to the iPhone (and Obj-C/Cocoa) platform, especially those coming from any platform with garbage collection will definitely get caught out by Cocoa’s memory management model. This will probably hit those developing using the iPhone SDK hard, with its limited memory catching leaks will be ever more important as when memory runs low your app will have to clean up after itself and exit :( .

For those reading Cocoa code for the first few times calls to methods such as -retain, -release and -autorelease might seem somewhat bizarre, but they form the basis of Cocoa memory management. Cocoa uses reference counting to keep track of memory and the code that uses it, a common practice in low memory devices. These calls are all you need to make sure you aren’t causing memory leaks in your code.

MethodDescription
-retainincreases the reference count of an object (by 1)
-releasedecreases the reference count of an object
-autoreleasedecreases the reference count of an object by 1 when possible
-allocallocates memory for an object, and returns it with retain count of 1
-copymakes a copy of an object, and returns it with retain count of 1

Basic Rules

Good things come in three, so here are the three golden rules for memory management for iPhone development

  1. Within a block of code, the use of -copy, -alloc and -retain should be balanced by use of -release and -autorelease.
  2. Objects created using convenience constructors (e.g. NSString’s stringWithString) are autoreleased.
  3. Implement a -dealloc method to release the instance variables you own when your class is destroyed

Examples

Maintaining the reference counts for an object

<
1.- (void)helloWorld{
2.NSString *string;
3.//alloc the memory for sting object
4.string = [[NSString alloc] initWithString:@"Hello World"];
5.// we created string with alloc so we need to release it so the
6.//referance count for this code block match
7.[string release];
8.}

Creating an object using a convienience constructor, autrelease is used.

1.- (void)helloWorld
2.{
3.NSString *string;
4.// object is created with a convenience constructor, will be autoreleased
5.string = [NSString stringWithFormat:@"Hello"];
6.// autorelease, no need for release
7.}

Working with arrays, and objects stored in arrays. Objects placed inside an array in can be released after addition since the array object will add 1 to the reference count

1.NSMutableArray *array;
2.int i;
3.for (i = 0; i <>
4.{
5.NSNumber *n = [[NSNumber alloc] initWithInt: i];
6.[array addObject: n];
7.[n release];
8.}