undefined method ‘remap’ for class ‘Magick::Image’

Problem
You have just deployed your rails application to dreamhost but you are getting this error from passenger.

Solution
There was a change in the ImageMagic between versions 6.4.3 and 6.4.4 from the affinity function to remap.
If you don’t want, or don’t have time to recompile the ImageMagick and install the rmagick gem, you can comment out the two declarations for the alias functions, located around lines 782 and 1525 in the file rmagick-2.12.2/lib/RMagick.rb:

alias_method :affinity, :remap

Getting your Github git project to dreamhost

Problem
You already have a project in github, but you want to move it to a different host (ie dreamhost)

Solution
Following the post here that describes how to setup a new git repository in dreamhost, the only difference after the initial setup :

ssh username@dreamhost_domain.com

mkdir -p ~/git/yourproject.git

cd ~/git/yourproject.git

git --bare init

is to edit your project’s .git/config file:
vi local_host/your_project/.git/config

and change the :
url = git@github.com:user_name/project_name.git

to the following:
ssh://dreamhost_username@dreamhost_domain/~/git/yourproject.git

Lastly you have to push for the first time to the server:
git push origin master

Optionally if you would like to check and/or checkout to a different pc you can use:
git clone ssh://dreamhost_username@dreamhost_domain/~/git/yourproject.git

Mandriva 2010, Dell Vostro 430, Broadcom Netlink BCM57780 problem

Problem
Just recently installed Mandriva 2010 in a new Dell Vostro 430 and the network card (Broadcom Netlink BCM57780) was not recognized.

Solution
Add the following to the /etc/modprobe.conf file:
sudo vi /etc/modprobe.conf
install tg3 /sbin/modprobe broadcom; /sbin/modprobe/ –ignore-install tg3

ferret installation error

Problem
Trying to install ferret with sudo gem install ferret fails with the following error:

fs_store.c:300: error: format not a string literal and no format arguments
make: *** [fs_store.o] Error 1
rake aborted!
Command failed with status (2): [make…]

Solution
As the installation was not possible by using the gem install command, the next step was to download the ferret.tar.gz file extract it and try and install the plugin manually.
It also failed with the same error message.
After some googling for the error message it seems that newer gcc versions fail for non critical errors which in this case is caused by the make options -Wformat -Werror=format-security
So if you replace the:
-Werror=format-security
with
-Wno-error

in the extracted folder/ext/Makefile

and then follow the original instructions as in:

$ rake ext
$ ruby setup.rb config
$ ruby setup.rb setup
# ruby setup.rb install

It should be installed correctly.

undefined method `render_component’ with ActiveScaffold and Rails 2.3.2

Problem
When using a nested (or embedded) scaffold in ActiveScaffold with Rails 2.3.2 you have the error:

undefined method `render_component'

Solution
According to the issue here, in Rails 2.3 the render_component has been removed.

Install the render_component from:

script/plugin install git://github.com/lackac/render_component.git -r rails-edge

and restart your server, and it should be working.

Spree installation error in Mandriva.

Problem
You are trying to install spree from the git source, following the instructions from here, but there are errors like:

gem install activemerchant --version "= 1.4.1"      
ERROR:  While generating documentation for builder-2.1.2
... MESSAGE:   Unhandled special: Special: type=17, text=""
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/builder-2.1.2/ri --title Builder 
    -- Easy XML Building --main README --line-numbers 
    --quiet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc 
    doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.

Solution
Make sure you have the following gems installed:

sudo gem install builder haml echoe

and then run:

sudo rake gems:install

Mandriva – Rails 2.3.2 – mysql gem – ‘ERROR: Error installing mysql’

Problem
You are trying to install the mysql gem in Mandriva, but it fails with error messages:

ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension...
checking for mysql_query() in -lmysclient... no ....

Solution
After searching in google, with solutions about providing different options (– –with-mysql-config, ..etc), even trying different combinations for providing the client library path, the configuration file, or the header file path, was still faced with the same error installing the mysql gem.
As the Mandriva installation was quite new, it turns out to be a couple of missing packages.
So try:

urpmi gcc
urpmi make

and run:

gem install mysql

again.

It should work out ok install the gem and output:

Building native extensions. This could take a while...
Successfully installed mysql-2.7
1 gem installed

Comparing data from two big MySQL tables

Problem
You have two big tables in MySQL (>640K records), that maybe differ in the number of fields, but you want to make sure that the data in the common fields in both tables are the same.

Solution

  1. Use mysql to export the data from the first table in a csv file, selecting only the common fields.
    We use the /tmp folder on the server to make sure we have the right permissions to create the file:

    mysql>SELECT common_field1, common_field2, ... 
    INTO OUTFILE '/tmp/first_table.txt'
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    LINES TERMINATED BY '\n'
    FROM table1;
  2. If the tables are in different databases remember to switch db:
    use seconddb;

    Export the second table in the second file:

    mysql>SELECT common_field1, common_field2, ... 
    INTO OUTFILE '/tmp/second_table.txt'
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    LINES TERMINATED BY '\n'
    FROM table2;
  3. now use the diff. You can use any of the following options:
    • diff -q first_table.txt second_table.txt
    • diff first_table.txt second_table.txt > diff.txt