Memcached – Libmemcached already built; run ‘rake clean’ first if you need to rebuild.

Trying to install memcached ruby gem on Ubuntu 10.04 Lucid Lynx and I get the error

Libmemcached already built; run ‘rake clean’ first if you need to rebuild.

Fixed this by installing

sudo apt-get install libsasl2-dev
gem uninstall memcached && gem install memcached

Full Error Stacktrace:

Read the rest of this post »

Posted on June 28, 2010 at 2:10 pm by Jordan Carter · Permalink · 2 Comments
In: Ruby on Rails, Server Config, Ubuntu Tricks · Tagged with: , ,

Developing Ruby on Rails on Ubuntu Lucid Lynx 10.04

Developing for any Web Application can be helped by developing in the same environment as the deployment.  For me this means that running Ubuntu Desktop and deploying onto Ubuntu Server is a no brainer.  Most Ruby on Rails developers you’ll find today use a Mac and Textmate.  I learnt Ruby on Rails in the same scene, and Textmate is awesome.  It is yet to be matched by another text editor.

There are some things that I don’t like about Mac, or I guess I prefer about Ubuntu/Linux.  The procedure to install something on a Linux machine is so painless.  Ruby Gems works really well.  Xapian is a breeze to install on a linux machine, Postgresql installs with one command in less than 20 seconds!  The last time I installed Postgresql on a Mac (and had the development headers, so you can install the gem..) it took the good part of an hour.

We have now all been blessed with the latest LTS (long term support) Ubuntu release.  It is pleasant on the eyes, right out of the box!  It fast the fastest boot time I have seen (I have used WinXp, Vista, Win7, OSX)

I would be confident when I say almost all Ruby on Rails deployments are to a linux environment.  Probably Red Hat, but I prefer Ubuntu just because of the ease of use and my familiarity of it.  So to get yourself up and running on Ubuntu Desktop and Developing Ruby on Rails, follow below! Read the rest of this post »

Posted on June 8, 2010 at 2:54 pm by Jordan Carter · Permalink · Leave a comment
In: Ruby on Rails, Server Config · Tagged with: 

Package ‘adobe-flashplugin’ is Virtual when installing Flash on Firefox or Chrome – Ubuntu Lucid Lynx 10.04 64

Trying to install Flash on Ubuntu 10.04 64 bit fails with the error

Package ‘adobe-flashplugin’ is Virtual

I managed to install it with the following pasted into terminal.

sudo add-apt-repository ppa:sevenmachines/flash && sudo apt-get update && sudo apt-get install flashplugin64-installer
Posted on June 8, 2010 at 9:36 am by Jordan Carter · Permalink · 6 Comments
In: Ubuntu Tricks · Tagged with: , , ,

Share Keyboard and Mouse between Two or Multiple Computers

I have three computers at my desk.  No reason other than I am a geek.  I have a desktop, nice beasty thing.  I have a Tablet Laptop and I have a netbook.

I wanted to connect them all up so that I could use the screen space on them, put twitter on one maybe, gmail on another.

The answer is Synergy

Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It’s intended for users with multiple computers on their desk since each system uses its own monitor(s).

It is easy to setup and seems to be in the repos, install by:

sudo apt-get install synergy

You then need to have a config file, it has a default name but I prefer to call it .synergy, mine as follows.
Read the rest of this post »

Posted on June 4, 2010 at 9:42 am by Jordan Carter · Permalink · Leave a comment
In: Ubuntu Tricks · Tagged with: 

Sending Emails with Rails, multipart html plain with Attachments

When trying to send attachments along with type versons of an email (html and plain text) you might notice that there is no content in your email message.  While I found this out too.  Simple if not over the top solution.

The trick is that you have to put the html and plain part inside a “multipart/alternative” block.  If you don’t you’ll end up sending no message with the email, or you’ll send two attachments, the actual attachment (image etc.) and a message attachment.  Not ideal!

Koz, so a friend of mine pointed out my problems and I ended up with the following.

def send_photo(employee)
recipients “bob@example.com”
from “jane@example.com”
subject “Security Photo”
sent_on Time.now
part(:content_type => “multipart/alternative”) do |p|
p.part :content_type => “text/html”, :body => render_message(“send_photo.text.html.erb”, :employee => employee)
p.part :content_type => “text/plain”, :body => render_message(“send_photo.text.plain.erb”, :employee => employee)
end
unless employee.security_photo.path.nil?
attachment :content_type => employee.security_photo_content_type,
:body => File.read(employee.security_photo.path(:medium_email))
end
end
Posted on June 3, 2010 at 5:36 am by Jordan Carter · Permalink · One Comment
In: Ruby on Rails · Tagged with: , ,

VirtualBox shared folder guest access command

Enable shared folders
Add shared folder via “Devices” > “Shared Folder…”

Windows from virtualbox.org

net use x: \\vboxsvr\sharename

Linux from virtualbox.org

mount -t vboxsf [-o OPTIONS] sharename mountpoint

Sharename is for example (by default) if you shared your Hosts Desktop, it would be Desktop.  Easy.

Posted on May 18, 2010 at 10:36 am by Jordan Carter · Permalink · Leave a comment
In: Ubuntu Tricks · Tagged with: ,

what changes did I just pull from git?

Ever wanted to see what changes you just pulled from github?

This little command will show you the changes for the last commit, if the pull resulted in more commits being pulled then add a couple more ‘^’s to HEAD^

git diff HEAD^ HEAD
Posted on May 14, 2010 at 4:12 pm by Jordan Carter · Permalink · Leave a comment
In: Ruby on Rails · Tagged with: 

Git cherry-pick

cherry-pick is a useful Git command, especially if you are working in an Agile team.

We used it for the first time today on our project.

Team member A lets call him “James” made a feature and put it onto master.

Team member B lets call him “Jordan” later refactered some code from “James”‘s feature.  Later that day, James also wanted to refactor that code, but “Jordan” had not finished his story and so “James” had to wait until Jordan had finished before starting his refactor otherwise face horrible conflicts.

Instead of waiting, “Jordan” created a commit for the refactor, push it in his feature branch to remote.  James pulled down the commit, cherry-picked it from “Jordan”‘s feature branch and continued on with his own refactoring.

Another great example of Git being more than just version control.

Posted on May 14, 2010 at 1:15 pm by Jordan Carter · Permalink · 2 Comments
In: Ruby on Rails · Tagged with: