Sunday, October 31, 2010

WPF GridView Sample To Insert, Update, and Delete Records

This will teach you how to build a simple database application using WPF that can display data in GridView and can perform ADD, UPDATE and DELETE operations on SQL server database..

Original Link here

TextBox Control WPF 4.0

Spell checking and Multi line features can be added to a TextBox control in WPF 4.0

For more check it here..

Friday, October 22, 2010

Creating an .ipa File for Your Ad Hoc Distribution

If you ever find yourself doing iPhone consulting then you will probably need to know how to create an .ipa file. An ipa file makes it easy to distribute apps to people. It’s part of the Ad Hoc app distribution process. iTunes Mac users don’t require an .ipa file to install an Ad Hoc app. They can simple drag the app and the provisioning profile into iTunes. On the other hand, Windows users will need an .ipa file in order to install the app on their device. The great thing about distributing via an .ipa file is Mac and Windows users can install the app in iTunes.

Tuesday, October 5, 2010

How To Read a File From Your Application Bundle

First you need to add your file to the Resources folder of your Xcode project. Then you can access the file like this (assuming the file is called MyFile.txt):

  1. NSString *filePath = [[NSBundle mainBundle] pathForResource:@"MyFile" ofType:@"txt"];
  2. NSData *myData = [NSData dataWithContentsOfFile:filePath];
  3. if (myData) {
  4. // do something useful
  5. }

Here’s a complete example reading a help text file into a UIWebView.

  1. NSString *filePath = [[NSBundle mainBundle] pathForResource:@"HelpDoc" ofType:@"htm"];
  2. NSData *htmlData = [NSData dataWithContentsOfFile:filePath];
  3. if (htmlData) {
  4. [webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];
  5. }

If you want to read the file into a string, which you can then display in a UITextView, for example, then do this:

  1. NSString *filePath = [[NSBundle mainBundle] pathForResource:@"important" ofType:@"txt"];
  2. if (filePath) {
  3. NSString *myText = [NSString stringWithContentsOfFile:filePath];
  4. if (myText) {
  5. textView.text= myText;
  6. }
  7. }

Or simply
use this..

NSString *fileContents = [NSString stringWithContentsOfFile:@"myfile.txt"];
NSArray *lines = [fileContents componentsSeparatedByString:@"\n"];