New minimum culture

November 6th, 2009 by 深町晶

It’s come to my attention that certain visitors to this web log are criminally bereft of exposure to the essential media of the ages.

I live to serve and I correct this lacking with this comprehensive study course:

Pump Up the Volume
Heathers

More as I think of them.

Disqus – a single point of failure

October 27th, 2009 by 深町晶

I do not understand why bloggers adopt services such as Disqus.

It is not hard to put comments on a blog. Really, it is not hard at all.

It is not especially hard to block spam. This blog may not be popular but it’s over 4 years old and gets a LOT of spam; sometimes thousands a day if some bot gets into heat. All is dealt with. It’s not effortless but it’s pretty minimal.

So why do people wilfully pervert the core strength of the internet’s redundant peer-to-peer structure and adopt a centralised commenting system for their independent blog? I just don’t get it. Especially the so-called experts at Ruby Best Practise who apparently can’t even run a fricking comment system. I qualify for “Ruby Worst Practise” most of the time and I have written and run several.

Here’s “Ruby Best Practise” as I experienced it today:

Best practise right here folks

Thanks for losing my comment, matchless professionals at Ruby Best Practise.

I love TextMate, but …

October 23rd, 2009 by 深町晶

… but it has taken almost 2 hours now to do a simple find and replace in a (admittedly 400k lines long) single file.

That is very inefficient.

In other news, if you tried to access this server this morning, you likely couldn’t. Why?

$ uptime
19:50:39 up 152 days, 3:40, 4 users, load average: 0.68, 31.71, 64.91

That is *not* what one wants to see. A runaway image resize daemon was to blame. Couldn’t even run ssh; had to drop to console over IP and kill the offending processes, then restart ssh et al.

I want some better hardware … and I really should reboot one of these months.

Update: I ended up killing TextMate and rethinking my methods.

Song of the Week – Love Is Growing

October 23rd, 2009 by 深町晶

From the .

Love Is Growing (mp3, 5.9M)

Another perfect song by the current greatest musician on Earth, Kanno Youko. Lyrics below.

Read the rest of this entry »

More Australia Tax

October 16th, 2009 by 深町晶

Thinking about buying an SSD as about the best possible upgrade to any computer? I certainly am, so imagine my delight when I compare the differences in price of buying the drive in, say, Japan, and my wonderful Australia!

Japan: ¥45,885 (AUD$550)
Australia: around $800

A nice $250 Australia Tax there.

The Office according to The Office

October 15th, 2009 by 深町晶

I think this is one of the best descriptions of working life at a large company that I have ever read.

Installing nginx-gridfs on RHEL5

October 8th, 2009 by 深町晶

Now, installing on RHEL5. This took a while to work out!

cd ~/src
mkdir nginx_gridfs && cd nginx_gridfs
 
yum install scons boost boost-devel pcre pcre-devel
 
git clone git://github.com/mdirolf/nginx-gridfs.git  
wget http://sysoev.ru/nginx/nginx-0.7.62.tar.gz
tar -zxvf nginx-0.7.62.tar.gz
 
#note my mongo install path; different from on OSX
export MONGO_INCLUDE_PATH=/root/src/mongodb-linux-x86_64-1.0.0/include/mongo/
export LIBMONGOCLIENT=/root/src/mongodb-linux-x86_64-1.0.0/lib64/libmongoclient.a
export BOOST_INCLUDE_PATH=/usr/lib64/
export LIBBOOST_THREAD=/usr/lib64/libboost_thread.so
export LIBBOOST_FILESYSTEM=/usr/lib64/libboost_filesystem.so
 
cd nginx-0.7.62/
 
./configure --add-module=/root/src/nginx_gridfs/nginx-gridfs
make
make install

I’d like to point out that this install was by pure trial and error; a lot of trials, and a lot of errors, since I have no clue whatsoever about C++. The above Works For Me™ but is probably suboptimal and your mileage may vary.

update: it should be noted that this is very early version software; there are bugs and it’s probably not a production option yet. Great potential though, so check it out.

Installing Nginx-GridFS on OSX

October 7th, 2009 by 深町晶

Follow these steps to install ’s on OSX. Linux coming soon.

cd ~/src # your sources directory
mkdir nginx_gridfs && cd nginx_gridfs
git clone git://github.com/mdirolf/nginx-gridfs.git  
wget http://sysoev.ru/nginx/nginx-0.7.62.tar.gz
tar -zxvf nginx-0.7.62.tar.gz
 
sudo port install boost pcre++ spidermonkey scons # macports!
 
cd nginx-0.7.62/
 
# i put mongodb at /mongodb - alter to fit your installation
export MONGO_INCLUDE_PATH=/mongodb/include/mongo/ 
export LIBMONGOCLIENT=/mongodb/lib/libmongoclient.a
export BOOST_INCLUDE_PATH=/opt/local/include/
export LIBBOOST_THREAD=/opt/local/lib/libboost_thread-mt.a
export LIBBOOST_FILESYSTEM=/opt/local/lib/libboost_filesystem-mt.a 
export LIBBOOST_SYSTEM=/opt/local/lib/libboost_system-mt.a 
 
./configure --add-module=/Users/sho/src/nginx_gridfs/nginx-gridfs
make
sudo make install

In nginx.conf:

server {
    listen       80;
    server_name  localhost;
 
    location / {
        root   html;
        index  index.html index.htm;
    }
 
    location /gridfs/ {
        gridfs;
        gridfs_db database-name;
 
        # these are the default values:
        mongod_host 127.0.0.1:27017;
        gridfs_root_collection fs;
    }
 
    # blah
 
}

You should now be able to start nginx using /usr/local/nginx/sbin/nginx and navigate to 127.0.0.1/gridfs/#{file_name}.

UPDATE: for snow leopard, python is in /usr/bin, so you may need to symlink it like this for scons to find it:

$ sudo ln -s /usr/bin/python2.5 /opt/local/bin/python2.5

Also, nginx is updated to 0.8.30 now; these instructions work for the latest version too.

UPDATE 2: Currently the best version of this to use is , which simply pulls together a number of different patches to make a working version. Well, works for me, anyway!

National Day Parade torrent

October 5th, 2009 by 深町晶

Anyone thinking of watching China’s National Day military parade from a few days ago – and I should certainly recommended so, if only because they put so much effort into it – this is the torrent to get.

There are some others floating around but they are mostly taped from HK television. I hate Cantonese, and apparently the parade wasn’t broadcast in widescreen anyway.

This is just the military section, not the subsequent “floats from all the provinces and singing school children” part. The language is mandarin of course but it’s still very watchable. Anyway, the indecipherable Chinese commentary, excitedly talking over the chilling diesel drone of hundreds of tanks rolling past, kind of adds to the atmosphere. The aircraft flybys are also mixed at a very satisfying volume.

If that’s not enough – there’s girls in uniform. The only time Hu Jintao smiles the whole time is when girls walk past. They’re pretty cute!

Recommended. 45 minutes, 1.37G.

Shockingly bad memory performance under Snow Leopard

October 5th, 2009 by 深町晶

I don’t know what caused it, but sometime after upgrading to Snow Leopard the performance of my laptop has dropped through the floor. It’s really bad, especially with video – this 2yo mac can’t play a youtube clip without CPU going to 100% and jerking unwatchably.

I’ve been busy so hadn’t had much chance to investigate, but one thing or another led me to suspect memory performance, so today I ran Xbench. As you’ll see, the results speak for themselves.

Memory Test 15.31

System 23.78

Allocate 116.31 427.14 Kalloc/sec
Fill 70.52 3428.64 MB/sec
Copy 9.67 199.83 MB/sec

Stream 11.28

Copy 10.55 217.93 MB/sec
Scale 10.50 216.93 MB/sec
Add 12.76 271.83 MB/sec
Triad 11.61 248.39 MB/sec

That is shockingly bad and a full order of magnitude lower than expected. There’s something seriously wrong here.

The ram is 2×2GB Kingston 667MHz. It was working fine before and continues to work, just 10x slower than it should. Any ideas?

update: i’m going to list some details to make it easier for others with similar issues to find this post by search.

ram details:

BANK 0/DIMM0:

Size: 2 GB
Type: DDR2 SDRAM
Speed: 667 MHz
Status: OK
Manufacturer: 0×7F98000000000000
Part Number: 0×393955353239352D3031312E4130304C4600
Serial Number: 0×160AA70D

BANK 1/DIMM1:

Size: 2 GB
Type: DDR2 SDRAM
Speed: 667 MHz
Status: OK
Manufacturer: 0×7F98000000000000
Part Number: 0×393955353239352D3031312E4130304C4600
Serial Number: 0×160AE80F

system details:

Model Name: MacBook Pro
Model Identifier: MacBookPro2,2
Processor Name: Intel Core 2 Duo
Processor Speed: 2.33 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 4 MB
Memory: 4 GB
Bus Speed: 667 MHz
Boot ROM Version: MBP22.00A5.B07
SMC Version (system): 1.12f5

UPDATE: removing one of the 2GB modules returns speed to normal:

Results 126.95
System Info
Xbench Version 1.3
System Version 10.6.1 (10B504)
Physical RAM 2048 MB
Model MacBookPro2,2
Drive Type FUJITSU MHW2120BH
Memory Test 126.95
System 145.21
Allocate 274.47 1.01 Malloc/sec
Fill 111.52 5422.41 MB/sec
Copy 124.24 2566.05 MB/sec
Stream 112.77
Copy 104.49 2158.22 MB/sec
Scale 106.87 2207.96 MB/sec
Add 121.81 2594.72 MB/sec
Triad 119.98 2566.73 MB/sec

This machine is actually only able to address 3GB of memory; previously it ignored the other 1GB without consequence. Seems it might not be without consequence anymore.

Sucks to only have 2GB of memory but the system is now so much more responsive it’s actually a huge win. I’ll continue like this until further information emerges.

2016 Olympics

October 3rd, 2009 by 深町晶

So it’s been announced that the 2016 Olympics will be held in Rio, in Brazil. That’s fantastic news for the country, will be a real boost and I strongly support that decision.

I also strongly support the games being denied Chicago. The Olympics is supposed to be about international spirit – America is a closed, unfriendly country where foreigners are unwelcome and distrusted, and its disingenuous bid deserved to be discarded in the first round.

Tokyo would have been cool but they didn’t have much of a chance, since it was Beijing just last year. Madrid was the other strong contender, and I hope they (and Tokyo) try again for 2020.

Looking forward now to seeing what architecture and infrastructure Rio pulls out for 2016. I’m much more of a fan of the preparations for the games than the games themselves!

update: removed the fruits of my time-wasting. Tsk!

sayonara CouchDB

October 3rd, 2009 by 深町晶
[master b5a03e0] you know what? fuck this, i am switching to mongo
 52 files changed, 76 insertions(+), 91957 deletions(-)

* i wish this blog had “Tweets” like Wincent’s. Good feature!

Song of the Week

October 3rd, 2009 by 深町晶

Scooters by Kanno Yoko, sung by James Wendt.

I swear, this is the last media post using WP. I need to spend a day abstracting media processing / serving out of other projects and into my replacement blog software.

Read the rest of this entry »

A couple of Mongrel forks

September 23rd, 2009 by 深町晶

Mongrel, still probably the most-used workhorse for serving Rails applications, has been abandoned for a long time – first by its creator, then its so-called maintainers. It’s been a farce, actually, that this important piece of infrastructure has been tossed around in this casual manner. I still rely on Mongrel in several ways, and I know others do too.

Anyway, I wanted a gem with the Ruby 1.9 patches in it, so I made one . Nothing but 1.1.5, plus the Ruby1.9 patches (thanks ), there will be no ongoing changes – all I care about is that I can do

sudo gem1.9 install sho-mongrel

update: fucking github has turned off gems so this doesn’t work anymore.

and it works.

If you’re looking for more progress than that, phurley is actively improving mongrel in (which I didn’t know about before I made mine). He is also making it available as a gem, and looks to be actively improving and modernising the ancient battleaxe.

CPU History

September 21st, 2009 by 深町晶

Like having a running graph of CPU usage in your dock, but hate Activity Monitor’s 10%+ overhead?

Try CPUHistory, an ultra-lightweight replacement which uses more like 0.3%. Great stuff.

GitHub’s really fucked today

September 18th, 2009 by 深町晶

Practically unusable for large parts of the day. Becoming a real annoyance. Looks like their move to Rackspace is not a moment too soon. If I was paying for this, I would not be happy.

Telstra faces forced break-up

September 16th, 2009 by 深町晶

The government finally told Telstra to break up or be broken up, in preparation for the NBN.

I have been waiting for this day for 15 years!

Song of the Week

September 15th, 2009 by 深町晶

Heaven on a Bird, by Bryan Scary & The Shredding Tears.

Rails can’t scale!

September 15th, 2009 by 深町晶
Processing AdminController#do_import (for 124.170.0.0 at 2009-09-14 11:33:51) [POST]
  Parameters: {"commit"=>"submit", "authenticity_token"=>"qUBkNAAEB7EM4SGQRnlM+uaKlqmVM09+8l4sCFhPvBw=", "import_order"=>{"number"=>"5000"}}
Redirected to http://adomain.com:3000/admin/import
Completed in 6026460ms | 302 Found [http://adomain.com/admin/do_import]

Er, obviously this is not Rails’ fault. It’s an import script processing large numbers of records, and it blocks while it’s doing so. I really should farm it out to a worker daemon, but it’s just a one-off thing as I set up a new site, so I can’t be bothered going to all the trouble for something that will only be used once.

But I am quite proud of that number – almost 2 hours for a single request. Lucky Mongrel doesn’t time out requests, unlike, say, Passenger.

UPDATE: another one

Completed in 7922222ms | 302 Found [http://adomain.com/admin/do_import]

Wordpress does its usual trick

September 6th, 2009 by 深町晶

Ah, just when you thought WP had outgrown its massive, public security problems – surprise!

Happily, for anyone who knows anything, updating looks like this:

svn sw http://svn.automattic.com/wordpress/tags/2.8.4

However – this BS is still pretty inexcusable. I’ll be leaving WP “soon”. Unfortunately, since writing one’s own blog software is very much a hobby project, it’s been delayed a few times – but crap like this certainly inspires me to get it done soon.

update: Matt Mullenweg sez:

I’m not clairvoyant and I can’t predict what schemes spammers, hackers, crackers, and tricksters will come up with in the future to harm your blog

Matt, we’ve disagreed in the past, but I’m with you 100% on that one.

update 2: ooh, a blog I host – not this one, but a friend’s – was hacked. No risk to anywhere else of course; I am paranoid about security at the best of times and when it comes to WP I don’t take any chances. But still, interesting. The hack inserts a script to hide the new hostile administrator from you in the Users section; never seen that before. Happily, a quick visit to the web developer toolbar in FF got rid of that, and the user is now deleted, and there don’t seem to be any other effects. I don’t see anything weird in an SQL dump either. Currently debating if it’s worth nuking the site and redoing or just sitting it out until all these blogs get moved to another server anyway, which is imminent.