Archive for April, 2007

How to remove all .svn subdirs from a given directory

Wednesday, April 18th, 2007

Well.. Sometimes I'm a smart (or you might call it lazy) folk, so I do reuse my code. And the code is usually is stored inside a Subversion system, and several projects are always checked out to my local computer and therefore have these invisible .svn sub-directories all-over the place.
Being lazy (or you call it smart? :) to checkout stuff I need to be duplicated from a previous project into a current one, I usually just copy, say, "tiny_mce" folder from an old project to a new one.

The problem that appears when I try to do that and add the newly duplicated folder to the new project, is that svn complains the folder is already being under version control. Well of course, because all these .svn dirs were copied along with the "meat" :) What's the easiest way to remove .svn directories from that directory? If you're on a Mac or some other Unix-based system, that is.

Look no further than for the code below!

cd /path/to/your/dir

find . -name ".svn" -exec rm -rf '{}' \;

Voila. After some complaining about some .svn dirs couldn't be found (and you just safely ignore them) - you have a clean directory structure which you can than safely add to version control using everyone's favourite "svn add tiny_mce" (or whatever).

Mostly a note to myself, but hopefully it'll save somebody some time some day :)

Oh and of course you can just as easily remove dirs or files with a different file names, just bu replacing the ".svn" with, say, "Icon.icn" or something like that.

del.icio.us and google plugins sign a peace treaty :)

Sunday, April 8th, 2007

Good news from del.icio.us :) They have finally updated their Firefox browser plugin so it doesn't conflict with Google's browser sync plugin.

Really good news because I really love del.icio.us, but I definitely love my Google browser sync plugin several magnitudes more. Before, del.icio.us was just refusing to work after detecting Google's plugin, but no more! I now have them both installed on my Firefox and am a really happy camper :)

del.icio.us bookmarks plugin

google's browser sync plugin

good things come in.. couples? :)

How to install Ruby, Rails, mySQL and Apache from (almost) the scratch

Tuesday, April 3rd, 2007

I've been installing everything that is needed to run Ruby on Rails application onto a host (which is CentOS 4.x), which didn't even have Ruby installed, mySQL was too old and Apache didn't have required modules for running Mongrel clusters. So I had to install everything from the scratch, and the whole process was documented so I could repeat it in the future :) But may be this will helpful to someone else too, so here it is, right from my Yojimbo's note :)
Just one thing to notice. CentOS already has some of the required libs installed (zlib, libpng, libjpeg and freetype), so if you don't have them installed, do it before proceeding. I think there are plenty of info on this matter so I'll omit it.

Now, to the business.

RUBY

wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz
tar zxvf ruby-1.8.5.tar.gz
cd ruby-1.8.5
./configure
make
sudo make install

Warning! If you're on Mac, you have to use the following string to configure Ruby install:

./configure –prefix=/usr/local –enable-pthread

On Mac OS X, once you have installed Ruby, you have to fix default paths for your default shell, because Ruby installs itself to /usr/local/bin by default, and Apple's default binaries location is in /usr/bin. Do this in Terminal:

pico ~/.bash_login

# and paste the following text:
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
# save the file (Control-W) and relogin, or just re-open terminal session before proceeding.

RAILS : GEMS

wget http://rubyforge.rubyuser.de/rubygems/rubygems-0.9.2.tgz
tar zxvf rubygems-0.9.2.tgz
cd rubygems-0.9.2
ruby setup.rb

RAILS: CORE (possible to use –include-dependencies, but i was getting some 'not found' error with this option)

#install the specific version, which happens to be 1.2.2 in this case.
gem install -v=1.2.2 rails

RAILS: STANDARD STUFF (possible to use –include-dependencies)

gem install capistrano
gem install mongrel
gem install mongrel_cluster
gem install gettext
gem install unicode

APACHE 2 with load balancer (for Mongrel cluster)

wget http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-2.2.4.tar.gz
tar zxvf httpd-2.2.4.tar.gz
cd httpd-2.2.4
./configure –enable-rewrite –enable-proxy –enable-load-balancer –enable-mods-shared=ALL
make
sudo make install

GHOSTSCRIPT & FONTS

# we need to install/update ghostscript and install ghostscript-fonts in order to get rid of the "`get_type_metrics': unable to read font `(null)' (Magick::ImageMagickError)" error:

wget http://jaist.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.56.tar.gz
tar zxvf ghostscript-8.56.tar.gz
cd ghostscript-8.56
./configure
make
sudo make install

wget http://jaist.dl.sourceforge.net/sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz
tar zxvf ghostscript-fonts-std-8.11.tar.gz
mv fonts /usr/local/share/ghostscript/8.56/

IMAGEMAGICK (required by RMagick)

wget ftp://ftp.u-aizu.ac.jp/pub/graphics/image/ImageMagick/imagemagick.org/ImageMagick-6.3.3-10.tar.gz
cd ImageMagick-6.3.3
./configure
make
sudo make install

RAILS: RMAGICK (manual install - I have always had multi-systems compatibility problems with the gem install)

wget http://files.rubyforge.mmmultiworks.com/rmagick/RMagick-1.15.4.tar.gz
tar zxvf RMagick-1.15.4.tar.gz
cd RMagick-1.15.4
./configure
make
sudo make install

MYSQL

wget http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.0/mysql-5.0.37.tar.gz
tar zxvf mysql-5.0.37.tar.gz
cd mysql-5.0.37
./configure –with-extra-charsets=all –prefix=/usr/local/mysql
make
sudo make install

#in /etc/my.cnf
[mysqld]
set-variable = max_allowed_packet=32M # I upload large images into DBs, therefore need a bigger allowed packet size

(also need to change encodings to utf8)
default-character-set=utf8

SUBVERSION (required to capistrano deployment to work)

wget http://subversion.tigris.org/downloads/subversion-1.4.3.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.4.3.tar.gz
tar zxvf subversion-1.4.3.tar.gz
tar zxvf subversion-deps-1.4.3.tar.gz
cd subversion-1.4.3
./configure
make
sudo make install

That all folks :) Hope this was helpful.