Skip to content

PHPlot, MySQL and the Dark Ages of Camelot

The Dark Ages of Camelot (DAoC) is one of a number of Massive Multiplayer Online Role playing games (MMORPG) available for people who like those types of things. Mythic Entertainment, the company behind DAoC decided to offer an xml feed with various statistics about the game including the number of active players. From April 2002 to July 2005 I used a cron job to query the xml feed once every 5 minutes, parse the results and store the statistics in a database table.

I made a graph of these statistics available on a fan site I operated. The graph used the open source PHPlot graphing class in order to draw a line graph charting the number of players playing the game by hour for a 24 hour period. Visitors to the site would see the line graph shown here, plotting the number of players per hour against a second line showing the day's average. Like many PHP graphing libraries, PHPlot assumes that you have the GD library installed and available to PHP on order for the graphs to work.

This was one of my early experiments with PHP, and illustrated its power and flexibility. Now that the site where the graph appeared is no longer online, I figured I would provide the code, and a small subset of the database, for people interested in how to program with PHPlot. At the time I created this code, PHPlot didn't have much documentation and required some trial and error experimentation. Of course, since then (several years now) PHPlot has been improved, and should definately be considered if you want graphing in your application. Because I don't want to spend time debugging old obsolete code, I've provided the library I used in the download along with the graph script. It would probably work with the latest release, but I don't have time to test it. You can download my example database, version of PHPlot and script here. The database contains one months data, so you can play with the script and explore the class.

Read on for some brief instructions and an explanation of the code. Continue reading "PHPlot, MySQL and the Dark Ages of Camelot"

Joomla (Mambo) Core ERD diagrams

I have a small project that involves an implementation of Joomla (a fork of the popular PHP/Mysql based content management system Mambo). I started with Mambo and during the time I was configuring the site, the core developers of Mambo left to create the Joomla project. The reasons for this are discussed on their OpenSourceMatters website.

Suffice it to say, I find an Entity Relationships diagram to be very helpful in understanding the architecture of a database driven application like Joomla. There wasn't one available, so I decided to reverse engineer the database, and created these diagrams, which break the core database down into a few functional areas.

UPDATED At one time my pdf version of this was hosted by Joomla, but in one of the many moves of source code, the links to it were broken. You can get the pdf with all the views here.

User and Security Subsystem


Backend (modularity and extensibility) Subsystem


Content and Presentation Subsystem


Banners


Logging
Defined tags for this entry: , , , ,

PHPeclipse Annoyances

I have become an Eclipse convert. Eclipse is an IDE which I use to develope my PHP projects. Eclipse is open source and free, and has too many features to even begin listing. It also has a myriad of modules supporting language specific extensions and support for programmer tools like CVS.

I've also been using the PHPeclipse extension, which adds a number of nice PHP specific features and in eclipse terminology, an eclipse perspective, which is especially useful if you develope in an all-in-one environment with a local apache and php instance on your workstation. This allows you to iterate rapidly, as your changes can be instantly examined in the docked browser window, and ostensibly give's one access to php's debugging hooks. I'll admit I've never tried this, although having a debugger available is always a nice feature for any platform.

The main things I want out of PHPeclipse are color syntax hilighting, a class and function browser window that makes it quick to jump around inside your code, and PHP functionn prototypes so I know what the argument list is for all those useful built-ins like substr and array_sort, all of which you get with PHPEclipse. The class browser works well, except that it's not smart enough to resolve includes, and for this reason, rarely has visibility into the classes you're using because they're in their own class file. You can always open these in a seperate source window of course, as your workspace you can have numerous files open, all easily accessible from tabs. Continue reading "PHPeclipse Annoyances"

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: , , , , ,

The 6 Million dollar site!

We can rebuild him. We have the technology.
We have the capability to make the world's first Bionic man.
Steve Austin will be that man. Better than he was before.
Better . . . stronger . . . faster.


After several web years having earned some sort of living from the development of interactive systems, I felt it was finally time to sit down and get started on a project that has been in the back of my mind for much of 2004. Namely, to relaunch GizmoLA.com, using database driven technology (in this case the popular LAMP combination [Gentoo Linux running as a UML instance on a coop server coowned and operated by myself and a bunch of people I met virtually through the Linux Users of Los Angeles, the Apache Web server, Mysql database server and PHP scripting language] as the platform for a php based "blogging" server called Serendipity. I realized some time ago that the original GizmoLA.com (which was always plain old html, created primarily in Dreamweaver) had always been designed to be a "Blog" of sorts, only I began it long before anyone had actually coined the term. Back in those days you just called it a homepage or personal home page. What I always wanted was a site that I could use as a repository for notes about my various projects, diary entries and musings about the places I've been, music I listen to, books I've read, movies I've seen, people I know, products I like and dislike, and things that I find interesting.

For quite some time the task of sitting down and manually updating things in the static html pages that comprised GizmoLA have made it an onerous task. The site has also moved a number of times and in the process things that were originally on the site broke or became obsolete.

I have a variety of goals for this new system, and I'm betting that Serendipity, which is still very much in Beta, will be the platform upon which I can build the type of site I have always wanted. As I work on converting the original Gizmola over, I'll try and elaborate on my goals, and provide an occasional update in the process.

My first order of business will be to convert some of the old articles over (or not, I haven't 100% decided how to proceed), and create a template that reflects as much of the original GizmoLA.com design as makes sense. This will certainly be an adventure in wrangling html and .css.

Another important aspect of what I want from my blog is the ability to include code and diagrams in certain blog entries. From what I can see this will probably be the first thing I'll need to create a module to do, unless I can find one that already exists. I did look hard at using the popular PHP blog package WordPress, even to the degree of installing it and adding in a few modules. I can't say for certain that my experience with Serendipity will be better, but the module architecture for Wordpress required me to do a lot of manual editing of existing scripts which didn't strike me as particularly modular.
Defined tags for this entry: , , , , , , ,