This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
[gregorian setLocale:[NSLocale currentLocale]]; | |
[gregorian setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]]; | |
NSDate *now = [NSDate date]; // This is current date or the end date for the graph. | |
NSLog(@"Now: %@", now); | |
NSDateComponents *currentDateComponents = [gregorian components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit fromDate:now]; | |
NSDateComponents *startDateComponents = [[NSDateComponents alloc] init]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Man O Man | |
When without money, eats wild vegetables at home | |
When has money, eats same wild vegetables in fine restaurant. | |
When without money, rides bicycle; | |
When has money, rides exercise machine. | |
When without money, walks to earn food | |
When has money, walks to lose the fat. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *base = [[NSString alloc] initWithString:@"Base"]; | |
NSLog(@"Base pointer is instantiated with type: %@", [base class]); | |
// NSMutableString is derived from NSString class. | |
NSMutableString *derived = [NSMutableString stringWithString:@"Derived"]; | |
NSLog(@"Derived pointer is instantiated with type: %@", [derived class]); | |
// Converting Base to Derived:- | |
base = derived; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
One FRIEND WAS chatting with a female - Online chat. | |
(Background both are s/w engineers by the way and both work for real big MNC's) | |
Hero : Hey...GM (Good Morning)... How's u doing today? | |
Female: VGM...Day is going good and it got better having found u on chat | |
Hero : wow...am honoured, u know what, my day starts only when I find you on Chat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[googlePlaces fetchWithCompletionHandler:^(NSMutableSet *fetchedPlaces, NSError *error){ | |
if (fetchedPlaces) { | |
places = [[NSMutableArray alloc] initWithArray:[fetchedPlaces allObjects]]; | |
[self.tableView reloadData]; | |
}else { | |
if (error) { | |
// Optionally display error here. | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sorry" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; | |
[alert show]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *jsonString = @"{\ | |
\"posts\" : [\ | |
{\ | |
\"post\" : {\ | |
\"description\" : \"The latest news from the Joomla! Team\",\ | |
\"id\" : \"1\",\ | |
\"title\" : \"Latest\"\ | |
}\ | |
},\ | |
{\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSRange searchStringRange = [textView rangeOfString:@"string to search goes here" options:NSCaseInsensitiveSearch]; | |
if (searchStringRange.location != NSNotFound) { | |
// Got the search string. | |
NSString *searchStringInTextView = [textView substringWithRange:searchStringRange]; | |
NSLog(@"The search string is: %@", searchStringInTextView); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
NSLog(@"%@",dic_txt); | |
static NSString *CustomCellIdentifier = @"CustomCellIdentifier "; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CustomCellIdentifier]; | |
if (cell == nil) | |
{ | |
[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; | |
cell=self.tvcell; | |
self.tvcell=nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { | |
completionHandler(iTunesURL, NO, error); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AppStoreConnectionHandler *appStoreConnection = [[AppStoreConnectionHandler alloc] init]; | |
[appStoreConnection initiateConnectionForAppURL:[NSURL URLWithString:appURL] withCompletionBlock:^(NSURL *appURL, BOOL finished, NSError *error){ | |
if (finished) { | |
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:appURL]; | |
if (canOpenURL) { | |
[[UIApplication sharedApplication] openURL:appURL]; | |
}else { | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"Application cannot open the URL" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; | |
[alert show]; | |
} |