Windows Media Player Javascript Detect and Embed

Geoff Stearns over at wrote a great script to detect and embed Flash objects, called SWFObject embed. What I love about it is that it is really simple to use and bypasses the problems of the Eolas v Microsoft debarcle (Click to activate this control). He also produced a Quicktime detect and embed alongside the Flash SWFObject that is also very useful. I needed a similar script for Windows Media Players, so without being able to find a great example, I knocked this up, based on his code.

First we create the WMPObject:

Then deal with any parameters that are passed:

We then have a function to generate the core HTML and return a string of HTML code:

And deal with attributes:

Write the generated HTML out to the page:

And deal with plugin detection:

Then to use the WMPObject, you can use the following:

Download a fully functional demo of this code from

Centralised internet application logging

Imagine that I am a developer that works on a number of internet web sites, services and background applications. These applications run on internet facing servers either owned by myself, or by my clients. Those applications sometimes have errors, and at present, those applications maintain their own error logs locally on each server. If an application fails, then these logs provide me with a way to investigate, solve and patch the problem in the application. However, sometimes an error does not completely stop the application from working, and the client or customer tries again and it works. This could be for a variety of reasons, including communication errors or file locks, or anything else that could be temporal. Because of this, these errors will often be overlooked, but in reality, those errors are being trapped, and logged, either to email, and log file or the Event Log. That is expensive in terms of resource usage, and either you just don’t log them, or you log them in a way that actually makes you respond to them. Centralising the logging of errors is one way to address this problem.

From a basic perspective, I can see that such a logging system would need to offer an interface to accept and store error messages information with a corresponding application reference. We can make this more complicated, but at a base level, that’s all we need. We can do this using a web service, and instead of logging to a local resource, the application passes the message to the central logging server.

If we want to do this properly, we need to use a proxy. Imagine for example that the web application cannot communicate with a database. The database resides on a different server, and in this example the web server’s network connection has failed. Trying to send an error message to the logging server in this case is pointless, as there is no network connection. Using a proxy, we can log application errors to the proxy, and the proxy acts as the middle man, passing error messages to the logging server when the network becomes available again. The proxy runs a simple queuing system, which has a queue of messages waiting to be sent, a queue that need to be retried after failure, and a permanent failure queue for messages that could not be sent after three retries (for example).

Now, the question: Does anyone know if such a system already exists commercially or open source? This would ideally be a Windows based Windows service running the proxy, and a .NET based web service storing data in a Microsoft SQL Server, but if there is a LAMP version out there, then I’m not adverse to it. If you know of any such applications, please feel free to suggest them in the comments.