Ruby on Rails thin server error: `to_specs’: Could not find thin

When using the /etc/init.d/thin script to run thin server as a service, I experienced the following error:

/home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find thin (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
from /home/myuser/.rvm/gems/ruby-1.9.3-p125/bin/thin:18:in `

'

The problem is that the script is trying to start thin without rvm being loaded into shell.

My solution was to replace the default /etc/init.d/thin with this, which first declares the rvm_path and loads rvm into shell:

Resources:

Upgrade to Ubuntu 12.04 – Ruby on Rails gem mysql2 error: libmysqlclient_r.so.16

When upgrading from Ubuntu 11.10 to 12.04, you may experience the following error with the Ruby on Rails gem mysql2:

.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': libmysqlclient_r.so.16: cannot open shared object file: No such file or directory

This is because Ubuntu 12.04 is now using the newer libmysqlclient 18. Creating a symlink won’t fix the problem– the mysql2 gem needs to be re-installed (and therefore recompiled) to support the latest version.

Shell script for cloning a WordPress installation

The shell script below will copy a WordPress installation from one server to another- including the database. The script uses the ‘sed’ command to update the new wp-config.php with the new server information, as well as replace all references to the original domain (such as in post_content) in the new DB with references to the new domain.  I wrote the script in order to create a ‘one-click’ solution to mirroring a WP installation.  It will work with both single and multisite installations.

WARNING: Use at your own risk.  I recommend that you manually back up the original WP installation until you are confident that the script is configured correctly.  It is possible to inadvertently alter or erase your original installation if you do not configure the script’s variables correctly. The script was written in the Mac OS environment and may require some alterations to work in your environment.

Multisite Dashboard Switcher for WordPress Released

The Multisite Dashboard Switcher is a plugin written for WordPress that allows multisite administrators to easily switch between Dashboards. MSDS provides convenient access to options pages across every site in the network, reducing the number of clicks necessary to manage settings. For larger networks, sites can be grouped by letter.

View the plugin on WordPress.org

Use PHP and LDAP to list members of an Active Directory group (Improved)

PHP function that gets the members of an Active Directory group, and returns the Users’ attributes as an array.

This is an improved version of the snippet posted on 2/10/2011

The Function

Example Output