EC2 just got 10x better
27 Mar 2008Now Amazon’s EC2 supports static IP addresses that can be pointed at any of your instances on the fly. This is cool.
Categories : Web Development
Now Amazon’s EC2 supports static IP addresses that can be pointed at any of your instances on the fly. This is cool.
Many moons ago I wrote a quick status report on my first 100 days of Rails consulting. Now that it has been over a year since I joined the freelance world full time, I figured it was a good time to reflect again on that experience.
I said it then, and I’ll say it again — this experience has been a blast. I may go to work for someone else again at some point in the future, but for now I’m loving being independent. I’ve learned to manage the stress of worrying about where the next check is coming from, and I’ve gotten into a rhythm with the ebb and flow of client work, so life is good.
If you happen to need someone to help you build your web application, drop me a line. My schedule stays pretty full, so don’t wait until the last minute to get in touch!
I’m looking forward to seeing what the next year will bring. :)
I recently integrated the Scribd API with my resume management application, Catch the Best, so I thought I’d share a few details here about how I did that in case you are interested in using their great API.
To get started, first you need to install the rscribd gem and set up an account at Scribd to get API access.
Once you do that, it’s easy to send a document to Scribd:
require 'rscribd'
Scribd::API.instance.key = 'yourkey'
Scribd::API.instance.secret = 'yoursecret'
Scribd::User.login 'login', 'pass'
doc = Scribd::Document.upload(:file => '/path/to/file')
One thing to consider when creating documents with Scribd is that you don’t want to be uploading documents to them during the request/response cycle. It’s not that Scribd is particularly slow, but you don’t want unnecessary delays slowing down your users. To accomplish that, I move the call for Scribd::Document to a method in my Attachment class (which is using attachment_fu), and then queue the creation of the Scribd document with the excellent Bj plugin. So, my model ends up looking something like this:
class Attachment < ActiveRecord::Base
has_attachment ...
after_create :send_to_scribd
def scribdify
doc = Scribd::Document.upload(:file => self.full_filename, :access => 'private')
...
end
def send_to_scribd
Bj.submit("./script/runner ./script/scribd.rb #{self.id}")
end
end
The scribd.rb script is itself pretty simple — it just does the setup code for Scribd and then calls scribdify on the attachments it finds from the arguments passed to Bj.
And that’s it! Easy Scribd API integration for your Rails app. You can see the finished product here: Catch the Best integrates with iPaper
Update: See info on integrating Scribd in your Rails app — client-side edition.
This is cool… TaffyDB is an in-browser javascript database. This could be really useful for doing changes to a dataset without moving page to page, and then simply sending JSON back to a Rails or Merb app to save the changes.
Chris came up with this excellent little snippet, try, as seen on Ruby Inside.
That inspired me to a create a similarly sugary method for an idiom I use time and again:
class Object
##
# @person.name rescue nil
# vs
# @person.do_or_do_not(:name)
def do_or_do_not(method)
send method rescue nil
end
end
Recent Comments