Archive for February, 2010
Google Buzz
I heard about Google Buzz on CBC Radio yesterday… came home and tried to connect but it wasn’t activated. What’s all this Buzz about? Today, while using Gmail, I noticed the icon for it, opened it up, and added some “connected sites”. I’ve already had two conversations about a picture of a turtle I took a few years back. Awesome.
Seems easier to use than Facebook too.
Posted by Karl Herrick on February 10th, 2010 in Google, Culture | No Comments »
Recursive find and replace
From time to time I find myself wanting to replace a bit of text, in multiple files, throughout a huge directory tree (particularly in the case of a Wordpress migration).
Here’s a method I frequently use (other examples I’ve seen out there make use of perl, xargs, grep, etc.):
user@host:~$ find . -type f -exec sed -i 's/Text_To_Find/Replacement_Text/g' {} \;
The find command will return a list of all the files in the directory tree and execute the sed command on each one it locates. In the example below, I added the “-name” option to the find command to allow for working only on files with the .js extension:
user@host:~$ find . -type f -name "*.js" -exec sed -i 's/var pageName="example page";/var pageName="Final Page";/g' {} \;
In the next one, the text to find and replace has special characters (in this case the ‘/’ in the URL).
user@host:~$ find . -type f -exec sed -i 's/http:\/\/www.example.com\/old_directory\//http:\/\/newsubdomain.example.com\/new_directory\//g' {} \;
See the following links to read more about escaping special characters:
- Bash Hackers Wiki - Quotes and escaping
- Unix / Linux Shell Scripting Tutorial - Escape Characters
- Advanced Bash-Scripting Guide
Posted by Karl Herrick on February 8th, 2010 in Wordpress, Linux, Hosting, Bash | No Comments »
Sloppiness at 1and1
So I have been noticing issues with 1and1 again. Yesterday when trying to get into my hosting control panel at admin.and1.com, I received a “HTTP Error 503 Service unavailable” error, and thought to myself… really, on the admin panel… really?
Today while checking out my own site, I noticed that all of the PHP files I tried browsing to returned “500 Internal Server Error” errors.
Now this has gone too far… so I called them up. At first the person I talked to explained that I needed to force PHP5 using a .htaccess file, and proceeded to tell me that they could make the change for me. Calmly, I responded by saying that I did not want a change, and that it had been working fine the way it was for months.
She put me on hold, and while I waited… it started working. She told me that the shared hosting server “had a glitch”.
Afterwards, I ssh’ed into my server. Look what I found:
total XX
-rw-r–r– 1 uXXXXXXXX XXXXXXXX 16 Feb 3 14:06 info.php
I thought, “weird, I didn’t put that there”.
Shame on you 1and1, for not cleaning up after yourself. Well, I guess you get what you pay for.
Posted by Karl Herrick on February 3rd, 2010 in Culture, Linux, Hosting, Bash | No Comments »