Archive for the ‘ruby’ Category

h1

Automatic blog posts from your Google Reader Shared items

September 9, 2007

You may notice every once in a while I have a post titled “items from” and some date, with the content being some (hopefully) interesting items I’ve read on the web that day. Creating that post looks like a simple matter of manually creating a new post, copying and pasting the title and a summary, then adding some formatting and publishing. While that isn’t too hard, even easier would be if you could just share interesting items in your Google Reader (using the “Share” link) during the day and have them magically appear later that night in your blog.

Below is a Ruby script I wrote that does just that. It consumes an Atom feed of your Google Reader Shared Items, formats them, and automatically posts them to your WordPress blog using their XML-RPC interface. You can run this manually, or schedule it to run at a specific time as a cron job. Note that this does not rely on inserting the post directly into the WordPress SQL tables as I’ve seen other WP plug-ins do - that requires you to have access to the WP database, which you don’t if (like me) your blog is hosted at wordpress.com.

This whole process takes less than 100 lines of Ruby, including lot’s of comments. What this shows is how easy it is to “glue” together different web services to accomplish a useful goal when all the players use well documented web standards. It also shows how simple, yet powerful, a dynamic scripting language designed for the web can be.

The script can be found here. Read the comments at the very top for examples of how to run it. Make sure you edit your personal settings in the “Stuff you should change” section.

Later, I’ll show you a similar script that automatically creates blog posts from your del.icio.us links.

h1

On the relationship between open source software and real estate business models

September 3, 2007

pot of gold?I had originally titled this “Installing Ruby on Rails on Mac OSX”, but as I typed, it gradually became about this other, more general, topic.

I saw this a little too late, but next time, I’m going to try RM-Install from Five Runs. Looks like it installs a very comprehensive Ruby on Rails stack from one place in minutes.

This is also an interesting look at an open source business model. Notice that they are offering you the free Ruby on Rails stack that you need, in a value added package, in exchange for lead information. You must enter an accurate e-mail address because they are delivering the actual download link to your inbox. To be clear, everything they are giving you is open source and freely available from different sites, but they are combining it into a single package so that the customer can save time and increase compatibility.

Five Runs also currently offers a Rails management solution called RM-Manage (very cool, watch the demo video) for which they charge a monthly subscription fee. From the looks of it, these two offerings are just two pieces in a much larger suite of services they are building out to ride the wave of Ruby on Rails as it washes into the enterprise space.

This model relates to real estate in so many ways:

  • What can you package up and offer potential customers, at low cost to you and free to them, that are still valuable enough for them to give you valid contact information?
  • What are you doing to ensure you contact that lead ASAP to find out further needs, establish a real relationship, and move them on to your other offerings that will generate real revenue?
  • Traditionally for real estate agents, that real income is in the form of commissions, but what can you learn from an open source based software company about generating revenue from suites of related products? Maybe on a subscription or per use basis?
  • Note how simple and professional, both the site in general and the lead form in particular, are. They make it very clear, in a subtle yet direct way, that “mickey@mouse.com” will not cut it here. If you want the value, we want the real you.

How long do you think it took me to get an e-mail from Five Runs? Yep, about thirty seconds. Of course it was automated, but if I now proceed with the download and the install goes smooth, I receive true value and I now have a positive relationship established with this company.

How long do you think it will take before someone actually calls me on the phone? I’d bet this week I’ll hear from someone.

Photo credit

h1

REST 101 with Rails

September 1, 2007

railsI’m doodling around with a new idea. Since it’s goal is to produce several standardized web feeds (Atom, KML, HTML) of a data set over the web, I’ll be using Ruby. Since it makes sense for this to be a REST web service, I’ll also be using Rails. Mike asked about Rails yesterday, and I just read a GREAT introduction by the Softies on Rails guys called “REST 101“. It’s split into five parts (start reading from the bottom), with the first being a pretty non-technical overview of HTML, HTTP, REST and understanding their differences, and the last being technical code samples to show why Rails is a very clean way to pull this off. It’s very well written and I encourage even non-technical people to read at least the first section. Others can read until their eyes glaze over.

BTW - these guys put on a two day “Essential Rails” seminar in Chicago which I attended this past January. I see another is coming up Sept 21-22. Highly recommended.

Photo credit

h1

Building librets on Mac OSX

September 1, 2007

SpaghettiI’ve used librets with Ruby on WinXP for a while now, but now I need it on my new Mac to try out some new ideas with RETS. Clearly, I’m a Mac “noob”, but boy - was this freakin’ hard! I’ve documented it here for future reference. Hopefully it will help someone else out.

Download librets

  • Download librets-1.1.9.tar.gz from CRT.
  • According to /doc/build/mac-osx.txt and unix.txt, it looks like there’s a lot of dependencies to install and build, which I’m not too comfortable doing manually.
  • There’s a note that that the OpenDarwin package manager can install these for you, and I remembered reading about MacPorts earlier, so that seems worth installing.

Install MacPorts

  • Download and install MacPorts from http://www.macports.org/
  • Make sure path is correct according to installation instructions.
  • Update MacPorts using “sudo port selfupdate”.

Install dependencies

  • Install Boost using “sudo port install boost”. Takes a while - about 15 minutes for me.
  • Install Expat using “sudo port install expat”
  • Install ANTLR using “sudo port install antlr”
  • Install libcurl using “sudo port install curl”
  • Install swig using “sudo port install swig”. This was not documented as a dependency, so it took a while to figure this one out after the below steps kept failing.

Build librets

  • “./configure” kept returning errors finding Expat and Boost files.
  • Used “./configure –with-expat-prefix=/opt/local –with-boost-prefix=/opt/local” instead.
  • “make”
  • “sudo make install”

Build librets ruby

  • In the project/swig folder, use “make ruby”

Test

  • In the project/swig/ruby folder, run “ruby login.rb” and “ruby search.rb”

You’ll know now if you’ve got everything dialed in. Note that when you are writing your own Ruby code in a different folder, make sure you include the path to librets.rb at the top like this:

# Prepend load path with path to librets.rb
$:.unshift(’/usr/local/src/librets-1.1.9/project/swig/ruby’)
require ‘librets’
include Librets

Geez! That took a while. I guess if I’d had a lot of *nix experience, it would have been easier, but librets has a special Windows install that easier.

Special thanks to the CRT guys for making librets freely available.

h1

Why a new Mac?

August 28, 2007

My home PC was about five years old and dragging running WinXP. I tried a little experiment with Ubuntu and I liked it a lot - more than XP for what I was doing at home. I but could never get sleep mode and color photos on the Canon Pixma i4000 working right, and those proved to be deal killers. After a few months, I gave up.

So I needed a new computer - web, e-mail, spreadsheet, photos, minor video - basic stuff.

Reasons I decided to try a Mac:

  1. With Firefox, OpenOffice, and Parallels, you no longer need Windows to run your most used apps. I decided the only app I really needed to run that required Windows was MS Money, and Parallels has that task covered.
  2. My new favorite programming language is Ruby, and that crowd is full of switchers. No need for Windows to write web apps.
  3. Lot’s of people I respect have been leaving Windows for a Mac and cite the “OS’s are becoming irrelevant, so why not use a beautiful OS” meme. See Marc Andreessen (he of Netscape, Opsware, Ning, and the cover of Time Magazine fame) and Marc Cuban (he of the Dallas Mavericks, broadcast.com, and collaring his Yahoo! stock fame).
  4. I’ve got Greg to rely on for tech support.
  5. I’d liked NOT using XP so much with Ubuntu, but needed a little more driver support and ease of use.

iMacI waited for the new 24-inch iMac’s to come out and snagged one the first week. The display is unreal, the desktop is beautiful, and everything just works. I can run WinXP in a window faster than on my old computer, and I can even drop down into Terminal for a bash shell. There’s a reason I’m seeing more and more Mac notebooks at every conference I go to.