Labview_rails and development motivation
Alright, my wife has been trying to convince me that I should share the one-off I wrote for our internal lab management, so today I finally got around to fixing the last *major* bug in the system, and putting it up on github.
Yep, that’s right, you too can have a quasi-specialized lab management Ruby on Rails application to manage all the machines in your lab!
What I do hope that this does is inspire me to become a better Rails developer. I’ve been using Ruby for over a year now, I an extremely confident in my Ruby skills, and I’ve made many things I consider useful for myself and maybe for other people. Labview was my first real Rails project, and by first “real” project, I mean first one that I use every day, other people in my office use, and I feel halfway confident releasing it for people to see.
On the other hand, the testing is lacking, documentation is poor and some of the authentication systems are kind of hacked together. I’m labeling this one a “learning experience” and moving on. I probably won’t commit any more to Labview (but that doesn’t mean I wouldn’t be open if someone wanted to fork it on Github…) simply because right now it works well enough.
Oh yea, and I can’t thank my wife Delilah enough for the better visual design. You should have seen Labview back when it was hacked together in PHP. It was a pastelle assault on the eyes.
Anywho, Labview is a really simple project, and a great start for someone interested in getting into Rails. I’ve learned a lot from developing it, and a lot of the knowledge has immediately been applied in some other projects I’m working on. Perhaps the next Rails app I work on will conform for test-driven-development? I’m looking forward to other projects I have ideas for in the future
I’m also excited about taking a look at Sinatra, since Atmos did a talk on it last night at the Ruby meetup. Specifically, I’m interested to see if I can build a ssh-tunneling server using only Sinatra and Ruby over HTTP…
From Newsbeuter to Instapaper with the Ruby RicePaper library
I love Instapaper, a truly elegant solution without any needless over-architecting. I use it every day, for queuing up articles to read during a lull in the workflow around here.
However, I’ve had an extra step in my article reading, see I read my RSS feeds in Newsbeuter, so I normally have to open the feed in Newsbeuter, open it in the browser, use the bookmarklet to add it to instapaper, then close the tab (until I want to read the article later). Well no more!
Enough introduction, I haven’t posted nearly enough on here lately, so I wanted to share a little library I’m working on called RicePaper. It’s a simple Ruby library/cli tool for submitting URLs to Instapaper. I’ve started a github project for it, go check it out or download the file directly. RicePaper requires the HTTParty gem (which you can install using “sudo gem install httparty” on a system with Ruby installed) Ricepaper works extremely easily from the command line, like so:
% ./ricepaper.rb -u user@mydomain.com -p mypassword -t "The IWishI site" "http://iwishi.org"
The -t “<title>” option is optional, Instapaper will attempt to find a title for the article without it. You can also use ricepaper from any Ruby code (if you’re a Ruby scripter) as a library by using this little code:
require 'ricepaper'
rp = RicePaper.new(user@email.com, password)
rp.add("http://www.asdf.com", "The ASDF site")
rp.add("http://www.google.com")
It’s extremely simple to use.
Anyway, back to what I was originally going to use it for, bookmarking a URL directly from Newsbeuter, for that, we’ll need a “glue” script, like this (I named mine ricepaper.sh):
#!/bin/bash
# Change these to be your instapaper credentials
USERNAME=email@domain.com
PASSWORD=yourpassword
# Where the ricepaper executable is located
RICEPAPER=ricepaper
# If the title is non-empty, set it
if [ ${#2} -gt 0 ]; then
$RICEPAPER -u $USERNAME -p $PASSWORD -t "$2" "$1" > /dev/null &
else
$RICEPAPER -u $USERNAME -p $PASSWORD "$1" > /dev/null &
fi
# Exit correctly, either way
exit 0
Watch out for the quotes in the script above, sometimes wordpress makes them “special” quotes, which confuses the bash interpreter.
Replace the username and password to your Instapaper credentials and put the correct location to the ricepaper ruby executable, then save the script, chmod +x it and put it in your path somewhere.
Only one step left, which is to add this line to your ~/.newsbeuter/config file:
bookmark-cmd ricepaper.sh
What happens now, is when you bookmark an article in Newsbeuter, it will call ricepaper.sh with the URL and Title of the article, so whatever you put the Title of the bookmark to be, that’s the title that will show up on Instapaper. Voila!

Feel free to email if you have any questions about using the script(s). Hope you enjoy!

