Wednesday, October 13, 2010

Removing the crap from iTunes 10.0.1

I use iTunes to play music on my osx laptop, though I have been very disappointed with the latest updates to iTunes. It seems that apple thinks that I want to be a part of yet another social network and thus has enabled "Ping" on my iTunes account.

First thing I did was to "opt-out" of ping (wtf Apple, these things should be opt-in), a quick Google search reviled that it is fairly easy to do (after you agree to their new terms and conditions of course). Though even after I did this, the iTunes interface is still littered with crap about Ping (including the new side bar that was added with 10.0.1). It seems that you can removed these with a quick jump into Terminal.app with the following commands:
defaults write "com.apple.iTunes" "disablePingSidebar" -bool "TRUE"
defaults write "com.apple.iTunes" "hide-ping-dropdown" -bool "TRUE"

I also discovered that you can get the minimize/zoom/exit buttons back with some other plist values:
defaults write "com.apple.iTunes" "full-window" -boolean "YES"

While I am at it, if you want to disable to links to the itunes store from next to your songs, you can use this option:
defaults write "com.apple.iTunes" "show-store-arrow-links" -bool "FALSE"

Don't forget to restart iTunes after you have made these changes.

Wednesday, March 3, 2010

Making the switch to xmonad (on ubuntu)

I have been using xmonad under unbuntu for nearly a year now (and have been VERY happy). I thought it was finally time that I share my method for configuring/setting up xmonad.

I run xmonad under gnome, this allows a lot of the magic of Ubuntu to continue working (such as network manager configuring wifi), and helps keep the amount of manual configuration down to a minimum.

Monday, January 4, 2010

NCSS Python Golf

It is time again for me to run a Python Golf challenge... The aim? To write a python program that solves a problem in the least number of bytes (of source code).

The first of a few problems is:

Given a list of words on stdin (one per line), find the words that have the largest number of anagrams in that list.

Print all of the words that have the meet the criteria of having the largest number anagrams (One per line, in alphabetical order).

This competition has now finished. The winner was Nick Cooper at 103 bytes, with the following awesome solution:
import sys
s=sorted
o=s(sys.stdin)
r=map(s,o)
d=map(r.count,r)
for e,t in zip(o,d):print e*(max(d)==t),

Wednesday, August 26, 2009

Always discoverable on Android

Something that is starting to annoy me about some of the newer smart phone operating system (I am looking at you iPhoneOS and Android) is that when you tick the box to make your phone discoverable by Bluetooth, it does not stay discoverable. Other operating systems give you an option to switch between hidden, temporally visible or always visible.

After a bit of hacking around on the my phone (a HTC Dream), I have discovered a way to make the Bluetooth stay discoverable. These instructions require adb (the Android Developer Bridge), an a (slightly) nonstandard rom. The reasoning behind requiring the non-standard rom, is that chown under android does weird things.



Remember that this is done at your own risk.

adb remount
adb pull /system/etc/bluez/hcid.conf ./hcid.conf
sed -i'' -e 's/iscan disable/iscan enable/;s/pscan enable;/&\n\n\t\#Make the device stay discoverable for ever\n\tdiscovto 0;/' hcid.conf
adb push hcid.conf /system/etc/bluez/hcid.conf
adb shell chmod 440 /system/etc/bluez/hcid.conf
adb shell busybox chown 1002.1002 /system/etc/bluez/hcid.conf
adb remount
rm -f hcid.conf

HCID_CONFIG="$(adb shell ls /data/misc/hcid/*/config | sed -e 's/\r//g')"
adb pull "$HCID_CONFIG" hcid_config
sed -i'' -e 's/^discovto.*$/discovto 0/' hcid_config
adb push hcid_config "$HCID_CONFIG"
adb shell chmod 644 "$HCID_CONFIG"
adb shell busybox chown 1002.1002 "$HCID_CONFIG"
rm -f hcid_config

After all this is done... Don't forget to power cycle the Bluetooth system (untick, then tick the box for Bluetooth).

Thursday, July 16, 2009

Setting up my old iBook G4

Now that I have moved, I have decided to reclaim my old iBook (which I was using as my router). With this decision, I thought it would be a good idea to keep track of what I had to do to get this machine to a state where I was happy with it (and thus a mac in general).

So, here it is, for those who are interested. You might even find a few things that you had not though of performing on your mac.

Wednesday, June 17, 2009

Reversing Latitude

I have recently been playing around with the (relatively) new Google service named Latitude. This service may be either used from your mobile phone (including the Nokia S60 range) to allow you to see where your friends are located.

Something I have wanted to do with this service for a while is to use it to keep track of where I have been. Recently Google released an API to do this. The only problem with this is that your are required to change your privacy settings, effectively allowing everybody to know where you are.

This lead me on the quest to reverse engineer the data that the latitude iGoogle gadget uses to update itself. So far, I can parse the data into a set of lists once given a url to where the data is.

To obtain this url, you will need to use firebug to watch all of the requests made by the iGoogle page (with the latitude gadget loaded into that page) and look for the one that contains makeRequest. Copy this url, with all of it's parameters to get access to the data.

I have written a small parsing library (in python) that will grab the data, and parse it out into the specified data structure. This library is available from my mercurial repository under the latitude project.

Friday, April 17, 2009

Default email addresses for contacts in OSX

Have you ever wondered how OSX decides what email address to use when you email a contact? A lot of the time, you get to choose, but there are times when the system decides for itself... Such as when you are using iCal to send out event invitations.

There is actually a way that the system decides on which address to pick, and this is even a public API. The problem though, is that Address Book does not expose this interface to the user.

So, after some researching (to find the actual way this is implemented), I developed a small (command line) tool to change the default email address for a user. This tool, takes the form of a small python program, using the pyobjc bindings to the AddressBook framework.

The source code is avaliable from my repository in the stuff repository under the osx/addressbook/edit_default_address.py path.

You will also find in the same folder: a script to create a mutt alias file from the system address book, and a script to convert all of the phone numbers into the international format (from the Australian format).

These three programs form the basis of a good set of examples of the python objective-c bridge for the AddressBook format.