php functions #1 preg_replace, alphanumeric

I use these functions to clean up variables, maybe for sanitation of filenames or urls.

function alphanumericspaces($string) {
 return preg_replace('/[^a-zA-Z0-9\s]/', '', $string);
} 

function alphanumeric($string) {
 return preg_replace('/[^a-zA-Z0-9]/', '', $string);
} 

function cleanfilename($string) {
 $string = strtolower($string);
 return preg_replace('/[^a-zA-Z0-9]/', '-', $string);
} 

function numeric($string) {
  return preg_replace('/[^0-9]/', '', $string);
}

Ubuntu How To Install Apache, PHP, MySQL, and PHPMyAdmin

Step by step guide to install Apache, PHP, MySQL and PHPMyAdmin on Ubuntu Server Lucid. Make sure you are connected to the internet.

1. SSH into your server and login as root with this command

su

2. Update your repositories list

apt-get update

3. Install Apache

apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils

4. Install PHP

apt-get install php5 libapache2-mod-php5 php5-common php5-gd php5-mysql php5-imap php5-cli php5-cgi php-pear php-auth

5. Install MySQL

apt-get install mysql-server mysql-client

when MySQL is being installed you will be prompted to supply a root password

6. Install PhpMyAdmin

apt-get install phpmyadmin

follow the wizard and configure phpmyadmin

7. Installation finished, now restart the servers

/etc/init.d/mysql restart
/etc/init.d/apache2 restart

8. Create a new PHP file /var/www/index.php and paste the code below

< php phpinfo(); >

Good job, you are finished, view your website in the browser, you can also login to phpymadin

http://localhost/phpmyadmin

How To Install Vmware Tools on Ubuntu Server Lucid

1. Power on the virtual machine. After the guest operating system has started, prepare your virtual machine to install VMware Tools. Choose VM > Install VMware Tools. Inside Vmware Workstation, make sure CD/DVD is connected.



Note: If you have a previous installation, delete the previous vmware-distrib directory before installing. The default location of this directory is
/tmp/vmware-tools-distrib.

2. Login to Ubuntu Server

su

3. Mount the CD Image

mkdir /media/cdrom
mount /dev/cdrom /media/cdrom

4. Copy VmwareTools

copy VMwareTools-5.0.0-<xxxx>.tar.gz /tmp

5. Unmount the VmwareTools Image

umount /media/cdrom

6. Uncompress the TAR

cd /tmp 
tar zxf /mnt/cdrom/VMwareTools-5.0.0-<xxxx>.tar.gz

7. Install Vmware tools, just answer the configuration questions

cd vmware-tools-distrib
./vmware-install.pl

Congratulations you are finished!

DIY Third Hand - Budget Mod

I really don't want to spend $40+ on a third hand, so today I walked down to the local hardware store and picked up some parts to build my own. I left spending around $5, granted I have a few of my own tools to build it. You will need a tube cutter and a drill.

Alligator Clips - 2 inch, $1 gets you four.



6-32 x 3/8 Screws, Washer and Wing Nuts, 8 pack about $3 for all



Cotter or Split Pins - 1/8 x 2

I picked up 3 of them they are about 25 cents each.



Aluminum Tube - 1ft, about $1

Check the diameter of the aluminum tube, you want it to fit tight inside the back of the alligator clip. Also when you cut the tube make sure you are leaving enough room for the Cotter Pin to go all the way through.



The Base (free)

I had a broken clamp light laying around so this is what I used for my base, but you can pick up a plastic clamp for under a $1. Just make sure you get a big enough one to drill a hole in the top handle.



Third Hand Assembly
  1. Cut the tubing to your desired size
  2. Attach alligator clip to the tube
  3. Insert a pin to the opposite side of the tube
  4. Drill a hole on top of the clamp handle
  5. Screw the arm to the base, use a wing nut for easy adjustments


Robot Drummer

The “Spruce Deuce” has since become a sophisticated android drummer brought to life by 11 RC servos.  Servo control signals are generated by a single MD24 MIDI Decoder:



Compare to Steve3PO, an MSA-T driven MIDI robot drummer.
Other MD24-based MIDI percussion projects are underway and are being discussed at the Highly Liquid Forums.  Have you joined the forums yet?

Let them sing it for you

Even though this technology is nothing compared to the AT&T speech engine, you will find this little flash application most entertaining.

Have it sing some funny phrases to you, as it utilizes clips from other songs. If the word you picked glitches out, you can send the creator a suggestion.

http://sverigesradio.se/cgi-bin/Src/sing/sing.asp?key=F8DSMTDN