Network Link Conditioner

We’ve all known, for quite some time, about the existance of the NLC tool: it’s used during iOS App Testing, under bad network conditions.

However… i’ve (recently.. cough… cough…) realized that this tool can also help you cap OS X bandwith.
This is specially useful when downloading the latest Xcode, and you don’t wanna kill the entire connection, just with that.

You can find the Network Link Conditioner in Apple’s Developers Portal, inside the Hardware IO Tools for Xcode package.

VMWare Fusion: Shrinking OSX Image

If you’re using VMWare Fusion for OSX, and you’ve got few images of older OSX releases, odds are you might have over-alloc’ed the disk space… you can never know how much it’s really gonna be required!

Steps to fix this are:

  1. Launch the OSX image that requires shrinking
  2. Open Disk Utility App
  3. Pick the Disk, click over the Partition tab, and reduce the partition’s size, as much as possible
  4. Shutdown the Virtual Machine

Once ready, you’ll need to locate the VMDK file of your image: it can be found inside the Image.vmwarevm bundle.

We’ll need to perform two final steps. Let’s fire Terminal, and head over to this location:

/Applications/VMware\ Fusion.app/Contents/Library/

Once there, you may run the following commands, which will defragment the image, and free the empty space:

./vmware-vdiskmanager -d [PATH TO VMDK]
./vmware-vdiskmanager -k [PATH TO VMDK]

Hope you find it useful!

Update:
Alternative method involves installing VMWare Tools in the host machine, and running the following command:

sudo /Library/Application\ Support/VMware\ Tools/vmware-tools-cli disk shrink /

Swift: Unit Testing

I’ve recently stumbled upon severe issues, while trying to write a Unit Test, in Swift, that would access Swift Code that belongs to the main app.

Contrary to what almost everyone mentions, you should not import the Main App’s files into the Testing target.

Instead, this is what you should do:

  • Enable Defines Module in the main target.
  • Add an import at the top of the Unit Test, to make the main project visible.
  • Make sure that the classes to be tested are set to public.

Reference Here!

Fixing Violent OSX GPU Crashes

I’ve been experiencing, for months and months, quite violent OSX crashes, attributed to the GPU.

My awesome friend Dennis suggested me to try disabling Integrated <> Discrete GPU switching. And guess what? i’ve been crash free for almost two weeks.

I’m just documenting right here what has to be done, for future reference. Just uncheck this Energy Preference.
I’ve been told that the exact string for the checkmark might look different across the latest Yosemite releases, but the setting should still be lurking there:

Automatic Graphic Switching

P.s.: Again, thank you Dennis!!