Phine Solutions web work notes

Use cygwin on winxp, be careful about using xwidow/xterm

Filed under: programming in general by 1.618 — March 25, 2007 10:08 pm

Normally I use eclipse for as the development IDE for my web projects. But sometimes I also enjoy using just VI (or Vim) and consoles for coding. The biggest difference from using a GUI IDE is that I would do a lot of typing and not much file looking up from a GUI directory tree. This is especially helpful If I know my files and I can find it by simply typing some commands on the console screen, versus go to the file navigation tree (usually in a small font) in a IDE, scroll up and down and try to locate a file.

Since I use winxp, Cygwin becomes the tool to get some Unix like consoles and commands.

With the base installation I get a simple command prompt. It looks just like a windows cmd prompt so it is a functional tool but doesn’t satisfy my Unix style crave. Luckily I have a couple of other options.

Run Cygwin-X

It is an X window system on a windows machine. Basically I can run an X server in windows OS and run other X tools and toys such as xterm and xclock. xterm is the main thing I was looking for since it comes with all the bells and whistles and I can customize the fonts and colors to the way I like.

The installation is pretty simple. Using the Cygwin setup program and simply choose the X11 package and you should be good to go

But I didn’t run into the “file permission” problem until I actually start heavily using it. The problem starts with the new files I created in xterm. My web apps (in php) could not read them because “the permission was denied”. Using chmod command seemed to fixed the problem. But soon I has CVS issue for some reason all the CVS folders becomes invisible to windows and Tortoise the CVS client started to complain.

After researching on the web and not being able to find anything that can get me out of this easily so I decided to give it up. Can’t afford losing my time since there are other alternatives.

Falling back to Eclipse is not painful. It is still a good IDE. However, Cygwin has another nice bach console tool called rxvt.exe and the good thing about it is not needing a X server.

My rxvt.exe batch file (rcvt.bat):

@echo off
c:\cygwin\bin\rxvt.exe -sl 500 -fn ‘Courier New-16′ -sr -title “My bash” -e c:\cygwin\bin\bash.exe –login -i

This will give me a nice bash console with a nice font and so far I am pretty happy with it. I guess it needs a little time to find out if it also gives me file permission problems.

If you had the similar experience and know how to fix this, please let me know.

use rsync to backup

Filed under: my 2 cents by 1.618 — March 11, 2007 10:45 pm

Backup is always an important chore for a webmaster. Recently I started to use rsync to backup important files between my servers. I don’t backup the code base since they are already in CVS. I mainly backup the database and some other user generated content, such as uploaded images, etc.

This is a great tutorial to use rsync to backup files and diretory trees.

The database content was first dumped into a file using msqldump utility by cron job, and later on another cron job will call rsync to sync with another server, which can be accessed through SSH.

So far this has been working great. The next step will be setting up script to periodically rsync the configuration files such as httpd.conf, my.cnf … so changes won’t get lost in case the server failure or migration.

©phinesolutions.com