Tuesday, December 28, 2010

Application loader is currently unavailable. Directory Services reported the following error: Your Apple ID or password was entered incorrectly. (-20101)

We're having trouble connecting to the iTunes Store. Please try again later

When launch Application loader, its showing the above error message .


Hi its fixed.

1. Quit the Application Loader
2. Launch the "Keychain Access"
3. Delete the itunes email entry from the Password Category.
4. Lauch the Application Loader -
       It just appeared with no error message and prompted the password on next screen.

How to set a tabbarcontroller as rootview controller of UISplitViewController

When I try to do this, 8 tabitems are displaying without "More" button. so its overlapping items title. And it will display More button if more than 8 tab items.
As it is using width 320, How to set only 5 tabs visible at a time.

I have posted this question in stackoverflaw.com http://stackoverflow.com/questions/4459634/how-to-set-a-tabbarcontroller-as-rootview-controller-of-uisplitviewcontroller

its still an open question. So I think its better to use tabbar instead of tabbarcontroller. But this will change my whole design. :(

Monday, December 27, 2010

How to change Tomcat default character encoding

We faced an issue last week on linux machine,

In a tomcat deployed server, The non-english characters getting from web services are not displaying correctly.

We write a main program in java and retrieved the data through web-service. its parsed well and correctly displayed the non-english character.

So the issue is with tomcat, after investigation we found this.

In the catalina.bat (catalina.sh) add the java args...

set JAVA_OPTS=-Djavax.servlet.request.encoding=UTF-8 -Dfile.encoding=UTF-8

then all encodings seem to come across as UTF-8 by default.. 
This resolved the problem.

source: http://marc.info/?l=tomcat-user&m=108576957301771&w=3

Added some more info:

Configuring Tomcat's URI encoding

By default, Tomcat uses ISO-8859-1 character encoding when decoding URLs received from a browser. This can cause problems when Confluence's encoding is UTF-8, and you are using international characters in attachment or page names.
  1. Edit conf/server.xml and find the line where the Coyote HTTP Connector is defined. It will look something like this, possibly with more parameters:
    <Connector port="8080"/>
  2. Add a URIEncoding="UTF-8" property to the connector:
    <Connector port="8080" URIEncoding="UTF-8"/>
  3. Restart Tomcat
Also check this

Friday, December 17, 2010

How to change MySql Data folder location - Windows machine

1. Stop/Exit the MySql service.
2.  Go to the Data folder location which we see while doing the installation. Usually it is
    C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data
3. delete all files which names begins like ib_log*
4. Go to the mysql installed location . The default location is C:\Program files\MySQL\MySQL Server 5.0
    open/edit the my.ini file
5. find the section
   #path to the database root
   and change the value of datadir
6. save the my.ini file
7. start the MySQL service

How to install MySql on a specified path/location on Windows machine

1. Run mysql-essential-5.1.51-win32.msi
2.  in the Setup type screen, select "Custom"
3. next screen, change the location to be installed.

On the next screen, we can see the Destination folder location is changed with what we given
But the Data folder location remains unchanged..

no worries, we can change the Data folder location after installation.

click install.

How to change the Data folder location

How to get motherboard and processor details from windows

#. Type "dxdiag" command in Run (Start -> Run), we can see all System informations like Motherboard Model, DirectX, Display,  and Sound, information

Monday, December 13, 2010

iPhone Core Data Encryption - encrypt your sqlite databse

in IOS4 Apple introduced a new feature NSFileProtectionComplete to encrypt the filesystem.

I found very useful article. 

Remember that we can apply this only with Device not with simulator.

And on device you should enable the passcode security under Settings -> General

If you have iTunes login, see the apple video about security
session 209 securing application data in category : Core OS 


We need to prompt a message to the user if file system is not protected, So
How to know the device is password protected ? or How to know the filesystem(database) is encrypted.?

Thursday, November 25, 2010

CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 4.2'

After update sdk4.2 , I am getting this error..

I found no way to solve.. so creating new project with existing files..

Edited: No Issues after creating new project with existing source.  :)

Edited on Feb 1, 2011

Got the same error today

This time I found the issue and fixed..

in xCode menu  Project -> Edit Active Target "App"

the profile was selected for "Code Signing Identity" instead of "Any iOS".
So deleted the value of "Code Signing Identity" and select profile for "Any iOS" . The following image is the correct one.

2013 , March 11
Got this issue again:

CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 6.1'

Wednesday, November 17, 2010

MySql installation asking current Password !!

Today I met this issue..

Its happened because one guy installed the mysql and now he forgot the password. So we decide to uninstall the existing mysql. and install a fresh one.

But when we try to install its asked current password, and if we click next, its failed at "start service"

we tried to uninstall and remove the directory under program files . but didn't help.. After a little googling found that we have to also remove the MySql data folder inside c:\documents and settings\all users\application data\

Its better to do that, search "MySql" in C drive(or include other drives) and delete all folders.(because in some windows os it would be in another path) And do a fresh install. It will work. :)

Friday, October 8, 2010

iPhone Application for MS CRM

After Releasing MobileEdge 4.3.4 version
Mobile Edge for MicrosoftDynamics v 5.0.0 is Available now.

New features :
Push Notification- When A record is created or edited on CRM, you will get a push notification on iPhone and can immediatly sync with CRM
More details, 

Friday, September 24, 2010

Add UIToolBar on top of Keyboard

UIToolbar *boolbar = [UIToolbar new];
boolbar.barStyle = UIBarStyleDefault;
[boolbar sizeToFit];
UIBarButtonItem *cancelleftBarButton =[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(buttonClicked:)];
NSArray *array = [NSArray arrayWithObjects:cancelleftBarButton, nil];
[cancelleftBarButton release];
[boolbar setItems:array];
myTextFieldorTextView.inputAccessoryView = boolbar;

How to right or center align the UIToolBar items

create  buttons like this 
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] 
              target:nil action:nil];

Add  UIBarButtonSystemItemFlexibleSpace items to your toolbar, to the left and right of your items OR left to get the center align OR right align

Wednesday, September 1, 2010

Thursday, August 12, 2010

static declaration of 'xxx' follows non-static declaration

If you declare a variable as static in your implementation file, then don't declare the same variable in header file.

expected specifier-qualifier-list before extern

There may be many reasons for this. one situation if you variable declaration inside the @interface block in the header file. It should be  outside.

Tuesday, July 27, 2010

What's the difference of UIView frame and bounds.

UIView and its subclasses all have the properties "frame" and "bounds". What's the difference?

The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.
The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).

Difference between delegate and data source?

Thursday, July 1, 2010

Can't run - was built for 'armv7', but device requires 'armv6' or compatable architecture.

This error may appear when connecting to device from iPhone Sdk 4, (Xcode 3.2.3)

to fix this
in Xcode Project->Edit Active Target
Set the Architectures:Standard(armv6 armv7) 

Tuesday, June 29, 2010

Connecting MS CRM 4.0 using Java webservices

Continue from connecting with MS CRM 3.0

The following is the sample code to connect MSCRM 4.0

String password = "password";

String username = "user";
String OrganizationName = "orgname";  //Whats Org Name

String endpointURL = "http://server:port/MSCrmServices/2007/CrmService.asmx"

CrmAuthenticationToken token = new CrmAuthenticationToken();

CrmServiceSoapStub bindingStub = (CrmServiceSoapStub) new CrmServiceLocator().getCrmServiceSoap(new URL(endpointURL));
"CrmAuthenticationToken", token);


WhoAmIRequest whoRequest = new WhoAmIRequest();
WhoAmIResponse whoResp = (WhoAmIResponse)bindingStub.execute(whoRequest);
String userid = whoResp.getUserId();
System.out.println("userid = "+userid );

I will provide the sample code for connecting MS CRM Services for all types of deployment

NSString constants in Objective C

Easiest way:
// constants.h
#define MY_CONSTANT @"my_constant"
Better way:
// constants.h
extern NSString * const MY_CONSTANT;
// constants.m
NSString * const MY_CONSTANT = @"const value";

There is also one thing to mention. If you need a non global constant, you should use static keyword.

// in constants.m file
static NSString * const MY_CONSTANT = @"const value";

The following are some interesting article.

Java Developer’s Guide to String Constants in Objective-C

Correct way of defining constants in Objective-C

Saturday, April 17, 2010

Monday, March 15, 2010

Apple Hot News iPad Now Available for Pre-Order

Starting today, you can pre-order your iPad from the Apple Online Store and have it delivered free to your door. Or buy it at your favorite Apple Retail Store starting April 3.
Read More

Wednesday, March 10, 2010

Predicted sales for Nexus One reduced by 70%

Only one million to be sold this year
Google's plan to release its own mobile phone - the Nexus One - seems to have backfired as sales estimates have been slashed.
Read More

Thursday, March 4, 2010

Apple World’s Most Admired Company by Fortune Magazine

For the third year in a row Apple has been named the World’s Most Admired Company by Fortune Magazine — this year by the widest margin ever. What makes Apple so admired? Fortune explains: “Product, product, product. This is the company that has changed the way we do everything from consume music to design products to engage with the world around us.” Apple also ranked #1 in Innovation among all companies.
Read More

See the TOP 50 companies..

Monday, March 1, 2010

How to trim NSString in Obj C

To trimming an NSString in Objective C  ..
NSString *trimmedString = [description stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

Friday, February 12, 2010

resize or scale UIImage


we can scale the UIImage to any size using the follwing method

add this code to your .h file

@interface UIImage (INResizeImageAllocator) + (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize; - (UIImage*)scaleImageToSize:(CGSize)newSize; @end

add the following to .m file

@implementation UIImage (INResizeImageAllocator) + (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize; { UIGraphicsBeginImageContext( newSize ); [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; } - (UIImage*)scaleImageToSize:(CGSize)newSize { return [UIImage imageWithImage:self scaledToSize:newSize]; } 

e.g to resize an image
self.resizeimage = [UIImage imageWithImage:actual_image scaledToSize:CGSizeMake(65.0f, 65.0f)];

Thursday, February 11, 2010

UIWebView : load local html file

Formatting UITextView

There is no feature to format the text in UITextView

We can use the UIWebView to display the formatted text
The easy two methods are :

1. - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL
2. - (void)loadRequest:(NSURLRequest *)request

use the html formatted text as input.
NSString *htmlText = @"<html><head><meta name=""viewport"" content=""width=320""/></head><body><h3>Header</h3><p>Just for testing n;</p></body</html>";
[webView loadHTMLString:htmlText baseURL:[NSURL URLWithString:@"http://www.apple.com"]];

2. Or we can load a local html file
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];

Tuesday, February 9, 2010

Dynamic Height for UITextView / UILabel / UITableViewCell

we can use this for calculating the height taken by a UILabel or UITextView or we can use this same method to calculate the height of cell according to its content..

CGRect frame1 = CGRectMake(5.0, 100.0, 300.0, 75.0 ); UITextView *textView = [[UITextView alloc] initWithFrame:frame1]; textView.font = [UIFont systemFontOfSize:17.0]; NSString *str = @"The Lord takes care of me as his sheep; I will not be without any good thing."; CGSize textSize = { 300.0f, 9999.0f }; CGSize size1 = [str sizeWithFont:textView.font constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap]; textView.text = str; frame1.size.height = size1.height; textView.frame = frame1; [self.view addSubview:textView]; [textView release];

For UITableView
we can use like
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//calculate the height of the text displayed on this cell using the above method
return MAX(size1.height, kMinRowHeight);

Macworld 2010 Feb 9 -13 @ San Francisco

Macworld 2010 is a five day celebration that will educate, entertain, and immerse you in the Mac community. Macworld offers access to hundreds of Mac products and services, paired with expert advice, demonstrations and instruction. Macworld conference programs feature industry leading minds, presenting cutting edge product training on the topics you most want to see. Whether you are a creative professional or a Mac IT pro, Macworld has the conference content, special presentations, exhibit hall highlights and experiences that meet your specific Mac needs.

Read More

Sunday, January 31, 2010

PIT Solutions extends Blue Brain association

Technopark based PIT Solutions to partner Blue Brain Project

THIRUVANANTHAPURAM: PIT Solutions based at the Technopark in Thiruvananthapuram, which focuses on IT solutions to the small and medium sector, has extended its comprehensive IT support to the Blue Brain project.
The project is the first comprehensive attempt to reverse re-engineer the mammalian brain in order to understand brain function and dysfunction through detailed simulations.
PIT Solutions will continue to partner Dr Henry Markram, director of the Swiss Federal Institute’s (EPFL) Brain Mind Institute, for the Blue Brain project. Dr Markram said the mysteries of the mind could be solved, and that it was possible to have a supercomputer that models all the brain’s 100 trillion synapses.
The project attempts to build a computerized copy of a brain, starting with a rat’s brain, and progressing to a human brain, inside one of the world’s most powerful computers. The project hopes to bring into being a mind that will be able to think, reason, express will, lay down memories and perhaps even experience different emotions including love, anger, sadness, pain and joy.

Read More

Thursday, January 28, 2010

Start Developing iPad Apps Today

iPhone Developer Program Members can start developing the next generation of innovative applications for iPad with iPhone SDK 3.2 beta, now available in the iPhone Dev Center.

The iPhone Dev Center also provides members with additional resources including the iPad Programming Guide, iPad Human Interface Guidelines, Preparing Universal Applications, and sample code.

Apple iPad SDK available soon, offers iPad development alongside of iPhone development

Here It Is: Apple Unveils The iPad, SDK Coming Later Today

The traditional Mail and Calendar applications for the iPhone have received a welcomed update for the iPad, and developers will be able to get their hands on the SDK for the device later today in preparation for the upcoming launch.

Tuesday, January 26, 2010

Add work address filds to Addressbook contact programmatically

sample code..

//add work adress         ABMutableMultiValueRef multiAddress1 = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType);                NSMutableDictionary *addressDictionary1 = [[NSMutableDictionary alloc] init];         if(address1_street)        [addressDictionary1 setObject:address1_street forKey:(NSString *) kABPersonAddressStreetKey];         if(address1_city)        [addressDictionary1 setObject:address1_city forKey:(NSString *)kABPersonAddressCityKey];         if(address1_state)        [addressDictionary1 setObject:address1_state forKey:(NSString *)kABPersonAddressStateKey];         if(address1_postalcode)    [addressDictionary1 setObject:address1_postalcode forKey:(NSString *)kABPersonAddressZIPKey];         if(address1_country)    [addressDictionary1 setObject:address1_country forKey:(NSString *)kABPersonAddressCountryKey]; ABMultiValueAddValueAndLabel(multiAddress1, addressDictionary1, kABWorkLabel, NULL); [addressDictionary1 release]; ABRecordSetValue(aRecord, kABPersonAddressProperty, multiAddress1, &amp;anError); CFRelease(multiAddress1);

Tuesday, January 5, 2010

iPhone : Update Addressbook contact

Hope you know how to add a contact to AddressBook,
And have stored the recordid in our application while adding.

following is the piece of code to get the contact id in Addressbook
ABAddressBookAddRecord (addressBook, aRecord, &error);
if(ABAddressBookSave ( addressBook, &error)){

recordid = ABRecordGetRecordID (aRecord);

Update a record
inputs are recordid, NSString* firstName,lastName,companyName

ABAddressBookRef addressBook = ABAddressBookCreate();

ABRecordRef aRecord = ABAddressBookGetPersonWithRecordID(addressBook, recordid);

/*** update firstname, lastname, company name **/
CFErrorRef error = NULL;

if([firstName length]==0) firstName = nil;

ABRecordSetValue(aRecord, kABPersonFirstNameProperty, firstName, &error);
if([lastName length]==0) lastName = nil;
ABRecordSetValue(aRecord, kABPersonLastNameProperty, lastName, &error);
if(companyName!= nil){

if([companyName length]==0) companyName = nil;
ABRecordSetValue(aRecord, kABPersonOrganizationProperty, companyName, &error);

CFErrorRef error = NULL;
BOOL isSaved = ABAddressBookSave ( addressBook, &error);