Tuesday, March 16, 2010

Count No of occurrences of a String or a character

Hi Friends,

I was in a search of a function that would give the number of occurrences of a character or a string in another string and finally I landed in the following solution. If you have any other way to achieve it, please share it.

+ (NSInteger)occurrencesOf:(NSString *)str InString:(NSString *)mainString
{

return [[mainString componentsSeparatedByString:str] count];

}

Thank you.

Friday, March 12, 2010

iPhone OS 4.0 Multitasking

Hi Friends,
This is a good news for iPhone and future iPad users, if it is true as reported in AppleInsider. And as reported this move would silence the critics who always take a dig at apple for not providing the Multitasking. And the main thing to watch out is how is going to achieve it without compromising on battery life.

Lets wait and see whats happening!!

Thursday, March 4, 2010

Rename project File and Target Name in XCode

Hi Friends,

This post is going to help you to change the name of your Project in XCode. And follow the steps given below to achieve the same.

1. Make a copy of your project Folder and delete the build folder if there is one.
2. Rename it to the name you wish to have.
3. Change the name of the .xcodeproj file to the name you wish to have.
4. Change the name of the .pch file.

Now it seems to be fine and when you run you will be blocked by the following error:
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

So lets get to the fifth step.
5. Go to the Targets. Right click on your Target Name and click Get Info.
6. Now go to the Build tab and find the GCC_PREFIX_HEADER in the User-Defined section and you will find the name of the .pch file that you have just renamed and voila.

For renaming the Target, just change the "Bundle display name" in your <project-Name>-info.plist file. And your done...

Monday, March 1, 2010

Palm WebOS- Web Service and Persistent Storage

Hi Friends,

This article will take you through the ways of handling Web Service and Persistent Storage in Palm Web OS.

First let us look at Web Service.

Web Service

1. We can access webservice using two means.
a. Prototype Javascript Framework (Ajax.Request)
b. Native javascript (XMLHTTPRequest)
2. Exchange data can be of any form (JSON, XML, or any of your own format)
3. Currently only asynchronous operations are supported using XMLHTTPRequest, done to preserve UI responsiveness. (I have not checked with the Ajax.Request. If someone has verified it, please share them)
4.Use Prototype Javascript Framework if you don't wish to control every operation yourself and the framework will take care of everything.
5. use Native Javascript if you wanted more control over your code.

Processing JSON:


1. Two ways:
a. eval()- best to avoid, only if source is trusted.
b. JSON parser- faster, never allow malicious script to get executed.

Processing XML:

1. use either DOM or a SAX parser.

Now lets turn towards, Persistent Storage:

Memory is partitioned as three segments:

1. root- for the OS and apps that come by default like calendar, Browser.
2. var -meant for third party Applications, that we are wiling to develop.
3. Media-media partition are visible on the USB volume( Available in your computer, when you plug-in your Palm based phone- pre or pixi).

Three ways to store data:

1. Cookie
2. Depot
3. HTML5

All three forms of data are tied to an application. So, they will be deleted, if you delete your application from the device.

Cookie:

1. Data stored as a key-value pair.
2. It has nothing to do with the Web browser cookie, other than storing data.
3. Maximum of 4KB of data.
4. Can be used to store preferences, simple settings.

Depot:

1. Can store up to 1 MB of data.
2. Size can be extended by using a keyword ext,while creating database.
3. Data stored as Key-value pair.
4. Normal way of creating DB:
var db = new Mojo.Depot({name:”demo”}, onSuccess, onFailure);
5. For extended storage:
var db = new Mojo.Depot({name:”ext:demo”}, onSuccess, onFailure);

HTML 5 database

1. It is a structured database, unlike the first two.
2. Normal way of creating the DB:
this. db = openDatabase("myDB", 1, "My DB", 10000);
3. To store data in Media partition, use
this. db = openDatabase("ext:myDB", 1, "My DB", 10000);


Depot and HTML5 DB operations are asynchronous, unlike the Cookies.

And thats all for this article. Thank you.

Sunday, February 7, 2010

Switch off Monitor in iMac

Hi Friends,

I were searching for an option to switch off my iMac monitor, whenever I am not using it. And there were lot of options provided, some thing goes like using a Utility and lot more. But I stumbled upon this site http://www.ehow.com/video_2179481_turn-off-imac-display.html where they had advised to use CTRL+SHIFT+EJECT to get them done. And really it worked. Cheers! Thanks for the person who suggested it.

Instruction to Follow:
1. Press the ONTROL + SHIFT + EJECT buttons in any order.
2. Ensure that they all are down by the end of the command and set them free from your fingers.
3. And you have your screen slept.

Update:

The first option I have provided CTRL+SHIFT+EJECT helps us take our system to Sleep mode. But to lock your screen in addition to switch-Off the monitor,

1. Press the COMMAND+OPTION+EJECT keys together and your done.

I thank my friend Girija for identifying this combination.

Wednesday, February 3, 2010

Setting up Symbian OS development Environment

This procedure that is to be explained is for Symbian OS development in Windows and not for Mac. I found a link (http://www.randomtype.com/?p=103) which stated there is a Plug-in available for Xcode to develop for symbian OS. But the link specified in the article was broken. So If some one knows a way to set up environment in Mac just share it.

Now lets get in to the procedure:

1. Install the latest ActivePerl available from the following link
http://www.activestate.com/activeperl/downloads/

Note:
Install the Activeperl first before you install the SDK.

2. Install the carbide.c++ IDE from the availble from the Link

http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/IDEs/Carbide.c++/

3. Install the latest SDK availble from the Link

http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html


And its done and start developing your applications.:)

Please let me know if any one has trouble in setting up the environment and also share your ideas if you have to overcome any problem you faced.

For Additional info follow the below links

1.http://mobiledevices.kom.aau.dk/development/programming/symbian_c/getting_started/

2.http://wiki.forum.nokia.com/index.php/How_do_I_start_programming_for_Symbian_OS%3F

Tuesday, January 19, 2010

Good News

Hi fellow budding developers,

A good news for you all. I am one of you, who wish to share whatever I experience as a developer. My posts would be regarding Smartphone applications (iPhone, palm OS and Blackberry) . I would meet you all with my first post sooner.

Thank you all.