See if a file exists in Visual Basic

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:

Continue reading

Simple Machines Forums (SMF) and Deleting Multiple Posts by One User

OK folks, I came up with something helpful and I thought I would pass it on.  Recently I had a spam bot (or maybe a real person, who knows) join the forums.  Went right through all of the security controls and verifications.  Then, said user went about posting almost 500 porn posts all over my site’s forums.  Posting topics, posts, pics and embedded videos, it was really bad and I was really mad.  First off I banned the user, no problem.  I figured I would do that so I could keep relevant info like IP and email addresses rather than just deleting him.  Now I had the arduous task of removing all those damn posts and topics.

I do know that you can delete a user and tell SMF to also delete all of those users topics posts as well, but that hasn’t worked in the past so I did it on my own. Here is what I did.

Continue reading

MySQL Database Backup Script

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.  Continue reading

Solarum’s MySQL Reference

Heads up, I have added something that I think you will find useful.  I have added a MySQL reference to the Library!  This is more than a cheat sheet, I try to explain the things that are going on in there as we do it, so it should be a good way to not only see how to do specific things, but also understand them as well.  Check it out here and see what you think, if you see anything wrong with it or you have some tip of you own you’d like me to add, drop a line and let me know.  Enjoy!

Labeling Hard Drives In Linux

Recently I got another external USB hard drive for backing up data. I plugged it in and everything was great except for one thing. The drive came up with the name (label) that Seagate put on there by default. So I was looking a drive mounted at “/media/FreeAgent Drive”, ugh, that sucks. So, I did a little digging and came across this awesome article that covers the many different ways to label your drive. It was interesting that it all basically comes down to your file system, but this article has most everything covered. Check it out