Author - Web Developer - Educator
RSS Feed

I had a case of the Tuesdays

I know it's Wednesday, but this first portion deals with YESTERDAY. Deal with it. After I posted yesterday's entry, Keat and I went home. Nothing super special, but it started raining. Hard. We went to Ingles to pick up some dinner, then got back out to the car, and the stupid car wouldn't start! Since the RKE doesn't respond anymore, we have to open the car with the key, which causes a mini-alarm to go off for a bit. After about 10-15 seconds, the full-on "HEY! I'M BEING STOLEN!" alarm goes off. Which it did. For 10 minutes. The stupid key wouldn't turn in the ignition. So here we are, holding groceries, in the hard, wet rain, trying to either disconnect the car battery and/or start the car. The car finally started and we were off. Soaked, but wet.

ANYWAY, there were a few comics in the past day that I liked, so I'll be posting them throughout the week. Here's the first one.
The System

Haven't posted a System comic in a while, but what the hey - I thought I'd do it.

On to more technical stuff(s), I had an idea for a developer-friendly MySQL error notifier, since mysql_error() only works on the front end. My proof-of-concept that I developed yesterday really worked! And I'm so happy! Here it is for anybody to use.
#notify developer(s) of MySQL Errors
 
#use: $result=mysql_query($sql) or die("Oops!".mysql_dev_error($sql));
 
#(c) 2011 - Shadow Development [http://shadowdev.com]
 
if (!function_exists(mysql_dev_error)){
 
function mysql_dev_error($sql){
 
        #get the php-generated mysql error
 
        $error=mysql_error(); 
 

 
        #get the database name
 
        $db_q=mysql_query("SELECT DATABASE()"); 
 
        list($db) = mysql_fetch_array($db_q);
 

 
        #get the top-level domain along with the page the 
 
        ## query is being executed on
 
        $page=$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; 
 

 
        #send HTML email
 
        $headers  = 'MIME-Version: 1.0' . "
 
";
 
        $headers .= 'Content-type: text/html; charset=iso-8859-1';
 
        $headers .= "
 
";
 

 
        #generate message
 
        $message ="SQL Query:
$sql

"; $message.="Database:
$db

"; $message.="Error:
$error

"; $message.="Page: $page"; #send off mail("DEVELOPER_EMAIL", "MySQL Error for ". $_SERVER['SERVER_NAME'], $message, $headers); }}

BTW: Creative Commons License
MySQL Developer Error by Kyle "KP" Perkins - Shadow Development is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

I'm really surprised how well it works for just a proof-of-concept. I told Keat last night that I must be getting really good at this "programming" thing. I used to think of an idea, write it down, write the code in 15 minutes, then spend 2 weeks debugging it. Now, my 15-minute code sessions work like a charm from the get-go. I must be doing something right....

Here's the overview of what I got done today:
  • I got some minor edits done to the Shadow Dev Beta blog (added a side navigation like the on one this blog; had to make my own URL shortener for some URL-based comments).

  • Made some additions and edits to the Receipt Rescue.

  • Finally sent out May's newsletter and followups (I'm only 3 days late!).

  • Contacted a potential client to find out that my idea of a "potential client" turned into "We need an editor" - no fun.

  • Made a minor adjustment to my Cron job from last week (decided to have the IP addresses added to a DB log and see which ones were repeats - so far, it's blocked 29 addresses in just over a week; that's about an hour of free time I got back!).

  • Finished Rocko's Modern Life on Netflix (first 3 seasons were good, the last season got a little weak, like most final seasons do).

  • Added a Microtimer to the Main and Beta Shadow Dev sites to see the page generation time.

  • Found out about EchoSign.com - an electronic PDF signer for clients. Not a bad idea, and I may try it in the future.

...and that's about it for now. Till tomorrow!


Tags:#thesystem #php #creativecommons #mysql #car #alarm