Archive

Author Archive

Copy an Entire Directory in Linux

November 4th, 2005 Tony 35 comments

Yeah, this is simple but I’m forgetful so heres how you copy an entire directory, its subdirectories, and files:

cp -R dirtocopy/ newdir/

Categories: Linux Tags:

Ruby on Rails – Could it Replace my PHP Java Mixture?

November 3rd, 2005 Tony 5 comments

It must have been the code God trying to tell me something this week. First Brian on Tuesday and then Mike on Thursday asked me if I had looked into into the Ruby on Rails yet. I had read a few articles about the framework… well, to be honest I only scanned them. My first impression was that it was a lot of hype over a glorified hack to a version of perl. But now that I’ve actually spent a bit of time reading over the beautiful site and and watching the 15 minute intro video I’m very entrigued.

A few months ago I forced myself to spend some time with Python because I had read one too many blogs agreeing that Python cuts development time by 75% over Java. The thing that turned me away from Python was the lack of a good web application (like JSP for Java).

I’m still very wary of switching to Ruby for reasons such as a lack of pre-configured webhosts. My current dedicated host ships all servers configured for php. Thats not such a big one because I already have to install Resin. I’m still not convinced that I could give up the power of Java for a scripting language. For instance, I currently use PHP extensively for quick, simple, dynamic interaction with the end user. It is extremely fast, its quick to develop, it runs on every platform, and it scales big time. However I recently spent a few days trying out the PHP port of Jakarta Torque known as Propel. (Torque and Propel are a object database mapper persistence layer). While Torque performs extremely well, Propel does not. The problem is that the code generated by the Propel generator is quite large. Most classes are 800+ lines. This is no problem for a language like Java that is compiled into bytecode but for a script language like PHP the overhead of simply including one class file is 400 milliseconds. Ugg.

Will Ruby suffer the same constraints? Will Ruby be difficult to adapt to SEO practices? I doubt it. The simple fact that it plays nicely with Apache tells me that mod_rewrite should be no problem.

Categories: Ruby on Rails Tags:

Create a tar file of an entire directory and its sub-directories

November 2nd, 2005 Tony 7 comments

To create a tar archive of an entire directory including all files and sub-directories:

tar -cvf mytarfile.tar mydir/

Categories: Linux Tags:

Making mysqldump compatible with older versions

October 28th, 2005 Tony 1 comment

If you receive some errors such as the following when trying to import your mysql database dump you are most likely attempting to dump a database from a newer version of MySQL and import it into an older version:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘DEFAULT CHARSET=latin1′

OR

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘DEFAULT CHARSET=utf-8′

Solution?
Add the following parameter to your msyqldump statement:

–compatible=mysql40

Categories: MySQL Tags:

grep all files and sub-directories in a directory for a string

October 14th, 2005 Tony 4 comments

This is mostly just a post for my recollection. To search all files and subdirectories recursively for a phrase:

grep -r -i somethingtosearchfor ./

Categories: Linux Tags: