Archive for March 4th, 2006

Pandora

Saturday, March 4th, 2006
Pandora

Pandora – why did they choose that name?

Pandora
is the latest internet craze.
All the cool kids are doing it.
You should too.

The story I heard from Jeff last night at Hrach’s place is that these music researchers were building a database of classifications for a ton of music for a few uears, and then decided to try applying the database to help people find music they might like.
The result is Pandora.
You can read
the official description too.

Last night we were all playing board games and each person added one artist to set up the playlist.
Then as the music played, we would vote on how we liked songs.
Not every song, just those that people particularly disliked (and one I think that was liked).

To keep up with the “social” meme that pervades everything these days, you can share your playlist-ish thing (it’s not really a playlist – more like a Music profile) with friends.
They can search for you by your email address.

I, wanting to track spam, entered a spam-orific address of “rae+pandora@tnir.org”.
How the “+” stuff is ignored by email is fodder for another Tech Tok article (or did I already write one? Hmph).
So if you want to hear my (currently only ambient/electronica) music, just enter that in the search tnigee and give a listen.
I find it still sticks in pretty cacaphonic music which I have not managed to train it to realize i don’t like.

Wow, is that a legal sentence?

The one other thing about Pandora is that it works well with Slingboxes.
Jeff has one and is using Pandora on it. The remote can be used to “thumbs up” or “thumbs down” each song.
I’m not sure if you can add it to your favorites or not.

making the most of “ls”

Saturday, March 4th, 2006

ls” is the age-old command to list files and directories in Unix.
Over the years it has permuted and grown very functional.
At the moment, I typically use two “forks in the road” versions of ls.

The first is the “ls” that comes pre-installed in Mac OS X.
It’s the BSD version.
The second is GNU “ls“, which I install on Macs using
Darwin ports.
Ironically enough, the term “ports” there comes from BSD.

No what I want out of “ls” is the following:

  1. use colour to hilight files types (*.jpg/gif/png/bmp vs *.mp3/m4a/m4b/ogg vs *.tgz/zip/rar)
  2. show file sizes in MB (not k, not 512-byte blocks)

So this is how you do this.

Using BSD “ls“, we would set the BLOCKSIZE to 1048576 and set the environment variable CLICOLOR (not to any particular value, just ensure it exists; under csh I do “setenv CLICOLOR”).

Using GNU “ls“, we need the flags “–block-size=1MB” and “–color”.

Now when you use “ports”, GNU ls shows up as gls, so you also need to alias “ls” to be “gls“.

There, now isn’t that fun?
Throw in to the mix some favorite other flags as well as some combinations and permutations of
listing only files, only directories, and maybe all the source code around here,
and you get the bottom of my .cshrc file
(the equivalent .profile is left as an exercise for the Bash user):

if($?prompt) then
	# make ls a nice, happy thing that:
	#	(a) uses color to show different file types
	#	(b) shows file sizes in megabytes
	#
	#CLICOLOR - makes BSD ls always list in color
	setenv CLICOLOR
	#BLOCKSIZE - used by BSD ls to determine how to print the size of files
	setenv BLOCKSIZE		1048576
	setenv LS_OPTIONS		-AsCF
	setenv LS_COLOURS		'di=1;34:ln=1;36:ex=1;35'
	if("$term" == "xterm") set term=xterm-color
	# start off using the usual 'ls' in /bin
	alias base_ls /bin/ls
	# try to use gls, if it's available
	if ( "`which gls`" !~ *'not found'* ) then
		# GNU ls is better than BSD ls in general
		alias base_ls gls
		setenv LS_OPTIONS		"-AsCF --block-size=1MB --color"
	endif
	alias ls		base_ls ${LS_OPTIONS}
	alias ll		'base_ls -al'
	alias ls		'base_ls ${LS_OPTIONS}'
	alias ls.		"find . \!* -name '.[a-z]*' -maxdepth 1 -print0 | perl -p0 -e 's#^\./##;' | xargs -0 base_ls -da ${LS_OPTIONS}"
	alias lsd		"find . \!* -type d \! -name '.*' -maxdepth 1 -print0 | perl -p0 -e 's#^\./##;' | xargs -0 base_ls -d ${LS_OPTIONS}"
	alias lsf		"find . \!* -type f \! -name '.*' -maxdepth 1 -print0 | perl -p0 -e 's#^\./##;' | xargs -0 base_ls -d ${LS_OPTIONS}"
	alias lsfa		"find . \!* -type f               -maxdepth 1 -print0 | perl -p0 -e 's#^\./##;' | xargs -0 base_ls -Ad ${LS_OPTIONS}"
	alias lss		'base_ls -a ${LS_OPTIONS} \!* {,*/,*/*/}*.{h,cc,c,cpp,cxx,hxx,hpp,m,mm,py,rb,sh}'
	alias zappaths	rm ~/.cshpaths
endif

We won’t even mantion that I sometimes run across versions of find that do not grok “-maxdepth”..