Archive for January, 2007

The sea change in the music business.

I’ve been thinking about writing a note on this topic for a long time. I have this outline in mind where I describe the long (1000-year) history of how musicians make money, and how a momentary blip in technology (between Thomas Edison and Vint Cerf) created a short-lived industry (the audio media manufacturing, marketing and distribution industry). But Chris Andersen just wrote a nice, clear article on this subject, that succinctly gets to the core of this idea.

A shorter version: for decades the music business consisted of touring musicians around (at low or no profit), to generate interest in buying physical media (records and CDs).Today, the physical media that contain music have almost no economic value, the business should be reversed: spread the music around to generate interest in attending live performances.

It’s not a business plan the RIAA likes: they own trucks and media manufacturing plants and retail distribution. The musicians own the talent. Going forward, the money will now flow to the talent, rather than the disc manufacturing and delivery people.

Another cool physics/flash game, stick remover.

I’m a sucker for these things:

http://ishi.blog2.fc2.com/blog-entry-206.html

A tool for quickly checking analytics packages

This is pretty cool.

Some people are actually using webtrends and hitbox AND omniture. Sounds like somebody has too much money in their marketing budget!

How to set connect time out on Java sockets

You’d think this would be incredibly obvious, and maybe it is. Maybe I’m an idiot. Whether or not I am, I recently was trying to figure out why Socket connect timeouts weren’t working. Here was the code that didn’t work:

Socket sock = new Socket("hostname", port);
sock.setSoTimeout(5000);

This was supposed to set a connect timeout of 5 seconds. But what actually happens is that the constructor initiates the connect(), when that the timeout hasn’t been set. So you get the default timeout, which is like 75,000 centuries. The right way to do it:

SocketAddress sockaddr = new InetSocketAddress(host, port);
Socket sock = new Socket();
sock.connect(sockaddr, 5000);

And now everything is working. Yay.

How to get PHP 5 working with MySQL 5 on CentOS 4.x

You’d think this would be pretty much automatic, but it hasn’t been my experience.

There are two problems: CentOS 4.x distribution still has MySQL 4.1.x as the default MySQL installation. I really like to use MySQL 5 now, it’s pretty stable. The other problem is that the PHP packages that claim to have MySQL enabled, actually don’t. Or that’s the way it seems to me, after several hours pounding my head against “yum.”

Step 1: install MySQL 5

This is pretty easy:

% yum --enablerepo=centosplus install mysql-server mysql-devel
% /usr/bin/mysql_install_db
% /etc/init.d/mysqld start
% mysqladmin password your_secret_password
% mysql -h localhost -p
Enter password:
mysql>

Step 2: Compile PHP

Assuming you have the standard apache httpd package installed on the machine, we have to build PHP 5 with mysql enabled. This is the only way I have been able to get PHP 5 to work. It’s annoying, because you’d think that PHP + Apache + MySQL 5 would be the second most popular config on these machines.

First get PHP from http://www.php.net/downloads.php

You’ll also need to make sure that httpd-devel is installed so you can have apxs.

% yum install httpd-devel
% yum install libxml2 libxml2-devel flex           (you might already have these)
% tar vxzf php-5.2.0.tar.gz
% cd php-5.2.0
% ./configure --with-apxs2=/usr/sbin/apxs --with-mysql
% make
% make install

That’s it. This should also take care of updating your httpd.conf to load the PHP module. Now restart apache.

Tutorial on making an emacs major mode.

At work, we have these message declaration files for localizing the application. I wanted to make an emacs mode where at least the message identifiers were highlighted in a different color. I found this nice tutorial on getting started with the hooks.

It only took me 10 minutes to get my mode working well enough. Here is my mode, as an example.

(defvar r9msg-mode-hook nil)

(defvar r9msg-mode-map
  (let ((r9msg-mode-map (make-keymap)))
    ;;(define-key r9msg-mode-map "\C-j" 'newline-and-indent)
    r9msg-mode-map)
  "Keymap for r9msg majo mode")

(add-to-list 'auto-mode-alist '("\\.msg\\'" . r9msg-mode))

; comments begin with #
; msg ids begin with *
; directives begin with @
(defvar r9msg-font-lock-keywords-1
  (list
   '("^#.*" . font-lock-comment-face)
   '("^\\*.*" . font-lock-constant-face)
   '("^@.*" . font-lock-variable-name-face)
   )
  "Minimal highlighting expressions for r9msg mode")

(defvar r9msg-font-lock-keywords
  r9msg-font-lock-keywords-1)

(defun r9msg-mode ()
  "Major mode for editing msg files"
  (interactive)
  (kill-all-local-variables)
  (set (make-local-variable 'font-lock-defaults)
       '(r9msg-font-lock-keywords))
  ;;(set-syntax-table r9msg-mode-syntax-table)
  (use-local-map r9msg-mode-map))

Apple might have a case vs. Cisco?

This is hilarious stuff.

[via Infectious Greed]

Speculation on the future iPod

Gizmodo has a thought about the next gen iPod. Their take: same form factor, touch screen, but with 100GB drive (or something), and way cheaper.

My speculation: the next iPod will be identical to the iPhone in every way except that it won’t be able to make phone calls or do SMS. That is, everything except what they need Cingular for. But it will have:

1. WiFi (and hence full Safari etc.)

2. bigger disk (maybe not 100GB, but bigger.)

It will be sort of an iPod crossed with a UMPC, but actually portable. Good for email and browser as long as you can find a hotspot, which is really pretty easy these days. And it makes the “multi-year” Cingular exclusive not so much of a bad deal for Apple. Heh.

The Google releasing user-space file system for Mac

This is cool, and hopefully will lead to more funky filesystem hacks for Mac, like maybe the Flickr file system that is available for Linux.

Love the Google.

How to disable Ruby “Insecure world writable dir” warnings

In your ruby script, start with this line:

#! /usr/bin/ruby -W0

Don’t even think of lecturing me on the wisdom of this. Sometimes I just want to write one-off scripts and have them read files from globally writable directories.