Trumpet and Drum

A busker playing the trumpet, offers to let a passer-by his drum. The man, accepts, beating the drum to his own tune, a melody that while out of synch with the trumpet player, seems to fit. The soulful tunes of the trumpet echo throughout the mall, and the slap of hand on drum bounces from the walls. I wander past, the drummer dances, the trumpet player continues his tune, and people watch as they pass.

An argument erupts – it seems the drummer’s tune isn’t appreciated by all. This is to be expected, different musical tastes, and the testosterone flow induced by the consumption of alcohol makes those tastes into challenges for some people. The argument escalates, the music stops and instead, the sounds of shouting replace the tune.

Returning from my journey, I pass the group again, and wonder what the argument is truly about – I won’t ever know, and other than this story, I’m likely never to think about it again. Continuing on, I hope for the music to return, but alas, it is replaced by another sound.

Bass travels further than treble, having a slower frequency that travels through the air further. The flat slap of fist on face has little treble, and is easily recognised to anyone that’s felt or heard its sound before. The sound repeats, and I turn. A scuffle has broken out, as happens with groups of alcohol-fueled people having a difference of opinion. Reason and logic are rare in today’s society, and this is only made worse by such circumstances.

I watch for a second. Girls, seeming to be friends of part of the group are screaming for the fight to stop, and friends of the fighters are pulling them apart. With the police presence in the area, the fight will not continue for long, so resign myself to the fact that this will just be another scuffle of many tonight around the city, and continue on my journey back to work, to type up this tale.


2 Comments

phpSQLiteAdmin falls down

Well, there goes that idea. I was going to start work on something like a mini phpMyAdmin for SQLite, but it doesn’t support quite a few things that a project like this would require. I don’t know if it’s possible to pull the information from the database engine itself, but things like table lists and so forth aren’t part of the function list like in the MySQL functions available through PHP. What a pity – some of those functions are really quite powerful, though generally only useful for administration tools.


No Comments

PHP5 – a whole new ball park.

As you may have read in my previous post, I’ve installed PHP5 on my laptop. It’s running windows, but don’t hold that against it – it’s still running Apache as the httpd. I’ve heard some good things and some bad things about the latest incarnation of the PHP scripting language – most of the bad things are the fact that they’ve changed the language so much that many people are going to have to entirely re-write their applications. This is a problem, but hopefully only a relatively short-term one – except for the fact that it’s still VERY hard to find any hosting companies that supply servers with PHP5 installed and usable, since most people are still looking for good old PHP4 servers.

I’ve been playing with it over the last two nights, and from the things that I’ve seen, I’m blown away! I love PHP – most of my programming is for websites, and it lets you get most jobs done really quickly with a minimum of fuss. With the latest version, I can only see good things. The language has been re-written to be more suited to object-oriented programming styles, which is great for the larger application developers, and for the people that don’t use those sorts of things, the language doesn’t pick on you.

The inclusion of the simpleXML lib functions are a great boon to anyone using XML. I still can’t work out how to use the original built in PHP4 functions – I’m sure they make sense to someone. The new functions allow you to go (for example):

$parsed = simplexml_load_file( “test.xml” );

And it will load the file, parse it, and set $parsed to an object including all the data in the XML file. It means that you can access the data straight away, and don’t have to write a whole XML parsing library before you get down to the job of actually doing something useful with the data. I’ve been told that there are a variety of classes and libraries that have already been written, but they are all .php files, needing runtime processing by the PHP engine, and adding overhead to your application. The inclusion of built-in functions means they are written in C code, making them a lot faster and removing another step from the testing process (hopefully there’s no actual bugs in the functions!) :)

What I’ve been playing with tonight is the SQLite functions, which allow you to run a small (hence the name) SQL server based on files in the directory structure on your server. There’s a little bit of overhead in this of course, but for people running small sites that don’t need the full-blown power of MySQL or any of the other RDBMS’ it makes for a great addition to the language.

SQLite isn’t a separate daemon that you have to run, it’s built into PHP – meaning that if it’s part of PHP when it’s compiled, that’s all you have to do. The functions have been written just as the old mysql functions were – sqlite_connect(), sqlite_query() and so forth. Obviously you have to know how to manipulate the data with SQL commands, but for anyone that’s done it before, it’s rather easy. Otherwise, there’s lots of tutorials on-line on how to set up a new table and so forth.

For anyone actually running a large site, using SQLite would be a disadvantage of course – it’s not designed for large amounts of users or large applications. Each time you load a page, it’s loading the database files afresh – being based on file system storage – rather than a proper RDBMS which can load databases into memory and allow for large amounts of users and concurrent requests. I think I might get around to writing something like phpMyAdmin for SQLite – it could be a nice little project to play with, since there’s going to be a need for it by the community in the future. I guess I should probably check if someone else has already started a project like it, since I’ll probably be reinventing the wheel :)


No Comments

Bored!

Yahoo! I’m officially bored out of my skull. I’ve read pretty much all the interesting parts (and the rest) of the PHP manual that I’ve got on my laptop, I’ve played a bunch of games of Pinball, Minesweeper and Solitaire (I know I’ll only get frustrated with FreeCell) and I’ve done little coding projects on everything I can think of, other than just throwing data in and out of SQLite. I know I could probably start on the solitaire game I’ve been telling myself I would code up for a while, but you know what? I really can’t be bothered right now :)


No Comments

LiveJournal FOAF XML Parser

This was originally page on this site, but I’ve since decided to just make it a post. Here goes:

 

This is a class for PHP5 that allows you to load up a FOAF (friend of a friend) file from livejournal.com and display information from that file.

Simple usage:

require( xml-foaf-class.php );
$foaf = new Foaf;
$foaf->do_processing( “filename” );

echo $foaf->nick;

Download the source here: xml-foaf-1.0.zip


No Comments

Older Entries Newer Entries