Archive for the ‘lifestyle’ Category

Song of the Week

Tuesday, March 30th, 2010

Love Or Lies by capsule.

Could not find any good lyrics so find my attempt at correction / transcription / interpretation after the break.

(more…)

Song of the Week: The Music

Thursday, March 11th, 2010

From capsule’s new album PLAYER.

The Music

The App Store’s plague of content-only pseudo-apps

Friday, January 29th, 2010

So Apple’s bandying about the fact that its App Store now has over 140k applications. That’s pretty impressive. Until you realise that a huge proportion of them – possibly the majority – are nothing more than “content + viewer” bundles which really should be PDFs, ebooks, or iphone-optimised web pages. Or not even that – I thought the iPhone had a proper web browser?

Here’s some examples of the “apps” making up this suspiciously high number:

Japanese Photobooks (this single company has hundreds of “apps” – nothing but picture viewers with embedded pictures)

Romance novels (little better than the above – again, this company has almost a thousand “apps” just by itself)

Go to the “books” category of the App store. There’s 20 per page, and as I write this, there’s 871 pages. That’s over 17,000 “apps” which do nothing but package one or more books. They are technically applications, sure. But on a desktop PC they would be nothing more than jpeg files, PDFs, or – even better – simply web pages.

Why all these useless apps cluttering up the store? I believe it has to do with the iPhone’s lack of a user-accessible filesystem. There’s no way for a user to, say, save a PDF of a book (or 100 books) he wants to look at on the device, and then use one app to read them all. Instead, users are reduced to the highly inefficient workaround of simply saving one app per item of content they wish to access.

So, just a couple of examples above and I’ve already cut close to 20,000 “content-only apps” off the claimed 140,000. But there’s many, many more. Have a look in “music” – plenty of filler in there too. Check out “Justin Timberlake lyrics” – the app. That developer has spammed the store with over 120 nonsense apps just like that, mostly over the course of one or two days.

Check out “reference”. Thousands more there.

The fact that you need to make and release an application to load content of any kind onto your iPhone is not a strength of the platform, it’s a weakness, IMO.

kitsune-san

Tuesday, January 26th, 2010

All artwork from the famous kitsune-san Google background.

http://rabbit.eng.miami.edu/students/epeng/kawaii/kitsune/index.html

I love that little fox! Since there are 12 panels, and kitsune-san sleeps for only 2 of them, we can deduce that he sleeps for only 4 hours per day.

Songs of the Week

Thursday, January 14th, 2010

Songs of the week are I’ve Sound, live at Budokan 2009 in the five-singer configuration they call “Love Planet 5″, singing together in a two-song set. It’s from the end of the concert.

1. Hydian Way 72.6M
2. See You 70.3M

I don’t think they reach quite the heights of 2005 but it’s still a good concert and they’re good singers. I’m just happy that someone is still making this kind of music and giving this kind of performance.

Threads

Thursday, January 7th, 2010

I recommend the somewhat dated but utterly harrowing mockumentary Threads, which attempts to speculate on the likely result of nuclear war on an average working-class family in Sheffield, England. It’s somewhat overly pessimistic, IMO, but differs from most other movies in its class by at least trying to consider everything and present a realistic, if close to worst-case, scenario.

I can’t believe I hadn’t heard of it before, and it deserves to be better known.

2010

Saturday, January 2nd, 2010

IT’S FUCKING 2010 I CANNOT FUCKING BELIEVE IT

Aren’t we all supposed to be living in fucking space by now? My god damn cyborg body better be on track for 2029. I am counting on that god damn body.

i5 is alive

Saturday, January 2nd, 2010

Bought a new iMac. Stock 27″ quad core (i5), I paid AUD$2339. I then went on holiday, so couldn’t even use it until yesterday.

This thing is a fucking monster. The screen is huge – you don’t realise how big it is sitting in the shop, because all the other screens there kind of desensitise you, but when you get it home you realise how god damn huge it is. It’s almost TOO big. And it was an utter bitch to carry home.

The performance is just wonderful. I’ve become more and more frustrated with my Core 2 Duo laptop – it just seems laboured and out of breath and spins its fans up at the slightest load. That machine just seems sluggish to me these days and this was becoming a hindrance in my work – I am *often* waiting for the machine to restart a server, switch apps, whatever – it’s just slow all round.

The new machine is a whole lot faster – a rough factor of 4. It’s got 4GB of memory, soon to be 8, and can take up to 16, which should do for now. It’s got 4 slots, so I can use cheap 2GB modules – the upgrade to 8GB will cost $142.

Basically I’m totally delighted. Apple really nailed it with this machine. The thing is almost too good, since there seems to be little point getting a Pro when you can have this much capacity and performance for such a low price. Check out ; I agree with everything that guy says.

Incredibly impressed with Ruby 1.9.2

Friday, December 4th, 2009

So I’ve got this web app. It’s pretty “heavy” and it does a lot of image manipulation. It’s a bit of a pig, to be honest.

Under Ruby 1.8.7 and 1.9.1, you can reliably expect the memory usage of this app to grow .. and grow .. and grow. I have seen it reach 900M before I shut it down (manually on development machine – in production monit would have killed and restarted it long ago).

Memory usage under 1.9.2pre1? 72.7M and it’s been running for hours. It got as high as ~130M or so at one point, but then – astonishingly – GC actually worked and released unused memory. Will wonders ever cease?

Performance is up around 20% on 1.9.1, too.

Memory usage, and the constant leaking/growth thereof, is my number one daily problem with Ruby. The preview release of 1.9.2 seems to have solved it. To say I’m happy about this development would be an understatement. I am looking forward to deploying on 1.9.2 ASAFP and will do so, probably, upon the release of preview 2 (I have noticed no stability problems whatsoever).

update: 12 hours later it’s gone down to 65.5M. Praise the Ruby Gods!

.to registers a headless A record

Friday, December 4th, 2009

Neat trick – the .to top level domain control has registered a “headless” A record. In other words, the domain “to” resolves now – although your browser will probably try to “correct” it.

They used it to make a URL shortener – the shortest URLs possible, basically, unless a 1-character TLD is commissioned (no technical reason why not).

I can’t standa URL shorteners but couldn’t resist http://to./.ot//:ptth, which actually worked a grand total of once before not working any more for some reason. Oh well.

Not any more it can't

Album of the year?

Sunday, November 29th, 2009

Is it just me, or were precious few good albums released in 2009? Even those fags at MetaCritic practically admit defeat with this lame-ass list. There’s not a lot on there you should bother with, trust me, I’ve heard enough of them to realise MC is grasping at straws.

So, dear reader, was there a good album released in 2009? To be honest, my favourite for the year so far is “The Boy Who Knew Too Much” by Mika. It pains me to call such mainstream sugar-pop the album of the year but where’s the alternative?

Rails 2.3.5 still broken on 1.9.1

Sunday, November 29th, 2009

So Rails 2.3.5 is out and while I don’t really know what’s new, I can tell you what isn’t – not running on the current stable version of the ruby programming language as reported by Ruby-Lang.

If you would like to start testing Rails on 1.9, you’ll need to apply the patches listed at this Lighthouse ticket, which fix the two most serious problems. A kind user down the bottom of that ticket has pulled the patches into monkeypatches suitable for just slipping into your config/initializers folder – I can confirm that they work for me.

I cannot fathom Rails Core’s bizarre refusal to pull these patches into 2.3.5. Yet another release goes out that is completely non-functional on the newest, fastest and best version of the language, forcing users to seek out and apply non-official monkeypatches – or just forsake 1.9 altogether, as the vast majority seem to be doing. In what way is this in the best interest of the framework or the community? What is holding them back? The patches might not be 100% perfect but they’re a lot better than what we have now, which is that out of the box Rails is broken on 1.9.1.

UPDATE: Happily, the 1.9.1-patched Rails does seem to be working on 1.9.2 as well. I’ve installed ruby 1.9.2dev (2009-09-07 trunk 24787) and my favourite “fussy site” is working there, too. That’s great news, because 1.9.2 is going to be the “serious” version of Ruby 1.9 and has further big performance increases.

i5 or i7

Friday, November 27th, 2009

So, I’m getting a desperately needed new iMac.

I’d been planning to get the i5, but after seeing this report I think I’ll plump for the i7. It’s on sale today for AUD$2,758.01 (don’t forget the 1c).

Killing a sentient being is murder, no matter what species

Saturday, November 21st, 2009

New research is confirming what interested parties have suspected for a long time - dogs are as intelligent as infant humans.

I am pretty dispassionate about which species is involved when it comes to ending life – the main factor is the intelligence and self-awareness of the victim. There are plenty of animals that are demonstrably self-aware, so in my view, it’s ethically worse to kill, say, an adult dog, than to perform an abortion. Or a dolphin, for that matter – or a pig, or an ape, or any other animal with clear signs of intelligence.

Glad to see more expert support that we should be taking the rights of animals more seriously. We are animals, after all, no matter what superstitionists insist, and by killing any other animal, we’re killing our own. Better have good reason.

Maglev hype train derailed at last

Saturday, November 21st, 2009

Ah, Maglev. It seems that only yesterday I was ripped to shreds by a furious mob for daring to question your public claims of drastic speed gains over every other Ruby interpreter.

And so imagine my delight today, when the first alpha release is finally available! Sure, it’s only an alpha release, so it’s not going to be quite as good as the final product – but surely it will live up to the claims in the RailsConf 2008 demonstration? I mean, it was that good even then! Surely it must be even better now!

Anyway, I obviously had to install it and put these claims to the test.

I followed the instructions on – with a couple of changes, such as that I use .profile instead of .bashrc.

I decided to test with as close to a real world library as I could. That post mentions that Maglev supports Sinatra, so I thought that would be an ideal test. Then again, it also says it supports RubyGems but I couldn’t get that to work at all. C extensions are out too, so we’ll be using Webrick.

To get around the RubyGems problem, I manually downloaded Rack and Sinatra and placed the contents of their lib directories into a single folder. I then created a trivial sinatra app as shown:

require File.expand_path(::File.dirname(__FILE__)) + '/sinatra.rb'
require File.expand_path(::File.dirname(__FILE__)) + '/rack.rb'
 
get '/' do
  "Maglev Rocks!"
end

I decided to run good old ab against it. My exact command was:

ab -kc 10 -t 10 http://127.0.0.1:4567/

Because I have other servers installed in Ruby 1.8.7 and 1.9.1, I forced sinatra to serve using webrick as follows:

ruby1.9 testmaglev.rb -s webrick

Considering the past hype of order-of-magnitude speed hikes, I was ready to be blown away. Are you ready to be blown away? Oh yeah baby, 50 times faster comin’ right up!

RESULTS

Ruby 1.8.7: Requests per second: 131.38 [#/sec] (mean)
Ruby 1.9.1: Requests per second: 144.77 [#/sec] (mean)
Maglev: Requests per second: 97.78 [#/sec] (mean)

Well golly gosh. Look at that. It’s not faster after all – in fact it’s climbing the same steep performance hill ever other interpreter has had to climb, Smalltalk magic notwithstanding. How about that.

I said the benchmarks shown at RailsConf were bullshit and would not even remotely reflect the real world performance of the final product. I said that until the interpreter implemented all of ruby, it was not ruby, and it was worthless to measure its performance. I poured skepticism upon the notion that a new interpreter, just by dint of some doubtfully superior Smalltalk heritage, could leapfrog all previous contenders with a two-order-of-magnitude performance boost.

Looks like I was right. But don’t take my word for it, run the tests yourself. I will be accepting contrite apologies in comments … ;)

Rails Metal MongoDB GridFS access

Friday, November 20th, 2009

I’m kind of new to Metal (and all things Rack) but this works. Just for reference.

# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class ImageShow
 
  def self.call(env) 
    request = Rack::Request.new(env)
    if request.path_info =~ /^\/show_image\/(.+)$/
      if GridFS::GridStore.exist?(Media.database, $1)
        GridFS::GridStore.open(Media.database, $1, 'r') do |file|
          [200, {'Content-Type' => file.content_type}, [file.read]]
        end
      else
        [404, {'Content-Type' => 'text/plain'}, ['File not found.']]
      end
    else
      [404, {"Content-Type" => "text/html"}, ["Not Found"]]
    end
 end
 
end

That will need to be saved as image_show.rb. Slow .. but not as slow as doing it through a Rails controller.

Girl of the week

Friday, November 20th, 2009

Shiori Kanzaki

Rails kinda running on 1.9.1

Wednesday, November 18th, 2009

So I’ve been ranting recently about Rails’ lack of Ruby 1.9 support. And rightfully so! It’s inexcusable for the #1 Ruby framework to not support the fastest, most efficient version of Ruby, especially not after it’s been available for almost 2 years.

But for some people, it is kind-of possible to use Rails on 1.9 today. Rails’ 2.3-stable (“stable” in quotes) branch has fixed a few of the worst problems in 2.3.4, such as the string comparison bug which made authentication systems unworkable. The showstoppers for me, like the utf8 in templates issue, remain. I wouldn’t rely on it in production – not for a site which your job depends on, anyway – but as long as you don’t use certain features of rails (like i18n), and don’t need to deal with utf8 much if at all, you may be able to use it.

You should want to switch to 1.9.1 as soon as possible. I see between 20% and 50% higher performance than 1.8.7, with memory usage significantly lower and even better, less prone to leakage. In one of my projects there is a daemon which does nothing except wait for items to hit a queue and then launches a script to deal with them. In 1.8.7, it would gain a meg or so every few hours and I’d be nervous about leaving it running unmonitored. In 1.9.1 it sits rock solid on 6.5M for weeks on end. I am totally sold on 1.9.1.

Anyway, here’s the instructions to get Rails up to the latest possible usable state. Open a terminal at the root of your Rails app:

# head into /vendor
$ cd vendor
 
# clear out any other rails
$ rm -rf rails/
 
# clone rails into here
$ git clone git://github.com/rails/rails.git rails
Initialized empty Git repository in /Users/sho/projects/myproject.com/vendor/rails/.git/
remote: Counting objects: 123204, done.
remote: Compressing objects: 100% (27700/27700), done.
remote: Total 123204 (delta 95101), reused 121853 (delta 94037)
Receiving objects: 100% (123204/123204), 21.72 MiB | 380 KiB/s, done.
Resolving deltas: 100% (95101/95101), done.
 
# enter that directory
$ cd rails/
 
# checkout 2.3 stable, ignore the errors
$ git checkout -b  2-3-stable remotes/origin/2-3-stable
warning: unable to unlink arel: Operation not permitted
warning: unable to unlink rack-mount: Operation not permitted
Branch 2-3-stable set up to track remote branch 2-3-stable from origin.
Switched to a new branch '2-3-stable'
 
# go back to the root dir 
$ cd ../..
 
# run rails as 1.9.1. get ready to find out which gems you forgot!
$ ruby1.9 script/server
 
# hello, console
$ script/console --irb=irb1.9
Loading development environment (Rails 2.3.4)
>> RUBY_VERSION
=> "1.9.1"

And there you go. It’s working, kind of. Try it out.

I would probably recommend using thin as the web server, but if you need a working mongrel in 1.9, my gem is still available:

sudo gem1.9 install sho-mongrel

That will probably die when github pulls gems for real but who knows, maybe the official mongrel will have been fixed by then (HA!).

Meanwhile, I’m going to step up my harassment of the Rails Core team to get this crap fixed; it is a fucking JOKE that it still doesn’t work 100%.

update: moved the gem to gemcutter.

script/memcached

Wednesday, November 18th, 2009

The inimitable Wincent recently referred to a memcached script he had written that toggled whether memcached is running or not. I thought that was a great idea so wrote my own and in the spirit of comparing dicks I thought I’d post it here.

#!/usr/bin/env ruby
 
 = ::File.expand_path(::File.dirname(__FILE__)) + '/../tmp/memcached.pid'
 
def process_id
  File.exist?() ? File.read().to_i : false
end
 
def running?
  if process_id 
    Process.kill(0, process_id) == 1 rescue false
  else
    false
  end
end
 
def start!
  print 'starting memcached ...'
  system "memcached -d -P #{} -l 127.0.0.1"
  sleep 0.5
  print "started with pid #{File.read}"
end
 
def stop!
  print 'stopping memcached ...'
  Process.kill('INT', process_id)
  sleep 0.5
  File.delete() if File.exist?()
  print 'done.'
  puts
end
 
def ensure_running
  running? ? puts('already running.') : start!
end
 
def ensure_stopped
  !running? ? puts('not running.') : stop!
end
 
def toggle
  running? ? stop! : start!
end
 
case ARGV.first
when 'start'
  ensure_running
when 'stop'
  ensure_stopped
when 'toggle'
  toggle
when 'status'
  running? ? puts('running') : puts('not running')
else
  toggle
end

I love writing these kinds of scripts in Ruby. It’s perfect for it.

Cool Ruby one-liner

Tuesday, November 17th, 2009

Is the process 1234 running?

Process.kill(0, 1234) == 1 rescue false