2010
02.07

Zing

Just for you:

You’re not yourself today.  I noticed the improvement right away.

Your father should have pulled out.

When you take your Viagra do you grow taller?

2010
02.02

This will work to re-direct a single directory to a new location:

# Permanent move
Redirect 301 /directory/ http://newlocation.com

2010
02.02

You need to re-direct an entire site to a new location?  This will do it:

# Permanent move
Redirect 301 / http://newsite.com

2010
01.22

.htaccess to redirect dynamically to to the www version of the domain if the non-www version is requested:

RewriteCond %{HTTP_HOST} ^([a-z-]+)\.([a-z]{2,6})$ [NC]
RewriteRule ^(.*)$ http://www.%1\.%2/$1 [R=301,L]

2010
01.18

MySQL – LEFT

I needed a way to trim the three left side characters.  I’ll save you the long boring story about why – here’s the how:

SELECT

LEFT( price , CHAR_LENGTH(  price ) -3  )
AS price

FROM products

This gave me 150 instead of 150000.

2010
01.18

Alphabetize an Array

Reading a directory and putting the files found into an array shouldn’t be such a big deal, right?  How about alphabetizing that array?

function read_a_directory( $DIR )
{
if ( is_dir( $DIR ) )
{
if ( $dh = opendir( $DIR ) )
{
while ( ( $file = readdir( $dh ) ) !== false )
{
if ( $file <> ‘.’ && $file <> ‘..’ )
{
$a[] = strtolower( $file ) ;
$b[] = $file ;
}
}
}
}
if ( is_array( $a ) )
{
//sort( $return );
asort( $a ) ;
foreach( $a AS $k => $v )
{
$return[]    = $b[$k] ;
}
}
return $return;
}

I found myself down this path only to take care of the upper and lower case names given to some files.  Further, some were prefaced with numbers.  This little function did the work.

2010
01.18

New Version Out

We launched the new version of Homeport today.  Thank goodness.

Even as we launched it new ideas started coming in.  It is a fantastic experience when people actually use what you develop.  Then, along with that, they start sharing good ideas.

A new version will probably be started on soon enough.  Before that I’d like to convert the Off Island and Alberta versions.  Then start it off in Saskatchewan.

2010
01.18

Still Going

Well, I’m just as surprised as you are.  I’ve made it to the gym every business day this year.  I wont be entering the Mr Universe any time soon as I’ve simply been on the elliptical machine.  I’m up to 20 minutes each visit.

The ‘crew’ have a new weigh-in day scheduled.  I’ll let you know my numbers after.

2010
01.11

New Year Push

I made it to the gym four times last week. A fifth trip on Friday was just for a sauna. I also managed to Wii Fit each morning.

Today I went as well. Hope I can keep it going!

Note: I noticed they cleaned the hot tubs out. I’m still not going in. Ewww!

2010
01.02

Temptation

Don’t worry about avoiding temptation. As you grow older, it will avoid you.

Winston Churchill