Posted on Nov 3, 2011

How to enable Airdrop on old Macs running Lion

Airdrop is a feature available in Lion that allows users to easily share files between Macs without sharing a connection to the same Wi-Fi Network.
It uses PAN to provide for p2p connection (like Bluetooth does).
It may happen that your old mac does not carry a Wi-Fi module capable of supporting this type of network but there’s a known workaround to make this possible.
Fire up your terminal and issue

defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1

Once you did that, relaunch Finder by Opt+Clicking onto the Finder icon in the dock or by issuing

killall Finder

in a terminal shell.

Now you should have your old-fashioned MacBook running both Lion and Airdrop.

Thank you @LorenzoMMariani that pointed this out to my attention.

Posted on Aug 17, 2011

Automatically update store schema with Core Data

Today I was playing with Core Data technology and I was trying to check whether it is possible to update the store schema according to the changes I made to the entities, relationships and whatever else.

I found out that the important steps are:

  • Use the versioning: before modifying your current schema you should select “Editor -> Add Model Version..”
  • Edit as much as you like
  • Select the new version as the active one
  • Go to your app delegate file and modify the - (NSPersistentStoreCoordinator *) persistentStoreCoordinator method as follows:
    NSURL *url = [applicationFilesDirectory URLByAppendingPathComponent:@"YourApp.storedata"];
        __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mom];
    
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
    						 [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
    						 [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
    
    if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:options error:&error]) {
    		// The rest of the code here
    	}
    
    return __persistentStoreCoordinator;
    



    The highlighted lines are the one to be added. Please notice that row 8 needs to be updated with options:options. I only tried it using NSSQLiteStoreType as persistent store type but it should work fine even with NSXMLStoreType.

References:

  1. Working with Core Data: Schema Versioning and Lightweight Migrations

Posted on Jul 21, 2011

How to burn Lion boot image once installed

Plenty of websites and users have posted the solution to the problem “How can I burn a Lion image onto a DVD?”. What I was really looking for today is a way to get the installation files back in order to be capable of extracting the dmg file containing the image to burn.

The solution is pretty trivial: fire up the Mac App Store and click on the “Purchased” tab on the top. You’ll get the list of applications you have previously bought. Around the top of such list there should be an entry labeled “OS X Lion”. Keeping your “alt” button pressed, click on that entry (on the name). You will enter the Lion page but the install button is now labeled as “Install”. Keep the “alt” key button pressed and click on the “Install” button. The Mac App Store will ask you again for your Apple ID. Issue your credentials and enjoy (once again) the download.

The following steps are the same proposed in many blogs on how to burn OSX Lion dmg image.

After the download completes, go into “Applications” and search for the “Install OS X Lion.app” file. Right click -> Show package content, locate “SharedSupport” directory and pick up the file named “InstallESD.dmg”. Copy it somewhere else and burn it. Oh you just need a common DVD-R single layer.

See ya!

Posted on May 11, 2011

iTerm 2: iTerm successor

I’m not very fond in reviews because I think I’m not really good at it. Anyhow, yesterday I discovered the existence of iTerm 2.

For me, iTerm, is really not an option over Terminal (the terminal emulator shipped with Mac OS X). The latter feels a little bit dizzy starting from the selection (try to select a path in Terminal.app) and ending to the poor tab management in Terminal compared to the one brought by iTerm.

When I hit iTerm 2 website I jumped to the features page to see what’s actually is different and I saw a lot of cool-but-useless things except for three killing ones:

  • The split panes

  • The set mark capability

This latter feature is somehow hidden, in a very loose sense. It allows you to mark a position on your terminal screen and come back to that position with the “Jump to Mark” menu item.
It comes to be very handy when you have commands that print out a lot of garbage and you are interested in reading the output starting from the top instead of the bottom.

There are a lot of more features such as the instant replay (that I don’t think I will ever use it) or the autocompletion (that is somehow interesting but so much time has past since I started using the UNIX console that I don’t think I will remember this feature while using the terminal).

Does it sound interesting? Then give it a try!

Posted on Apr 11, 2011

Early 2011 Macbook Pro GPU Switch

Today I tried gfxCardStatus, an application that allows you to monitor whether you are using the integrated or the discrete GPU.

I have nothing to complain about how long lasts my battery, I just did it out of curiosity.

I discovered, on regular basis, that when I open Chrome and I go to a page containing flash video (such as Youtube) the application notifies me that the discrete GPU has been turned on. It is not a big deal. The tricky part comes when you actuallly close the page containing such player.
The application keeps telling me that the discrete GPU is still enabled.

As you can see, from the image below, gfxCardStatus says that there is a process asking for the GPU. This process is Chrome, indeed.

The real problem here is that the only solution to turn the discrete GPU off and switch back to the integrated one is to completely close Chrome. I guess this is because of the Flash Player staying in background even when you close the tab responsible for it.

Then I tried with Safari and the discrete GPU card is not turned on. Furthermore, the same things, for both the scenarios above, happen if I try with the HTML 5 player.

This makes me think that Apple is properly using the discrete/integrated GPU switch and, for third party developers, having set a low threshold (I don’t know on which kind of parameter) in order to turn on the discrete GPU even if it should be unnecessary.