Categories
MySQL

MySQL Scheduled Backup

Another of these things that I'll park here until I have the time to implement it.  A MySQL backup solution to to scheduled backups and optionally email the backup files and logs.  Open Source, of course.

http://www.debianhelp.co.uk/mysqlscript.htm

Categories
MySQL

MySQL Triggers

This external resource looks like about the best tutorial I've seen yet for MySQL Triggers.  I'm going to have to play with this, I've been putting off implementing some necessary triggers for lack of a clear tutorial to guide my first efforts.

http://forge.mysql.com/wiki/Triggers

 

Categories
Operating Systems

Testing and Elevating Admin Privileges in Windows 7 / Windows 2008

Introduction

Due to UAC , many processes, including many installations, must be run from an elevated privilege level, even when you are logged in as an administrator.

Testing for Privileges

The following code in an installation script will test to see if the script is operating

::Test whether script has Admin Privileges/is elevated
at > nul:
If "%errorlevel%"=="0" (
  echo You are Administrator
) else (
  echo You are NOT Administrator. Exiting...
  Ping 127.0.0.1 > nul: 2>&1
  Exit /B 1
)

Elevating a Session

You can run any executable by right-clicking it and selecting Run as Administrator.  However, you may find that you want to simply elevate your session.  (Think before you do this, there's a reason they have UAC.)

The following process details how to elevate a session;

  • Log in as admin
  • Open an elevated CMD window
  • Right-Click on Command Prompt in the Start menu and click Run as Administrator.
  • Kill the explorer proccess from Task Manager or enter the following command at the elevated command prompt. (/F forcefully terminates the process and /IM represents the 'image name' of the process to be killed, i.e. explorer.exe )
    • taskkill /F /IM explorer.exe
    • In the elevated CMD window, start a new explorer process explorer.exe
    • Close the elevated CMD window
    • Since the explorer process is now running elevated, subsequent operations should not require elevation.

In fewer words:

Log in as admin
From an elevated command window enter the following 3 commands:

taskkill /IM explorer.exe /F
explorer
exit

 

Categories
Web Development

Make your .php extension optional

Place the following code in your .htaccess file to make the .php extension on your pages optional.

RewriteEngine on
# ----- make .php extension optional -----
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ $1.php [QSA,L]
# ---- /make .php extension optional -----

Further suggestions on URL rewriting can be found these articles:

Categories
MySQL

Foreign Keys and Referential Integrity in MySQL

This TechRepublic article is a good fast introduction to the topic of Referential Integrity and the use of  Foreign Keys in MySQL.