Changing the default "From:" email address for emails sent via PHP on Linux

I’ve had to solve this problem a couple of times at least, and it’s quite a common task, so I thought I’d document it here. When you send emails to users of your site through using the PHP mail() function, they will sometimes turn up in the mailbox of customers of your site with the following from address: From: Root <root@apache.ecommercecompany.com> This makes absolutely no sense to your customers, and often they will think it is spam and delete it. Often, the decision will be made for them by their web mail host, such as hotmail.com or googlemail.com, and they will never even see the email. You don’t want this to happen. ...

March 10, 2010 · 2 min · David Craddock

Shell scripts for converting between Unix and Windows text file formats

I’ve been using these shell scripts I wrote to convert between unix and windows text file formats. They seem to work well without any problems. If you put them in the /usr/sbin/ directory, they will be accessible on the path of the linux admin account root. /usr/sbin/unix2win `#!/bin/bash Converts a unix text file to a windows text file. usage: unix2win requirements: sed version 4.2 or later, check with sed –version sed -i -e ’s/$/r/’ $1 ` ...

March 9, 2010 · 1 min · David Craddock

Site Redesign

I’ve just updated the design of this blog, re-enabled comments and added a contact tab. I’ve installed a strong anti-spam comment filter, but you should now be able to comment on entries. I’ve also changed the layout of things slightly, and made it easier to read.

January 14, 2010 · 1 min · David Craddock

PHP Sample - HTML Page Fetcher and Parser

Back in 2008, I wrote a PHP class that fetched an arbitary URL, parsed it, and coverted it into an PHP object with different attributes for the different elements of the page. I recently updated it and sent it along to a company that wanted a programming example to show I could code in PHP. I thought someone may well find a use for it - I’ve used the class in several different web scraping applications, and I found it handy. From the readme: ...

January 14, 2010 · 3 min · David Craddock

Passed the W3Schools PHP Certification

As a break from my contract work, I took the W3Schools PHP Certification. I didn’t do any revision, which probably wasn’t wise. It was a bit more difficult than I thought, but I passed still.

January 14, 2010 · 1 min · David Craddock

Config files for the Windows version of VIM

Today I encountered problems configuring the windows version of the popular text editor VIM , so I thought I’d write up a quick post talk about configuration files under the Windows version, if anyone becomes stuck like I did. I use Linux, OSX and Windows on a day-to-day basis, and VIM as a text editor for a lot of quick edits on all three platforms. Here’s a quick comparison: Linux Linux is easy because that’s what most people who use VIM run, and so it is very well tested. ...

January 10, 2010 · 5 min · David Craddock

Speed Climbing

I’m going to take a break from the purely technical posts to get more people to see this video. Here the late Dan Osman speed-climbs a cliff without any safety equipment. http://www.youtube-nocookie.com/v/Fpm0m6bVfrM&hl=en&fs=1&rel=0 Risky? Just a bit. A few years later he lost his life during a similar attempt. But no-one can doubt the guts required, and the level of skill he achieved, in this type of climbing.

October 17, 2009 · 1 min · David Craddock

Regex in VIM.. simple

There are more than a gazillion ways to use regexs. I am sure they are each very useful for their own subset of problems. The sheer variety can be highly confusing and scary for a lot of people though, and you only need to use a few approaches to accomplish most text-editing tasks. Here is a simple method for using regex in the powerful text editor VIM that will work well for common use. ...

October 7, 2009 · 5 min · David Craddock

Heart rate monitor now available for the XO Laptop

Volunteers on the OLPC project have developed a low-cost heart rate monitor that can be plugged into the XO laptop , making steps towards an affordable monitoring system for hospitals in developing countries. For more information on the development, see the: OLPC Goldenstate project. People in the US can currently buy the sensor here ; unfortunately there is no international shipping yet in place.

April 7, 2009 · 1 min · David Craddock

VirutalHosts on CentOS

A common task when setting up an Apache webserver under Linux, is writing a httpd.conf file. The httpd.conf file is the main configuration file for Apache. One of the main reasons to edit the httpd.conf file is to setup virtual hosts In Apache. A Virtual host configuration allows several different domains to be run off a single instance of Apache, on a single IP. Each host is a ‘Virtual host’, and typically has a different web root, log file, and any number of subdomains aliased to it. The virtualhosts are configured in parts of the httpd.conf file that look like this: ...

March 30, 2009 · 3 min · David Craddock