Skip to main content


Showing posts from 2010

How to setup a static ipaddress via the command line in linux

From time to time I need to do some manual network configuration via the command line in Linux.  At one time I would gasp at the thought, with the help of Google I have become very comfortable with command line activity.

Here is a great article from  They go into a lot more detail.  I have put the info below that I used:

Howto: Ubuntu Linux convert DHCP network configuration to static IP configuration

Open network configuration file
$ sudo vi /etc/network/interfacesOR$ sudo nano /etc/network/interfaces Find and remove dhcp entry:
iface eth0 inet dhcp Append new network settings: iface eth0 inet static
Save and close the file. Restart the network:
$ sudo /etc/init.d/networking restart

I lost DB.php, Where do I find it?

I was helping a colleague get a website back online after a server meltdown.  The database was not connecting and the page was complaining about a missing file:  DB.php.  I checked the backup and the files were not there.

Of course the first thing that came to mind is how did this website ever work if it needs that file...?

After some Googling and testing I found that  I needed to install the DB model from the PEAR Repo.

pear install DB

I ran that as root and I was in business.

Coldfusion Form Validation for the Lazy Programmer

I love to program but I don't like to type.  I constantly look for ways to type less but accomplish more.  When I am not using CFWheels I end up having to type a whole lot more.

The other day I came up with this function:

<cfset not_required="billingform,address_2">
<cfloop collection="#form#" item="key">
<cfif not listFindNoCase(not_required,key) and trim(form[key]) is "">
 <cfset variables.e = variables.e & "<li>#ucase(replace(key,'_',' ','all'))# is a required field.</li>">

The only thing I am not happy about is it doesn't show the error messages in any kind of order, which makes longer form errors look kind of weird, but I don't consider that to be too big of an issue because most of the time a user is only gonna be shown 1 or 2 error messages.

So what do you think?  How could this function be improved upon?

Caps First Title -- Capitalize the first letter of each item in a list

A while ago I needed to capitalize the first letter of every item in a list.  I created a handy dandy UDF in Coldfusion.

Capitalize the first letter of each item in a list.

@param str      List to parse. (Required)
@param delimiter      List delimiter. Defaults to a comma. (Optional)
@return Returns a string.
@author Randy Johnson (
@version 1, May 30, 2010
<cffunction name="capFirstList" returntype="string" output="false">
<cfargument name="str" type="string" required="true" />
<cfargument name="delimiter" default="," required="false">

<cfset var newstr = "" />
<cfset var word = "" />
<cfset var separator = "" />

<cfloop index="word" list="#arguments.str#" delimiters="#arguments.delimiter#">
<cfset newstr = newstr & separator & UCase(left(word,1)) />