Sunday, July 25, 2010

how to list files in iOS

This is how you can list files in your iPhone apps.

NSFileManager *manager = [NSFileManager defaultManager];
NSArray *fileList = [manager directoryContentsAtPath:documentsDirectory];
for (NSString *s in fileList){
NSLog(s);
}

How to test if file exist in iPhone iOS

BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:somePath];

Friday, July 23, 2010

How to get Application Name with code

Below is how you can get the name of your application with code.

[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]

Wednesday, July 21, 2010

How to enable SQL debugging for Core Data in XCode

Right click on the project executable and click “Get Info.” Navigate to the Arguments tab and add the following argument: “-com.apple.CoreData.SQLDebug 1″.

When the project is running, you should see the sql used in the console.

Thanks to http://www.raywenderlich.com/934/core-data-tutorial-getting-started

Tuesday, March 30, 2010

Tuesday, March 16, 2010

How to access ext2 or ext3 file system from Mac OSX


I have always wanted to access my Ubuntu harddisk in my Leopard. For months, google has been telling me not possible but, today came as a surprise, you are able to do so by installing fuse. Fuse is a user space file system which allows system to read different type of file system provided the developers has followed the Fuse inferface. It is originated from Linux and it has been ported to Max OS. Man, I really like FOSS. For more infor in fuse, http://fuse.sourceforge.net/

So to start, 

1. go to http://code.google.com/p/macfuse/ and download the latest version

2. go to http://sourceforge.net/projects/fuse-ext2/ and download the latest version. You should be able to download dmg format under the "Files" type

3. Install macfuse first

4. Install fuse-ext2

5. Reboot and you should be able to read ext2/3 formated drive.

PS: Just a note, there is another ext application for Mac however, I tried and it does not work for me.