Posts

Showing posts from 2010

Hide Status Bar in iPhone using Objective C

To hide the status bar in iPhone through programming, [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

Create UIScrollView in iPhone Objective C

Today, we will create a scroll view using the UIScrollView class and add the alphabets in the scroll view. The frame values used should be changed as per the needs. Action method for these buttons can also be added. #define WIDTH_OF_SCROLL_PAGE 65 #define HEIGHT_OF_SCROLL_PAGE 40 #define WIDTH_OF_IMAGE 65 CGRect scrollframe = CGRectMake(0.0, 4.0, 320, 40); UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:scrollframe]; scrollView.bounces = YES; scrollView.delegate = self; scrollView.userInteractionEnabled = YES; scrollView.clipsToBounds = YES; scrollView.scrollEnabled = YES; scrollView.showsHorizontalScrollIndicator = NO; NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H", @"I", @"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R&qu

Create UIActivityIndicator in iPhone Objective C

To create a UIActivityIndicator that displays a loading indicator in iPhone, UIActivityIndicatorView *viewIndicator = [[UIActivityIndicatorView alloc] initWithFrame:indicatorFrame]; [viewIndicator startAnimating]; [viewIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray]; [self.view addSubview:viewIndicator];

Create a UIButton in iPhone Objective C

To create a UIButton in iPhone, the following code gives the standard features that needs to be initialized. Two images are used, one for Normal state and other for Highlighted state. UIButton *button = [[UIButton alloc] initWithFrame:frame]; [button setButtonType:UIButtonTypeCustom]; button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; [button setTitle:title forState:UIControlStateNormal]; [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [button setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; UIImage *newImage = [image stretchableImageWithLeftCapWidth:12.0 topCapHeight:0.0]; [button setBackgroundImage:newImage forState:UIControlStateNormal]; UIImage *newPressedImage = [imagePressed stretchableImageWithLeftCapWidth:12.0 topCapHeight:0.0]; [button setBackgroundImage:newPressedImage forState:UICont

Random number in Objective C iPhone

To get a random number in iPhone Objective-C, srandom(CFAbsoluteTimeGetCurrent()); int offset = random() % 30; // Here 30 can be replaced by any integer Now offset is the random number.

How to Block Unwanted Emails

Do you want to block emails from your ex wife/husband? Do you want to block those annoying offers and newsletters that reach your inbox? Well here is a way to block all those unwanted and annoying emails that you do not want to see or read! With this trick you can block individual email address or the whole domain from which you do not want the emails to come from. Here are the step-by-step instructions to do this. For Gmail 1. Login to your account 2. At the top-right corner, click on Settings 3. Under Settings, click on Filters 4. You’ll now see an option “Create a new filter“, click on it 5. Now in the From field enter the email address from which you do not want to receive the emails For ex. you may enter john@gmail .com in the From field to block all incoming emails from this address. However if you want to block the whole domain then use the following syntax: *@xyz.com. Now all the incoming emails from the domain xyz.com will be blocked. 6. Click on Next Step, se

Display Network Activity Indicator in iPhone

To display a network activity indicator in iPhone, set the networkActivityIndicatorVisible property to YES. NO to disable it. UIApplication* application = [UIApplication sharedApplication]; application.networkActivityIndicatorVisible = YES;

Firewall free softwares

AppArmor Security suite for Linux, freeware, open-source. AppArmor is also very useful for preventing scripts and programs running on Webservers from being hacked and exploited. AS3 Personal Firewall Free firewall for Windows (32bit). Ashampoo Offers a free firewall for Windows. Comodo Free firewall + anti-virus for Windows. Core Force Open-source firewall, packet-sniffer and security framework for Windows. Firestarter Freeware open-source firewall for Linux with graphical user-interface. FortKnox Personal Firewall Free firewall for Windows. GhostWall Free firewall for Windows (both 32bit and 64bit). Home PC Firewall Guide Independent reviews of Internet security and privacy-related products. MoBlock Freeware for Linux . A linux console application that blocks connections from/to hosts listed in a file. Netdefender Freeware open-source firewall for Windows. Omniquad Personal Firewall Freeware Free firewall for Windows. Although the site looks like it has

Free Anit-Virus softwares list

Here are list of free anti-virus softwares. Avast! Anti-virus program for Windows. The home edition is freeware for noncommercial users. AVG Free edition Free edition of the AVG anti-virus program for Windows and Linux. Tested and recommended by Freebyte.com. Avira Antivir Free anti-virus software for Windows, Linux, Free BSD and Solaris. Detects and removes more than 50,000 viruses. Free support. BitDefender Freeware virus scanner for Windows. Clam AV Freeware , GPL, Linux. Clam AntiVirus is a GPL anti-virus toolkit for UNIX. The main purpose of this software is the integration with mail servers (attachment scanning). The package provides a flexible and scalable multi-threaded daemon, a command line scanner, and a tool for automatic updating via Internet. ClamWin Freeware , open-source anti-virus program for Windows. Comodo Anti-Virus Free anti-virus program for Windows. FProt Free anti-virus program for Linux, FreeBSD and Solaris (personal use only). Evaluation ve

Level of Confidence

Image
Having 100% confidence and involvement in your work is good. But this is too much!!! Moral: Working Hard is good but Working with Knowledge is very good.

Create NSThread in iPhone using Objective-C

1. Create a NSThread as follows. [NSThread detachNewThreadSelector:@selector(threadMethod) toTarget:self withObject:nil]; 2. Define the threadMethod in the code. - (void)threadMethod { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; /** add the code for the new thread **/ [pool release]; }

Create UIWebView in iPhone using Objectiv-C

A UIWebView class is used to embed web content in your application. A sample code describes the implementation of UIWebView in detail. CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0); UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame]; [webView setBackgroundColor:[UIColor whiteColor]]; NSString *urlAddress = @"http://--Any Web Site Address--"; // Fill the string with Website address NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj]; [self addSubview:webView]; [webView release]; NSURL class is used to create an object which will hold the URL information. NSURLRequest is used to create a request to the URL. Method loadRequest of UIWebView is used to load the request in the UIWebView.

Display Images in iPhone using UIImageView

Here is the code that will display the image using UIImageView in Objective-C. CGRect imgRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f); UIImageView *image = [[UIImageView alloc] initWithFrame:imgRect]; [image setImage:[UIImage imageNamed:@"SampleImage.png"]]; // where SampleImage.png should be available within in the project [self.view addSubview:image]; [image release];

Convert string to NSDate

In Objective-C, you commonly nead to convert a string to an NSDate object. A simple way to do this is using the NSDateFormatter object. It provides the dateFromString method which converts a string into an NSDate object. You do, however, need to tell NSDateFormatter the format the date will be in. See below example: NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df setDateFormat:@"yyyy-MM-dd hh:mm:ss a"]; NSDate *myDate = [df dateFromString: myDateAsAStringValue]; NSDateFormatter uses the Unicode Locale Data Markup Language to determine the date format.