Recent Posts

New Business Card

September 11, 2006

Figured that I might as well follow in the footsteps of Luke Redpath and show you my new business cards.

New business
cards{width=”240” height=”180”}

Our Creative Direcrtor, Allison Beckwith felt that it was time for a redesign. I should try to snap a shot of all the past PLANET ARGON cards. We have them up on a wall in chronological order… dating back four years ago this month.

Since we were doing double-sided this time I wanted to be sure that there was enough space for writing on the back… which helps with writing down a note, giving someone a coupon code for hosting, or my cell phone number if they are special enough. :-)

Meeting up in London

September 11, 2006

I’m leaving for London tomorrow. Thank you all for your responses to my travel security questions. I really appreciate it. :-)

I’m going to be getting in on Wednesday afternoon and am going to try to meet up with people at PizzaOnRails.

Thurs-Fri is RailsConf fun… but I haven’t figured out what I will be doing over the weekend. I’m leaving for New York on Tuesday.

Does anybody know of any good vegetarian places that I should go out of my way to try in London? Interested in hanging out and talking shop? Email me! :-)

Question: Travel Restrictions

September 10, 2006

Travel restrictions?

When I purchased my tickets for my trip to London for RailsConf Europe through travelocity.com, it showed me the following warning (after I paid).

Traveling in the UK:

  • If you are traveling within the UK, you will have to check ALL of
your belongings. Wallets, IDs, and necessary medications are the
exceptions, and must be carried in a plastic bag (clear bags are
recommended).
```text
-   Laptops, mobile phones and iPods are among the electronic items
```text
banned in carry-on luggage on British flights.
```bash
-   Liquids, gels, and pastes are no longer permitted in carry-on
```text
luggage on board any aircraft within the U.S. and UK (This includes
toothpaste, sunblock, and perfume.)
```text
-   [Please check our website for updates and the latest
```text
information.](http://travelocity.custhelp.com/cgi-bin/travelocity.cfg/php/enduser/std_adp.php?p_faqid=1678)

So, I follow that link and come across this page, which doesn’t mention laptops, mobile phones, or iPods.

Does anybody know what the current restrictions are for flights to and from the US and UK?

RubyConf Express

September 08, 2006

Wow… this is awesome!

The sd.rb group is following up on our concept for The Argon Express. People are heading to RubyConf 2006 from San Diego, California to Denver, Colorado on the RubyConf Express.

DSCF1030.jpg{width=”240” height=”180”}

We had a blast on our two-day trip across the country… check out our photos on flickr.

It’s great to see the tradition continue!

Before
Boarding{width=”240” height=”160”}

ArgonExpress Band
Photo{width=”240” height=”122”}

Jeremy and
Robby{width=”240” height=”180”}

IMG_0306.JPG{width=”240” height=”180”}

Have fun! :-)

Apache, Typo, and Feedburner

September 08, 2006

A few weeks ago, I started using FeedBurner and posted a blog entry about how I configured Lighttpd to handle that so it didn’t disrupt everyone that subscribes to my RSS feed. This was working great… until the other day.. when I upgraded to Typo trunk. When I did this, I decided to start using mongrel::cluster and pound. Two days later… I’m noticing that my subscriber count has dropped over thousand people in a day… was it something that I said?

A ha! I was handling the redirect with Lighttpd and had replaced it with Pound.

So, I am now delegating this to Apache.


# Redirect typo feeds to FeedBurnerruby\ `RewriteCond %{HTTP_USER_AGENT} !^FeedBurner.*$ruby\ RewriteRule /xml/(atom|rss|rss20)/feed.xml$ http://feeds.feedburner.com/RobbyOnRails [R=temp,L]```ruby\

…and all was well again.

UPDATE

The rewrite condition should be !^FeedBurner.*$ not !^FeedBurner$.

Injecting Rails into your Legacy World

September 06, 2006

Many of you know that I have an unhealthy obsession with databases… in particular legacy databases. I’m not the only one it seems. :-)

I’m hoping to compile a few stories of how Rails enthusiasts have been able to take advantage of the Ruby on Rails framework within a Legacy environment, whether that be to talk with legacy databases, web services, or a piece of cauliflower. If you have a story (good or bad) of how you used Rails with a legacy system, please email me and let’s talk. :-)

Also, I would like to announce that I have started a new google group that focuses on the topic of using Rails with legacy environments. Check out the new Rails and Legacy group.

If you’re down in California, you can see my talk, “Rails meets the Legacy World” at the Ruby on Rails Seminar, which is being hosted at the AJAXWorld Conference & Expo.

Typo upgraded to trunk

September 05, 2006

I upgraded my blog to Typo trunk this evening. I hadn’t updated since late last year… so it was long overdue. I only had one issue with a migration from a while back.

old revision: 761

current revision: 1258.

I’m impressed that the upgrade worked so nicely… last year the migrations were a bit rough. :-)

UPDATE

I’m also now running this on mongrel with pound! I followed the configuration here.

PL/Ruby loves RubyGems and DRb

August 22, 2005

I admit it. I have had a torrid love affair with procedural languages ever since I started playing with PostgreSQL. The ability to share logic amongst all the applications touching the same database server.. was…well… a breath of fresh air.

What is a procedural language in Postgresql?

PostgreSQL docs describe them as, “…allows user-defined functions to be written in other languages besides SQL and C. “

Well, PostgreSQL has PLs for Perl, Python, Java, C, PHP… and even RUBY!

CREATE FUNCTION ruby_max(int4, int4) RETURNS int4 AS
' if args[0].to_i > args[1].to_i return args[0] else return
args[1] end ' LANGUAGE 'plruby';
````ruby
PL/PGSQL is nice and all, but it's not as fun as playing with Ruby.
PL/Perl... well is perl, and PL/Python... is python. Both PL/Perl and
PL/Python have untrusted variants. You see, they don't want your
PostgreSQL server to do anything harmful to the machine by being able to
do stuff like system('cat /dev/null > /etc/passwd). But for some
people, (like me) they want the flexibility of their language anyways.
:-)

Note: Never do this if your system user that runs PostgreSQL has
privileges to do anything harmful on your system.

The PL/Ruby documentation is minimal at the moment, but covers enough to
get you started. I don't know if many people are using it out there...
but hopefully that is about to change! I've played with it a bit, but
always wanted to be able to do stuff like require 'rubygems', but this
is a feature of an untrusted language. I even found myself digging
around in C code to see if I could figure out how to hack the plruby
language to skip over those checks... but I am not a C programmer and I
got lost in some header files.

Then it hit me. "Why haven't you emailed the author?"

So I emailed the author of PL/Ruby, Guy Decoux, who responded pretty
quickly with the answer to my dreams! Okay, I do have bigger dreams than
this... but you get the idea.

First of all, some of you might be thinking, "Why on Earth would you
want to do this?"

Well, here is a simple example of how it could be used with RedCloth
Let's say that I want to be able to perform the following query from
within SQL.

```sql
SELECT redcloth('**strong text** and *emphasized text*');
```bash
Why not do this in the application? Well, I do actually have a case
where I have an older PHP application that I will be porting to Ruby in
the future, but would like to give the application some access to some
of the features of Ruby that I will be using, such as RedCloth.

Okay, so show me an example of one of these scary PostgreSQL functions.

```sql
CREATE FUNCTION redcloth(text) RETURNS text AS '

  require "rubygems"
  require "redcloth"

  content = args[0]

  rc = RedCloth.new(content)

  return rc.to_html

' LANGUAGE 'plruby';
```shell
"Wait! You said this would be scary!?"

Well, PL/Ruby allows you to write... plain ole Ruby within your
functions. (do you see where I am getting here?)

## PL/Ruby meets RedCloth

```sql
rb=# SELECT redcloth('*strong text* and _emphasized text_');
```text
                         redcloth
```yaml
------------------------------------------------------------------
 <p><strong>strong text</strong> and <em>emphasized text</em></p>
(1 row)
```shell
## PL/Ruby meets ShortURL

```sql
CREATE FUNCTION rubyurlize(text) RETURNS text AS '

  require "rubygems"
  require "shorturl"

  return ShortURL.shorten(args[0])

' LANGUAGE 'plruby';
```text
...which allows for

```sql
rb=# SELECT
rb-#   rubyurlize('http://www.robbyonrails.com/') as link1,
rb-#   rubyurlize('http://moulon.inra.fr/ruby/plruby.html') as link2;

```text
      link1           |         link2
```ruby
--------------------------+------------------------
 http://rubyurl.com/lyoKm | http://rubyurl.com/dTo
(1 row)
```shell
## PostgreSQL meets DRb

Okay, this is one of the reasons why I wanted to play with PL/Ruby a bit
more. Distributed Ruby Objects... from PostreSQL?

### What is DRb?

If you don't know already... per the description in RDOC, "dRuby is a
distributed object system for Ruby. It allows an object in one Ruby
process to invoke methods on an object in another Ruby process on the
same or a different machine."

It basically allows you to share an object to other machines... at the
same time!

mmm...distributed objects...

### DRb Object

Here is a simple ruby script that you would run from the shell. It
creates a DRb object which accepts connections at localhost:9000.

````ruby
#!/usr/bin/ruby

require 'drb'

class MyRemoteObject
  def say(str)

```text
return "You say #{str}. I say #{str.reverse.upcase}!"
```ruby
end
end

server = MyRemoteObject.new

DRb.start_service('druby://localhost:9000', server)
DRb.thread.join
```text
Start me up!

```bash
$ ruby mydrb.rb
```text
Now that we have DRb running and listening for connections...we need a
client to connect to it.

DRb function in PL/Ruby

Here is a very simple DRb client script and I just drop that into a
PostgreSQL function.

```sql
CREATE FUNCTION drb_test(text) RETURNS text AS '

  require "drb"

  DRb.start_service

  ro = DRbObject.new(nil, "druby://localhost:9000")

  return ro.say(args[0])

' LANGUAGE 'plruby';
```text
The result?

```sql
rb=# SELECT drb_test('Potato');
```text
       drb_test
```yaml
-------------------------------
 You say Potato. I say OTATOP!
(1 row)

Are we having fun yet?

Okay, so how do I manage to get this to work? Well… for that, you will have to read my blog post, Installing untrusted PL/Ruby for PostgreSQL

Let’s all go get some coffee (or tea) and start playing with PL/Ruby today!