2009
12.23

Secure copy(scp) can be stalled, generally while transferring a big file.

You can resume the stalled transfer by,

rsync –partial –progress –rsh=ssh user@host:remote_file local_file

2009
12.18

save partial to string

By satya

Some times, it might be necessary to save a partial content into an instance variable and use it later while rendering the whole page.

For those cases, use “render_to_string”,  which takes partial as a parameter (and many others too).

Eg: @partial_string = render_to_string :partial=>”some/partial”

render_to_string renders according to the same rules as render , but returns the result in a string instead of sending it as the response body to the browser.

Hope this helps. :-)

2009
12.15

HTML Emails

By Swanand

Here is a link to an excellent article about HTML emails:

http://24ways.org/2009/rock-solid-html-emails

For further reading: The Email Standards Project

2009
12.11

Image-Magick can render/output a host of image-types.

But, support for some of the formats are delegated to libraries or external programs.

This link provides a detail overview of the libraries required for proper rendering of image by Image-Magick.

I faced a problem with PNG format, which required the library “libpng-devel”.

It can be found if its installed or not by using : rpm -qa | grep libpng-devel

If its not installed, do install it by : yum install libpng-devel

An then, re-configure and re-install Image-magick.

Things should be fine. :-)

2009
12.11

This posts skims through the installation of Gruff & RMagick on a fedora based linux system.

Gruff has a dependency on rmagick, which in-turn is dependent on ImageMagick.

RMagick is a little tricky to install. Plain “gem install rmagick” won’t do the job.
The following are the steps to install (abstracted from https://saltalert.wordpress.com/2006/06/30/rmagick-installation-on-linux/)

  1. Install ImageMagick
    • Download the source from http://www.imagemagick.net/download/ImageMagick-6.2.8-1.tar.gz
    • gunzip -c ImageMagick-6.5.8-4.tar.gz | tar xvf -
    • cd ImageMagick-6.5.8-4/
    • export LDFLAGS=”-L/usr/local/lib -Wl,-rpath,/usr/local/lib”
    • ./configure
    • make
    • make install
  2. Install RMagick
    • gem install rmagick
  3. Install Gruff
    • gem install gruff

Hope, it works clean and simple.

2009
12.07

Memcached: Cache Stats command to get Statistics

By Satish Natarajan

If you want to know the statistics of how effective your Memcached is here is what you do.

“telnet 11211″ – change 11211 if you changed the port.

type the command “stats” – that is it – Once your cache is warmed up you will see your hits way greater than misses. (Else you need to look into what you are caching…)

2009
12.07

Linux: CentOS: Installing Memcached

By Satish Natarajan

I wanted to install Memcached for a project we are working on on CentOS and thought about recompiling the code etc. However in the end I felt it best to use the src rpm from here http://dag.wieers.com/rpm/packages/memcached/ and then rebuild it.

Once you rebuild it you can edit the /etc/sysconfig/memcached file to modify the memory used by memcached. For changing the memory size edit the “CACHESIZE” entry – this entry is in MBs.

To start /etc/init.d/memcached start

Works like a charm!

2009
12.03

Subversion 1.6.6 has a lot of code changes and configuration changes, which ensures that you will never have a smooth install process until someone comes up with packaged binaries to install.
You can download it here: tar.bz2 , tar.gz , .zip

Here is a step by step process that you can follow to install Subversion 1.6.6 (This post assumes that you are on a Red Hat / Fedora or equivalent platform and have the GCC build environment ready.)

0. Basics. For extracting different archives:

tar xvjf foo.tar.bz2
tar xvzf foo.tar.gz
gunzip foo.gz
unzip foo.zip

1. Install Apache Portable Runtime libraries: apr, apr-devel, apr-util, apr-util-devel

First lets check if we already have it:

[root@myhost workdir]# rpm -qa | grep apr
apr-1.2.12-2.fc9.i386
apr-devel-1.2.12-2.fc9.i386
xorg-x11-drv-dynapro-1.1.2-1.fc9.i386
apr-util-devel-1.2.12-7.fc9.i386
apr-util-1.2.12-7.fc9.i386

Bingo! I have have all of them. But, if you don’t, no problemo! You can install these using your default package manager:


[root@myhost workdir]# yum install apr apr-devel apr-util apr-util-devel
# Listing all the 4 is not required. Almost always, a 'foo-devel' package has a dependency on 'foo'. So this is enough
[root@myhost workdir]# yum install apr-devel apr-util-devel

2. Install neon or serf. For this, download the source tarball of neon with version as suggested by subversion ( neon-0.29 for subversion-1.6.6) and install it with following commands ( Check if you already have, using commands similar to Step 1):


[root@myhost neon-0.29]# ./configure --with-ssl
[root@myhost neon-0.29]# make
[root@myhost neon-0.29]# make install

3. Install sqlite-amalgamation. Get source from here. Extract it to the directory of your choice. I would say: “/path/to/new/sqlite/” And do a normal install:


[root@myhost sqlite-3.6.13]# ./configure
[root@myhost sqlite-3.6.13]# make
[root@myhost sqlite-3.6.13]# make install

4. Compile and install subversion. Configuration step is important. Change to directory where you extracted subversion.

[root@myhost subversion-1.6.6]# ./configure --with-ssl --with-neon=/usr/local --with-sqlite=/path/to/new/sqlite/sqlite3.c
[root@myhost subversion-1.6.6]# make
[root@myhost subversion-1.6.6]# make install

If you retrying the install, its a good idea to clean previous attempts:


[root@myhost subversion-1.6.6]# make clean