Entries Categorized as 'PHP'

Is that a spare computer?

Date May 21, 2008

After my last harddrive purchase I explained to my wife how much space I would have (note to self, don’t do that again), she asked “Does that mean you have enough room for the kids games, so we can get rid of their computer?”.

Of course I answer too quick for my own good “Oh yeah sure”. What was I thinking? They might infect it with thier harsh treatment of shutting down improperly, constantly reinstalling programs, and of course they’re DOS based games! But it was too late, I had said yes, and if it weren’t for my oldest I’d be sunk.

He spoke up (I think he suffers the same quick to comment problem I have) and said “We barely even use it anymore, so we don’t need to use your computer dad”.

Sweet, totally off the hook and I have a spare computer to boot!

So what to do, what to do?

My technical blog - in beta form (finally)

Date April 2, 2008

So, as a personal experiment I’ve been developing a technical blog from scratch.

Well I’m happy to say it’s now into a beta stage and available to view by anyone. There’s not a lot to it, just a few entries and no way to comment (yet), but it’s working and it’s doing the job it’s been programmed thus far.

mc-beta01

You can see here the basic form, I’ve built it from a theme developed by arsin called Beautiful Day. Everything else has been done by me. I’m pretty happy with the little calendars I built (look ma, no tables!). I’ve been struggling with trying to keep the whole thing XHTML valid, but I’m getting stuck when trying to show code inside an entry. I know the problem, and I’m working on a solution, just takes time…

Backup my databases! PHP + Shell + Cron = simple backups

Date January 25, 2008

Alright, I think I have it (I’m just waiting to make sure cron fires off and runs everything)! It’s very simple, and probably pretty dirty - but hey I’m not a whiz with shell scripting, nor cron so I think what I have is pretty sweet.

Because I’m lazy (I’m a programmer!) and I know I wouldn’t remember to run backups in an normal fashion, I wanted to make a system to run them automatically, think set it and forget it (wait wasn’t that an infomercial of some type?). So without further adieu…

The Shell script:

#!/bin/sh
export PATH=/usr/local/bin:/bin:/usr/bin
mysqldump --opt -uUsername -pPassword --all-databases >
~/db_backup_tmp/all-db-backup.sql &&
mv ~/db_backup_tmp/all-db-backup.sql ~/db_backup/all-db-backup.sql

The PHP script:

$file = "~/mysql_backup.sh";
exec($file);

Calm down, I’ll explain it…

So first we have the shell script.

#!/bin/sh

From Wiki