Archive for the ‘development’ Category

YUI Javascript compressor is total crap

Friday, January 4th, 2008

After reading the self-congratulatory rhetoric splattered all over , one might think their java compressor – which you actually have to download (2.4M) and run from the fucking command line – is pretty damn good. “It’s a lot of trouble”, you’d say to yourself, “but boy .. sounds like it’s worth it!”

Nope:

-rw-r--r--@  1 sho  sho   50085  4 Jan 22:53 prototype-dean.js
-rw-r--r--@  1 sho  sho   72726  4 Jan 22:50 prototype-yui.js
-rw-r--r--@  1 sho  sho  124136  8 Nov 12:07 prototype_uncompressed.js

Note that prototype-dean.js, the smallest compressed version, is produced by the Dean Edwards online, web-based JS compressor specifically singled out as inferior in the YUI article.

God I hate Yahoo, and yet there’s a certainly type of developer who showers them with praise – whether it’s for their shitty CSS “grid” (WTF?), their total crap JS “User Interface” library in which every single fucking class name starts with YAHOO, or now their bullshit doesn’t-work fucking downloadable command line java vm-needing time-wasting nothing-doer. I can’t believe I wasted 20 minutes following a suspicion that some Yahoo-loving fuckwit knows anything.

Plotr for Prototype 1.6

Friday, January 4th, 2008

UPDATE: Please do not use this nasty hack. It will probably not work, and I am unable to assist you in any way.

UPDATE 2: You should probably use this “more official” patch: . The one below works for me but best to get it from the source.

Since developer Bas Wenneker is just way, WAY too busy to take 2 minutes out of his hectic schedule to update his javascript graphing framework Plotr to work with Prototype 1.6, which was released almost 2 months ago, I patched it myself and am sharing it with you here. I’ve even included a packed version, how nice am I? Tested and seems to be working in FF and Safari on MacOSX 10.5.

It’s a trivial change, just replacing two lines:

466
this.dataSets.merge(dataset);

–>

466
this.dataSets = this.dataSets.merge(dataset);

and

961
this.renderStack.merge({element: options});

–>

961
this.renderStack = this.renderStack.merge({element: options});

I hate as much as anyone that obnoxious, needy type of user who treats Open Source developers as their free 24/7 software and support hotline but c’mon – it’s two freaking lines. If you can’t find the time, over two months, to change two lines in your open source project to fix a showstopping bug then maybe it’s time to reconsider either your time management practises or your suitability to release open source software in the first place.

Fixes taken from a post by Alexey Borodin – thanks a lot, saved me some time.

Zed Shaw goes postal

Wednesday, January 2nd, 2008

Zed Shaw, the writer of the popular essential server software mongrel, goes absolutely fucking nutzoid insane on his weblog in a 6000-word essay on what he hates about, well, pretty much everything to do with Rails.

Jesus H Christ, he really gets into it. Now I’m a big fan of dissing DHH and everything, but man, Zed just takes it to a whole new level of bitterness. And there’s some pretty scary disclosures, like when DHH admits to Shaw on IRC that he couldn’t keep 37Signal’s flagship products up for more than 4 minutes at a time:

(15:11:12) DHH: before fastthread we had ~400 restarts/day
(15:11:22) DHH: now we have perhaps 10
(15:11:29) Zed S.: oh nice
(15:11:33) Zed S.: and that’s still fastcgi right?

Recommended reading, it’s a laugh riot. Couldn’t agree with him more on most of it re. the idiots in the community.

Set aliases to ruby 1.9

Sunday, December 30th, 2007

What’s all this debate over the best way to try out Ruby 1.9 in MacOSX? Just install in /usr/local as detailed here and then set aliases in .profile:

alias ruby9="/usr/local/ruby1.9/bin/ruby"
alias irb9="/usr/local/ruby1.9/bin/irb"
alias gem9="/usr/local/ruby1.9/bin/gem"

Et voila.

UPDATE: This will only work for scripts you run directly from the console – it (probably) won’t work for scripts that call other scripts, eg rakefiles, so take care. It makes my playing around easier, but that’s probably all it’s good for.

Never, ever use IronRuby

Wednesday, December 26th, 2007

So, you’ve heard of IronRuby? Microsoft’s implementation of Ruby on .NET. I’m hearing a bit of talk about it around the interwebs. Thinking of trying it out, eh?

Don’t. Ever.

Microsoft invented the technique we now refer to as Embrace, Extend, Extinguish. They tried it to Sun Java (MS JVM). They’ve tried it with Kerberos, and even today every web developer in the world is frustrated, wasting time trying to get around MS’s attempts to poison HTML and CSS.

A Leopard doesn’t change its spots. There is only one conceivable reason for Microsoft to implement another language on its own platform, and that’s that it sees it as a threat and wants to kill it. First, make a really good implementation! Fast, easy, Visual Studio! Next, “improve” it – on Windows only, of course! Third, we’re using MS Ruby++ and we’re fucked.

Run a million miles from IronRuby. If you assist in giving it traction, if you feed it any attention at all, you’re just making the world a worse place for all of us.

And one would be advised to think very, very carefully before adopting any technology – or, just as importantly, any *implementation* of a technology – that is not open source from top to bottom. GPL is best but MIT will do.

May MS never stain the history of computing again…

Ruby 1.9 released!!

Tuesday, December 25th, 2007

See http://www.ruby-lang.org/ja/, it’s not on the English site yet, nor is it tagged in SVN.

Awesome! : )

UPDATE: it’s on the english site now, but still not tagged in SVN.

I wonder what the “best practise” method of upgrading in OSX would be?

Rails not working yet on Ruby 1.9 trunk

Saturday, December 15th, 2007

For those entranced by these benchmarks results and wanting to host Rails on Ruby 1.9 ASAP …

My testing shows Rails 2.0.1 failing on current svn/trunk installs of Ruby 1.9 on MacOSX 10.5.1.

But WEBrick works!

Ruby 1.9 build:

cd ~/src
svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby-1.9
cd ruby-1.9
autoconf
./configure --prefix=/usr/local/ruby1.9
make
sudo make install
cd /usr/local/ruby1.9/bin/
./ruby -v
-> ruby 1.9.0 (2007-12-15 patchlevel 0) [i686-darwin9.1.0]

Rails 2.0.1 installation:

pwd
-> /usr/local/ruby1.9/bin
sudo ./gem install rails
-> Successfully installed actionpack-2.0.1
-> Successfully installed actionmailer-2.0.1
-> Successfully installed activeresource-2.0.1
-> Successfully installed rails-2.0.1
-> 4 gems installed
-> Installing ri documentation for actionpack-2.0.1...
-> Installing ri documentation for actionmailer-2.0.1...
-> Installing ri documentation for activeresource-2.0.1...
-> Installing RDoc documentation for actionpack-2.0.1...
-> Installing RDoc documentation for actionmailer-2.0.1...
-> Installing RDoc documentation for activeresource-2.0.1...
$

All installs nicely …

Attempting to run a Rails app (after install a few more requisite gems using above method):

$ cd /rails/my_1337_app/
$ /usr/local/ruby1.9/bin/ruby script/server
=> Booting WEBrick...
/usr/local/ruby1.9/lib/ruby/gems/1.9/gems/activerecord-2.0.1/lib/active_record/associations/association_proxy.rb:8: warning: undefining 'object_id' may cause serious problem
/usr/local/ruby1.9/lib/ruby/gems/1.9/gems/rails-2.0.1/lib/initializer.rb:224: warning: variable $KCODE is no longer effective; ignored
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-12-15 07:24:35] INFO  WEBrick 1.3.1
[2007-12-15 07:24:35] INFO  ruby 1.9.0 (2007-12-15) [i686-darwin9.1.0]
[2007-12-15 07:24:35] INFO  WEBrick::HTTPServer#start: pid=3386 port=3000
 
## I request http://0.0.0.0:3000/ ... 500 Internal Server Error
 
Error during failsafe response: can't convert Array into String
127.0.0.1 - - [15/Dec/2007:07:24:52 EST] "GET / HTTP/1.1" 500 60
- -> /

OK, it bombs out trying to actually process a request. But this error is really, really fast! I am actually serious saying that, the error *is* really fast.

Mongrel installation fails:

$ sudo ./gem install mongrel
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing mongrel:
        ERROR: Failed to build gem native extension.
 
/usr/local/ruby1.9/bin/ruby extconf.rb install mongrel
creating Makefile
 
make
gcc -I. -I/usr/local/ruby1.9/include/ruby-1.9/i686-darwin9.1.0 -I/usr/local/ruby1.9/include/ruby-1.9 -I.  -fno-common -g -O2 -pipe -fno-common  -c fastthread.c
fastthread.c:13:20: error: intern.h: No such file or directory
fastthread.c:349: error: static declaration of ‘rb_mutex_locked_p’ follows non-static declaration
/usr/local/ruby1.9/include/ruby-1.9/ruby/intern.h:556: error: previous declaration of ‘rb_mutex_locked_p’ was here
fastthread.c:366: error: static declaration of ‘rb_mutex_try_lock’ follows non-static declaration
## etc etc etc

So webrick’s all we have for now.

You can track the state of edge Rails’ 1.9 readiness in this ticket on the Rails Trac. Plugins, though, will be another matter, although some fixes are pretty easy; an early failure I’ve seen is with plugins using File.exists?('file') which is of course deprecated in 1.9 in favour of the far, far superior File.exist?('file').

I like using the 1.9 console, though – it really does feel snappier, especially to load irb!

Migrations much improved in Rails 2

Friday, December 14th, 2007

I hadn’t been using migrations much in Rails 1.x. I just didn’t like the workflow – it was too clumsy, and I got annoyed at writing out the files. The workflow in 1.x was as such:

1.

script/generate migration MigrationName [--svn]

2. go and manually edit 00x_MigrationName.yml in /db/migrations to reflect your desired database changes, both up and down:

class AddCreatedAtToStaff < ActiveRecord::Migration
  def self.up
    add_column :staff, :created_at, :datetime
  end
 
  def self.down
    remove_column :staff, :created_at
  end
end

3. rake db:migrate to apply the changes to the local database.
4. svn commit and cap deploy:migrations to apply the changes to the remote database

Too long – especially step 2. I knew I should do it in principle, but CocoaMySQL is right there – especially if you make several changes in the space of a few hours. In theory it’s best practise – but in actual practise someone as lazy (and impatient) as me tends to just do it directly in the DB, then eternally put off that day where they’ll finally “move to migrations”.

It’s not even the laziness – it’s the “flow”. I’m doing other things, I’ve realised I need this field. I don’t want to stop what I’m doing and write out a damn YAML file! I want the field there, right now. Too demanding? Maybe, but like I said, the DB is right there, and the difference between a 5 second edit and 2 minutes writing the file is a lot of lost concentration.

And various other solutions, such as auto_migrations, seemed good but in practise are too flaky and a dangerous, unsupported road to take.

Enter Rails 2.0, and migrations are far, far better. The core Rails principle of “convention over configuration” is in full effect here, with excellent results.

Now the process of adding a migration is as such:

1.

script/generate migration add_created_at_to_staff created_at:datetime [--svn]

Note the convention at work here. You’re implicitly telling Rails the table to use, in this case “staff”, and the field you’re adding – in this case one of Rail’s magic “created_at” fields. You then explicitly write the fields out, which you’d have to do anyway in CocoaMySQL or similar, or manually at the mysql command line.

2. rake db:migrate to apply the changes to the local database.
3. svn commit and cap deploy:migrations to apply the changes to the remote database

That’s only one step less, but it was the biggest and most annoying one. The actual creation of the migration file and addition to svn is now a single brief, easy-to-remember line. This is now terse enough and convenient enough to enter my personal development workflow, a very welcome improvement to the framework, and an excellent demonstration of Rails’ core principles in action.

Resolve conflict between jQuery and Prototype

Thursday, December 13th, 2007

I had a strange error where Prototype and jQuery were overwriting each other’s namespace. Please don’t ask me why I happen to using both – it’s just on one page, and it’s just until I work out how to duplicate my Prototype effort in JQ (I find JavaScript utterly incomprehensible and incredibly difficult to learn).

Anyway, I tried a number of tricks with loading order and including various bits of each. I couldn’t keep it working – either I had one or the other, never both. Then I read this page: Using jQuery with Other Libraries on the official jQuery developer pages. It recommends you do as such:

   <script>
     jQuery.noConflict();
 
     // Use jQuery via jQuery(...)
     jQuery(document).ready(function(){
       jQuery("div").hide();
     });
 
     // Use Prototype with $(...), etc.
     $('someid').style.display = 'none';
   script>

But I don’t have any Prototype script in HEAD. It’s all addressed through the default Rails includes. I didn’t want to start messing with that.

I implemented the above, it didn’t work but the failure was different – now Prototype was trying to work, but erroring out with prototype TypeError: Value undefined (result of expression $) is not object.

Solution: On a lark, I removed jQuery.noConflict(); and renamed all jquery-targeted $(function) shortcuts to jQuery(function):

   <script>
     jQuery(document).ready(function(){
       jQuery("div").hide();
     });
   script>
 
// in body: Ajax.new & co Rails commands

It’s a horrible nasty hack that gets around the horrible nasty problems from using two JS frameworks on the same page. Don’t copy this, I’m posting it only for your morbid curiosity. If you dare copy this horrible technique your Good Programmer’s Card is revoked. But it works!

Rails? Slow?

Tuesday, December 11th, 2007

Rails? Slow?

75 seconds is nothing! Why, when I was young, we’d count ourselves lucky if a web server responded within the day…

In its defence, I’d been doing other things before requesting again .. enough time for some of it to go into swap. But man, 75 seconds!

Rails: multiple assets servers with 1 server using Apache

Wednesday, December 5th, 2007

Rails 2 has added the ability to automatically serve static public files – “assets” – from multiple servers, to speed up loading times. This is well worth implementing and will speed loading times considerably. And it’s very simple to do. You’ll need Rails 2.0RC1+ for this. Obviously your implementation details may differ, especially filepaths on the server.

Step 1: In rails_app/config/environments/production.rb:

config.action_controller.asset_host = "http://assets%d.my_kewl_domain.com"

Step 2: In my_kewl_domain.com.zone

www              IN              A       31.337.31.337
 
assets0         IN              A       31.337.31.337
assets1         IN              A       31.337.31.337
assets2         IN              A       31.337.31.337
assets3         IN              A       31.337.31.337

Step 3: In httpd.conf

<VirtualHost 31.337.31.337:80>
ServerName assets0.my_kewl_domain.com
ServerAlias assets1.my_kewl_domain.com, assets2.my_kewl_domain.com, assets3.my_kewl_domain.com
DocumentRoot /www/my_kewl_domain.com/current/trunk/public
VirtualHost>

Note this is a separate vHost from your main application. Note also that it is looking straight into the /public directory of your app.

svn up, cap deploy, restart %w[named httpd mongrel] and you’re done.

Including the coming Ruby 1.9 (apparently still on course for sometime this month), this is a nice free speedup for your application.

Rails 2 – Too Much Magic?

Tuesday, December 4th, 2007

So I’ve been watching the RailsCasts episodes going through the latest features in Rails 2. I’ve read about them before – but it’s good to see them demonstrated by an expert.

But man – some of this is too much. Don’t get me wrong, I like magic – if I didn’t like magical free stuff I wouldn’t be using Rails at all. But there comes a point where there’s enough magic, and more just trades off too much for too little – diminishing returns, as it’s called.

Take this screencast: Simplify Views with Rails 2.0. It shows very clearly what I’m talking about.

Now some of this is good shit. The ability to write this:

<% div_for_product do %> # is this supposed to be <%= ?
<% end %>

And have it automatically generate div IDs and the like is great. That saves some nasty looking code – assuming it works properly, stays unique across multiple includes, etc. Good shit. A worthwhile addition.

But this:

# from
<%= render :partial => 'product', :collection =>  %>
# to
<%= render :partial =>  %>
# and for a single case
<%= render :partial =>  %>

I think this is bad news. Suppposedly Rails is going to look inside that instance variable, decide whether it’s an object or an array, and automatically use the correct partial, multiple times if it’s an array .. why? To save what, 15 keystrokes?

I would argue the “Rails 1.2″ way of doing this is about the most concise way to write this function imaginable while still maintaining decent at-a-glance understandability. It’s not so long and unweildy, is it? And you can see what’s happening instantly – ok, now render a bunch of partials named ‘this’ using whatever was in this . The word “collection” is a nice touch which helps you remember there’s a number of them.

The second one? Its behaviour literally changes according to what’s in that instance variable. Is it really that much nicer to look at that it’s worth losing the information necessary to see, at a glance and unambiguously, what it’s doing?

There’s more, and worse: forms, where we go from this

<% form_for :product, :url => product_path(), :html => {:method => 'put'} do |f| %>

to

<% form_for  do |f| %>

And if you’ve used the strict Rails conventions, mapped all your resources in routes.rb, are using the strict controller layout as demonstrated in the resources scaffold generator and have a picture of DHH as your desktop background, it’ll know what to do and work.

Now, at this point you might be saying “but you don’t have to use these features – it’s only if you follow the convention, which is the whole point of Rails! Follow the convention, get free benefits – it’s been like that since day 1″!

I agree with that, kind of. But there is such a thing as too much convention, and too many limits, and – this one’s my point – too much “magic”. I know it’s a bit silly to talk about “vendor lock-in” in the context of a Rails project but following “The Rails Way” is beginning to smell strangely similar. And these extraordinary efforts to save a few keystrokes, ONCE, at the expense of readability (and no doubt speed!) are beginning to seem less like cleverness and more like Koolaid-driven idealogy.

We’ve been told, again and again, that it’s all about “Beautiful Code”. And you know, I appreciate that up to a point. But when the code is getting less readable and more dependent on arbitrary chains of “convention dependence” which may or may not work (and which may or may not change in 3.0!!) then I start getting cold feet.

You know what? I’m working on *a* web site, not *the* web site like these changes all seemed designed for.

Predictions of a coming fork, anyone? “Rails Lite”?

Oh, and despite the endless hours which must have been poured into this kind of useless bloat, YAML handling in rails is still UTF8-unsafe.

UPDATE: Sure, you can just not use these features. But the codebase bloats, the execution speed is slower – and it’s not like it was fast to begin with. I argue these new features make the code more difficult to read and learn – hurting the Rails community as a whole, reducing numbers of developers, marginalising the framework – as someone with a considerable investment in that framework I am a stakeholder in Rails, and it’s from that position I comment.

Make shadow.rb serve unicode

Sunday, December 2nd, 2007

Shadow is an awesome little project that gives you a tiny, zero-config REST server for your database. Just pure GET PUT POST DELETE, nothing more, nothing less. Uses mongrel for the net and AR for the db – you’ll need to point it at your database.yml.

But it didn’t do UTF8 out of the box, so let’s change that:

1
2
3
4
5
6
7
8
9
10
$ diff shadow-old.rb shadow.rb
5a6
> require 'Ya2YAML'
12a14
>     $KCODE='u'
42c44
<       out.write obj.to_yaml
---
>       out.write obj.ya2yaml
$

できた!

I really love this kind of thing. Rails is becoming a MONSTER and is a bitch to force to play with anything else on your server(s). I think we’ll see a lot more of this kind of thing – a breaking-out of small pieces of very nice Rails functionality, into a way that makes them play nicer in a team.

Dead simple IP to Country in Rails

Saturday, December 1st, 2007

Step 1:

Follow these instructions to get MaxMind’s GeoLite IPCountry table into your Rails MySQL database.

Step 2:

In a Rails Controller:

  def get_country_from_ip
    ip = request.remote_ip
    result = ActiveRecord::Base.connection.execute("SELECT country_code FROM ip_country WHERE MBRCONTAINS(ip_poly, POINTFROMWKB(POINT(INET_ATON('#{ip}'), 0)))")
    result.fetch_row
  end

Step 3:

There’s no step 3. There’s no step 3! Ahahahaa!

.rhtml vs .erb

Monday, November 26th, 2007

post_update <<-EOF
Can the people who read this rant please remember that this is not a very serious blog. In fact it’s mostly just me talking shit and this post is a prime example. I actually like the changes I’m dissing below, it’s nothing but a rant for rant’s sake and I have no idea why Google seems to be sending so many people to it – so don’t get all upset and leave nasty comments telling me I’m an idiot.

This is a personal blog of the most whimsical and useless kind, and I make no pretensions otherwise. Bear that in mind. Thanks! :-)
EOF

Can someone please tell me what the point of moving from .rhtml to .html.erb is?

I mean seriously. There wasn’t a naming conflict, .rhtml isn’t the nicest extension on earth but it was pretty unambiguous as to what it was – ruby mixed with HTML.

.html.erb is if anything worse. What kind of a file has TWO extensions? Hell, why not have fucking ten. I sometimes like to put CSS and JS into my files as well, they’re feeling a bit left out – I guess that according to this new “all inclusive” philosophy they’re properly named index.html.css.js.erb.

And what the fuck does ERB even stand for? Embedded Ruby, right? Well that would be great if Ruby was two words. One acronym per word is the English standard. Yet another example of Rails flaunting the standards.

I just don’t see the point. Trying to enforce a taxonomy on what are by nature highly mixed and variable files is an exercise in futility. And furthermore, the .erb is completely superfluous within the already highly structured folder structure of a Rails app. What the hell else would it be?

Change for change’s sake. DHH is drunk on power!

learning jQuery

Friday, November 16th, 2007

I’ve put it off as long as I reasonably could, but it’s a fact of life for those developing web sites these days – at some point you’ll need to learn JS. I’ve managed to hack together a bit of JS in the past, and managed to put together a few bits and pieces of Prototype code, but I’ve never been even a little bit comfortable with it.

And I’ve always disliked Prototype and its companion Script.aculo.us, or whatever the fuck it’s called. Firstly, combined they’re over 100K (!!!!) which is INSANE. A javascript library must be as small and lightweight as possible! Secondly, I find their syntax weird, trying-to-be-ruby-but-not-quite, hard to grasp and frankly Not Worth Learning (TM). So, I needed a replacement.

Contenders are MooTools and JQuery. Initially I had thought mootools was the best option – it’s certainly got a nice website, with some very compelling demos. But as I looked into it further I lost confidence. You know the feeling – you begin to realise that this #{whatever} has been designed and built by someone who does not share your perspective on things. The demos, while beautiful, were opaque and uninstructive. The mootools framework ignores namespace and plays havoc with anything else you might wish to use. The documentation is a shambles, third party writings have a decided “in-group” feel to them, even the pictures of the developers had a nasty 37Signals-esque “kewl” look to them. Well, fuck that, and fuck that name as well.

Which leads me to jQuery, at 24KB (packed) the smallest (and fastest) of the frameworks.

I like a number of things about jQuery. Firstly, as I mentioned, it’s lean and mean. Seriously – fuck Prototype and its 100K download before you’ve even done anything!! In what kind of universe is that even remotely acceptable? People still use dial-up, you know! You’re looking at upwards of 20 seconds just to download the javascript file!

Anyway. Secondly, I like its selectors. They’re closer to the “metal” of CSS/DOM than any of the others. For example, here’s how you’d, say, hide

="hide">hide me!>

in jquery:

$('span.hide').hide();

I like it. $ sends to jQuery. Then you have the css selection: a span, and then its class (with a dot – an ID is selected with a #, just like CSS) – all sent, nicely, to a reasonably named function. Understandable enough.

Installing couchdb on RHEL4

Tuesday, October 23rd, 2007

1. Install erlang

Ignore the instructions here which are misleading and outdated.

cd ~/src
mkdir erlang
cd erlang
wget http://www.erlang.org/download/otp_src_R11B-5.tar.gz
tar xzvf otp_src_R11B-5.tar.gz
cd otp_src_R11B-5
./configure && make && sudo make install
## ignore warnings about jinterface and odbc

2. Solve dependencies. You’ll need EPEL

yum install icu libicu-devel

3. install couchdb

cd ~/src
svn checkout http://couchdb.googlecode.com/svn/trunk/ couchdb
cd couchdb
./bootstrap && ./configure && make && sudo make install

You may need to change one line in configure.ac: You don’t need to do this in latest builds (last tested 0.73a)

38
39
--FLAGS="-I${ERLANG_HEADERS_DIRECTORY} -I/opt/local/lib/erlang/usr/include/"
++FLAGS="-I${ERLANG_HEADERS_DIRECTORY} -I/usr/local/lib/erlang/usr/include/"

or if you don’t want to do that, this nasty hack will paper over the problem: (unnecessary in recent builds)

ln -s /usr/local /opt/local

4. start couchdb

sudo couchdb
couch 0.7.0a548 (LogLevel=info)
CouchDB is starting.
CouchDB has started. Time to relax.

UPDATED to cover recent builds.

couchdb: switching to experimental branch

Friday, October 12th, 2007

Current CouchDB development is progressing in an experimental branch named “interface-changes”, and it’s not in trunk yet. As the name implies, the interface is changing and it’s very useful.

To switch your svn checkout to this branch, do this:

svn sw http://couchdb.googlecode.com/svn/branches/interfacechanges/
./bootstrap && ./configure --prefix=/opt/local && make clean && make && sudo make install

You can then have a look at the “documentation” to see some of the new changes.

While still alpha, it’s still a very interesting project. The prospect of getting something like Map/Reduce capability natively in a database is almost too exciting for words, if you’re a data nerd like me. Well, figuratively speaking, Map’s there, but Reduce isn’t yet – still, it’s great to get your hands on what seems sure to become a Big Thing so early. Oh, and in case you were wondering, COUCH stands for “Cluster of Unreliable Commodity Hardware”.

Imagine GFS and Map/Reduce, baked into a single databse, with JSON in/out, pluggable query language, and native REST .. what’s not to love?

Laika’s ThingFish is a Ruby-based competitor. You might think I’d be more interested in that, since it’s in my favourite language! Not so. The very thought of a Database programmed in Ruby actually gives me an instant waking nightmare along the lines of running through treacle, gulliver in lilliputia, 80286SXs with 12MB of RAM, etc. And using mongrel server for a database!

UPDATE: it’s been merged to trunk, so just forget that interface-changes stuff.

Installing nginx on RHEL4 x86_64

Thursday, October 11th, 2007

Want to use the new kid on the block, nginx, as a server on your old RHEL4 server? Well, guess what, it’s now available in EPEL so it’s incredibly easy.

First add EPEL as a repository on your system. They provide a package to do that:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm

now install nginx. You’ll need to specify the testing repo. I use yum but the same thing will work with up2date

yum install nginx --enablerepo=epel-testing

Done. Now go edit /etc/nginx/nginx.conf to use an IP or port that doesn’t conflict with anything, and:

service nginx start

UPDATE: Updated EPEL RPM link with new version.

Installing CouchDB on MacOSX

Monday, October 8th, 2007

If you, like me, have been keeping an eye on the extremely interesting CouchDB Project then maybe you’ve thought about playing around with it a bit on your Mac. This turns out to be very simple.

I assume you have macports w/ subversion (and XCode, of course) installed already. Most of this comes straight from the Readme but I hate reading those, I just want someone to write what I have to do – maybe you do too, so here you are!

UPDATE: 11th October

Reinstalling after noticing 60 commits in 3 days .. now that’s active development.

(more…)