GTA4 aka 'Worlds Most Insane Car Chases'

Posted by John
on Wednesday, 27 February 2008

GTA4

If you're like me, everytime you play GTA for a bit you just can't help trying your luck at making the police's life a misery. It's bad I know, you're driving down a road, 30% into a mission, bored and then just go 'damn it' and slam right into a police car and whizz away at 200mph with 5 cops in tow.

It's such a rush and one of the cornerstones of the GTA series that make it so enjoyable, the freeform model allowing you to try things you'd never do in real-life and re-live moments like the Bullitt car chase or Popeye Doyle's dash thru the streets of San Francisco; and with the enhanced gameplay and more realistic effects this is going to be one game you just won't be able to put down.

Roll on April 29th, I personally can't wait!

'Thin' Rails Server + Fedora Cleanup

Posted by John
on Wednesday, 27 February 2008

Thin

Thanks to Thomas Glasgow, I've been told of a new lighter Mongrel web server called THIN. It's more-so a cut-down version of the Mongrel Web Server, with the added power of an Event machine and Rack parser.

Haven't tested it out, but intend to try it out on one of my apps, install it with...

sudo gem install thin

Thin - Rake Task

With the above I found a startup script similar to Monrel's .yml config file.

namespace :thin do
  namespace :cluster do

    desc 'Start thin cluster'
    task :start => :environment do
      `cd #{RAILS_ROOT}`
      port_range = RAILS_ENV == 'development' ? 3 : 8
      (ENV['SIZE'] ? ENV['SIZE'].to_i : 4).times do |i|
        Thread.new do
           port = ENV['PORT'] ? ENV['PORT'].to_i + i : ("#{port_range}
%03d" % i)
          str  = "thin start -d -p#{port} -Ptmp/pids/thin-#{port}.pid"
          str += " -e#{RAILS_ENV}"
          puts "Starting server on port #{port}..."
          `#{str}`
        end
      end
    end

    desc 'Stop all thin clusters'
    task :stop => :environment do
      `cd #{RAILS_ROOT}`
      Dir.new("#{RAILS_ROOT}/tmp/pids").each do |file|
        Thread.new do
          if file.starts_with?("thin-")
            str  = "thin stop -Ptmp/pids/#{file}"
            puts "Stopping server on port #{file[/\d+/]}..."
            `#{str}`
          end
        end
      end
    end

  end
end

copy and paste it into a .rake task in your apps /lib/tasks directory.

then fire with...

rake thin:cluster:start
rake thin:cluster:stop

and...

rake thin:cluster:start RAILS_ENV=production SIZE=10 PORT=8000
  • SIZE = cluster size (2 is usually enough)
  • RAILS_ENV = environment (production, development or test)
  • PORT = port range to start from (for 2 clusters it'll be 8000 and 8001)

Thanks to Stephen Celis for this.

Fedora Package Errors and Cleanups

Lately i've run into some problems with my Fedora package manager, inconsistent files and dropped repositories. However I think I've managed to cleanup this problem by first cleaning up my package managers metadata, db cache and doing a general tidyup with...

sudo yum clean all
sudo yum clean metadata
sudo yum clean dbcache

Then giving the once-over of my RPM repository,

sudo rpm -vv --initdb

This looked ok, but I wanted to make sure so I rebuilt my RPM repository,

sudo rm -f /var/lib/rpm/__db*
sudo rpmdb -vv --rebuilddb

Now looking a little better,

Want to install Beryl + Compiz to get the 3D effects and cubed desktop next.

Update on Beryl

After hunting around I found that Beryl has been dropped in favour of Compiz, so don't go hunting for it because you won't find it.

Preload your Apps - Linux

Posted by John
on Tuesday, 26 February 2008

A new addon I've just discovered is a package called PRELOAD which basically runs in the background learning what kind of apps you like loading (firefox, etc.) and then puts these into free memory so when you open them they'll boot up faster.

Installing

From the terminal, install with...

sudo yum install preload //fedora
sudo aptitude install preload //ubuntu, etc.

Monitoring

You can monitor what resources it's using by...

sudo tail -f /var/log/preload.log

Or more specifically with...

sudo less /var/lib/preload/preload.state

These will give you output from it's logs as to exactly what programs it's caching and how it's operating.

Remove?

If you don't like it and want to remove it,

sudo yum uninstall preload //fedora
sudo aptitude uninstall preload //ubuntu, etc.

Links

More can be found at...

Hacking Attachment_Fu for bmp + tiff uploads

Posted by John
on Monday, 25 February 2008

Quick hack, recently I needed to get the Rails Attachment_Fu image uploader to support TIFF & BMP image uploads. Took a fair bit to work out but in the end I hacked it by doing this.

First open the file...

/vendor/plugins/attachment_fu/technoweenie/attachment_fu/attachment_fu.rb

In this file look for @@content_types and add these to the end...

, 'image/bmp', 'image/tiff'

Quick & dirty but allows Attachment_Fu and RMagick to support BMP and TIFF uploads, along with all the rest.

IE Debugging Tools

Posted by John
on Monday, 25 February 2008

It's hard to do but these might help,

  • X-Ray, a bookmarklet to examine elements within the document model, similar to firebug's 'inspect'.

  • Fiddler, an http debugger for ie 6/7

  • IE Developer Toolbar, similar in power to firebug but in no way as comprehensive.

  • IETester, full-blown IE6 standalone browser, finally you can test against IE6 on Vista!