Uncategorized

Google Chart API PHP classes

Following on from my recent release of AGCDR (Asterisk CDR Statistics), I thought I would make an important sub-set of that project available separately. As part of writing AGCDR I wrote a reasonably extensive set of PHP classes to interact with the Google Chart API. The following chart types are supported, although some do not support all the features that the API offers:

The download contains all the classes, both in separate files and in a combined file (which one you will use will likely depend on whether or not you use class auto-loaders) plus a page of example usages to get you going.

As with AGCDR, this is currently being released as a beta so it’s not perfect and I would welcome comments, suggestions and bug reports. Please submit any comments, suggestions or indeed any code you would like to contribute via the Google Code page in order that all information pertaining to it is kept in the same place.

Here’s a gallery of examples:

Uncategorized

Asterisk CDR Statistics

I’ve been a beneficiary of the open source software community for quite some time now. Ever since downloading Slackware Linux onto upteen floppy disks in 1995, I have used and profited from the use of open source software, whether it it be an operating system, programming language, server technology or desktop application. However, up until this point I’ve never given anything back to the open source community (I really don’t count my Twitter CLI script), chiefly because every software system I have created or worked on has been proprietary and subject to non-disclosure agreements. I’m not grumbling about that, not all software is meant to be or should be open source and working on such systems has paid the bills (just about).

So, what have I written? Unhappy about the lack of a decent (and free of charge) system for analysing caller detail records (CDRs) generated by Asterisk PBX telephone systems, I decided that I would combine a number of techniques that I have learnt and developed over the past year or so to put my own package together, and it’s now at the stage where I think it could be considered a beta. This means that it’s not perfect but it’s more or less there. I’ve started hosting it over at Github.

Principal features

  • Clean, modern interface.
  • Supports multiple Asterisk servers which record their CDRs to a MySQL database.
  • Uses Google Chart API to generate dynamic charts.
  • Quick and advanced search facilities.
  • Rolling monthly and annual reports.
  • MVC framework*.

Screenshots

Further development

Where does it go from here? I’m open to suggestion, which is why I’ve published it and I would welcome comments from anyone who’s interested and/or finds it useful, whether you are a developer or just an end user. Is it useful? Does it work out of the box on your system? Is it easy to install for someone who isn’t a developer? What other features would be useful, bearing in mind that the data produced by the Asterisk CDR MySQL add-on is relatively limited?

I know that the documentation is a little rough around the edges and so I shall be paying attention to that, certainly. I also want to do some really thorough and structured testing in order to ensure it’s as robust as possible. I’ve tested it, obviously, but I’ve not seriously tried to break it yet.

So please feel free to download it, either as a tarball for installation or from the Subversion repository if you would like a good look under the hood. Please submit any comments, suggestions or indeed any code you would like to contribute via the Google Code page in order that all information pertaining to it is kept in the same place. I won’t publish any comments made directly on this blog post for this reason.

Uncategorized

Command line Twitter script

I mentioned on Twitter the other day that I have a relatively basic but functional command line Twitter script, for use when you can’t or just don’t want to load the full-fat Twitter site in your web browser or you don’t want to use a third party GUI client. I received much more interest in this than I thought I would (i.e. more than zero) and so after some thought* I’ve decided to make it available to anyone who wants it.

The script, which supports a single Twitter account, supports the following actions:

  • Update (tweet), with option to specify an existing update ID to reply to.
  • Retrieve your public timeline (your tweets and those of who you follow).
  • Retrieve your own timeline.
  • Retrieve the public timeline.
  • Retrieve your recent mentions.
  • Retrieve recent re-tweets of your updates.
  • Search Twitter.

In order to work, you must authorise your Twitter account with SuperTweet, and provide the script with the username and secret that you specify in your SuperTweet account. This is because the script does not support oAuth (at least, not yet). Also, if you use Twitter to post URLs (and you probably do) you will also require a Bit.ly API key. Edit the script and provide both sets of credentials at the top.

The script is self contained, containing all the various classes that it depends on in the same file. I’ve verified that it works “out of the box” on Ubuntu Linux 10.04 and Mac OS 10.6. It will probably work on many other systems too, assuming they have PHP installed. With a small modification to the first line you can probably get it to work on Windows too, but that’s as far as I can advise, you’re on your own from there. The version I use doesn’t contain the included classes as I link it to my local class library.

To get started, download the script, unpack it with gzip -d, add execute permissions with chmod +x and then type ./twitter.php commands for a usage summary. Some commands when called without arguments will present further usage summaries which will tell you how to use them. You’ll probably want to start with something like:

./twitter.php update "Testing @stuartford's pitiful command line Twitter script."

Don’t forget to add your Twitter and Bit.ly credentials to the top of the script otherwise it definitely won’t work first time for you and I’d rather that didn’t happen.

If you don’t understand most of this post then this script probably isn’t for you, sorry, it is what it is, no warranty, etc.

* I say it required some thought because it’s rare that I make my code available for public use. I don’t know why, because I believe I am a talented software developer, I guess it might be the slight family creative gene within me that might be forcing a behaviour equivalent to an artist who’s perpetually reluctant to show people his work, who knows, that’s one for the shrink’s chair. Certainly the script isn’t my best work, it grew out of something quick and dirty, and as any developer will tell you, anything that grows out of something quick and dirty will always be quick and dirty at its heart.

Uncategorized

Back in the saddle

I  started my new job in Birmingham city centre (specifically, the Jewellery Quarter) on Monday, for Glide Utilities, a firm that sells household utilities (gas, electricity, telephone, broadband and TV licence) as a package to renting house-sharers, passing on a portion of the cost-savings brought about by bulk deals made with suppliers.

As I mentioned in my previous post, instead of paying separate suppliers directly, who will insist that accounts held with them are in one name only, house-sharers all pay a fixed sum every month to Glide who then handle the rest. It makes for easy budgeting and reduces household administration which can otherwise be a bit bewildering to people who are living separately from their parents and not in university halls for the first time. Glide is currently unique in its market and by all accounts seems to be doing very well.

My job is, with another member of technical staff, to maintain and enhance the somewhat complex software system that runs the company, which does virtually everything from internal company administration, accounting and billing right through to live ordering and status checking of utilities from suppliers. As with any existing system being started on by a new developer I will need a suitable gear-up period, but I’m making great inroads into it and I reckon that by the end of the week I’ll be able to make some initial recommendations as to procedure and future development.

It’s really good to be doing what I do full time again. It occurred to me on Monday morning that the last time I got up in the morning to go to a full time job in an office somewhere my life was very different, better in some ways and worse in others. It’s very different now, still a long way from ideal, but I do know that I’m going in the right direction to get to where I want to be. Doing what I am good at every day is a critically important step towards my goals rather than wasting time on the amount of sales and marketing that self employment demands of me, because I’m absolutely hopeless at both. I’m creative and technical, always have been, always will be.

I’ve been told to get the train in on Friday and not drive in. I can only assume that this means there’s going to be some sort of new-starter party in the afternoon/evening. It’s a young company and everyone who works there is around my age or younger, so I think it’s a fair bet that that’s what it’s going to be.

Uncategorized

Gainful employment

I’m delighted to report that on Monday I start a new job as a Software Engineer for a utilities management company in the Jewellery Quarter in central Birmingham. The reality of being self employed is quite different to what is perceived and I was very much struggling with the sales and marketing side of working for myself, so I decided to move back in to full time employment in order that I may concentrate on and spend my time on what I’m actually good at rather than incur frustration at spending time on having to do things that I’m not so hot at. I’ve never been a salesperson and I never will be. You have to be a certain type of person to do that I’m just not that person. I’m creative and technical, always will be.

The company is unique in its market. It provides a service to landlords and tenants whereby all members of a shared rented household pay one fixed monthly sum for all their utilities, including gas, electricity, water, telephone and broadband. Primarily aimed at the student market where house-sharing is most common, the company uses its buying power to negotiate cheaper rates from utilities providers and passes a portion of those savings on to their customers. It’s an exciting young company and I believe that I can make a difference to their operation and improve it through the ongoing enhancement of their existing software systems.

It’s an 11 mile commute into central Birmingham every day, which is fine, it should take me around 45 minutes each way. I don’t have to be in the office until 10.00am each day so that should allow me to avoid the worst of the traffic, which is ironically enough on the roads leading into and out of Sutton Coldfield rather than central Birmingham itself, once I’m past Sutton it becomes a lot easier. The equivalent train journey is less pleasant at 90 minutes in each direction including the two walks from the start and destination stations, so using the car is the way to go.

I’m looking forward to it.

Uncategorized

Aptana Studio

aptana_blackUp until a few months ago I used Zend Studio as my IDE (Integrated Development Environment). I’d used this for a number of years, since 2005 I believe, and the version I was using (5.5.x) was starting to show its age. Zend do have a new version but I never got on with it, largely I suspect due to its Eclipse underpinnings. Whilst Zend Studio 5 was dedicated to PHP, Zend Studio 6 seemed little more than a plugin for a different IDE that was more geared towards Java developers, and it just didn’t work for me. The price didn’t work for me either, at €399.

Then along came Aptana. which I stumbled across whilst doing some research into Adobe Air (which came to nothing, incidentally, I’m not going to bother with it). Apatana takes all the good bits of Eclipse, adds to them and packages them up into an IDE that’s aimed at web developers in general, whether your poison is PHP, Python, Ruby or whatever else. It’s aware that the software you’re developing is web software, and so knows about things like CSS, Javascript, Javascript libraries, XML, JSON and so forth. It just feels like it’s geared towards you as a web developer, rather than a generic software developer, which is how Eclipse makes you feel.

Aptana is brimming with features, too numerous to list here. Suffice to say that, if you are familiar with modern IDEs, all your bases are covered and then some. For those who don’t use an IDE I would suggest Aptana as a good starting point in the IDE world because of what I mentioned before about it not being completely generic.

It has its shortcomings, as any piece of software does. My biggest gripe is that it’s written in Java, which brings along all the usual problems associated with software written in Java, i.e. large memory footprint, high CPU usage, messy crashing, etc. That said I appreciate that Java has allowed Aptana to be cross-platform, thus reducing development costs and, ultimately, keeping its price tag at a very reasonable $99. It’s certainly the best $99 that I will spend this year.

1 2