Sunday 29 June 2008

Live Across The UK

Network programming. Personally, I have nothing against it. Without it we would not get a Top 40 show and it's sometimes good to hear something a bit different on the radio. However, if you're going to do it, either make it really obvious (e.g. "across the UK, this is Jimmy's show!") or integrate with the local station properly.

Take for example one station I listened to in my local area. I will not name and shame however there were a few obvious give-aways that it was not a local program.

Now, the presenter was not saying the station name, only backtiming to a locally played jingle. Fair enough, we can cope with that. However, not giving any phone number out because it's probably different was a bit taxing. "Call us on the usual number on get onto the website...". I hope people can remember it.

But that's not an issue. It's expected with networked programming. The glaring mistake was the presenter promising us another program up next. The catch, the local station doesn't carry the program. Hmm... at least try to keep up the appearance of being local.

Thursday 26 June 2008

.NET and MySQL

I've done a fair bit of work on the database interface for AllDay DJ 3. One of the decisions taken very early in the design process was to make the program able to operate over a number of database back ends.

To allow for this, I've developed a standard base class that has all of the calls to the Idb... interfaces .These are generic, no mater the database connection used in a .NET program.

In a bit of a strange move and allowing for the different SQL syntaxes, I store the commands in a map that is looked up by the generic class, but loaded by the database specific class. This combined with prepared statements and the factory pattern allows for adding new database back ends easily.

Talking about prepared statements. I had to to a bit of digging around to find out how to do it in C# with a generic interface. Unfortunately, it's not as nice as the MSSQL specific calls. So, I've thrown together a method for adding a parameter to an IDbCommand:

        /// <summary>
        /// Creates and assigns a parameter.
        /// </summary>
        /// <param name="command">The command to add the parameter to.</param>
        /// <param name="param_name">The name of the parameter. E.g. "@ID"</param>
        /// <param name="type">The type the parameter accepted. E.g. string, int</param>
        /// <param name="value">The value to enter into the parameter</param>

        private void assignParameter(IDbCommand command, String param_name, DbType type, Object value)
        {

            IDbDataParameter param = command.CreateParameter();
            param.ParameterName = param_name;
            param.DbType = type;
            param.Value = value;
            command.Parameters.Add(param);

        }


Not bad, eh? You can have it for free.

Now, so far I've talked about generic database access but have MySQL in the title. Why?

I've been making use of the ByteFX library. Using it with .NET 3 has proven a bit of an issue. For one, you have to use the OLD_PASSWORD() call when creating users for the ByteFX library on the latest MySQL builds. So you may want to create a .NET only user.

Secondly, the ByteFX MySQL objects don't directly map to the MSSQL calls. Thus the rather generic interfaces. Still feeling generous at the moment, I'll give you the method I use to connect to MySQL:

        /// <summary>
        /// MySQL specific connection
        /// </summary>
        /// <returns></returns>

        protected override IDbConnection connect()
        {
            IDbConnection conn = new ByteFX.Data.MySqlClient.MySqlConnection(this.connection_string);
            conn.Open();
            return conn;
        }

Simple enough to use. I'm assuming this.connection_string contains your connection string.

So I think I'll wrap it up by saying I'll post more interesting code from AllDay DJ 3 in the future. Though, for obvious reasons, not the "trade secret" parts.

Monday 23 June 2008

Thank you for the Music

Summer has it's perks. Free time is one of the major ones for students.
But unlike some, I've decided to be productive. Rather than lazing
about as I have done for the past few weeks, I've decided to do some
software development.

My big project this summer is AllDay DJ. Currently, I'm working with a
small team to work on new features and do some bug fixes. Those of you
that want to know what's coming up, here's a sneak preview.

I've already managed to make the database management screen more user
friendly and added a drag and drop instant player. In fact you can now
drag and drop onto the main playlist now as well!

Instant players can now be stopped (there was a fair few complaints
about that one) and search as you type has now been disabled for
performance reasons.

There's also been a few behind the scenes works as well including
search results in alphabetical order and the database is no longer
preloaded (it had minimal benefit for a large trade-off).

Those of you itching to make your music library sound like a radio
station can get involved. I'm looking for voluntary beta testers for
all these new features. Joining the teams is as simple as sending a
message to:

beta [at] radioautomation.co.uk

Note that I'm looking for people I know or are involved in the radio industry at any level.

Tuesday 17 June 2008

Get Talking

I've spent most of today so far working on STAR's new messaging system. The reasons for working on a new one is buzz messages have a tendency to disappear into the spam folder on our e-mail account in the best case. In the worst case, some were being dropped completely.

I've put together a simple PHP application that sends messages to the database rather than /dev/null. These are retrieved via. an AJAX page that fits quite nicely into a popup. New messages are polled for roughly every 15 seconds. I say roughly as the next request will not start until the current one is completed.

One point I thought I would make is over the data format used to get data from the server. Due to the regular updates and amounts of data to be passed, I decided to make use of JSON. It carries less overhead than XML for the data being transferred and is quickly parsed by the Javascript through a simple call to eval(). Although not ideal for most situations, it seemed to make sense to me on this simple project.

Anyway, it's integrated and now up and running. However, I don't think I'll be posting a public URL for this one. Security through obscurity and all that. :)

Sunday 15 June 2008

A Busy Day

Although yesterday was my rota Saturday off, it did not mean I did nothing. The day actually started a little later than usual with a gala in Invergowrie (west of Dundee). What was I doing there? No, not idling my day away wondering round the stalls. I was in fact DJ-ing (with Mark and Joe as well) on behalf of Bridge FM.

That turned out to be both a fun and interesting experience. Firstly, there was a falconry display (yeah, the spelling is miles off!) display that was fairly impressive. We got to watch the bird of pray "hunt" for food. Though, later in the display, the local birds appeared to have taken action about being upstaged and tried to get in on the act.

So when that finished, we got on with the music playing. Until the power kept cutting out (apparently it had been doing that before I arrived). So we just pressed on through the problems, only taking a break for the raffle.

The weather had been on and off rain and thankfully held out for the duration of packing up the equipment. That part wasn't so bad. The interesting part came at the hospital when we went to return the equipment.

We had managed to obtain the use of a trolley from the porters. However, these things have only one set of setting wheels to navigating tight corridors was tricky to say the least.

Roll on a few hours, I finished the day off back in Bridge FM's studio presenting the "Night Shift" (called so because it finishes at 11pm).

Not too bad a Saturday off (I've had worse) and I'd certainly do it all again. Today, I finally managed to get my tax return submitted online. The result... HMRC owe me the huge sum of £24. Oh well, better in my pocket than theirs.

Friday 13 June 2008

Exams

The results are in.... (tense music plays in background).


 


I appear to have passed both Advanced Internet Programming and the Computer Science equivalent. Both are equivalent second year courses but provide steps to the seperate branches available.


 


The higher grade for myself was in the straight computer science thread. Not completely unexpected. However, I'm a little unsure as to which way to go. I enjoyed the AIP course a little more than the CS course, but enjoyed them both. However, with 4 points between the grades, I think that may have decided for me.

Monday 9 June 2008

Getting Things Going

We're a few weeks into the summer holidays now and I feel I've had enough time just lazing about sleeping, eating, drinking and going to work part time. With a tax return sitting on my desk and money to extract from the Scottish government to go to university, I though now is about the time to get things moving.

One of the major items on my todo list this summer is STAR's website. It's not the most updated of sites. The committee are looking to get a new website. I've been a little more sensible and looking at all the options.

A New Site

If we go for a new site, we can keep it seperated from the admin side of things (mailing lists, etc.) possibly even keeping the current staff portal but slimmed down. There are a number of "off the shelf" options. However they would require a fair amount of customisation.

I've been experimenting with this option. In fact in a day I managed to get this site together for experimentation.

Update The Old One

The old site could easily have the look / layout changed without too much work. However, there is a fairly sizable list of "requests" from the old committee over the website. Considering I'm already getting flack for refusing to follow through an order for duckers (we don't need them and they would be too difficult to install correctly with our setup), I would have to implement most of these changes.

The old site can be found here.

Get Involved

The options are open, what's your opinion?


I've dropped the requirement to register to submit your comments. You will need to supply an e-mail address but I promise not to sell your information to anyone that looks a bit shifty.

Friday 6 June 2008

The Server's Online

Well, after many problems yesterday, I decided to update the firmware on the router. The result, no more drop-out. So the piggy back connection is no longer required.


 


I've decided to setup a simple web and ssh server for personal use. Making use of a patched version of Debian, it's up and running. There was no problems in the starting of the server, the issues came with SSL. I have self-signed the certificate for the server and have setup Apache to use mod_ssl. It's not the easiest to setup and took hours of searching to find the correct settings to use in the virtual host.


 


There were separate guides for signing certificates (worked well) and using certificates with apache (worked not so well). We could really do with a combined guide. Oh well...


 


If you want to take a peak, goto http://steelehost.dyndns.org/ [normal] or https://steelehost.dyndns.org/ [secure]. There's nothing there yet, but proof it is working.

Wednesday 4 June 2008

Network Woes

Well, I'm back home and mostly unpacked now. So what needs attention...? Only the computers at home. Firstly, the hard drive on the parents machine has failed. So I've spent a little while recreating the system for them on a new hard drive.


 


The more interesting problem is the home network. We were using a combined wireless router and ADSL model (Zyxel 600 series if you're interested). Unfortunately, the modem bit seems a bit faulty and keeps dropping the connection.


 


Looking for a simple fix, I managed to find the modem our ISP supplied to us. Thankfully is has an ethernet port on the back. So my plan became piggy back the wireless router on the modem connection.


 


Sound simple, right? Well... it's not as easy as that. To force the router to route traffic via. the modem, I had to make use of the backup WAN settings. This allowed me to specify an alternate gateway for if the DSL connection failed. That's ok so far. Now to simulate failure. This was done by simply removing the phone cable from the router and inserting it in the modem. The router should now attempt to ping google every so often on a connection without a cable. I think you can guess the outcome of that one... constant failure.


 


Thankfully it works but I'm very surprised I had to simulate failure to get the unit to do as I wished. It's a bit easier doing this and using the built-in DHCP server rather than going manual and having to change the gateway on every machine on the network.