Skip to content

Exploring Mysql CURDATE and NOW. The same but different.

Sometimes I see people attempting to use VARCHARS or CHARS to store dates in their MySQL database application. This is really fighting against MySQL, which has a variety of interchangeable date types. Internally MySQL is storing dates as numbers, which allows it to do all sorts of nice arithmetic and comparisons with very little effort on your part. For example, when you use a mysql DATE column to store a date, you don't have to worry about sortation, or comparing that date to another DATE, because MySQL already understands how to do those things internally. A lot of people also don't realize that they can output a DATE column in just about any way they choose using the DATE_FORMAT function. This causes people to shy away from using DATE, DATETIME, TIME, or TIMESTAMP columns, when they really should.

Continue reading "Exploring Mysql CURDATE and NOW. The same but different."

My First Serendipity Plugin

I've exploring the Serendipity API by writing an "event" plugin wrapper around GeSHi. GeSHi is an extremely cool php class that does color syntax highlighting for any computer language you want. Since I hop from language to language, this is exactly the type of capability I want. So without further ado, here's a test of my plugin, currently in alpha state:

First some PHP

    function generate_content(&$title) {
        $title = PLUGIN_EVENT_GESHI_NAME;
    }
 


Now some SQL

SELECT * FROM temptable WHERE USER= 10
 


and how about a hot cup-o...

Java
  1.  
  2. /**
  3.  * Java example for GeSHi
  4.  */
  5.  
  6. import javax.swing.JOptionPane;
  7.  
  8. public class Foo {
  9.         public static void main ( String[] args ) {
  10.                 JOptionPane.showMessageDialog(null, "hello, world!");
  11.                 int n = args[0];
  12.                 for ( int i = 0; i < n; i++ )
  13.                 {
  14.                         System.out.println(i);
  15.                 }
  16.         }
  17. }
  18.  


I have a lot to do (and learn about Serendipity) before I feel the plugin will be ready to release in beta state, but at least I thought I'd try it out and show a proof of general concept.


Defined tags for this entry: , , , , ,

Laurel Canyon Cam

I wanted to do a Laurel Canyon Cam for a while, and finally got one positioned in a location of the house that provides a decent if not perfect view of the inner canyon through a window. The cam faces north and takes a 640x480 image once every minute, transfering it to one of the gizmola webservers. I then overlay this information with the local temperature which I pull from an xml weather feed via a php class library (ivweather.class.php) that I've recently released. The included ivweather test page is live here.

The cam allows for positioning, and I'm experimenting with this, and hope to allow visitors to be able to move the cam into one of a series of presets via the web.

In addition I added a forum to support the various scripts and opensource projects I've released, as well as providing a place for folks to guest book, or leave questions or comments about any of the articles or blog type entries I've provided on the site over the last few years. Drop by and say hello.
Defined tags for this entry: