Categories
computer personal

Rails Presentation: attachment_fu, Kropper and Mugr.com face-based services preview.

I’m giving a brief talk at tonight’s Rails meeting in Chandler at 7:00pm on what we’re doing with attachment_fu and Kropper for upcoming face-based search service mugr.com. I’ll post the slides afterwards for those who can’t make it, but you won’t get to see the Über-secret developer build unless you come 🙂

Slides: Keynote PDF

Categories
computer

Rails attachment_fu/Kropper Scaling Fix: attachment_fu_skip_resize

I recently integrated Kropper into a custom RoR application for OpenRain affiliate img surf. A fundamental flaw in the upload-save-crop-save process used by Kropper is that attachment_fu automatically scales down the image on first save to :resize_to dimensions. After the subsequent crop–which may result in a significant drop in resolution–the image is scaled back up to :resize_to dimensions: an ugly lossy operation.

The attachment_fu_skip_resize plugin gives attachment_fu the ability to temporarily bypass resizing of the full-size original image, thus allowing your final cropped photos to be of the highest quality as possible.

  1. Install the plugin.
  2. In your attachment_fu image class, add..
    attr_accessor :skip_resize
  3. Any time you want to save an image without invoking resizing on the original image..
    image.skip_resize = true
    image.save

    Thumbnails will be generated at their defined resolutions regardless of the skip_resize flag.

Categories
computer

Dynamically Generating SSL Certificates with Ruby on Rails

OpenRain had a couple projects recently need to programmatically generate private keys and SSL certificates in Ruby. To contribute back to the community, we’re releasing several small things today.

  • SSLsicle.com A simple form which does the OpenSSL grunt work and pop outs an SSL certificate ready to use with Apache (or whatever). SSLsicle uses..
  • eassl_fix A Rails plugin which patches a small but critical bug in the eassl v0.1.1643 gem which makes OpenSSL object manipulation a bit less dense. I’ve submitted a patch (included) to the author, but as of today he hasn’t applied it. (Also, props to the JumpBox guys.)

If you need to write your own code to generate SSL certificates in Rails..

  1. sudo gem install eassl
  2. Install the eassl_fix plugin
  3. Bust out a view for the user to enter the information that gets baked into the cert and then write a few lines in your controller…
    require 'eassl'
    key = Key.new
    options = {
    :country      => params[:csr][:country],
    :state        => params[:csr][:state],
    :city         => params[:csr][:city],
    :organization => params[:csr][:organization],
    :department   => params[:csr][:department],
    :common_name  => params[:csr][:common_name],
    :email        => params[:csr][:email]
    }
    name = CertificateName.new(options)
    csr = SigningRequest.new(:name => name, :key => key)
    ca = CertificateAuthority.new(:password => nil)
    cert = ca.create_certificate csr
    @pem = key.private_key.to_s
    @pem += cert.to_pem
  4. @pem.to_s will contain an unencrypted private key as well as a signed certificate suitable for deployment.
Categories
computer

RailsConf 2007 Session Content Download

Here are all the working RailsConf 2007 presentation slides and additional session materials I could find this morning, packaged in a single .zip file for your convenience. The content is an aggregate of things posted to the wiki, web2expo and a few other places on the web.

Categories
computer photography

RailsConf 2007 Photocast

Me and a couple thousand other Rails users are chillin’ in Portland right now enjoying the wifi. Here’s my photocast of things related to RailsConf and Portland, which I’ll update each night.

Categories
computer

RailsConf 2007 (USA) Registration Re-Reopened. New Track & Keynote Announced!

I received this from O’Reilly just a couple minutes ago..

—- BEGIN EMAIL —-

RailsConf 2007
May 17-20, 2007
Oregon Convention Center
Portland, Oregon
http://conferences.oreilly.com/rails
A fourth technical track has just been added to the RailsConf schedule.
That means a limited amount of space has opened up for those folks who
didn’t get a chance to register before RailsConf first sold out in
February.

If you haven’t yet registered and would like to attend RailsConf 2007,
please register now at:
http://conferences.oreillynet.com/cs/railswaitlist/create/reg/
(If you do not already have an O’Reilly user account you will be required
to create on in order to register for RailsConf. When prompted for your
password, click on “No, I am new to O’Reilly.” When you have finished
creating an account for yourself you will be taken back to the RailsConf
registration page.)

Note: We are no longer accepting checks for this event. All registration
fees will need to be paid in full by credit card at the time the
registration form is completed.

RailsConf Keynotes Just Announced
Chad Fowler and Ruby Central have put together a stellar program, which
now includes four simultaneous tracks. They’ve also just announced some of
the keynote speakers presenting on the main stage this year:

Ze Frank, Comedic Digital Savant
David Heinemeier Hansson, Creator of Ruby on Rails
Dave Thomas, The Pragmatic Programmers
Avi Bryant, Creator of Seaside
Tim Bray, Co-creator of XML and Atom
More speakers are being confirmed every day. Check out the entire list of
speakers and sessions on the RailsConf web site:
http://conferences.oreillynet.com/pub/w/51/speakers.html
Remember, seating is limited and likely to sell out very quickly. If you
haven’t already done so, register right away as this email does not
guarantee your seat.

We look forward to seeing you in May!

The RailsConf 2007 Team

—- END EMAIL —-

Categories
computer

Fixing "wrong number of arguments" Error w/Rails 1.2.3 Upgrade

If you’ve just upgraded your Rails gem from 1.2.2 to 1.2.3 and are getting the following error on database hits..
wrong number of arguments (1 for 0)
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/active_record/vendor/mysql.rb:566:in `initialize’

..note that updating RAILS_GEM_VERSION in environment.rb appears to be required. Running a 1.2.2 application on 1.2.3 (even when 1.2.2 and all dependencies installed) will yield this error. Whatever.