I was looking for a way to password protect a folder on the Mac. After a lot of research I found out a way of creating a disk image to protect our stuff in really a simple manner. I would like to mention its procedure in steps:
*First open up the “Disk Utility” application.
*Go to File -> New -> Disk Image from Folder
*Chose a folder to protect
*The next, most important part, is the encryption. You can pick either 128, or 256 bit encryption, it really doesn’t matter. I would recommend 128 bit due to speed although if you want to be extra safe pick the second option. Make sure the Image Format at the bottom is set to read/write, so you can write files into the disk image.
Once as you click ok, the engine will start working and it will create your disk image.
Enter your desired new password twice (Do not forget it.)
Once as you click ok, the image will mount and you have a standard image. You can then add in the files you want.This process creates an ordinary Macintosh disk image (.dmg) file. The disk image contains the entire contents of the folder, but cannot be opened unless the correct password is supplied. To open it, just double-click the .dmg file in Finder. A password dialog box will appear. Once you supply your correct password, Finder will automatically unencrypt your data and mount the image as a disk.
To be extra secure you may have to delete the Keychain password as it stores it by default. To do this open up Keychain Access, find your file in the list and delete it. You will then have to enter the image password if you want to access your files.
If you ever need to increase the size of you image because you have filled it up it is pretty simple. Make sure you have opened and closed Disk Utility. Click on the disk image you have created and then on Resize Image in the tool bar. Once as the box pops open click on the blue down arrow. Click on Resize Image, this will then enable you to increase the size of the image all the way up to the maximum free space on your disk. Once as you have done this you are done.
Hopefully, if you have followed the instructions OK, you will be able to password protect your files, and as a result of folder. Until Apple release a way of doing this in Finder, or the Get Info pane.
Monday, November 16, 2009
Thursday, November 5, 2009
iPhone: Shake to Update
Many applications perform some basic functions(like updating the UI, playing a sound etc.) when user shakes the iphone. Following snippet shows how to add this functionality in your app:
//In the .h file add the like this:
@interface TableViewController : UIViewController
//Add these two variables in the .h
BOOL shakeDetected;
UIAcceleration* lastAcceleration;
//Create a property
@property (retain) UIAcceleration* lastAcceleration;
//In the .m synthesize your property
@synthesize lastAcceleration;
//In the .m file, in your viewdidload add this line
[UIAccelerometer sharedAccelerometer].delegate = self;
//Add this method to the .m file
//Shake Detection Part 1
static BOOL IsDeviceShaking(UIAcceleration* last, UIAcceleration* current, double threshold) {
double deltaX = fabs(last.x - current.x);
double deltaY = fabs(last.y - current.y);
double deltaZ = fabs(last.z - current.z);
return (deltaX > threshold && deltaY > threshold) ||
(deltaX > threshold && deltaZ > threshold) ||
(deltaY > threshold && deltaZ > threshold);
}
//And add this method to the .m file also
//Shake Detection Part 2
- (void) accelerometer: (UIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)acceleration {
if (self.lastAcceleration) {
if (!shakeDetected && IsDeviceShaking(self.lastAcceleration, acceleration, 0.7)) {
shakeDetected = YES;
//This is where you put what you want to happen when it shakes
//The line below reloads the table
[tableView reload];
}
else if (shakeDetected && !IsDeviceShaking(self.lastAcceleration, acceleration, 0.2)) {
shakeDetected = NO;
}
}
self.lastAcceleration = acceleration;
}
//In the .h file add the
@interface TableViewController : UIViewController
//Add these two variables in the .h
BOOL shakeDetected;
UIAcceleration* lastAcceleration;
//Create a property
@property (retain) UIAcceleration* lastAcceleration;
//In the .m synthesize your property
@synthesize lastAcceleration;
//In the .m file, in your viewdidload add this line
[UIAccelerometer sharedAccelerometer].delegate = self;
//Add this method to the .m file
//Shake Detection Part 1
static BOOL IsDeviceShaking(UIAcceleration* last, UIAcceleration* current, double threshold) {
double deltaX = fabs(last.x - current.x);
double deltaY = fabs(last.y - current.y);
double deltaZ = fabs(last.z - current.z);
return (deltaX > threshold && deltaY > threshold) ||
(deltaX > threshold && deltaZ > threshold) ||
(deltaY > threshold && deltaZ > threshold);
}
//And add this method to the .m file also
//Shake Detection Part 2
- (void) accelerometer: (UIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)acceleration {
if (self.lastAcceleration) {
if (!shakeDetected && IsDeviceShaking(self.lastAcceleration, acceleration, 0.7)) {
shakeDetected = YES;
//This is where you put what you want to happen when it shakes
//The line below reloads the table
[tableView reload];
}
else if (shakeDetected && !IsDeviceShaking(self.lastAcceleration, acceleration, 0.2)) {
shakeDetected = NO;
}
}
self.lastAcceleration = acceleration;
}
Subscribe to:
Posts (Atom)