Kick Egg LITE IS A FREE IPHONE GAME ..ENJOY
Tuesday, January 10, 2012
Friday, November 11, 2011
Local notifcication at regular interval
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Add the navigation controller's view to the window and display.
[NSThread detachNewThreadSelector:@selector(scheduleLocalNotifications) toTarget:self withObject:nil];
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
return YES;
}
-(void) scheduleLocalNotifications{
for (int i = 0; i < 60; i++)
{
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
NSDate *sleepDate = [[NSDate date] dateByAddingTimeInterval:i * 60];
NSLog(@"Sleepdate is: %@", sleepDate);
localNotif.fireDate = sleepDate;
NSLog(@"fireDate is %@",localNotif.fireDate);
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"This is local notification %i"), i];
localNotif.alertAction = NSLocalizedString(@"View Details", nil);
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
NSLog(@"scheduledLocalNotifications are %@", [[UIApplication sharedApplication] scheduledLocalNotifications]);
[localNotif release];
}
}
Monday, October 10, 2011
Uploading XML to server via PHP
XCODE CODE
_____________________
// #######################################################
// Uploading to .net SERVER #######################################################
// #######################################################
//
NSString *urlString = @"http://www.innokria.com/dotnet.php";
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
NSString *boundary = [NSString stringWithString:@"0xLhTaLbOkNdArZ"];
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
[request addValue:contentType forHTTPHeaderField: @"Content-Type"];
//Reading the file
NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"readme.xml"];
NSData *myData = [NSData dataWithContentsOfFile:Read];
NSLog(@"file exist at %@",myData);
NSMutableData *body = [NSMutableData data];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"dotnet\"; filename=\"test.xml\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:myData];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:body];
NSError *returnError = nil;
NSHTTPURLResponse *returnResponse = nil;
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:&returnResponse error:&returnError];
##################################
in php , make a empty folder called dotnets and upload this php page
_______________dotnet.php
$uploaddir = './dotnets/';
$file = basename($_FILES['dotnet']['name']);
$uploadfile = $uploaddir . $file;
if (move_uploaded_file($_FILES['dotnet']['tmp_name'], $uploadfile)) {
echo "http://www.innokria.com/dotnet/{$file}";
}
?>
_____________________
// #######################################################
// Uploading to .net SERVER #######################################################
// #######################################################
//
NSString *urlString = @"http://www.innokria.com/dotnet.php";
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
NSString *boundary = [NSString stringWithString:@"0xLhTaLbOkNdArZ"];
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
[request addValue:contentType forHTTPHeaderField: @"Content-Type"];
//Reading the file
NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"readme.xml"];
NSData *myData = [NSData dataWithContentsOfFile:Read];
NSLog(@"file exist at %@",myData);
NSMutableData *body = [NSMutableData data];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"dotnet\"; filename=\"test.xml\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:myData];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:body];
NSError *returnError = nil;
NSHTTPURLResponse *returnResponse = nil;
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:&returnResponse error:&returnError];
##################################
in php , make a empty folder called dotnets and upload this php page
_______________dotnet.php
$uploaddir = './dotnets/';
$file = basename($_FILES['dotnet']['name']);
$uploadfile = $uploaddir . $file;
if (move_uploaded_file($_FILES['dotnet']['tmp_name'], $uploadfile)) {
echo "http://www.innokria.com/dotnet/{$file}";
}
?>
Friday, September 30, 2011
sending email in obj-c
in.h
import MessageUI/MessageUI.h
delegate MFMailComposeViewControllerDelegate
- (void)openInAppEmail:(NSArray*)recipients
mailSubject:(NSString*)mailSubject
mailBody:(NSString*)mailBody
isHtml:(BOOL)isHtml;
##########################################
in .m
- (IBAction)mail:(id)sender {
// SMS * start = [[SMS alloc] initWithNibName:@"SMS" bundle:[NSBundle mainBundle]];
//start.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// start.modalPresentationStyle = UIModalPresentationFormSheet;
// [self presentModalViewController:start animated:YES];
email=@"hi@hi.com";
[self openInAppEmail:[NSArray arrayWithObject:email] mailSubject:@"" mailBody:@"" isHtml:YES];
}
- (void)openInAppEmail:(NSArray*)recipients
mailSubject:(NSString*)mailSubject
mailBody:(NSString*)mailBody
isHtml:(BOOL)isHtml
{
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setToRecipients:recipients];
[controller setSubject:mailSubject];
[controller setMessageBody:mailBody isHTML:isHtml];
[self presentModalViewController:controller animated:YES];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error {
[self dismissModalViewControllerAnimated:YES];
}
import MessageUI/MessageUI.h
delegate MFMailComposeViewControllerDelegate
- (void)openInAppEmail:(NSArray*)recipients
mailSubject:(NSString*)mailSubject
mailBody:(NSString*)mailBody
isHtml:(BOOL)isHtml;
##########################################
in .m
- (IBAction)mail:(id)sender {
// SMS * start = [[SMS alloc] initWithNibName:@"SMS" bundle:[NSBundle mainBundle]];
//start.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// start.modalPresentationStyle = UIModalPresentationFormSheet;
// [self presentModalViewController:start animated:YES];
email=@"hi@hi.com";
[self openInAppEmail:[NSArray arrayWithObject:email] mailSubject:@"" mailBody:@"" isHtml:YES];
}
- (void)openInAppEmail:(NSArray*)recipients
mailSubject:(NSString*)mailSubject
mailBody:(NSString*)mailBody
isHtml:(BOOL)isHtml
{
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setToRecipients:recipients];
[controller setSubject:mailSubject];
[controller setMessageBody:mailBody isHTML:isHtml];
[self presentModalViewController:controller animated:YES];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error {
[self dismissModalViewControllerAnimated:YES];
}
Thursday, September 29, 2011
marker in core -Plot
// OHLC plot
CPTMutableLineStyle *whiteLineStyle = [CPTMutableLineStyle lineStyle];
whiteLineStyle.lineColor = [CPTColor whiteColor];
whiteLineStyle.lineWidth = 1.0f;
CPTTradingRangePlot *ohlcPlot = [[[CPTTradingRangePlot alloc] initWithFrame:graph.bounds] autorelease];
ohlcPlot.identifier = @"OHLC";
ohlcPlot.lineStyle = whiteLineStyle;
CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle];
whiteTextStyle.color = [CPTColor whiteColor];
whiteTextStyle.fontSize = 48.0;
ohlcPlot.labelTextStyle = whiteTextStyle;
ohlcPlot.labelOffset = 5.0;
ohlcPlot.stickLength = 2.0f;
ohlcPlot.dataSource = self;
ohlcPlot.plotStyle = CPTTradingRangePlotStyleOHLC;
[graph addPlot:ohlcPlot];
CPTMutableLineStyle *whiteLineStyle = [CPTMutableLineStyle lineStyle];
whiteLineStyle.lineColor = [CPTColor whiteColor];
whiteLineStyle.lineWidth = 1.0f;
CPTTradingRangePlot *ohlcPlot = [[[CPTTradingRangePlot alloc] initWithFrame:graph.bounds] autorelease];
ohlcPlot.identifier = @"OHLC";
ohlcPlot.lineStyle = whiteLineStyle;
CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle];
whiteTextStyle.color = [CPTColor whiteColor];
whiteTextStyle.fontSize = 48.0;
ohlcPlot.labelTextStyle = whiteTextStyle;
ohlcPlot.labelOffset = 5.0;
ohlcPlot.stickLength = 2.0f;
ohlcPlot.dataSource = self;
ohlcPlot.plotStyle = CPTTradingRangePlotStyleOHLC;
[graph addPlot:ohlcPlot];
Sunday, September 4, 2011
NSSCANNER take out String and numbers
NSString *str = @" hello i am emp 1313 object of string class 123";
NSScanner *scanner = [NSScanner scannerWithString:str];
// set it to skip non-numeric characters
[scanner setCharactersToBeSkipped:
[[NSCharacterSet decimalDigitCharacterSet]
invertedSet]];
int i;
while ([scanner scanInt:&i])
{
NSLog(@"Found int: %d",i);
}
// reset the scanner to skip numeric characters
[scanner setScanLocation:0];
[scanner setCharactersToBeSkipped:
[NSCharacterSet decimalDigitCharacterSet]];
NSString *resultString;
while ([scanner scanUpToCharactersFromSet:
[NSCharacterSet decimalDigitCharacterSet]
intoString:&resultString]) {
NSLog(@"Found string: %@",resultString);
}
Friday, September 2, 2011
save and update data / Read and Write
-(NSString *)readFile:(NSString *)fileName
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *appFile = [documentsDirectory stringByAppendingPathComponent:fileName];
NSFileManager *fileManager=[NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:appFile])
{
NSError *error= NULL;
id resultData=[NSString stringWithContentsOfFile:appFile encoding:NSUTF8StringEncoding error:&error];
if (error == NULL)
{
return resultData;
}
}
return NULL;
}
-(void)writeFile:(NSString *)fileName dataArray:(NSArray *)data
{
NSMutableString *dataString=[NSMutableString stringWithString:@""];
for (int i=0; i<[data count]; i++)
{
if (i == [data count]-1)
{
[(NSMutableString *)dataString appendFormat:@"%@",[data objectAtIndex:i]];
}
else
{
[(NSMutableString *)dataString appendFormat:@"%@\n",[data objectAtIndex:i]];
}
}
[self writeFile:fileName data:dataString];
}
-(void)writeFile:(NSString *)fileName data:(id)data
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *appFile = [documentsDirectory stringByAppendingPathComponent:fileName];
NSError *error=NULL;
NSFileManager *fileManager=[NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:appFile])
{
NSString *fileString=[NSString stringWithContentsOfFile:appFile encoding:NSUTF8StringEncoding error:&error];
data=[data stringByAppendingFormat:@"\n%@",fileString];
[data writeToFile:appFile atomically:YES encoding:NSUTF8StringEncoding error:&error];
}
else
{
[data writeToFile:appFile atomically:YES encoding:NSUTF8StringEncoding error:&error];
}
if (error != NULL)
{
//Check Error Here. if any.
}
}
- (IBAction)save:(id)sender {
//To Write the File.
NSArray *array=[NSArray arrayWithObjects:usernameField.text,passwordField.text, nil];
[self writeFile:@"arra.txt" dataArray:array];
//Read the File
NSString *result=[self readFile:@"arra.txt"];
NSArray *outputArray=[result componentsSeparatedByString:@"\n"];
for (int i=0; i<[outputArray count]; i++)
{
NSLog(@"the output=%@ index=%i",[outputArray objectAtIndex:i], i);
}
}
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *appFile = [documentsDirectory stringByAppendingPathComponent:fileName];
NSFileManager *fileManager=[NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:appFile])
{
NSError *error= NULL;
id resultData=[NSString stringWithContentsOfFile:appFile encoding:NSUTF8StringEncoding error:&error];
if (error == NULL)
{
return resultData;
}
}
return NULL;
}
-(void)writeFile:(NSString *)fileName dataArray:(NSArray *)data
{
NSMutableString *dataString=[NSMutableString stringWithString:@""];
for (int i=0; i<[data count]; i++)
{
if (i == [data count]-1)
{
[(NSMutableString *)dataString appendFormat:@"%@",[data objectAtIndex:i]];
}
else
{
[(NSMutableString *)dataString appendFormat:@"%@\n",[data objectAtIndex:i]];
}
}
[self writeFile:fileName data:dataString];
}
-(void)writeFile:(NSString *)fileName data:(id)data
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *appFile = [documentsDirectory stringByAppendingPathComponent:fileName];
NSError *error=NULL;
NSFileManager *fileManager=[NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:appFile])
{
NSString *fileString=[NSString stringWithContentsOfFile:appFile encoding:NSUTF8StringEncoding error:&error];
data=[data stringByAppendingFormat:@"\n%@",fileString];
[data writeToFile:appFile atomically:YES encoding:NSUTF8StringEncoding error:&error];
}
else
{
[data writeToFile:appFile atomically:YES encoding:NSUTF8StringEncoding error:&error];
}
if (error != NULL)
{
//Check Error Here. if any.
}
}
- (IBAction)save:(id)sender {
//To Write the File.
NSArray *array=[NSArray arrayWithObjects:usernameField.text,passwordField.text, nil];
[self writeFile:@"arra.txt" dataArray:array];
//Read the File
NSString *result=[self readFile:@"arra.txt"];
NSArray *outputArray=[result componentsSeparatedByString:@"\n"];
for (int i=0; i<[outputArray count]; i++)
{
NSLog(@"the output=%@ index=%i",[outputArray objectAtIndex:i], i);
}
}
Thursday, August 25, 2011
Dyanamic adding and removing buttons
#### button Adding
- (IBAction)whisky:(id)sender {
if(j<21) {
CGRect rect = CGRectMake(100,20,70,20);
lbl1= [[[UILabel alloc] initWithFrame:rect] autorelease];
NSString *intString = [NSString stringWithFormat:@"%d", j-10];
[lbl1 setText:intString]; lbl1.tag=99; [self.view addSubview:lbl1];
button3 = [UIButton buttonWithType:UIButtonTypeCustom];
[button3 addTarget:self action:@selector(ratingAction2:)forControlEvents:UIControlEventTouchUpInside];
[button3 setBackgroundImage:[UIImage imageNamed:@"scanbutton1.png"] forState:UIControlStateNormal]; button3.tag = j;
button3.backgroundColor = [UIColor blueColor];
button3.frame = CGRectMake(120, width1, 35, 35);
[self.view addSubview:button3]; width1 = width1 -38; j++;
}
}
############### button delete based on tag ###########
- (IBAction)delWhis:(id)sender { if(j>1)
{
j--;
int f;
f=j;
[[self.view viewWithTag:f] removeFromSuperview];
//int b = button3.tag/10;
{
NSLog(@" whisky ration is %d",f);
width1 = width1 +38;
}
}
}
Dynamic button and Event on them ( Retro)
- (IBAction)Can:(id)sender {
i++;
UIButton *button2;
//view did load
// for( i= 1;i<=5;i++)
{
button2 = [UIButton buttonWithType:UIButtonTypeCustom];
[button2 addTarget:self action:@selector(ratingAction:)forControlEvents:UIControlEventTouchUpInside];
[button2 setBackgroundImage:[UIImage imageNamed:@"scanbutton1.png"] forState:UIControlStateNormal];
button2.tag = i;
button2.backgroundColor = [UIColor clearColor];
button2.frame = CGRectMake(20, width, 35, 35);
[self.view addSubview:button2];
width = width -38;
}
NSLog(@" i am can ");
// [self dismissModalViewControllerAnimated:YES];
}
-(void)ratingAction:(id*)sender
{
if ([sender isKindOfClass:[UIButton class]]) {
UIButton *temp=(UIButton*)sender;
if ([temp tag]==1 || [temp tag]==3 || [temp tag]==6 || [temp tag]==7 ) {
[temp setBackgroundColor:[UIColor redColor]];
}
}
}
i++;
UIButton *button2;
//view did load
// for( i= 1;i<=5;i++)
{
button2 = [UIButton buttonWithType:UIButtonTypeCustom];
[button2 addTarget:self action:@selector(ratingAction:)forControlEvents:UIControlEventTouchUpInside];
[button2 setBackgroundImage:[UIImage imageNamed:@"scanbutton1.png"] forState:UIControlStateNormal];
button2.tag = i;
button2.backgroundColor = [UIColor clearColor];
button2.frame = CGRectMake(20, width, 35, 35);
[self.view addSubview:button2];
width = width -38;
}
NSLog(@" i am can ");
// [self dismissModalViewControllerAnimated:YES];
}
-(void)ratingAction:(id*)sender
{
if ([sender isKindOfClass:[UIButton class]]) {
UIButton *temp=(UIButton*)sender;
if ([temp tag]==1 || [temp tag]==3 || [temp tag]==6 || [temp tag]==7 ) {
[temp setBackgroundColor:[UIColor redColor]];
}
}
}
Tuesday, August 23, 2011
Android Installation
Download Andriod SDK and Eclispse
2) Launch Eclipse
3) go to help -> install new software
4) enter this url
http : //dl-ssl.google.com/Android/eclipse/
5)and configure
6) then create a new project (Others) and select google api and then launch first app
2) Launch Eclipse
3) go to help -> install new software
4) enter this url
http : //dl-ssl.google.com/Android/eclipse/
5)and configure
6) then create a new project (Others) and select google api and then launch first app
Subscribe to:
Posts (Atom)