Archive for the ‘Codebank’ Category
Jul
5
Here is a handy little tip (and function) for all you Visual Basic developers out there. I use this quite often, it’s useful to see if whatever file you are working with or looking for exists before you start trying to access it. So, here we have a nice little function you can drop into a module and call from anywhere when you need it.
(Need to do the same for a directory? That function is here!)
Check it out:
Read the rest of this entry »
Feb
22
Here we go folks, I thought I would share a handy little script with you that I use to backup all of the databases on a particular Linux/UNIX server. I do this by getting a list of the databases, and then using mysqldump to dump them all to a text file. This seems to be the best way (short of replication) to get good clean backups of the data. Toss it into a cron job and you can have it done automagically. There isn’t anything yet to rotate files, but I might add that later. Also, I am going to try and rewrite this in PERL so our Windows (and other OS’s that don’t have a shell like Bash) brethren can run this script as well. For now though, it’s written for Bash but almost any shell would work I think.
OK, onto the script. Read the rest of this entry »
Nov
6
Mr. Thierry H. was kind enough to post a comment with a nice little mod to the PERL round function I posted a while back. With his addition, you can now specify how many digits to show on the right of the decimal. Pretty neat, check it out.
Sep
20
Recently I was working on a script for log reporting. You know, one of those handy little guys that send you some info every day helping to make sure you keep up with whatever it is that you don’t want to forget about. Well, some of the data was in a plain old text file, and there is nothing wrong with that. It’s easy to simply cat the file and pipe it through mailx or mutt, no fuss, no muss.
Read the rest of this entry »
May
29
I have found many times when writing stuff in PHP that I have come across a need to generate a random number. That’s not too bad in and of itself, but what about when you need a unique ID key or something like that. For example, say you are writing the next best helpdesk application and need unique case numbers and don’t want to simply use a counter. For whatever reason, I put this little function together and it has served me well. Check it out …
Read the rest of this entry »
May
23
PERL is a wonderful scripting language, it is extremely powerful, flexible and portable. It also lacks a couple basic functions that other languages have built in. Fear not my friend, just like the PERL round function, I have functions for other things as well!
One thing I miss is a trim function. They have chop and chomp, but that doesn’t always fit what I want. Below I have included a few suns that will get the job done nicely, check it out. Read the rest of this entry »