Press "Enter" to skip to content

Select Indistinct

Looking for the Excel 2008 Analysis Toolpak for Mac?

I also spent a good twenty minutes looking for the Excel 2008 Toolpak addon which Microsoft advertises in their knowledge base, unfortunately this link is broken and there is no place to download and install said addon.

Do not despair! The functionality you seek is actually included in Excel, you just need to go looking for it. If you check your formula bar/builder, you will find that the statistical tools you crave(like the nice correlation tool) are right there.


MySQL Gem and Rails 3.0beta4 issues

If you are running OS 10.6 (Snow Leopard) and you are having problems installing the mysql gem via bundler, there may be a simple fix.

While fooling around with bundler/macports, I was having an issue where bundler would throw an exception:

ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
extconf.rb:10: command not found: /opt/local/bin/mysql_config5 –cflags
ERROR:  Error installing mysql:        ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rbextconf.rb:10: command not found: /opt/local/bin/mysql_config5 –cflags

It took me a good 5 minutes of tracking down the problem to find out that /opt/local/bin/mysql_config5 was a symlink to /opt/local/lib/mysql5/bin/mysql_config, and that for some reason, while the file was there and filled with delicious code, it wasn’t executable.
One sudo chmod +x later, the mysql gem installs like a charm.

Finding services advertised with Bonjour via Flame

Have you ever had an issue with someone sharing an iTunes library, and you want to quickly track down the IP of the offending user?

Here is a quick little guide on getting that done.

dns-sd is a service discovery application that can make tracking down users sharing various information quite easily. It also has a great API for accessing various information about local DNS information, and setting local DNS advertising quite easily.

First, an example:

dns-sd -B _daap._tcp
This command checks for bonjour iTunes shared libraries (daap protocol, tcp, .local subnet).
Browsing for _daap._tcp
Timestamp   A/R Flags if Domain Service Type Instance Name
9:31:12.844  Add  3  4 local.  _daap._tcp.   local’s Library_PW
9:31:12.844  Add  2  1 local.  _daap._tcp.   local’s Library_PW
local:~ local$ dns-sd -L "local’s Library_PW" _daap._tcp
Lookup local’s Library_PW._daap._tcp.local
local’s Library._daap._tcp.local. can be reached at
(interface 1)
Flags: 1
txtvers=1 iTSh
Database ID=D18C43A55BFAC99B
Machine Name=local’s Library Media
Kinds Shared=3145839
Machine ID=************

With these commands, it gives you the hostname, which you can always resolve by pinging it. This is a slightly edited output for readability. (spaces and newlines are escaped in the shell, but you see all the slashes)

How is this better than other solutions like Flame or Bonjour Browser?
Well, with this approach, we can actually script the entire event into one bash script, without too much work.
A minute of checking the man pages for sed and cut yields:

# create semi-random filenames for writing and reading to
tempfoo=`basename $0`
TFILE=`mktemp /tmp/XXXXXX` || exit 1
TFILE2=`mktemp /tmp/2XXXXXX` || exit 1
# grabs browseable list of bonjour shared libraries
dns-sd -B _daap._tcp 1>$TFILE &
# grab the process identifiers for the dns-sd process WHICH NEVER STOPS
sleep 1
# takes the last library in the list and formats it for dns-sd -L
res=$(tail -n1 $TFILE | awk '{gsub(/[ ]+/," ")}1' | cut -d' ' -s -f6-)
# read the protocol and then name in, allows us to use different protocols in the future
read -r protocol name << "$res"
# look up specific libraries
dns-sd -L "$name" "$protocol" 1>$TFILE2 &
# grab the process identifiers for the dns-sd process WHICH NEVER STOPS
# we have to wait a second because dns-sd -L can take a while to respond
sleep 1
res2=$(cat $TFILE2 | awk '{gsub(/[ ]+/," ")}1')
# for some reason cut wasnt respecting the spaces, but in another var it worked fine
ip=$(echo $res2 | cut -d' ' -f10| cut -d'.' -f1-2)
if [[ "$ip" == "" ]]
then echo "No computers are sharing their libraries"
else ping $whoa1
# kill the dns-sd processes
# remove the temporary files
kill $TFILE2_PID
rm $TFILE2

…and by a minute, I meant more like an hour. I commented most of the material, and the source can also be found at

A lot more went into this than initially expected, but that is always the case when it comes to bash.