Tuesday, September 22, 2009

First release: emaily 0.0.1

I made a new release about Emaily, an Email Robot for Google Wave.

This is the first release, it does not actually do too many things, just add an email-participant selection gadget to a wave, when itself is added.

How to use it:
  • Add emaily-wave@appspot.com to your Wave addressbook.
  • Create a new wave.
  • Fill the subject, start writing the email.
  • Add Emaily Robot to your wave.
  • You will see that the participant selection is popping up.
Work in progress. :) I am looking for coders and helpers.

More information about the project:

Sunday, September 13, 2009

Home audio server from Mac Mini (or any Linux/Unix)

I've read many posts about using computers as home media servers, but none of them provided the necessary functionality which I needed. In this post, I'd like to share my setup with a Mac sound server, and a Mac client. The process can be adopted to Linux easily.

The setup

First of all, I use a laptop as my main computer, and all of my music is in it. I bring it everywhere. At home, I have a Mac Mini. It is used mainly as a guest computer and for backup.

When I go home, I'd like to use my stereo to play my music. Plugging the sound cable into the laptop is too old-school, and it limits my movement in the flat, so I needed to find another solution.

I could use Apple's music sharing technologies (iTunes Music Sharing, iTunes Home Sharing - this is new in iTunes 9), but the problem is that it does not count in my laptop that I have listened the music. I have automatic playlists, which pick only songs which are not played recently, so that I don't listen music repeatedly. I also use iTunes DJ a lot, and remote libraries cannot be added to iTunes DJ, so it is also not working. I like my playlists, so it is not a good solution.

I had an Airport Express before, but it did not play music videos, just music. It would have been a good solution, though.

The best setup so far was that I mounted my iTunes library which relies on the laptop to the Mac Mini and started the iTunes instance in Mac Mini. It always took a couple of minutes to set up, so I did not use it frequently. Another reason why I did not like this was that I often started iTunes in the laptop accidentally when the iTunes run on the Mini, and that is dangerous: who knows what happens with your library file if two iTunes instance uses it. The last and most annoying problem was that if someone else used the Mac, then my iTunes was in the background, and could not use the audio output.

The solution

In my old Linux days, I used Esound to send music and sound effects to another computer. It was more than 10 years ago, but Esound is still around, I've found two blog entries which uses that to solve this problem: on MacOSXHints and on a DSLinux-related site. I improved them a little, and here is my solution:

The server

The server computer in my case is a Mac Mini. This computer is connected to the Hi-Fi, so this is turned into an audio server, like the Airport Express, but it also mixes the sound effects of the currently logged in user, so that guests also can listen to some music when they use the computer.

What you need to do the setup:
  • esound
  • netcat (I used gnetcat here.)
These can be installed through macports or might be available through fink, too. On modern Linux distros, these packages already installed.

I created a shell script, which starts the esound daemon and listens to incoming music. Put this script to any place, for example name it as /usr/local/sbin/esound.sh:
BINPATH=/opt/local/bin # macports binary directory
export HOME=/Users/root
$BINPATH/esd -as 1 &
while true; do
$BINPATH/gnetcat -l -p 7752 | $BINPATH/esdcat
Add executable rights to this and create a home directory for the root user: /Users/root.

Then create a launchd config file, which will start this shell script every time you restart your computer:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
<plist version="1.0">
Save this file as /Library/LaunchDaemons/esound.plist. Then load and start the script as root:
sudo launchctl load /Library/LaunchDaemons/esound.plist
sudo launchctl start esound
If you have a Linux box, you probably want to tweak the path of the binaries, and use the rc.d mechanism to start these jobs.

Now what you have is a music server computer, which listens accepts sound input on TCP port 7752, and automatically restarted in every reboot.

The client

The client is in my case also a Mac (a laptop). I used the following software in it:
  • esound
  • netcat (I used the standard nc command here)
  • SoundFlower
You can install esound and netcat as you did for the server. SoundFlower is a Mac application, so you should not have problem installing that.

Start SoundFlowerbed and set up SoundFlower(2ch) as a default input and output channel in Audio Setup.

Then start esd, esdrec and netcat to send the music to the server:
esd &
esdrec | netcat servername 7752
Start your iTunes, and Voila!

When you are finished and you want to listen to music again in your laptop, you just need to stop esd, esdrec and netcat, plus you can just map SoundFlower output to the Built-in Output.


The original tips uses music compression, but I've found it not necessary. Uncompressed music uses about 170k/s bandwidth, it is fine for a decent wireless router. If you have problems with the bandwidth, you could take a look at the referenced tips how to do the music compression.

Friday, September 11, 2009

What did you do at 09:09 09.09.09?

Something to remember: 09:09 09.09.09 was a special moment, and we won't have that special moment in this life any more (Update: thanks for Sorin, who pointed out that it is not really true, see below). So it is good to remember what did you do at that time.

I just turned into my other side after pushing the Snooze button in my iPhone.

And you?

Update: Actually I should have been written 9:9 9.9.9, because it is more unique, and the next similar time is going to be 11:11 11.11.11, and that's going to be the last probably in our lifetime.

Saturday, September 5, 2009

Mainau Island

On Sunday last week we went to Mainau island. This is a beautiful park close to the german border with a lot of flowers.

It was a really nice walk in the island. For me the most exciting part was the Butterfly House, where I could practice the macro-photography. It is a very humid closed place where there are plenty of flowers, trees and butterflies. Catching them was not really hard, some of them liked to fly to visitors, they were not shy.

I had to realize that macro photography is not really easy. Millimeters count if it comes to the focus. I wonder that maybe the autofocus system of my camera is not perfect (I tried to not move too much), I made a lot of blurry photos.

Besides bad ones, I made a couple of good one, and I'd like to share the best 3 with you:

Butterfly 1

Butterfly 2

Patient model

When we left the island, I just simply loved the shadows on the bridge:

Sunset over the bridge

That was a really nice afternoon!

More photos maybe coming later if you have more time or the demand is really high. :)

Steps to replace an old mac

Disclaimer: doing the following steps requires that you have some knowledge about Macs. Do these steps at your own risk. I used Mac OSX Leopard, maybe your system is different and will not work for you, I take no responsibility about your data loss.

I got a new MacBook pro laptop, and usually a new task comes with a new computer is to set it up. I had my old laptop, and I just wanted the new one to work in the same way as the old one. The first tool which is handy in case, is the Migration Assistant.

Migration Assistant

This program be found in /Applications/Utilities. You have to have a firewire cable and you have to boot your old mac in target disk mode. Here is how you can do that. I set it up to copy everything including all settings and all possible users. Unfortunately it cannot handle File Vault users, so I had to do it manually later. For me it worked for about 3 hours in the background (I could use the computer in the meantime), and after that, a lot of things were copied, including network settings, my MacPorts installation (in /opt/local), all of my non-encrypted local files (music, shell scripts, etc.), even my Hungarian Plus keyboard layout, which lies in /Library/Keyboard Layouts.

You can do anything during the copy, but make sure you don't do any permanent changes in your home directory if it is file vaulted, since you'll overwrite everything soon with your old home directory.

Copying a File-Vaulted user

I had a file-vaulted home directory, and this is not copied by the Migration Assistant, so I had to copy it manually. If you don't have file vault or don't want to copy it, you can skip this step.

Given that the old computer's disk is called Macintosh HD, and the old computer is in Target Disk mode, then your file vault home directory is in the Macintosh HD/Users/.username or Macintosh HD/Users/username . Note, that there are two Macintosh HDs, the remote computer is the one which has an eject button next to it, and this is what you need now.

You cannot see the files in Finder which starts with a ".", but you can navigate to the parent folder and press Cmd+Shift+G, and then enter the directory name, and it jumps into it.

Copy the username.sparsebundle file to your local computer somewhere outside to your home directory, for example in the root directory of your new computer (Macintosh HD).

When it is finished, you'll need to have another administrator user. If you don't have one, create it in the Account Preferences.

You can detach your old computer now, or if it is not finished with the Migration Assistant, wait for it, and detach it after.

Log out with your current user and log in with your other admin user. It is very important to log out with your user, not just use fast user switch, because we'll overwrite the user's home directory.

Find where is your main user's home directory, it should be in Macintosh HD/Users/username (or maybe .username, but it is usually happens only when you forgot to log out with that. Check if you are logged out properly before continue).

Assuming you copied your old sparsebundle to Macintosh HD, you have to do the following in terminal to have your old home directory replace your current one (replace username to your short username):
cd /Users/username
mv username.sparsebundle username.save.sparsebundle
mv /username.sparsebundle .
Now you are ready, and you are able to log in to your old environment in your new laptop!

Registered software, iTunes

We're almost ready, but some registered software requires a new registration, since you use them in a new computer. Check your Applications directory and re-register your software if you don't want surprises after some weeks when you try to launch your favorite but rarely used software out in the wild without internet and with no access to your registration numbers.

iTunes also requires you to register your new computer in iTunes store to listen to your audio and watch videos you bought. There is a menu item for that: Store/Authorize computer.

Time machine

Time machine will think that it is a totally brand new computer (which is actually true), and it will start backing up your system entirely into a new space. This is probably not what you want. If you want to continue using this new computer as you used your old one, it would be convenient to save to the same place as the old computer, and archive only the differences.

I've found a good tutorial about how to make it work here. The only addition to this that if you use a remote backup (not to mention remote encrypted backup), then the referred file which starts with a "." will be in a different directory: It will be in the folder which stores the sparsebundles, not in the directory where Backups.backupdb is in. After that, you also have to rename the sparsebundle file to match your new mac address. But other than that, that document fully applies and worked for me.

That's it!

Those steps seems to be necessary and enough to copy and set up everything the way it was in my old laptop. Double check that you have everything in your new computer, and then you can start to wipe everything from your old computer and give it to your daddy, your wife, sell it, etc.