RudyGems

Matthew Rudy Jacobs
see me swim
Github
see some of my code
WorkingWithRails
see me working with rails

SolrQuery - build your solr queries dynamically in Ruby

I’ve been using ActsAsSolr for about 6 months.

And at work I developed some code to make SOLR queries work a bit like the conditions in ActiveRecord.

Check out my library at Github. http://github.com/matthewrudy/solr_query

SolrQuery.build(:keyword => "Feather duster"
=> "feather duster"
SolrQuery.build(:keyword => "clean",
                :organisation => [organisation1, organisation2])
=> "clean AND organisation:(275 OR 6534)"

Wicked!

Check out the readme for more examples.

Comments (View)

UID problems across a shared mount?

We just moved to new Ubuntu servers.

We use file-column (with some modifications) to deal with our file uploads.

deploy@jgp-web01:/var/www/oursite$ ls -l public/uploaded_file/file_name/000/000/051/585/ 
total 4
-rw-r--r-- 1 gerhard www-data 2670 2008-11-15 05:09 MatthewJacobsCV.txt

deploy@jgp-web02:/var/www/oursite$ ls -l public/uploaded_file/file_name/000/000/051/585/
total 4
-rw-r--r-- 1 deploy www-data 2670 2008-11-15 05:09 MatthewJacobsCV.txt

If you look carefully, you’ll see one is owned by “deploy” and the other by “gerhard”.

These are mounted by NFS, shared across the two computers.

So these are actually the same file, but with different permissions on each.

A quick use of the “id” command confirmed this;

deploy@jgp-web01:~$ id deploy
uid=1004(deploy) gid=33(www-data) groups=33(www-data),1005(aspire)

deploy@jgp-web02:~$ id deploy
uid=1002(deploy) gid=33(www-data) groups=33(www-data),1003(aspire)

The answer is;

root@jgp-web01:~# usermod -u 10000 deploy

root@jgp-web02:~# usermod -u 10000 deploy

boom!

Now this is resolved, but you’ll have to chown all the existing files, back to `deploy`, else they’ll still be attached to the old uid.

Comments (View)
svn switch —relocate svn://oldserver svn+ssh://newserver need to move your svn repository?
Comments (View)
Welcome home DHH!
After a long time, it seems DHH is back, actively commiting to rails.
Getting ready for 2.2 to be released, he’s committed 20 times in the past week.
It’s nice to see.

Welcome home DHH!

After a long time, it seems DHH is back, actively commiting to rails.

Getting ready for 2.2 to be released, he’s committed 20 times in the past week.

It’s nice to see.

Comments (View)

Google App Engine to support Ruby?

A recent post on the Google App Engine blog refers to;

“Support for a new runtime language”

That’s got to be ruby…

Imagine a bespoke Sinatra-style minimal framework, with DataMapper bindings to the Google DataStore.

No doubt it’ll be pretty quick to make it work with Merb as well.

AWESOME.

Why did google never reply to my job application asking to work on it?

(if you haven’t seen the videos from last years Google IO, then they’re well worth watching - here)

Comments (View)

it’s hard enough to push out a great idea,
even if you thought of it,
and have spent years thinking about it.

If a potential investor is going to take the time, money, and bother to steal your idea,
then someone else is going to buy it from you
before they have a chance.

me, talking to Stephen Strudwick about startups, already in Beta, being too scared to pitch to investors!
Comments (View)

Rendering layouts that live in /public?

At work we have the following concept.

  1. a “site” has a subset of our content
  2. a “site” has a url - eg. “oursite.com/stickers” or “stickersNOTvicars.com”
  3. a “site” can have its own customised layout, or fall back to the default one

How does this work in code?

  1. site.articles (pretty simple)
  2. a whole load of “route filters” that match the incoming host
  3. the code I’m writing about

So, historically we did

class ApplicationController
  layout :determine_layout
  def determine_layout
    if File.exists?("#{Rails.root}/public/sites/#{@site.id}/application.rhtml")
      "../../public/sites/#{@site.id}/application"
    else
      "site_default"
    end
  end
end

This was a hack, and it breaks with Rails 2.1.1, so after a day or so playing with the internals of ActionView I discovered this;

append_view_path("#{Rails.root}/public/sites")

And it works!

We just need to set;

"#{@site.id}/application"

as our layout, and we’re away.

Site-specific layouts that live in /public!

Comments (View)
I didn’t get drunk enough to try the Goggles. Next time!
Comments (View)
 Google Goggles are good enough for me?
On Monday its the LRUG quiz.
Can Google’s entry into drunken embarassment prevention really hold out against my mathematical skills?
Am I just too elite?
At level 5 (the hardest) we still get sums like “6x9”!
Does my mathematical ability really drop that much?
We’ll see tomorrow!

Google Goggles are good enough for me?

On Monday its the LRUG quiz.

Can Google’s entry into drunken embarassment prevention really hold out against my mathematical skills?

Am I just too elite?

At level 5 (the hardest) we still get sums like “6x9”!

Does my mathematical ability really drop that much?

We’ll see tomorrow!

Comments (View)

What would happen if you ripped out your Db server?

Does your application and architecture really have failover?

If I broke into your datacentre, ripped out, and hid one of your servers, what would happen?

Is your architecture the biggest hurdle to scaling your web app?

Blain Cook and Joe Stump not talking about Twitter’s scaling issues.

Comments (View)