passenger ArgumentError (invalid byte sequence in US-ASCII)

Problem
After upgrading your server to use rvm and Ruby 1.9 you get the following error when you are trying to access certain parts of your redmine installation:

passenger ArgumentError (invalid byte sequence in US-ASCII)

Solution
If you follow the instruction posted here, you can add the following to your redmine’s “RAILS_ROOT/config/initializers/string_encodings.rb”:

Encoding.default_external = 'UTF-8'

and restart your application

OSx – VMware – Mandriva resizing partition

Problem
When you use WMware to run Mandriva or any other distribution on Mac OSx, if you resize the hard disk partition in VMware your Mandriva system won’t automatically resize the partition to use the newly available space.

Solution
To be able to use the available space the quickest solution is:

  • restart your VMware session but run in safe mode
  • start up drakdisk
  • select the partition you want to resize. WARNING (Make sure you back up important data – even though in my case everything went smoothly)
  • umount the select partition and resize using all the avaliable free space
  • after a few minutes you should be able to restart your VMware and login to your virtual machine as normal, and the partition should be resized

Splitting big files (Rails log files) in Linux command line

Problem
You want to examine some big log files (ie Rails production files), on the command line in Linux but they are quite big.

Solution
You can use cat and grep to look for a specific part in the log files. You can also use grep with the A and B parameters to specify how many lines you want to include before and after the search text, but maybe you want to have chunks of the logs to examine. In that case you can use split to split them up in smaller files:

split --bytes=10M input_log_file.log [output_files_or_directory]

In that case you will be splitting your log file on size (–bytes variable), so you can decide depending on the total size of the log file how many files you want. The output files or directory is optional and if you leave it empty it will create the files in your current directory.

You can also split by the number of lines you want in each file like:

split --lines=15000 input_log_file.log [output_files_or_directory]

Help! I’m getting the message “libMagickWand.so.1: cannot open shared object file: No such file or directory” I know ImageMagick is installed! What should I do?

Problem
Cannot install RMagick as there is an error about nob being able to find some shared libraries.

Solution
After reading the RMagick installation FAQ it seem there is a problem with the LD_LIBRARY_PATH that cannot find the needed libraries as they are installed in /usr/local/lib instead of /usr/lib.
Doing a quick search revealed that people suggest that the LD_LIBRARY_PATH shouldn’t be changed, for various reasons.
So, the quick solution is to create a couple of symbolic links for the libraries that cannot be found, ie:

sudo ln -s /usr/local/lib/libMagickWand.so.4 /usr/lib/libMagickWand.so.4
ln -s /usr/local/lib/libMagickCore.so.4 /usr/lib/libMagickCore.so.4

ATI Radeon HD-4350 Mandriva 2010 Dual Monitor

Problem
Trying to get Mandriva 2010 to work on a dual monitor with an ATI Radeon HD 4350. Desktop used is a Dell Vostro 430 and two BenQ G920WL monitors.

Solution
After reading the articles here and here, the steps required were:

  • Select driver ATI Radeon HD 2000 and later (radeon/fglrx)
  • Don’t select proprietary driver from next screen
  • Run xrandr -q to find out the name of the monitors
  • From the output find out the current resolution (1440×900), names (VGA_1,DVI-I_2/analog) and maximum resolution (1440×900)
  • Edit the xorg.conf file (/etc/X11/xorg.conf) and add the Virtual 2880 900 (without quotes) underneath the Modes line in the Display Subsection
  • Save the file and restart the X server
  • Run again the xrandr -q command and make sure the maximum resolution has changed to 2880×900
  • Run xrandr –output DVI-I_2/analog –auto –right-of VGA_1 to put one screen next to the other
  • Follow the description here to set it up permanently on login

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

Converting Paradox tables to MySQL sql in Linux

Problem
You want to convert some legacy tables created in Paradox (.db, .px) to another format so you can use it in MySQL.

Solution
Download the px tools from here.

Follow the instructions, in the INSTALL file after you untar the file.
You should have to do the usual three step linux installation:

configure
make
sudo make install

Afterwards to make sure that the .db file is a paradox file run:

pxinfo -f  path/to/paradox/db/file.db

The program should read the header and report back with something along the lines:

File-Version: Paradox 7.x
Filetype: indexed .DB
....

To export each Paradox db file to an sql statement run the following:

pxsqldump -d mysql -f path/to/paradox/file.db > path/to/mysql/exported/file.sql

Installing sqlite3-ruby in Mandriva and Rails 2.0.2

Problem
After upgrading to Rails 2.0.2 when trying to install the sqlite3-ruby gem got the following error:

ERROR:  Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb install sqlite3-ruby
checking for sqlite3.h... no
make
make: *** No rule to make target `ruby.h', needed by `sqlite3_api_wrap.o'.  Stop.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1/ext/sqlite3_api/gem_make.out

Solution
In Mandriva you need to install the ruby-sqlite3 and the development libraries first, like:

sudo urpmi ruby-sqlite3
sudo urpmi libsqlite3-devel

After that you should be able to install the gem as normal.