Sunday, July 10, 2011

How To Set Up Your YouTube RSS Feed

All you need to do is replace YourUserName with your YouTube user name.
http://www.youtube.com/rss/user/YourUserName/videos.rss

Saturday, July 9, 2011

MySQL:Can’t connect to MySQL server (10060)

Typically this kind of error message you see due to authentication issues. There could be many reason:
1. The MySQL server isn’t running.
2. Port at which MySQL server is listening is blocked for you.
3. Port at which MySQL server is listening cann’t accept any connection from outside world due to Firewall.

Wednesday, July 6, 2011

How To Unzip File With Java



import java.io.*;
import java.util.zip.*; 
public class UnZip {
final static int BUFFER = 2048;
// "/home/admin/Downloads/file.zip"
public String unzipFile(String compressFilePath, String uncompressFolderPath)
{
String uncompressedFilePath=null;
try {
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream(compressFilePath);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry;
while((entry = zis.getNextEntry()) != null)
{
uncompressedFilePath=uncompressFolderPath+entry.getName();
System.out.println("Extracting: " +entry);
int count;
byte data[] = new byte[BUFFER];
// write the files to the disk
FileOutputStream fos = new FileOutputStream(uncompressedFilePath);
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = zis.read(data, 0, BUFFER)) != -1)
{
dest.write(data, 0, count);
}
dest.flush();
dest.close();
} zis.close();
} catch(Exception e)
{
e.printStackTrace();
}
System.err.println(uncompressedFilePath);
return uncompressedFilePath;
}

public static void main (String argv[]) {
//String destinationPath="/home/admin/Downloads/";
UnZip unZip = new UnZip();
System.out.println(unZip.unzipFile("/home/admin/Downloads/filename.zip","/home/admin/Downloads/"));
}
}

How to hide keyboard when you press the button

in your .H-file: you must add dismissKeyboard method

"
#import


@interface MyViewController : UIViewController {
UITextField *textField;
UILabel *label;
NSString *string;
}

@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (nonatomic, copy) NSString *string;
- (IBAction)changeGreeting: (id)sender;
- (IBAction)dismissKeyboard: (id)sender;

@end

"

and in your .m-file:

"
#import "MyViewController.h"

@implementation MyViewController
@synthesize textField;
@synthesize label;
@synthesize string;
- (IBAction)changeGreeting: (id)sender {
self.string = textField.text;
NSString *nameString = string;
if ([nameString length] == 0) {
nameString = @"World";
}
NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, %@!",nameString];
label.text = greeting;

[greeting release];
}

-(IBAction)dismissKeyboard: (id)sender {
[sender resignFirstResponder];
}
"

then, connect in the IB's inspector for the textfield the 'did end on exit' option and connect it to the 'dismissKeyboard'.

happy coding...............

Thursday, June 30, 2011

Why Did I Create a Web App for the iPad?

I created a web-based iPad app mainly for my own personal use. I got fed up with the App Store and all the paid apps that didn’t do the trick.

My particular project is a news aggregating app that makes it easy to take 5 minutes every couple hours and keep up-to-date on news stories from a variety of sources.

This helps because I am in business/finance and it takes too long to go through a static newspaper or browse multiple websites.