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."
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
/**
* Java example for GeSHi
*/
import javax.swing.JOptionPane;
public class Foo {
public static void main
( String[] args
) { int n = args[0];
for ( int i = 0; i < n; i++ )
{
}
}
}
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.
I have been spending some of my free time as a moderator of the PHP forums at
Phpfreaks.com, one of the most visited websites on the PHP language. The Tutorial is titled:
LAMP, MySQL/PHP Database driven website design and development, and the List-Detail-Post paradigm. Part I. It's been read over 700 times already, which is a good start.
I released version 1.10 of IVWeather.class.php tonight. This release fixed a few bugs, and added localization support. Details available
here.
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.