Entries Categorized as 'Codeing/Development'

Windows x64 Access Database Connections

by Dan | 0 comments

I have spent many hours dealing with this on my own so I figured I would write down the solution so I wouldn’t have to research everything again.  If you are running a 64 bit system and need to use *.MDB drivers you need to make sure the following is set:

run: “regsvr32 odbcconf.dll” from c:\windows\Syswow64\

Edit ODBC using: C:\WINDOWS\SysWOW64\odbcad32.exe

That will save you many hours of frustration with x64 systems

Test post with wptogo

by Dan | Comments Off

I am just testing wptogo android app for wordpress

VBS Script to Delete Old Files

by Dan | Comments Off

scriptsI have setup my web hosting service to FTP my full backup of my website every Monday.  While this automation is great I forgot about one thing to maintain.  With each one of these backup files being about 1GB it can start to take up a lot of space if you do not clean up your older files!

So after searching around I came around the .vbs script that looks at the directory and deletes any file older than a specified number of days.  In this case I have chosen 60 days.  Now a few things to remember, make sure you keep backing up your site if you are running this file otherwise you will delete all of your backups if it is long than 60 days since your last backup!  Using Windows scheduler I have made this run shortly after I receive my latest backup file from my web host.  This makes my backup process totally automated now even for maintaining files!

Delete Files Older than 60 Days

Automated CPanel Full Backups

by Dan | Comments Off

cpanel_logoLooks like I finally figured out how to automate cpanel backups.  Since most of my sites are all hosted on the same account backup was a sinch with cpanel full backup.  Only issue was that I could not automate the task until now!

First I setup my own local FTP so I had a remote place to put the files.  Then using the script below edited it put in my cpanel variables and then created a cron job to run the file.  The issue wasn’t finding this script, I have had it for a while, the issue was getting the darn thing to work.  Looks like what I was missing was changing the $skin parameter to ‘lp’…thank you Lunar Pages Forum (yes should have looked there a long time ago but didn’t).  Lunar Pages would be my host and looks like they have their own skin for cpanel.  Once I got that in place everything worked perfectly and then I just scheduled the cron job below.

Here is the script cpanel_backup.php

Then schedule the script job via Cron
0 0 * * 1 /usr/bin/env php cpanel_backup.php

Color Scheme Design Picker

by Dan | Comments Off

Color Scheme Designer Screen ShotNot that you could ever have enough websites to help you choose color schemes that actually match here is another one to add to the list!

Color Scheme Designer

MySQL Dump and Load Commands

by Dan | Comments Off

logo-mysqlI have had to do this a lot lately with all the database work I have been doing so I figured I would write this down before I forgot about it.

If you need to restore a database from a .sql file here is the command:

mysql -h hostname -u username -pthepassword databasename < dumpfile.sql

If you need to dump a database to a file (for automated backup purposes) you can use this command:

mysqldump -h hostname -u username -pthepassword databasename > backup-file.sql

These can be very helpful when doing database work

Regular Expressions Find and Replace

by Dan | Comments Off

2009-07-22_085637Dealing with databases and SQL I run across a lot of lists that are usually broken by either excel or line breaks.  Well when you need a quick way to convert that to a single line comma separated list the fastest way to do it is a find and replace on regular expressions.  This can be easily done with Notepad++ or just about any text editor

For example if you had a list like:

1
2
3
4

A find of \r\n and replace with , will give you the output of

1,2,3,4

This can save a whole bunch of time!

MySQL – Find and Replace Statement

by Dan | Comments Off

50px-Edit-find-replace.svgThe other day I had to move a blog from one server to another and found out that Wordpress sometimes likes to hard code the server address into things like links and images.  I found this handy little SQL statement you can run to find and replace anything that you need changed:

update [Table] set [Column] = replace([column],’[old text]‘,’new text’);

This can save you a lot of heart ache dealing with moving servers and find out that you have a lot of broken images left after migration.

Monitor Your Website Directory

by Dan | Comments Off

php-scripts-1Well it seems that I have had a hell of a time cleaning up my website from its recent hack.  Gotta love it when the first time you find out about your site being compromised is via google.

So what happened to me is someone uploaded a whole bunch of files to my Wordpress directory with links to god knows what content.  So after going through those directories (numerous times!) and cleaning them up and deleting outdated random files I think it is finally clean.

I was looking for something to monitor my website directories for any file changes or any random uploads that I didn’t authorize.  I came across this PHP script that you can put in your root directory and then you set a cron job to run the script every so many hours.

The script emails a specified email address and lets you know of any changes since the last run.

Monitor Hacked Files Website

Download Monitor Hacked Files

Map Network Drives

by Dan | Comments Off

anyversion-icon-32x32-32bitI thought that I wrote about this a while ago…but I guess not.  Sometimes between working from home and working at the office sometimes I am missing my network mappings to get to the shared folders that I need.  Well with the easy command of:

Net use DRIVE: \\SERVERLOCATION

You can map your network drives via a batch script.  Also if you are at your office you can just run ‘Net Use’ and see all the drives you are mapped to and their locations.  This can make creating your batch script much easier.  All about the efficiency!