February 11th, 2009
I discovered this looking for an easy way to keep DNN alive on a low volume site. Since Dot Net Nuke (DNN) uses ASP, if no one visits the site for 30 minutes it will unload and take an ungodly amount of time to load for the next visitor. One more reason to avoid it…
Here’s a handy script (called “sPing”) to monitor any number of sites and ensure that they return a pleasant status code (200 or 304). The script will silently access each of the URLs in the array. Any that return something nasty like a 403, 404, 500, or 503 will be output to the console along with the particular status code.
http://jamescoletti.com/php-website-monitoring-script
Since my hosting arrangement sends me a notification every time a cron job executes, I entered a non-existent address (for cron notification) to avoid getting notifications every 15 minutes and then added my own SMTP mailer logic to send me a notice if any of the sites are down.
December 11th, 2008
I use the .html extension for many of my php files for varying reasons. I had given up on getting Dreamweaver to color the code properly until I stumbled upon this post:
http://groups.google.com/group/macromedia.dreamweaver/browse_thread/thread/8b0065838857c78b/49bedbef1f146e65?lnk=raot&pli=1
First, copy this file from the app config folder:
C:\Program Files\Adobe\Adobe Dreamweaver
CS3\configuration\CodeColoring\PHP.xml
To the user config folder:
C:\Documents and Settings\[username]\Application Data\Adobe\Dreamweaver
9\Configuration\CodeColoring\
Then open PHP.xml in your favorite editor. You need to add HTML to all
of the doctype lists Change every occurrence of this:
doctypes=”PHP_MySQL”
to be:
doctypes=”PHP_MySQL,HTML”
Save and close. If DW is running, close it. Now restart DW.
Worked like a charm. I’m using OSX, so just did a search for the appropriate files and found the folder structure to be about the same as above.
Voila. Thank you Randy Edmunds!
July 7th, 2007
I recently added a new page in WordPress to contain Google search results within the site. I did not want this page to appear in my top menu however which is automatically generated by the template. This page in the WordPress Codex shows how to work with the template tag “wp_list_pages” to exclude certain pages from being listed by id.
http://codex.wordpress.org/Template_Tags/wp_list_pages#Exclude_Pages_from_List
July 6th, 2007
Needed to pull rows from a MySQL database, selecting by month, using the MONTH() and YEAR() functions to extract from the datetime stamp. Following returns all records for the month of January, 2007.
SELECT * FROM table WHERE MONTH(datetimefield) = '1' AND YEAR(datetimefield) = '2007'
Or for more detailed date range control, use the DATE() function to extract the date. Returns all records between two dates.
SELECT * FROM table WHERE DATE(datetimefield) BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD'
MySQL manual documentation of date and time functions here http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html.
June 7th, 2007
So a client has a great new video site. And as it attracts users, it attracts unsavory script kiddies from across the globe – probing the system for weaknesses and always it seems trying to send nonsensical spam. The first thing they do is create a user account to get into the members area. We always get a heads up because inevitably they use a bogus email address, and in turn the registration notice bounces back to info@. The client then forwards to me and I delete the bogus users from the DB. I always notice in succession they try and stuff additional mail headers into the database. The input gets truncated because of the length and thus far appears to be a fairly harmless nuisance.
Read the rest of this entry »