On Parallels Desktop for Mac…

Their uninstall icon sums up my feelings quite well. Their support is horrible, the forums are filled with people complaining and even their phone system is a joke; the IVR has a computer reading the name – Para-lel-ells – instead of a person.

The real deal breaker is the sticky keys bug.  Which ever the CMD key is mapped in a Windows VM doesn't work right. If you map CMD to ALT, Alt+Tab will 'stick'.  If you map CMD to WIN, modifier keys like WIN+D don't work right.

This bug with sticky keys was introduced a couple years ago when Parallels Desktop 4 was released, and still exists with v5.

Maybe VMware Fusion is slower1, but VMware does virtualization right. I trust close to 90% of my servers to ESX/vSphere, and I'll continue to trust my desktop virtualization to Fusion. On a Windows desktop it's not even a question, VMware Workstation has no competition.

  1. Fusion 3.1 RC is in public beta, so the MacTech benchmarks are already outdated [back]

Passing Multiple Automator Variables to a Shell Script

Automator is incredibly powerful, but at the same time the most useless and semi-functional piece software I've ever encountered. I recently built my first Automator Workflow to watermark a PDF. I wanted to load selected PDFs from the Finder, and for each PDF create a file in the same directory with a -watermark suffix appended. file1.pdf and file2.pdf would yield file1-watermark.pdf and file2-watermark.pdf.

It took me much too long to figure out that it wasn't easy (or maybe even possible) with Automator, even though it's simple to do from the command line.

Each Automator action returns a result. That result is passed to the next item in the chain, assuming the item is accepting input. The key is to chain a series of Get Value of Variable calls together, which are passed to a shell script as $1-$n and the special $@ variable. I've written a short primer on using Arrays in Bash that may be helpful.

A crappy picture is worth at least 68 words, so here is what a sample workflow looks like:

You can download the sample workflow here.

If you want to loop through selected Finder items one-at-a-time, the best way is to use Nyhthawk Productions's excellent Dispense Items Incrementally action.

Bash – Array Primer

Posted mostly for my own reference since I always forget the syntax, arrays are invaluable when writing moderately complex shell scripts. If you're writing any serious shell scripts you'll want to refer The Linux Documentation Project's excellent primers: Bash Guide for Beginners and Advanced Bash-Scripting Guide

array.sh

#!/bin/bash
 
echo "<<< Load a file into an array"
echo "# Set the IFS (Internal Field Separator) to a newline
IFS='
'
# Load file.txt from the current directory
arr=( \$( < file.txt ) )
"
 
 
IFS='
'
arr=( $( < file.txt ) )
 
 
echo "<<< Addressing individual array elements"
echo "\${arr[0]} = ${arr[0]}" # the first line of the file
echo "\${arr[1]} = ${arr[1]}" # the second line of the file
 
 
echo ""
echo "<<< \${#VARNAME[@]} will always return the number of elements in an array"
echo "\$arr contains ${#arr[@]} (\${#arr[@]}) items"
 
echo ""
echo "<<< Loop through the array (\${arr[@]}), loading each item as \$foo."
num=1
for foo in "${arr[@]}" ; do
	echo "Loop iteration $num: $foo"
	num=$((num+1))
done
 
 
echo ""
echo "<<< Loop through the array, addressing each item with an index"
num=0
while [[ $num -lt ${#arr[@]} ]] ; do
	echo "Array index $num (\${arr[$num]}): ${arr[$num]}"
	num=$((num+1))
done

file.txt

file line 1
file line 2
file line 3
file line 4

Saving the two files above as array.sh and file.txt, and running array.sh yields:

$./array.sh 
<<< Load a file into an array
# Set the IFS (Internal Field Separator) to a newline
IFS='
'
# Load file.txt from the current directory
arr=( $( < file.txt ) )
 
<<< Addressing individual array elements
${arr[0]} = file line 1
${arr[1]} = file line 2
 
<<< ${#VARNAME[@]} will always return the number of elements in an array
$arr contains 4 (${#arr[@]}) items
 
<<< Loop through the array (${arr[@]}), loading each item as $foo.
Loop iteration 1: file line 1
Loop iteration 2: file line 2
Loop iteration 3: file line 3
Loop iteration 4: file line 4
 
<<< Loop through the array, addressing each item with an index
Array index 0 (${arr[0]}): file line 1
Array index 1 (${arr[1]}): file line 2
Array index 2 (${arr[2]}): file line 3
Array index 3 (${arr[3]}): file line 4

Battery Showdown – BlackBerry vs iPhone

Fairly typical day, except that that I enabled phone service on the iPhone. This test was conducted with my usual rigorous standards, which means I happened to glance at my iPhone data usage around lunch, and ballparked the data transfer. The only thing I can be sure of is the quantity and duration of the phone calls, and that I had them with me all day.

iPhone 3GS, brightness set to ~55%. Wifi was enabled all day, 7:00 AM – 10:40 PM. 3G was enabled between 11:00 AM and 8:30 PM. A single two-minute phone call was placed. Roughly 11MB of data usage while on 3G (several web pages and Twitter using Tweetie).

Final result: At 10:40 PM there was 26% remaining on the battery.

BlackBerry Bold 9700, brightness set to auto. 3G and wifi enabled all day – 7:00 AM – 10:40 PM. Multiple background apps – SocialScope (Twitter) and Twitter for BlackBerry, multiple web pages and push email for 5 different accounts (4 BIS, 1 BES). 5 phone calls were placed, lasting a total of around 70 minutes.

Final result: At 10:40 PM there was 65% remaining on the battery.

Dear RIM,

Please shave 1-3mm off the thickness of my next device, I obviously don't need a replaceable battery1.

xoxo,
Corey

Side note: I have replaceable batteries for the BlackBerry Tour/Storm/Storm2/8900, the BlackBerry Bold 9700, my Mifi, and the BlackBerry 8530. I do not have any spare batteries for any of my Android devices, which would feel like trying to color coordinate my car with vehicles the rest of the highway. The BlackBerry 9700 is the first device I've ever owned where it takes significant effort to drain the battery (<20% remaining). Enjoy the high caliber of writing I produce right before I fall asleep.

  1. Thanks to Alex for planting this statement in my mind [back]

© 2007-2010, Corey Gilmore | Posts RSS Feed | Comments RSS Feed | Contact

 

The views expressed on these pages are mine alone and not those of any past or present employer. All information presented on this site was obtained lawfully and not through disclosure under the terms of an NDA.