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();
token.setCallerId("00000000-0000-0000-0000-000000000000");
token.setOrganizationName(OrganizationName);
//token.setAuthenticationType(0);

CrmServiceSoapStub bindingStub = (CrmServiceSoapStub) new CrmServiceLocator().getCrmServiceSoap(new URL(endpointURL));
bindingStub.setHeader("http://schemas.microsoft.com/crm/2007/WebServices",
"CrmAuthenticationToken", token);

bindingStub.setUsername(username);
bindingStub.setPassword(password);

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.
Example

// 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  ..
e.g:
NSString *trimmedString = [description stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

Friday, February 12, 2010

resize or scale UIImage

hi,

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

1.
use the html formatted text as input.
e.g:
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
e.g:
[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