Wednesday, April 30, 2008

Apple's iPhone VS Canadian Market

Apple's iPhone is expected to enter Canadian market. Unfortunatly exact date is not announced but it seems to be nice when service get wider. So do Rogers Communications Inc..

Ted Rogers, President and Chief Executive Officer of Rogers Communications Inc. on tuesday issued the following statement: We're thrilled to announce that we have a deal with Apple to bring the iPhone to Canada later this year. We can't tell you any more about it right now, but stay tuned.

Demand for Apple's iPhone is very hight not only in canada I mean worldwide. Russia makes it fashionable and phone appears trendy the latest must-have for Russia's elite, numbering about 500,000 in all in the country already. This is despite the US$700 price that iPhones sell for in that country. Of course, this is nothing compared to the $1,800 it sold for when it was first launched in the US.

I see Apple's iPhone does not gives up. Repid market share and hight distribution lives it’s results - people like it so much. So we have to be patient and wait for the next announcement but may be iPhone already brouhgt to canada. Who knows? Even Ted Rogers keeps silent.

Tuesday, April 29, 2008

Updated KingdomGame for iPhone

A web rts game KingdomGame is now updated for iPhone consumers. KingdomGame is such kind of game where you compete against other players. The updated version features numerous bug fixes and updated functionality.

You can build new buildings; attack and spy on other Kingdoms; build diplomatic relations through the embassy; buy and sell goods at the market. All while you work towards the ultimate goal of being the Ruler of the known world.

The game doesn’t work in a remote place, as it requires constant internet connection.

To use KingdomGame on your iPhone visit the website: http://www.kingdomgame.net/LoginHome.asp


References:

http://iphone.click2creation.com/?p=652

Sunday, April 27, 2008

New iPhone Video Recorder By DreamCatcher

New Video Recording application known as iPhone Video Recorder was launched by DreamCatcher. iPhone Video Recorder records audio and video to the compressed mpeg4 format, so the recording is space saving, an-hour-high-quality recording will be a file as small as 60MB.

VideoRecorder allows consumers to save video with audio, and is offered in 2 versions. The first trial that lets you record up to 30 seconds to 15fps and obviously the second Full which has no time limit for registration. The cost of obtaining the full license is $ 19.95.

iPhone Video Recorder offers new recording method a scheme known as “postponed encoding,” in which video and audio are recorded and stored in your iPhone’s memory in raw format, and then encoded to the iPhone’s standard MP4 format at a time when it is convenient for you. This deferred method allows for the higher frame rates. One nice feature is that since the encoding itself is naturally slow, as you would expect from 412MHz worth of horsepower, they’ve added the ability to stop the encoding at any time and resume it later on.

Here are some different features of Video Recorder:


· Record both audio and video;


· Record to compressed mpeg4 format;


· Intelligent dynamic volume adjustment algorithm;


· Up to 15 fps with high-quality video;


· Playback, send out by email.

How to install? Firstly, Open the Installer, add source: http://www.iphone-recorder.com/install2 , browse to the Multimedia category and Install iPhone Video Recorder.

References:

http://mydepository.wordpress.com/2008/04/26/iphone-video-recorder/

Friday, April 25, 2008

Apple Has Signed Up 200,000 developers For iPhone

Apple has revealed that over 200,000 iPhone developers have downloaded Software Development Kit (SDk) so far. Apple also announced that in mid-March, the iPhone SDK had been downloaded 100,000 times. According to Apple CFO Oppenheimer Apple is signing up more developers each week.

Oppenheimer called the response to the SDK "tremendous" and said that interest in developing enterprise applications for the iPhone is also going well. More than 400 higher educations are now creating applications for the iPhone, and more than one-third of Fortune 500 companies are actively creating software for the iPhone as well.

Apple plans to deliver a free update to the software that runs the iPhone -called iPhone 2.0 in late June. That update will introduce the App Store, a new feature that will enable iPhone users to purchase, download and install third-party application software for the device. Apple also plans to release a similar update to the iPod touch delivered for a nominal fee that will enable iPod touch users to access the App Store as well.

Apple has sold 1.7 million iPhones in the quarter and is now selling phones in Austria and Ireland. Apple's COO, Tim Cook, reiterated to analysts who questioned him after Oppenheimer's preamble that Apple is on track to sell 10 million iPhones by the end of the year.

References:

http://www.macworld.com/article/133146/2008/04/iphonedevs.html

The Dangers of Beta

Okay, I'm debating whether to continue this series on Web Services using libxml. On one hand, I think there is a benefit to going through the process, and I'm guessing that a wrapper around libxml is going to be pretty fast and resource-efficient.

But... SDK4 introduced Cocoa's tree-based parser, NSXML, to the iPhone SDK, which is much easier and more pleasant to use in a Cocoa app. As a result, it might make sense to focus my energies on other iPhone technologies.

If you want an introduction to NSXML, you'll have to look in the Core Library docs, the iPhone docs have not yet been updated with these classes. I do not know yet if there are significant changes between the two versions or not. You can also check out this article over at MacTech from a few years ago written by yours truly which talks about using NSXML. It might be a little outdated at this point, but should give you at least a conceptual grounding. If I find they have completely change NSXML since then, I'll let you know; I'm going to try to find time today to play with the iPhone version of NSXML.

Thursday, April 24, 2008

AT&T Profits Rose Mainly By iPhone Sales

AT&T the largest communications holding company in the world (by revenue) has unveiled their quarterly results. Their first quarter results rose by 22%. According to AT&T such profits were in part driven by gains in its wireless business. And of course the main reason of it is the iPhone, which doubled the average revenue per subscriber that AT&T gets from other wireless customers.

The company said it gained 1.3 million net wireless subscribers for the quarter, the majority of which were new iPhone subscribers.

AT&T announced that net income jumped to $3.46 billion, or 57 cents a share, from $2.85 billion, or 45 cents, a year earlier.

AT&T didn’t break out the numbers of iPhone additions as earlier. The number could still be around 1.5 million because other carriers besides AT&T are selling it internationally, and about 30 percent are unlocked. By the end of last year, AT&T had activated two million iPhones. Here are the iPhone details AT&T provided:

iPhone continues to be very popular with customers, feedback is very good. ARPUs are in the mid to upper 90s across the base. We continue to see customers adopting iPhone. Over 40% are new to us. Continued, solid growth. Through Q1 stable.

References:

http://www.techcrunch.com/2008/04/22/apple-shares-slump-as-att-gives
-vague-details-on-iphone-growth/

http://www.alleyinsider.com/2008/4/att_q1_solid_waiting_on_guidance_t

Wednesday, April 23, 2008

Shiny Iphone

If you are gold or dimond addicted you should apply for Goldstriker to get specially established gold iPhone - most expensive I have ever seen.

It is for the true connoisseur of iPhone fans. It is elegantly lined with 24ct gold on the iPhone’s front bezel. Parts adourned in gold inc front full surround and 3/4 of the rear revealing a total mirror finish.The back of the phone is painted in a custom black paint.









The back of the iPhone also sees a 24ct gold Apple logo. The phone itself is the 16GB model. This beautifully crafted iPhone can be had for GBP699.95 ($1384).

Goldstriker International operate as a family run business, specialising in precious metal plating.

Sure, shiny Iphone makes you different!

But how different is the sum you are ready to pay for it?

Reference:

http://www.goldstriker.co.uk/catalog/product_info.php?products_id=156

Tuesday, April 22, 2008

HWPen: Handwriting Recogniton For The iPhone

A Chinese developer has released HWPen - a handwriting recognition app for the jailbroken iPhone. HWPen works in both Chinese and Latin alphabets.

The screen cap above shows the ‘writing area’ for HWPen. You need to enter letters within the left half of the work area, and numbers on the right. Because it integrates with the native text input of the iPhone, HWPen is available anywhere you would normally use the keyboard. It even works with the iPhone's auto-complete function, so you can start to type a word and hit the spacebar to pick spelling suggestions.

The software application can be downloaded from Installer.app. Then one can go to “Sources,” click on “Edit” and “Add” a new source: http://iphonecake.com/src/new

Refresh the sources to locate HWPen in the iPhoneCake packages. Install the software and restart your iPhone. After you install you will see a writing area making the standard keyboard vanish. The application is currently in beta and is also available for the Palm OS platform.

References:

http://www.techeblog.com/index.php/tech-gadget/iphone-gets-handwriting
-recognition-video-

Sunday, April 20, 2008

Apple And Orange Negotiating About Lowering The Cost Of The French iPhone

Apple is currently in negotiations with French wireless carrier Orage about lowering the cost of the French iPhone, according to a report from French business daily Les Echos.

As reported in the French paper, iPhones in France are currently priced at €399 ($629). However the difference would be that Orange would begin subsidising the handset based upon the monthly cost of the contract users would take out, which up until now - and contrary to practices in other European countries where the iPhone is sold - they have not done.

According to Les Echos, Apple is disappointed with sales figures for the cellphone in France, 100,000 handsets of which have been sold since it went on sale there. Takeup of the iPhone generally in Europe has been less enthusiastic than in the US, perhaps because 3G networks (and the handsets to take advantage of them) are more common and to some degree expected among European users.

As a result, Apple are encouraging all carriers to further subsidise the initial cost of the handset to boost sales, which some are seeing as a way to clear first-generation iPhones before the 3G version’s imminent launch.

Orange, however, is content with the current pricing, telling the paper that there is “‘no question of changing the business model of the iPhone” and that “everything is going well”, revealing that the carrier obviously had lower sales expectations than the manufacturer did.

The 8GB iPhone has recently seen its price slashed in the UK, from £269 to £269.

References:

http://ilounge.com/index.php/news/comments/apple-orange-negotiating-iphone-price-cut/

http://www.lesechos.fr/info/hightec/4716763.htm

Friday, April 18, 2008

Web Services Fun

Before we work more with libxml, let's talk about web services. Web services are a good practical application of XML and, it would seem to me, many iPhone apps will need to work as web service clients, so it seems like a good detour.

The easiest way to access web services from Objective-C is by leveraging functionality found in Core Services, a framework that is available in both Cocoa and Cocoa Touch. For both platforms it needs to be manually linked into your project as it is not included by default in the Xcode templates.

For a Cocoa project, simply select Project -> Add to Project... then add the framework found at the following location to your project, making sure to uncheck the "copy into your project folder" option:
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreServices.framework
For the iPhone, well, you'll need to figure that one yourself; I've already gotten in trouble once with Apple for telling people where it is, but if you use Spotlight, you should be able to find it without too much difficulty.

Now once you've got the Core Services framework included in your project, how do you use it? Well, if the web service you want to access has a WSDL then it's really quite easy. As part of the Developer tool install, a little command line utility was installed on your machine called WSMakeStubs which will generate stubs with all the methods you need to access that web service. For a Cocoa project, the way to use it is as follows:
WSMakeStubs -x ObjC -name MyClassFileName -url http://server:port/path/to/wsdl
So, let's say that we wanted to create stubs for accessing the National Weather Service. For that, you would type this:
WSMakeStubs -x ObjC -name WeatherService -url http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl
Once you issue that command, it will create four files for you:
  • WeatherService.m
  • WeatherService.h
  • WSGeneratedObj.m
  • WSGeneratedObj.h
The first two implement the class you'll actually use to interact with the web service, the second two are generic classes that you need in your project, but which will be generated every time you run WSMakeStubs. If you run WSMakeStubs again, you can just delete the new versions, as they will be exactly the same as the ones you already have.

No, go ahead and add these four files to any Xcode project where you want to access the web service. If you're playing along at home, I just created a Foundation Tool Xcode project and added the four files to it. We need to import the WeatherService.h file wherever we intend to use it, like so:
#import "WeatherService.h"
In order to use this service, we need to know what functions this web service exposes to us. So, how do we know what methods we can call? Well, you can look at the WSDL or documentation that goes along with the web service if those are available. If not you can simply open up WeatherService.h and scroll down toward the bottom. The last @interface declaration in the file — ndfdXMLService — is the class we'll be working with. You'll notice that it has several class methods which you (of course) remember are the methods that begin with a + rather than a -.  These class methods correspond to the functions exposed in the web service. Let's pick one to try out, shall we? How about:
+ (id) LatLonListZipCode:(CFTypeRef /* Complex type http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd|zipCodeListType */) in_zipCodeList;
This is the simplest one in the web service, so that makes it good for showing the basics of accessing a web service. Now, whenever possible, WSMakeStubs uses known datatypes when constructing method calls. Sometimes, however, you'll see parameter specified as CFTypeRef, which is similar to id in that it's a generic pointer whose type is not specified. That means either that that parameter is more complex than a single datatype can hold OR that WSMakeStubs was unable to determine which datatype or object would be best for holding that parameter. Since it knows it doesn't know everything, WSMakeStubs includes a comment with a link to the XSD file where the parameter is defined to help you out. 

The problem is, it's not obvious nor well-documented how to use web service methods that take CFTypeRef parameters. It's easy enough to figure out how to pass in a raw datatype, but not so easy otherwise.

Now, unlike this particular one, a great many web services will take only simple parameters and will be relatively easy to use. Here is an example of how you might call such a web service function:
id result = [myWebService callMethodThatTakesInt:1];
The value of result will either be an NSString or an NSData instance depending on the web service. Ordinarily, the result will contain XML data with the web services response to your call.

But what do we do in this case since we have a complex type? Well, unfortunately, we have to read the documentation and poke around the stubs and experiment a little. In many cases, complex objects expect an NSDictionary with the xml tag name used as the key and the tag's contents as the corresponding object. For complex types where there are nested tags, some of the objects in the NSDictionary you create might themselves be NSDictionary instances. Because of this, building your parameter objecs can get fairly complex in some instances. 

Fortunately for us, it turns out that this web service function just takes a single string containing a space-separated list of zip codes. Well, we can do that. Heck, we can do that in one line of code:
id result = [ndfdXMLService LatLonListZipCode:@"13413 94588 12901"]; 
Notice that we are using NSString, and not c strings here. You could also use CFString because they are toll-free bridged to NSString but since we're in Cocoa, let's stick with Cocoa, shall we?

After running this code, result will be a string that contains XML with tags representing the longitude and latitude for each of the zip codes passed in. Blogger won't let me paste that XML in - it keeps thinking the XML is HTML and if I change the tags to use > and < it helpfully converts those back to angle brackets. *sigh* Well, the price is right. Anyway, you can see the XML here if you want.


Now, we have the server's response in XML... if only we had an easy way to parse XML in Cocoa and Cocoa Touch. Oh, wait... I, um...  promised you something vaguely similar to that yesterday, didn't I? :)

Coming next: The libxml wrapper and a little practical application of it.

iHome To Launch iP99 Clock Radio For The iPhone

iHome is set to launch the new iP99 iPhone-compatible dual alarm clock radio at Brookstone specialty retail stores on June 1.

According to Brookstone, the iP99 iPhone clock radio can still receive calls while docked because engineers eliminated the shielding that normally interferes with cell signals. It also has a specialized adapter to accommodate for both the iPhone and all versions of the iPod, allowing it to dock, charge and play from every one of Apple’s audio players.

There are other clock radios on the market that will work with the iPod, but none of them today have allowed the iPhone to receive calls while playing music.

The iHome iP99 iPhone Clock Radio will go on sale on June 1 for $149.95. It features10-watt Reson8 speakers, an integrated AM/FM radio, an alarm buzzer and a remote control.

Customers can already start to order the iHome iP99 iPhone clock radio through 1 june and receive free shipping, by visiting any one of Brookstone’s 314 stores in the USA or at www.brookstone.com.

Brookstone, Inc. was founded in 1965 as a small New England catalog company. Brookstone, Inc., today is a USA based product developer and multi-channel retailer that generates annual sales of approximately half a billion dollars.

Brookstone operates 308 branded stores, located primarily in high-end shopping malls and lifestyle centers throughout the United States and in Puerto Rico.

References:

http://www.prnewswire.com/cgi-bin/stories.pl?ACCT=104&STORY=/www/
story/04-15-2008/0004792627&EDATE

https://www.brookstone.com/store/product.asp?product_code=595702

Thursday, April 17, 2008

AOL Mobile Search Service For The iPhone And iPod Touch

AOL has officially launched the beta version of AOL Mobile Search service created specifically for the iPhone and iPod touch.

AOL Mobile Search for the iPhone was designed specifically for the Apple iPhone's mobile Safari browser. Mobile Search has a traditional Web search engine, but also has features specially tailored to search the content of various AOL properties, including Moviefone, MapQuest, AOL CityGuide and others.

By combining AJAX technology and the iPhone’s easy to use multi-touch surface, AOL has created a user interface that allows the richness of the web to be delivered on a phone, says Steve Murphy, senior vice president of AOL.

The new search portal places a priority on iPhone-optimized websites and returns web searches with these websites at the top of the list.

References:

http://searchblog.aol.com/

Simplifying libxml

As I mentioned in my previous post, XML handling on the iPhone is through the open source libxml library, which is a procedural C-based API. We can also use libxml in Cocoa, and if you have an eye toward re-using your code on the iPhone, it's probably not a bad idea to use libxml instead of NSXML. It also means I can show you how to use libxml without using the iPhone SDK and violating the NDA. 

To use libxml in your Cocoa projects, you just need to do one thing in your Xcode project settings, which is to add /usr/include/libxml2/** to your Header Search Paths build settings:
This will tell your project where to find the header files for libxml.

Now, to use libxml to parse XML data contained in an instance of NSString, say we had:
NSString *xml; // string containing XML
We need to make sure we import the necessary header file:
#import <libxml/xmlmemory.h>
Next, we have to tell the library to parse this data. Being a procedural C library, libxml knows nothing about NSString, which is an objective-C class class cluster, so we have to convert our NSString into a c string, like this:
xmlDocPtr doc = xmlParseMemory([xml UTF8String], [xml lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
If this was successful doc will not be NULL. Now, how do we get values from this? Well, we can get the root node like this:
xmlNodePtr root = xmlDocGetRootElement(doc);
xmlNodes are implemented as doubly linked lists, a construct that we don't use much in Objective-C, although it's likely used under the hood in the implementation of some of the collection classes. This abstraction is different from how we commonly work in Objective-C. Ordinarily, we have an object that represents the collection and we call methods on that collection object to get to the objects that it contains. In an old-school linked list like this, the xmlNode object pointed at by an xmlNodePtr represents both the node itself and the collection. Now, there is only going to be one root node in most situations but let's look at how we would get to the children of the root node.

It's actually pretty easy. We declare another node pointer and point it at the nodes's children like so:
xmlNodePtr node = root->children;
Now, the children pointer gives us a single node, but that node is also our access to all of the node's siblings and children. To iterate through all the nodes at this level, we can loop like this:
xmlNodePtr cur_node;
for (cur_node = node; cur_node; cur_node = cur_node->next)
{
 // Do something
}
This loop keeps going until it gets to the last item in the linked list. The last item has NULL as its pointer to next, so the loop stops. Similarly, we can loop through a node's children like this:
xmlNodePtr children;
for (children = node->children; children; children = children->next)
{
 // Do something
}
To get a node's name, we just look at the name member of the xmlNode struct, which is a c string. So, if we want to find a node with a specific name among a node's children, we would do it like this:
NSString *nameToSearchFor = @"Id";
xmlNode *child = NULL;
for (child = node->children; child; child = child->next)
{
if (strcmp((char *)child->name, [aName cStringUsingEncoding:NSUTF8StringEncoding])==0)
{
// Do something with the node
}
}
To determine the value of a node - the value between the begin and end tab in your XML like this: 
<node>value</node>
It's a little more complicated, but not much. To obtain its value as a string:
xmlChar *ret = xmlNodeListGetString(doc, node->children, 1);
Notice that we pass not the node, but the node's children pointer. This is because the text between the begin and end tags counts as a child.

At this point, I think you can see how mixing a procedural C API with Objective-C code looks a little ugly. On the other hand, I believe that Apple must have had good reason to not port NSXML to the iPhone, probably having to do with performance, but that is just conjecture on my part. So, how can we make our code look nicer without imposing significant additional overhead? 

Well, we can create a very low-overhead Objective-C wrapper. In the internals of the class, we use libxml for performance, but then convert to and from Objective-C objects in our accessors and mutators. This gives us a nice compromise between performance and readability, so our code can look like this without adding significant processing overhead:
 NKDLibXMLDocument *doc = [NKDLibXMLDocument documentWithRawXML:result];
NKDLibXMLNode *root = [doc rootNode];
NKDLibXMLNode *user = [root childNamed:@"User"];
NSLog(@"Id: %@", [user valueForChildNamed:@"Id"]);
NSLog(@"FirstName: %@", [user valueForChildNamed:@"FirstName"]);
NSLog(@"LastName: %@", [user valueForChildNamed:@"LastName"]);
Doesn't that look nicer? Isn't it easy to tell what's going on in that code? We hide all the nastiness away in a couple of classes and then never have to deal with it again. Yeah, that's the ticket.

I've still got some work to do on on the wrapper class, but I'll post it in the next day or two.

Tuesday, April 15, 2008

Web Services Fun

Well, I got a proof of concept iPhone application working today. It's not ready to show off yet, as it's little more than a command-line application running in an iPhone window, but I was able to authenticate against a Tririga web service, pass in a username and password, then parse the results.

The iPhone does not have support for NSXML, unfortunately, so we're stuck using the procedural libxml api. Using libxml inside of an OO environment is like pulling teeth. It's a great procedural API, but compared to what you can do with a good high-level language, it's just downright ugly. I'm sure the performance is much better than NSXML, but the code it takes to use it is really, really ugly looking.

It took me longer than I expected, but I've now got the hang of using libXML, and have written a few utility functions to make my life easier. I may try wrapping it up into a low-overhead objective-C wrapper. If I do, I'll post the results here.

In the next day or so, I hope to have a full proof-of-concept iPhone app to submit a work request through Tririga.

Golden Ticket

I still have not gotten an acceptance letter from the iPhone developer program, much to my dismay, but I am finding great amusement in the fact that the iPhone dev community has taken to calling these acceptance letters "Golden Tickets" which is, of course, a reference to the great Roald Dahl's Charlie and the Chocolate Factory. I must admit that anticipation for getting the ability to test my apps on an actual iPhone makes me feel much the same way as Charlie must have when peeling back the wrapper of that Wonka Bar.

Renewed Stitcher Radio

Listen to the latest entertainment news and celebrity gossip, or get politics, world news and sports audio content that you can personalize. Stitcher Radio is a Web based application, designed specially for the iPhone.

You may start listening instantly. Verious thems are represented here. You can listen to

* Current headlines from CNN, ESPN, People, Fox News, the Onion and hundreds more.

* The juiciest dirt from sources like People and the Daily Dish.

* Favorites Station: Listen to the information that interests you, all in one station.

* Streams reliably anywhere – no syncing or Wi-Fi needed.

* New Content: Hundreds of new shows from the names you trust, updated daily.

New version is renewed, check out favorites station: listen to the information that interests you, all in one station. New Content is obvious, here you can find hundreds of new shows from the names you trust, updated daily.

Since it is Web based application, Stitcher Radio works nicely on your desktop too. Just click. on the far right arrow. Windows Mobile no need to apply!

Point your safari browser to http://www.stitcher.com/iphone/ to try.

References:

http://www.stitcher.com/

WWDC

If you're new to the platform, the best thing you can do is go to WWDC this year. Yes, it's expensive, especially if, like me, you no longer live in the Bay Area (or perhaps, never did). But WWDC is an unparalleled chance to learn about the iPhone. There will be a huge number of sessions and hands-on labs, and it's a great opportunity to meet other programmers. The labs are an unparalleled opportunity to have your code looked at by Apple engineer.

If you are a company looking to build iPhone apps or port your existing apps to the iPhone, you really, really, really, really (and really) should send your iPhone programmers to WWDC. The return on your investment will be astounding. Don't bother sending project managers or non-technical folk - this isn't a marketing, lovey-dovey kind of convention. This is a hardcore technical crowd, but there's an awful lot of smart people there and a lot of good information to be gotten.

Monday, April 14, 2008

HermitWorks To Release Space Trader For iPhone

HermitWorks Entertainment, founded by former BioWare game designers Cameron and Marcia Tofer, is working not only for Quack 3 for the iPhone and iPod touch ports, but on Space Trader

port for iPhone as well.

As widely reported this week, the port uses the built-in motion sensors to control action in the game, and offers the capability for two player play using WiFi.

HermitWorks hopes to release Space Trader in June for the iTunes Store for users to purchase and download but in order for that to happen they would need minimal support in Apple’s official SDK which was late in coming.

Space Trader is a FPS style game but the company is also working on a RPG game called Quest. They promise that it won’t be standard 2D RPG, but instead a full 3D game, with some NPC’s being real players.

HermitWorks Entertainment Corporation is an independent game company founded in 2004 by industry veterans Cameron and Marcia Tofer. HermitWorks is an innovative company interested in developing games that casual and hard core gamers can play together. Their first game title 'Space Trader' was realeased in the fall of 2007.

Sunday, April 13, 2008

New HybridShell And VideoShell Cases For The iPhone

Digital Lifestyle Outfitters has announced the release of two new cases - the HybridShell and the VideoShell for the iPhone. They’re available for $24.99 and $19.99 respectively from the DLO store.

The HybridShell is a fusion of crystal-clear polycarbonate plus gripable silicone, combined to provide a strong layer of protection for the iPhone. The new shield also has black rubber dots above the surface that makes it easy to grip. In the front it has DLO Surface Shield, which adds transparent protective layer, which allows you to use all the touch screen functions, and still have your device protected.

The VideoShell integrates a kickstand which allows you to comfortably place iPhone on flat surface and enjoy a movie, or any other video content. It provides you with access to the headphone port, hold switch, side controls and dock connector. It also includes a Surface Shield.

DLO Surface Shields are also available separately for $14.99. The pack contains five anti-glare films for protection against dust and smudges. Because they work with static adhesion, Surface Shields are easy to apply, re-adjust if necessary, and remove without leaving behind any sticky residue.

References:

http://www.dlo.com/Products/Hshell_iPhone_Prod.tpl?command=showpage&cart=
12079838911395131

Friday, April 11, 2008

World's First Photography Portal For The iPhone

Cameratown.com, a popular digital photography information website announced the World's First Photography Portal for the iPhone. It provides all the latest news from the world of photography. The new site is specifically designed for Apple iPhone and iPod Touch users. So by the help of Cameratown.com they can get all kind of latest photography news.

“The World’s First Photography Portal for the iPhone was launched by Cameratown. The new site, specifically designed for Apple iPhone and iPod Touch users, provides readers with quick access to “what’s new” in photography. Visitors can easily find the latest camera reviews from the best and most trusted sources around the web, new product announcements, the latest headline news, and camera information by brand and model. Photography information is now more accessible than ever,” - CameraTown webmaster Ron Risman said.

About Cameratown:

Cameratown.com is a digital photography and imaging website founded by Ron Risman, a veteran of the photography industry for the past 11 years. Officially launched on July 22, 2004, Cameratown's mission is to help "Develop the Photographer in You" and makes it easy to get the latest photography and imaging news, professional product reviews, tutorials, newspaper articles, product manuals, firmware updates, free photography software, and special deals from around the web.

Reference:

http://www.letsgodigital.org/en/18798/apple-iphone-photography-portal/

Idiocy Can Come with Many Letters After Its Name

The iPhoneDevSDK Blog blogged about an interesting article today. And by interesting I mean, of course, startlingly idiotic, as you can probably tell just from the sensationalist title "How the iPhone is killing the Net".

It just goes to show that you can be professor at a prestigious school and still be clueless concerning topics on which you believe yourself to be an expert.

Thursday, April 10, 2008

The Root of All Evil: Introduction to Optimizing Objective C

Donald Knuth has a very famous quote: "[P]remature optimization is the root of all evil"1. This is a valuable idea to keep in your head while programing. It's actually okay to write inefficient code at times. In the context of Objective-C, this means it's okay to use provided methods and objects in your first pass at writing algorithms, even if you know that those objects or methods might not be the optimal way to do the task in terms of performance. Get the code working, and get it working right, and then go back and optimize intelligently where it make sense. In many places small inefficiencies will have no noticeable affect on your application, and by leveraging thoroughly-tested code from Cocoa which was written by knowledgeable Apple and NeXT engineers, you likely saved yourself considerable time and maintenance headaches.

But, there are times when inefficient code has an impact and needs to be addressed. In Java, Visual Basic, Ruby, and the other high-level languages, there is a lot you can do to optimize your code, but there is a limit to what you can do because those languages insulate you from the inner workings using mechanisms such as garbage collection, and a lot of the code that is running when you run your code is completely outside of your control. In all of those languages, you can help the runtime know when it's okay to free up memory that you're done with it by following good coding practices, but memory management is mostly out of your hands. Other optimizations like loop unrolling can be used in these languages, but the performance yield tends to be less than from the same optimizations in a low-level language compiled directly to machine code.

Here's where Objective-C really has a leg up. It is a high-level language and has a lot in common with Java, VB, and C#. It has garbage collection (well, not on the iPhone, yet) and exception handling and it shields you from many low-level implementation details as a good high-level language should. But, Objective-C is a super-set of C, and even though it does have a small runtime engine to enable object messaging and other features, most of your code gets compiled down to machine language. You are shielded from the low-level implementation details, but not prevented from getting to them. When you have exhausted your options for optimizing using Objective-C and Cocoa, you always have the option to lift up the hood and use good old-fashioned procedural C to optimize even more. A great Objective-C programmer needs to be at least a good C programmer.

Let's take a look at an example of optimizing a small chunk of Objective-C code.

Let's say that we have an NSData that contains encoded binary data stored as 8-bit ASCII characters. In this encoded data,  we need to look for certain sequences of characters to make sure that it contains the type of data it's supposed to. These tags are simple sequences of ASCII characters (aka c-strings). 

Here is my first, quickly written version leveraging built-in Cocoa objects. This was written as part of a category on NSData, so any reference to self is a reference to the NSData object holding the encoded binary data.

I apologize for the code formatting. Blogger is not cooperating and refuses to believe me when I tell it that my code is preformatted using the pre tag.

The Original, Horribly Non-Optimized Version




-(BOOL)containsCString:(char *)cmp
{
NSUInteger offset = 0;
char * byte;
const char * bytes = [self bytes];

while (offset < [self length])
{
byte = (char *)bytes ;
NSString * checkString = [NSString stringWithCString:byte length:strlen(cmp)];
if ([checkString isEqualToString:[NSString stringWithCString:cmp length:strlen(cmp)]])
return YES;

offset++;
}
return NO;
}

Shall I leave it as an exercise for the student to identify just why this code is poor from an optimization standpoint? I'd better not, though the problems are likely obvious to many of you.

First of all, I'm allocating autoreleased objects inside of a loop. And that loop goes byte by byte through a potentially large chunk of data. None of the memory for those objects will be released until the end of the current pass through the run loop, which won't happen until after my loop finishes. I create two autoreleased NSString instances for every byte in the data and then run a string compare between them. NSString is a complex class cluster designed to deal with a multitude of string encodings, and could potentially be using multi-byte characters to represent these strings, meaning that each compare could be comparing two or even three bytes rather than just one. Now, the NSString class cluster is smart and probably won't use multi-byte encoding unless it needs to, but since that's not our code and the algorithms are not documented, we can't know for sure what it's going to do, and it's possible that something in our data could trigger the use of multi-byte encoding

So, basically, I'm being very, very inefficient with both memory and processing power here. That may not be important, depending on how I'm using this in my application, and this version only took me a couple of minutes to write, so if I do this rarely and the chunks of encoded data are small, perhaps this is going to be fine just the way it is. But there's the potential for real problems with this code in an application. 

One way to find out if it's going to be a real problem is to set up unit tests (you do use unit tests, right?) that use representative situations similar to what the code will face in the actual application.

For grins and giggles, let's run MY unit test on this method, which takes two three-megabyte chunks of encoded data - one that contains the tags being searched for and one that doesn't - and do two searches on both chunks. The result? 6.8  seconds to do the two searches on each of the two three-megabyte chunks running it on a a 2.6ghz MacBook Pro. That's definitely a potential Spinning Beachball of Death situation. I guess we'd better look at optimizing, huh?

Note that the amount of time it takes to run this code will depend on a number of factors, and it will not be the same every time, but it only varied by a few milliseconds over a dozen runs, so I'm pretty confident it's the algorithm that's slow and not something else running at the same time2.

First Optimization

The first and most obvious optimization here is getting the comparison string allocation out of the loop. That value does not change at all during the loop, so let's move it up to before the while statement so that only happens once per call to this method. In theory that should significantly reduce memory overhead and probably reduce the processing time significantly as well. Here's the new version:

-(BOOL)containsCString:(char *)cmp
{
NSUInteger offset = 0;
char * byte;
const char * bytes = [self bytes];
NSString *compareString = [NSString stringWithCString:cmp length:strlen(cmp)];
while (offset < [self length])
{
byte = (char *)bytes ;
NSString * checkString = [NSString stringWithCString:byte length:strlen(cmp)];
if ([checkString isEqualToString:compareString])
return YES;

offset++;
}
return NO;
}

Let's run the unit test and see what happens. And the result? This time it runs in a little faster, clocking in at 3.7 seconds. A significant improvement, but not fast enough to avoid that spinning beach ball. Perhaps I'm going to have to spawn threads. I'm going to be doing this encoding a lot in my application. 

So, is there a way I can improve it more? Is there any way for me to avoid autoreleasing so many NSStrings, or even creating them at all? Well, there are a couple of options. I could manually allocate and release the string objects. That would be considerably more efficient than filling up the autorelease pool, in theory. 

The Second Optimization

Here's what we get if we manually allocate and release our NSString instances rather than letting them go into the autorelease pool. This should help with our memory overhead, but it's unclear how much of a speed increase it will give us:


-(BOOL)containsCString:(char *)cmp
{
NSUInteger offset = 0;
char * byte;
const char * bytes = [self bytes];
NSString *compareString = [NSString stringWithCString:cmp length:strlen(cmp)];
while (offset < [self length])
{
byte = (char *)bytes ;
NSString *checkString = [[NSString alloc] initWithCString:byte length:strlen(cmp)];
if ([checkString isEqualToString:compareString])
return YES;
[checkString release];
offset++;
}
return NO;
}
We run it and? 3.44 seconds. Hm.. An improvement, but not a huge one by any means. It does appear that creating strings is one of our bottlenecks. In a more complex method, we would probably have to resort to using Shark or Instruments to identify where our bottlenecks were, but in this case, it's pretty obvious where the problem is.

So, let's look at doing this in straight C. After all, we're just comparing chunks of memory. C can do that, and it can do it fast without the overhead of objects or string encodings or anything else.

The Final Optimization

Instead, let's forget about using NSString or NSMutableString, and just use C. We'll work with pointers, and use some old-school techniques for comparing buffers.



-(BOOL)containsCString:(const char *)cmp
{
NSUInteger offset = 0;
const unsigned char * bytes = [self bytes];

while (offset < [self length])
{
if (memcmp(bytes++, cmp, strlen(cmp))==0)
return YES;

offset++;
}
return NO;
}

This version doesn't create any new Objective-C objects, it simply uses a C function that compares to chunks of memory. Now there is no overhead due to the objects, and none due to string encodings or conversions. 

So, just how much faster is this? Let's run our unit test and find out. How about 0.4 seconds? Not terrible at all for doing a byte-by-byte search through 12 megs of data, especially when half of the data it had to search didn't contain the thing it was looking for.

Concluding Thoughts


We could take this further. There are optimizations we could do to this that would eke out several more milliseconds, and if our code needed to process huge chunks of data, that would probably be worth investigating (and might be a good idea for a future posting), but for my purposes, I've decided that this is good enough performance for my needs. The point of this article was not really to teach you how to optimize your code, and certainly is not showing you the fastest possible implementation of this algorithm, but I did want to drive home the point that Objective-C is C, and that as nice as all the object-oriented goodness is, there are times when it makes sense to roll up your sleeves and do things old school, an option that most high-level languages don't offer, but Objective-C does. I also wanted you to see some of the rather common kinds of mistakes you often see in high-level languages that cause memory bloat and performance bottlenecks so that you'll be less likely to make them in the future.

The timings in this article were all done using the Debug target. The final optimization dropped down to .1 seconds by switching to the Release target, and I was able to drop it even lower by implementing a reverse iterator for the end tag.


1 - Structured Programming with go to Statements, ACM Journal Computing Surveys, Vol 6, No. 4, Dec. 1974. p.268
2 - It does, indeed, help to know that I intentionally wrote this inefficiently.

Wednesday, April 9, 2008

SDK Beta 3 is Out

iPhone SDK Beta 3 came out last night. You can, if you're a registered iPhone developer of course, download it from Apple's iPhone Dev Center.  The "Cocoa Touch Application" Xcode template now includes an xib file, and they've added a main nib file key to the property list file. There is also a nice new tutorial on creating Apps that use IB. The tutorial is not easy to find on the Dev Center web site, but they included a link to it in the notification e-mail that went out last night.

Tuesday, April 8, 2008

Disney California Adventure Mini Guide For iPhone Consumer

iPhone offers new opportunity to the consumer. “Disney California Adventure Mini Guide” in an interactive map and pocket guide, which will help you, to navigate easily the famous Disney Theme Park.

Disney California Adventure Mini Guide is an interactive map and pocket guide provides the information you need to visit Disney’s California Adventure theme park on your iPhone/iPod touch. Includes descriptions of attractions, identifies Fastpass attractions and includes details on restrictions for rides. For dining options, the type of food and type dining is provided. Most importantly, find the nearest restroom in your area.

References:

http://www.apple.com/webapps/travel/disneycaliforniaadventureminiguide.html

You're Doing it Wrong! A Brief Discussion of Categories and the Cocoa Way

Let's talk about a part of the Objective-C language that is somewhat unique: Categories. Well, not completely unique: the latest edition of C# has added something called Extension Methods, which is very similar, but it hasn't been around long enough to have really sunk into the collective psyche of .Net developers yet. Other than this recent addition to C# and the obscure language TOM, I don't personally know of any programming languages that have an equivalent to Objective-C categories. There probably are some floating out there, but the "biggie" languages in the world of object-oriented programming - Java, Ruby, Python, C++ - do not have an equivalent construct. 

Categories are über-cool, and almost universally underused by programmers new to Objective-C. Although I'm not a big fan of C# or .net, I have to give Microsoft kudos for recognizing awesomeness and incorporating it. Let's keep our fingers crossed that they use it as effectively as the NeXT and Apple engineers have in Cocoa.

A lot of people who come to Cocoa from other languages and read Apple's reference book on Objective-C  skim over the section on Categories, say "cool," and then move on. Heck, Apple's own Objective-C primer makes no mention of categories, which is just a shame, because Cocoa programmers use categories a lot. So, what are they, you ask?

Simply put, categories allow you to add methods to existing classes without subclassing them. You can't add instance variables (colloquially called "iVars" or "ivars" in the Cocoa world) or properties, but you can add both class and instance methods with impunity.

So why is this cool? Let's take an example, and look at the design choices available to us in Objective-C versus other languages. I'll use a real-world but very simple example here, but there are countless examples in a programmer's day-to-day life where categories can make your overall code base more elegant, many of which are more complex and more compelling than this one.

One of my current side projects is building two Cocoa-based NNTP clients (for accessing Usenet ): one for the Mac and the other for the iPhone. Now, NNTP servers expects date information to be passed into it in a very specific way - in the format specified in RFC 822. A date string for NNTP needs to look something like this:
08 Apr 2008 12:14:40 -0500
Formatting dates with Objective-C/Cocoa is relatively easy, so I can create a string in this format from an NSDate object relatively easily, by doing this:

NSString *dateString = [theDate descriptionWithCalendarFormat:@"%d %b %Y %H:%M:%S %z" timezone:nil locale:nil];
But where does this code go? Do I really want to put this code everywhere I need to use it? Well, maybe... like I said, this is a simple example for purposes of illustration, and not as compelling as many other real-world examples, but play along with me here, okay?

In an NNTP client, this same long line of code would probably need to be put into dozens or maybe even hundreds of places. But what if RFC822 were to change? Or what if, after using similar code in dozens of places, I realize that I have made a mistake? What a pain!

There are many ways of dealing with this problem in other languages. I could, for example, create a private static method or a function (depending on language)  that takes a date and returns a correctly formatted string. In C or any of its supersets, I could choose to create a preprocessor macro using #define to avoid having the same logic in multiple places. I could also choose to subclass NSDate and add a method in the subclass to return this method. In some cases, that might be appropriate, but in a strongly-typed language like C++ or Java, I probably don't want to do that just to get a single method because it would force a lot of type coercion and messiness into my code.

Without categories, subclassing might be a good choice in Objective-C because it is weakly-typed and could be done with minimal messiness. But we can do it with NO messiness thanks to categories. In Objective-C, I can simply add a method to the existing NSDate class to do what I need. Anywhere I need to use this new method, I just make sure to include the header file from my category. In my simple example, the category header file (.h) would look like this:
#import cocoa/cocoa.h
#import appkit/appkit.h
@interface NSDate(NNTP)

-(NSString *)rfc822DateString;
@end
and my implementation (.m) file would look like this:
#import "NSDate-NNTP.h"

@implementation NSDate(NNTP)
-(NSString *)rfc822DateString
{
return [self descriptionWithCalendarFormat:@"%d %b %Y %H:%M:%S %z" timeZone:nil locale:nil];
}
@end
Once I have this, anywhere I need a date formatted in this particular way, I simply call this new method right on the date object, like this:
NSString *dateString = [myDate rfc822DateString];
The result? Very readable and much shorter code, and it places the actual logic into a single place making it easy to maintain. 

If you want to see a more complex use of Objective-C categories, check out this this earlier blog posting where I showed how to add network socket support to the delivered NSFileHandle class.

Categories make it easier to stick with the overriding design philosphy used throughout Cocoa, and its presence allows the Application Kit and UI Kit to have much shallower class hierarchies than you find in other object-oriented application toolkits. If you're working in Cocoa/Objective-C, you really, really should get into the habit of using Categories whenever it makes sense. When does it make sense? Any time you think to yourself, "Gee, I wish the delivered class [X] had a method that does [Y]".

Pink Screen of Death

Looks like the beta of the iPhone OS 2.0 expired today. I don't have this problem yet because I haven't gotten my acceptance letter yet, but for those of you who have, apparently you can just re-download the SDK. Apple hasn't announced it, but apparently the disk image there is updated with a new version of the firmware that is not expired.

Monday, April 7, 2008

16GB IPhone - Top Selling Item

I4U have published the report about 10 selling products in the online apple store. It says that the 16GB iPhone was the top selling item during last week. As part of a weekly report on top selling Apple Store items, they claim that the largest capacity iPhone tool the lead in sales and items sold.


Not surprisingly, the 8GB iPhone followed in second place. At this rate, Apple might still stand a chance of reaching their 10 million mark.

References:

http://www.i4u.com/article16076.html

Sunday, April 6, 2008

A New Case - iShield Mirror For iPhone

Pacific Rim has designed a new case for iPhone called iShield Mirror. The case is made of transparent polycarbonate, and consists of two pieces that snap together, with holes in the proper places to allow for easy access to the controls.

The manufacturer also added a film to the surface that functions as a mirror when iPhone is not in use. When activated the film on the front is transparent enough to allow for normal usage and thin enough not to impede functionality.

The polycarbonate is completely clear so you can view your screen without obstacles. You can purchase the case for $29.99 from Pacific Rim’s website.

References:

http://www.pacrimtechnologies.com/detail.aspx?ID=159

Friday, April 4, 2008

New Webgames: Color Rush and Castle Feud For iPhone

Undercloud offers iPhone users two new free multiplayer webgames: Color Rush and Castle Feud.

The game Color Rush is partly strategy and partly puzzle. In this game you'll need to use all of your wisdom to beat the computer in the run for the total domination. Pick color gems to expand your field, whoever captures the bigger half wins. You can track your score on the global scoreboard, and more, play online multiplay with your fiends.

Castle Feud puts you in a straight-up battle of cannons and medieval castles. To get started, all you do is check the wind conditions, adjust the trajectory and power of your shot, and fire away.

The object of the game is to blast the opposing castle down to nothing before they’re able to do the same to you. You can play against the iPhone, or with a friend in two-player mode. Play against the iPhone, iPod Touch, or duel your friends.


Tuesday, April 1, 2008

TeenBuzz Added Ultrasonic Ringtones Support For iPhone Users

TeenBuzz, a website that offers ultrasonic high frequency ringtones has recently been reformatted to include added support for iPhone users.

The ringtones are of a particularly high frequency, which helps younger generations avoid detection of mobile phone usage. While younger teenagers can hear the tones, adults will have a hard time in doing so as a result of naturally occurring hearing loss (a phenomenon known as presbycusis).

Those who want to use this ringtone first have to subscribe to a PodCast website. As soon as the download to the ultrasonic is finished ringtones will be given, and they will be automatically added to the ringtones directory. Note that they will be made available upon successful syncing of the iPhone.

Teen Buzz (also known as Mosquitotone or Zumbitone) is a popular ringtone that was hijacked from a technology that was originally used to repel loitering teenagers from shops in the United Kingdom. Inventor Howard Stapleton developed the "Mosquito device" for Compound Security Systems.

The Mosquito is a product made to drive away teenagers from no-loitering zones. Because the ability to hear high frequencies deteriorates with age (a phenomenon known as presbycusis), the Mosquito works by emitting high-frequency tones at approximately 17.4 kHz.

The Mosquito was originally tested at one location in Newport, South Wales, where it was successful in reducing the number of teenagers loitering near a grocery store. In spite of this, some adults and seniors were still able to hear the Mosquito. It has not been tested by hearing experts, however the tones are broadcast at 75 decibels, so they fall within the government's auditory-safety limits. The Mosquito was released into the mainstream market in 2006.

P.S. For more information visit the official website of TeenBuzz.

References:

http://snapvoip.blogspot.com/2008/03/iphone-gets-ultrasonic-ringtones-from.html

http://www.teenbuzz.org/about-mosquito-ringtones.html