May 2007 Archives
“Now there is dynamic real pieces of data.
They don’t have to use Lorem Ipsum to fill it up with crap.”
DHH on designers using Rails view templates from the Scott Hanselman podcast
Nice podcast. Some great material in there.
Posted by Martin on May 29, 2007
I read with great interest Geoffrey Grosenbach’s recent article on how he gets his Rails news
I too ditched my feed reader some time ago in favor of aggregation/news sites such as Ruby Inside and PlanetRubyOnRails. They help get me my daily dosage of what is going on in the Rails World.
I now have a third additional source. It has become such a handy resource I have put it live on the
Working With Rails site. The WWR BlogSphere.
It basically gives you an aggregate view of Rails blog posts with a bias using metrics collected at WWR. So you can view the latest posts by the most authoritative or popular people. Or if you want to keep up with what is happening in the Rails source code you can follow by contributors. Even nicer if you have made recommendations you view only posts by these people - handy to make sure you are up to date with their latest developments.
I have plenty of ideas for enhancing the functionality and interface. I also welcome any suggestions or ideas. If you get a moment please do drop me some feedback - it’s all much appreciated.
Signing out at the airport (waiting for my flight to RailsConf)
Martin.
Posted by Martin on May 17, 2007
I had fun presenting on Monday at the LRUG meeting giving a talk on Distributed Ruby (on Rails)
I have put my presentation online - view it at Slide Share
If you are thinking about doing distributed ruby/rails it’s worth checking out. Plenty of links to resources and more.
Posted by Martin on May 16, 2007
Just a quick note to say that I’ll be giving a talk at tonight’s London Ruby Users group on distributed Ruby (and Rails.
More details on the event here
Posted by Martin on May 14, 2007
I have had the N95 just over a week now and it’s definitely fast becoming my favorite gadget of all time.
It really pushes the boundaries of what you can do with a phone - it’s pretty much got my wish list of features.
The good (most of the following are all in-built)
- Fantastic quality camera - takes great quality pics in pretty much all conditions
- Equally fantastic video camera
- Wireless and 3G web browsing (unlimited if on t-mobile)
- Catchup on RSS feeds, check your mail anytime any place
- Stream media where ever you are - bbc news, podcasts etc
- Post directly to Flickr and Twitter
- Make and receive VOIP calls - Skype on the move (with Fring)
- Apparently I can also blog directly from the phone but I’ve yet to try that
- Use can use your standard walkman headphones
- Phone is compact yet still usable and not a bulky PDA
- Extremely user friendly - lots of neat touches and intuitive shortcuts
The bad
- Battery life - 1.day at most if you are lucky
- Prone to occasional crashes
- Memory/storage - Soon runs out after a few tunes, pics and vids are taken.
- GPS / Navigation software - this should be in the list of good points but it’s been a real pain to try and setup. You can’t just download the maps directly and from what I have read the GPS can be flakey at times. I’ve yet to get this installed.
- Lack of support for Mac - bundled sync software / utils are all PC based
What next?
I’m heading to RailsConf next week and hoping that Duty free might be able to help me out with
the following:
- A 4GB micro SD (if it’s out yet)
- A spare charger - either USB or battery
I may even try and do some blogging from the conference next week - no promises though!
Posted by Martin on May 09, 2007
Get the wrong URL in twitter? Gotta love the error page:

Posted by Martin on May 09, 2007
I recently upgraded to the Nokia N95 (fantastic bit of kit btw) however my K750i was refusing to sync directly with either the N95 or my Mac. So short of time and knowing that the most up to date version of my contacts where on my phone here is a tip for quickly transferring your contacts.
Make sure you have Bluetooth turned on all three machines. On the K750i go the address book > options > advanced > send all contacts > via bluetooth
Select your Mac and it will upload a file with all your contacts in. You can now import these to the address book and sync the N95 directly with the Mac. Hopefully that might help somebody in need of a quick solution.
Posted by Martin on May 09, 2007
To the new blog.
Posted by Martin on May 09, 2007
Note: This is an import of a popular article that I wrote some time ago about using the Basecamp API with Rails. The internet archive version is also still available and contains blog comments.
37 Signals released the API to Basecamp this weekend.
This tutorial will show you how to get started using it in your
Rails applications. Don’t forget to enable API access on your account by
logging in, clicking the Account tab, and checking the box in the API section.
Make a new rails app
rails basecamp
Copy the ruby wrapper file to the lib directory from
http://www.basecamphq.com/api/basecamp.rb
Add the following at the bottom of config/environment.rb:
require 'basecamp'
Also ensure that all the relevant gems are installed:
sudo gem install xml-simple
Lets test this all works on the console:
script/console
session = Basecamp.new('beyondthetype.updatelog.com', 'username', 'password')
puts "projects: #{session.projects.length}"
projects: 1
All going well you should get the number of the project account listed.
Getting a list of all the message titles in our first project
session.message_list(session.projects.first.id).collect{|m| m.title}
=> ["Second post", "This is the first post"]
A list of all project message categories
session.message_categories(session.projects.first.id).collect{|c| c.name}
=> ["Assets", "Code", "Copywriting", "Design", "Miscellaneous", "Transcripts"]
A test post:
@project = session.projects.first
@category = session.message_categories(@project.id).first
session.post_message(@project.id,
{ :title => "A test post using the Basecamp API",
:body => "Testing 123",
:category_id => @category.id})
If you check back in the Basecamp web based interface sure enough the message
is listed. Sweet.
Lets extend this by creating a simple Rails application that lists all the messages in our project.
For the purpose of this exercise we will make use of Rails scaffolding. Create the table:
create_table "posts", :force => true do |t|
t.column "title", :string, :limit => 200
t.column "body", :text
t.column "project_id", :integer, :default => 0, :null => false
t.column "category_id", :integer, :default => 0, :null => false
end
script/generate scaffold Post
Edit app/controllers/posts_controllers.rb
At the bottom of the controller add:
private
def basecamp_connect
@basecamp = Basecamp.new('your_account.updatelog.com',
'your_username', 'your_password')
end
At the top
before_filter :basecamp_connect
def list
project = @basecamp.projects.first
@posts = @basecamp.message_list(project.id)
end
def show
@post = @basecamp.message(params[:id])
end
In the views you will need to remove all reference to pagination,
error_messages_for, and column names in the listing since the data
that is returned from Basecamp is not the normal Rails model.
All going well you will see your messages listed:

I’ll leave the updating and adding as an exercise for later but you get the idea.
So in summary this implementation is pretty crude but it’s a starting point. To get any kind of decent performance when using remote API’s caching of returned data is well worth looking at. Also you might want to consider putting the Basecamp login credentials in the main configuration file.
On another note, I can certainly see some Rails plugins/engines popping up that will automate much of this process. What would be really nice is if you could do something as simple as create a model called posts and add the following line:
act_as_basecamp_message
This would take care of all the remote calls, caching and such like but behaves just like a normal Rails
model. Actually this would be nifty for any remote API not just Basecamp. For example:
acts_as_remote_model :use => 'company.projectpath.com', :model => 'message'
But that’s a topic for another day!
Here are some further thoughts and ideas on how to use the Basecamp API:
* Listing of Project milestones on a blog
* Project analytics - frequency of posts, top poster, busiest project
* Cleanup tools to remove or archive
* Sync tools between Basecamp and existing applications
* Gantt chart export to Basecamp
* A portfolio site for your company using client and project data from BC
e.g what we are currently working on
* Copying or moving data from one project to another
If you found this article useful or have any questions please leave comments below. Thanks!
Related Links:
* Basecamp API doc
* Basecamp API Ruby Wrapper
* Basecamp API Forum
Posted by Martin on May 09, 2007