Monthly Archives: November 2010

Mac 101: Creating Secure Disk Image Files

If you have files on your Mac you don’t want others to have access to, the simplest way to secure them is to create an encrypted Apple disk image. An Apple disk image is a single file that can be mounted by OS X as a drive. You can create new blank disk images, which bear the familiar .dmg file extension, on a Mac using Disk Utility.

  1. Open Disk Utility (located in Applications>Utilities) and select File>New>Blank Disk Image from the menu bar.
  2. Under “Save As,” enter the desired filename for your .dmg. Enter a name for the disk image (this is what will appear in your source menu when it’s mounted) and choose the size of the disk you want to create.
  3. Keep the format set to the default: Mac OS Extended (Journaled)
  4. Go ahead and set the encryption to 256-bit AES
  5. Set Partitions to Single partition – Apple Partition Map
  6. For Image Format, choose read/write disk image

When you click Create, you’ll be prompted to set a password for the file you’ve created. If you click on the key image next to the password field, a Password Assistant will pop up to help you create a strong password. Choose Memorable and a long length (the max length of 31 characters is most secure), and the Password Assistant’s autogenerated password will be very hard to guess using a software program (the level of security is similar to that of a Captcha, the word-generating fields used to determine whether a visitor is human or not).

Dragging data to your disk image when it’s mounted will copy it to the .dmg. Once you eject the disk image, you’ll need to enter your password to mount the image again and access your files. If the .dmg file is unmounted (ejected), people who don’t have access to your password won’t be able to get the data within. You can securely mount the resulting .dmg file from any Mac. If you decide to remember the password in your Mac’s Keychain (the password prompt will ask you if you want to do this), keep in mind that anyone else who has access to the user account that keychain is associated with will also have access to the files within.

This technique is particularly useful when preparing taxes or hiding the electronic trail of receipts and correspondences related to a special gift you want to keep secret from tech-savvy nosy kids this holiday season.

Related content from GigaOM Pro (sub req’d):

Drawing Part of a UIImage

Happy Thanksgiving, and sorry for the relative lack of posts here lately. Things are crazier than ever and it’s been a challenge finding time to shower, let alone blog.

I do have something to share, today, though. No, it’s not the next chapter of OpenGL ES 2.0 for iOS. It’s a category that some of you may find useful: a method that allows you to draw only part of a UIImage rather than the entire thing.

On the Mac, NSImage has a handy instance method called drawInRect:fromRect:operation:fraction: that lets you specify exactly which part of an image to draw. On UIImage, we’ve only got the ability to draw the entire image either unless we drop down to Core Graphics calls. We don’t have a nice, easy, convenient way using just UIImage to draw a portion of the image it represents.

I needed this ability in an application I’m working on, so I hacked out the following category. At first glance, this may look to be inefficient, since we’re making a copy of the instance’s backing CGImage in order to create the sub-image, however I believe that CGImageCreateWithImageInRect() references the original image’s bitmap data. I haven’t confirmed that it doesn’t make a copy of the bitmap data, but the documentation certainly seems to imply it. Anyone know?

Anyway, here is the category; I’ve even commented the code more pedantically than is normal for me in case anyone might be confused about what’s going on. Improvements and bug fixes are, as always, welcome.

@implementation UIImage(MCDrawSubImage)
- (void)drawInRect:(CGRect)drawRect fromRect:(CGRect)fromRect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha
CGImageRef drawImage = CGImageCreateWithImageInRect(self.CGImage, fromRect);
if (drawImage != NULL)
CGContextRef context = UIGraphicsGetCurrentContext();

// Push current graphics state so we can restore later

// Set the alpha and blend based on passed in settings
CGContextSetBlendMode(context, blendMode);
CGContextSetAlpha(context, alpha);

// Take care of Y-axis inversion problem by translating the context on the y axis
CGContextTranslateCTM(context, 0, drawRect.origin.y + fromRect.size.height);

// Scaling -1.0 on y-axis to flip
CGContextScaleCTM(context, 1.0, -1.0);

// Then accommodate the translate by adjusting the draw rect
drawRect.origin.y = 0.0f;

// Draw the image
CGContextDrawImage(context, drawRect, drawImage);

// Clean up memory and restore previous state

// Restore previous graphics state to what it was before we tweaked it



©2008-2010 Jeff LaMarche.

How to Take Better Vacation Photos [Photography]

It can be very tempting to snap a photo of everything that happens on your vacation, but you might be better served by thinking of your trip as a story and carefully selecting the most interesting moments to capture. More »

Change Two Settings to Speed Up Photoshop [Photoshop Tip]

Just because a setting is tucked away doesn’t mean it can’t make a big difference. Many Photoshop veterans, for instance, are discovering that cutting out Cache Levels and Image Previews can make the photo editing beast a bit more agile. More »

Switch is a Smart Multi-User Browser for iPads [Downloads]

iPad only: The iPad is a device destined to be handed over to friends and passed among family members, but there are no user accounts or variable browser settings. Enter Switch, a clever browser that allows user accounts and anonymous guest browsing. More »

Create a Universally Unique Identifier (UUID)

UUID’s are 128-bit values which are guaranteed to be unique – typically the value is based on a machines ethernet address combined with the current time since October 15, 1582.

UUID’s are string values separated by hyphens, for example, here is how a UUID may look: 13222F23-C76A-7781-0C12-0293E3B34398.

The method below creates a UUID and returns a string representation of the same:

Create UUID
- (NSString *)createUUID {   // Create universally unique identifier (object)   CFUUIDRef uuidObject = CFUUIDCreate(kCFAllocatorDefault);     // Get the string representation of CFUUID object.   NSString *uuidStr = [(NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuidObject) autorelease];     // If needed, here is how to get a representation in bytes, returned as a structure   // typedef struct {   //   UInt8 byte0;   //   UInt8 byte1;   //   ...   //   UInt8 byte15;   // } CFUUIDBytes;   CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuidObject);     CFRelease(uuidObject);     return uuidStr; }

50 Free Apps We’re Most Thankful For [Downloads]

As we prepare to give thanks for our delicious Thanksgiving meals (and impending food comas), let’s not forget to pay tribute to the wonderful developers who bring us our favorite free apps. More »

Hands-On With Apple’s AirPlay in iOS 4.2

Apple today released iOS 4.2 for the iPod touch, iPhone and iPad, and iOS 4.1 for Apple TV. Together, the updates allow you to use the new AirPlay feature to stream audio and video content from your device to your television. It sounds like a killer feature, but does it live up to the hype? NewTeeVee certainly doesn’t think so, but AirPlay does have its good points.

It will depend largely on what you want to be able to do with AirPlay. Right now, it does two basic things pretty well: It streams photos from your on-device camera roll or Photos app to the Apple TV; and it streams audio and video from both the built-in YouTube app and the on-device iPhone or iPad-formatted video library. What it doesn’t do is transmit any video and audio content you come across to an Apple TV-connected display.

No third-party (downloadable) apps I tried had support for streaming video to the Apple TV yet (I tried the HGTV app, CityTV’s iPad app and Air Video). Audio streaming, on the other hand, seems built-in everywhere (works on HGTV, TuneIn radio, and with web-based content). Whether that means that audio streaming works without developer intervention, while video streaming must be programmed in, or whether third-party software will only have very limited access to video streaming isn’t yet clear.

Even if Apple does allow third-party programs to stream video, there will be some limitations. The video being streamed must be in a format the Apple TV can recognize, for example, since AirPlay just pushes the content from the iOS device to Apple’s set-top box, and there’s no processing involved. So .MKV files, a common format for HD video, won’t likely ever be able to be streamed from the VLC app, for instance. It also doesn’t work with home video recorded on your device, which seems like something I’d probably do most with the feature, were it available.

As for what it does provide, there are some limitations that show it’s early yet for the AirPlay tech. First, YouTube videos take quite a while to load before playing, at least in my experience. I thought it wasn’t working properly, in fact. Second, when streaming photos, there’s quite a delay, and no indicator there’s any kind of loading in progress before the image shows up on your screen. I was swiping through my library thinking photos didn’t stream when all of a sudden the first one I’d viewed showed up. The experience of many others on Twitter confirms that I’m not alone in this.

Devices using iOS can still run other apps while streaming content to the Apple TV, so that’s a huge benefit. You can check your email or play games while a movie broadcasts in the background, for instance, and you can control playback on either your portable or using the Apple Remote with your Apple TV. Also, content will display a TV as the AirPlay icon when it can stream video, and a speaker icon when it can only transmit sound, so you know at a glance what you’ll be getting.

For now, AirPlay remains a nice feature, but one that’s in its infancy. To truly have a wide appeal, I think it needs to be extended to third-party applications, and work better and faster while keeping user surprises to a minimum by telling users exactly when it’s loading. Apple also needs to seriously consider making this a two-way street, since being able to stream from iTunes libraries to an iOS device without having to install additional, unofficial software would be fantastic. Of course, it would also limit the appeal of larger on-device storage sizes, which is likely why it’s being ignored by Cupertino.

If AirPlay was the reason you were waiting to make an Apple TV purchase, I’d wait a little longer to see how the tech matures in future iOS iterations. What do you think? Is AirPlay in its current form grounds enough to justify buying the new Apple TV?

Related content from GigaOM Pro (sub req’d):

Get More from Your Frequent Flyer Miles [Frequent Flyer]

You may not consider yourself a “gamer,” but if you’ve watched your frequent flyer miles climb higher as you eagerly awaited redeeming them, you’re engrossed in some real-life game mechanics. Here’s how to get the most out of those miles. More »

How to Make All Your Video AirPlay-Compatible [Video]

With iOS 4.2's release, iOS devices and iTunes can now stream video to Apple TVs—video that meet's Apple's specs, that is. Here's how to convert your video collection to play over AirPlay and look good doing it. More »

WP Like Button Plugin by Free WordPress Templates