Wednesday, November 17, 2010

Difference b/w core data and Databse

Hands-on First Look

Understanding Microsoft Surface

Understanding Microsoft Surface

iOS Application Design

iOS Application Design

 


Starting the Design Process for Your Application

Designing an iOS application requires at least a basic understanding of a few key principles:
  • The UIKit framework provides the core infrastructure for managing and running your application. Application customization comes primarily through interactions with the classes of this framework.
  • The system frameworks use well-defined design patterns. Understanding those design patterns (which are documented in Cocoa Fundamentals Guide) is essential for interacting with the system frameworks and is often useful for implementing your own code, too.
  • Most other frameworks provide services or additional features that you can incorporate as needed. Some frameworks (such as Foundation and Core Graphics) are included in all Xcode projects, but most others must be added to your project explicitly. For a list of available technologies and the documents that show you how to use them, see iOS Technology Overview.
The focus of this document is on the core infrastructure provided by UIKit and how it runs your application. Understanding this infrastructure is crucial to creating applications that work well within the system. This document also addresses the things you must do outside of UIKit, such as in your Xcode project, to make your application run smoothly. For example, this document discusses the configuration metadata that needs to accompany every application.
A good starting point for learning about application development is to learn a little about the environment in which applications must run. You can find this information in “The Application Runtime Environment.” After that, you should proceed to “The Core Application Design” to learn about the core objects and behaviors (such as multitasking) found in an iOS application.

Supporting Common Application Behaviors

There are a handful of common behaviors that iOS applications can implement. These features are independent of the type of the application you are creating and are more closely related to the design goals you have for that application. For example, both games and productivity applications can be launched into a landscape orientation. And all applications need to be responsive to low-memory warnings coming from the system.
Deciding which behaviors you want to support is important to consider when designing your application. The amount of work required to implement each behavior is usually not large but such a feature might inspire you to rework part of your design to take better advantage of it.

Meeting the App Store and System Requirements

Configuration of your application’s information property list file (Info.plist) and bundle are essential steps of the development process. The Info.plist file contains crucial information about your application’s configuration and supported features. The system relies heavily on this file to obtain information about your application and the location of key resource files needed to launch it. Also, bundles provide the fundamental structure for organizing your application’s resources and localized content. Knowing where to put things is important to building a running application.
To learn about the structure of iOS applications, and the steps you must take to configure them, read “Build-Time Configuration Details.”

Tuning Performance for the Underlying Device

In iOS, good application performance is particularly important and can mean the difference between success and failure. If your application is slow or consumes resources that prevent other applications from running smoothly, users are unlikely to want to buy it. And because resources such as memory are more constrained on iOS-based devices, it is imperative that you factor in system constraints to your design.
Power usage is a particularly important area of performance tuning when it comes to iOS applications. Many features require the system to enable specific bits of hardware. Disabling features that you are not using at the moment gives the system the opportunity to power down the associated hardware and extend battery life.
For information about techniques for improving performance and managing power usage, see “Tuning for Performance and Responsiveness.”

See Also

After reading this document, you should also consult the following documents for information about how to implement different parts of your application.

 


 

Tuesday, November 16, 2010

How To Choose The Best XML Parser for Your iPhone Project

There are lots of XML Parser are available for Iphone Development




 The iPhone SDK comes with two different libraries to choose from, and there are several popular third party libraries available such as TBXML, TouchXML, KissXML, TinyXML, and GDataXML. How is a developer to choose?
I have been recently taking a look at the various options out there, and ended up extending the XMLPerformance sample from Apple to try out each of the above libraries to learn how they worked and compare their performance. I thought I’d share what I’ve learned thus far to others who might be searching for the best XML library for their iPhone project.

in this topic i will talk about popular iPhone libraries, explain how to choose between them, and give a sample project showing how to read XML data using each of the above libraries.

Before i getting start i will explain about the 

SAX vs. DOM

A SAX parser is one where your code is notified as the parser walks through the XML tree, and you are responsible for keeping track of state and constructing any objects you might want to keep track of the data as the parser marches through.





A DOM parser reads the entire document and builds up an in-memory representation that you can query for different elements. Often, you can even construct XPath queries to pull out particular pieces.




THE MOST POPULAR XML PARSERS FOR THE IPHONE


1.NSXMLPARSER 


NSXMLParser is a SAX parser included by default with the iPhone SDK. It’s written in Objective-C and is quite straightforward to use, but perhaps not quite as easy as the DOM model.


2.libXML2
libxml2 is an Open Source library that is included by default with the iPhone SDK. It is a C-based API, so is a bit more work to use than NSXML. The library supports both DOM and SAX processing. The libxml2 SAX processor is especially cool, as it has a unique feature of being able to parse the data as it’s being read. For example, you could be reading a large XML document from the network and displaying data that you’re reading for it to the user while you’re still downloading.


3.TBXML


TBXML is a lightweight DOM XML parser designed to be as quick as possible while consuming few memory resources. It saves time by not performing validation, not supporting XPath, and by being read-only – i.e. you can read XML with it, but you can’t then modify the XML and write it back out again


4.TouchXML


TouchXML is an NSXML style DOM XML parser for the iPhone. Like TBXML, it is also read-only, but unlike TBXML it does support XPath.


5. KissXML


KissXML is another NSSXML style DOM XML parser for the iPhone, actually based on TouchXML. The main difference is KissXML also supports editing and writing XML as well as reading.


6.TinyXML


TinyXML is a small C-based DOM XML parser that consists of just four C files and two headers. It supports both reading and writing XML documents, but it does not support XPath on its own. However, you can use a related library – TinyXPath – for that


7.GDATAXML


GDataXML is yet another NSXML style DOM XML parser for the iPhone, developed by Google as part of their Objective-C client library. Consisting of just a M file and a header, it supports both reading and writing XML documents and XPath queries.









XML Parser Performance Comparison 



Apple has made an excellent code sample called XMLPerformance that allows you to compare the time it takes to parse a ~900KB XML document containing the top 300 iTunes songs with both the NSXML and libxml2 APIs.
The sample allows you to choose a parsing method and then parse the document, and it keeps statistics on how long it took to download the file and parse the file in a database. You can then go to a statistics screen to see the average download and parse times for each method.
I thought this would be an ideal way to test out how these various APIs performed against each other, so I extended the sample to include all of the above libraries. You can download the updated project below if you want to try it out on your device. It also serves as a nice example of how to use each of the above APIs!
DOWNLOAD Here



A note on the project: if the library included XPath support, I used it for a single lookup, because I felt it represented the way the library would be used in practice. But of course XPath is generally slower than manually walking through the tree, so it adds to the benchmarks for those libraries.
So anyway – I’ll discuss the results of how things performed on my device here with the sample written as-is – but feel free to give it a shot on your device, or tweak the code based on the actual XML data you need to parse!




XML Parser Performance Comparison

Here’s some graphs that shows how quickly the various parsers parsed the XML document on my device (an iPhone 3Gs):






As you can see here, NSXMLParser was the slowest method by far. TBXML was the fastest, which makes sense because many features were taken out in order to optimize parse time for reading only.
I was surprised, however, to see that TBXML and some of the other DOM parsing methods performed faster than libxml2′s SAX parser, which I had thought would be the fastest of all of the methods. I haven’t profiled it, but my guess as to why it is slower is because of the frequent string compares needed to parse the document in the SAX method.
However, don’t discount libxml2′s SAX method by looking at this chart. Remember that libxml2 is the only one of these methods that can parse the document as it’s reading in – so it can let your app start displaying data right away rather than having to let the download finish first.
Ok, here’s a graph that shows the peak memory usage by parser (this was obtained through running the various methods through the Object Allocations tool):




Note that the DOM methods usually require more memory overhead than the SAX methods (with the exception of TBXML, which is indeed quite efficient). This is something to consider when you are dealing with especially large documents, given the memory constraints on an iPhone.
Also note that libxml2′s SAX method is the best option as far as peak memory usage is concerned (and I suspect it would scale better than the others as well).
Finally, let’s wrap up with a chart that summarizes the differences between the parsers and everything we’ve discussed above:

Which To Choose?

Which XML parser to choose really depends on what you want to do with the parser.
  • If you just want to read small XML documents, performance doesn’t matter as much with small documents. You probably want to pick something with XPath support and something that is written in Objective-C to make your job easier. So I’d recommend either TouchXML, KissXML, or GDataXML for this case.
  • If you want to both read and write small XML documents, again performance doesn’t matter as much as functionality and ease of use. You probably want to pick something with XPath support, written in Objective-C, with read/write capability. So I’d recommend KissXML or GDataXML for this case.
  • If you want to read extremely large XML documents, performance is the critical issue here. You’ll want to consider libxml2 SAX, TBXML, or libxml DOM for this, depending on what your exact situation is.
What about the ones I didn’t mention?
  • NSXML is a decent choice if you’re dealing with relatively small documents, and you don’t feel like adding a third party library to the SDK.
  • TinyXML could be an OK choice for medium sized documents if you already have experience with the API and are comfortable with C as it ports quite easily over to the iPhone.
I took a look at two other XML libraries during the course of this investigation (VTD-XML and Objective-XML), but I couldn’t get them working. If someone else has had more luck with these, feel free to extend the sample project to include them!

Any Doubts related to this feel free to ask me 



*reference apple developer Forum and google..

Monday, November 15, 2010

K-MUG UG Meet Nov 13 2010 - A Retro

Report :- Amal
During the Community Tech Days 2010 held at Kochi, K-MUG decided to conduct monthly user group meeting for Central Kerala region at Kochi. First meeting was conducted on Nov 13, 2010 and the venue was Mastermind Institute of Engineering,  Kakkanad, Kochi. I was given a chance by the K-MUG people to take a session on Windows Phone 7.

Although I had started making slides and creating some demo applications, last minutes hiccups is unavoidable. The case is no different here, I didn’t wanted any issues to surface during the presentation coz of my unstable development machine, so I decided to demo the application inside a VM. For that I created a new one with Windows 7 64-bit as OS and then went on to install the Windows Phone Developer Toolkit which is a free download from MSDN. Even though I had 3GB memory and a dual core processor, it took a pretty decent time to install. But to my horror, I found out that the application is not loading in the emulator after a successful build. So after googling for a while I was able to get the problem behind that, Windows Phone Emulator will not work properly in a VM. The time was almost midnight and I had to catch the early morning train, so I decided to show it in my machine come what may.

Next morning I got up early and reached the station in time. During  the journey I decided to go through the ppts and demo applications and made sure that everyone is working fine. I reached Eranakulam around 9.30 and thanks to ever present traffic blocks in Ernakulam, I was late by half an hour in reaching the venue. When I entered the hall, Yanesh was mid-way through his presentation on Test Driven Development and I was unable to listen to his talk coz I was busy with settling down and Safil was waiting for me to have my lap  to show his presentation. Although he had Praseed’s lap as a backup, I handed over mine to him to prepare for the session. By this time Yanesh wrapped his session and I was not able to pay attention. Really missed it, coz I had attended his last session on Generics at CTD Kochi and it was an excellent one.  In the meantime, if someone is wondering who Yanesh is, this is for them. He is a solutions architect with Millennium Consultants who has got 16+ years of experience in designing and developing application using Microsoft Technologies. Please visit the event page to know more about Yanesh .





Next up was Safil with his presentation on Microsoft Surface. Safil's area of focus is mobile app development and is currently associated with SunnySoft Solutions Kochi. Although he is fresh out of college, he has got in depth knowledge in developing apps for iPhone and is also good on Search Engine Optimization (SEO).  He started his talk by saying that he just wanted give an introduction about surface and told us to wait until his next session to explore the programming side of it. He then gave a brief history about the concept (actually a reality now). I had seen some articles about it, but When Safil said that the concept of Surface dates back to the 80’s, it was new to me coz all these year I believed it as new technology from MS. He then explained the various features, its underlying hardware, hardware and software requirements  and  also about its basics such as multi touch, 360 degree view, object recognition technology and its UI design principles.

After Safil session, the sponsors for the venue gave a little intro about their operations and their courses on offer. They also distributed leaflets and brochures to the attendees  and it was almost time for tea break. I always loved these breaks in between coz it gives me the opportunity to link up with new people and friends.


After the tea beak, it was my turn to take the session and this was my first session in a K-MUG event. My talk centered on the new product from the Microsoft stable, the Windows Phone 7 OS. I expected some iPhone or Android developers for the event, but to my surprise there were only two or three people. So I started my session by talking about the history and features available in WP7. Then I went to on to mention about the hardware specifications and tools available for developing WP7 apps.

Frequent power disruptions caused interruptions during the session and during one we decided to hand over the certificates to students of Adoor Engineering college who had completed their academic projects under the guidance of K-MUG people. This initiative was led by Raj, who sadly left  us last month and Praseed did mention about it while giving away the certificates to the student representative.

After the presentation I explained the Windows Phone emulator and then the life cycle of a WP7 app. Then I went ahead to show some demo apps which included areas such as display orientation methods, life cycle events and isolated storage. I had prepared one more app for the demo but the time constraints meant I had to wrap up the session without showing it. I will be putting it up in the blog along the with the slides I used for the presentation. So please keep on reading my blogs....

The last session of the event was Saravana Kumar, a Senior Software Engineer with Orion India, Kochi. He is into developing enterprise application using Microsoft Technologies and also writes articles on www.wcftutorial.net.
He started his session by explaining what WCF is and the new features available in WCF 4.0. He then went on to explain every features in detail and also showed us a demo for the majority of the features.

By the time Saravanan finished the demo it was almost one o clock and everyone was dying to have food. So we quickly wrapped up the things at the venue and  next up on my itinerary was a quick visit to Aluva, so I decided to be the pillion rider in Safil's bike who going in that direction and the rest went on to have food in a near by hotel .......

Surface Terminology