Archive for the ‘Web’ Category

Let Frebber make your FREB files easier to handle

June 16, 2011

If you have used IIS for any length of time you have probably come across the term FREB. If you don’t know what it is then you should read this great introduction to Failed Request Tracing in IIS. It’s applicable to IIS7 and above and is a great tool.

At a high level FREB produces an XML file containing details of errors you are interested in – you specify the error code you want to trap, the execution time threshold or a number of other filters – and provides a wealth of information about what was happening under the covers in IIS.

The problem with FREB Tracing though is that it’s very easy to end up with a folder containing hundreds or even thousands of error reports – all named a variant on fr000123.xml – and you have no way to quickly tell which where the ones with details of 401.3 errors, or which ones failbed because they took more than 5 seconds to execute.

Well, thanks to the wonders of powershell there’s now a simple solution.

Frebber scans the output directory where your FREB logs are stored and copies the files into a new subdirectory (called .Frebber of course) while at the same time renaming the files based on the nature of the error report they contain.

For instance fr000012.xml may contain details of an HTTP 415 error and took 2571ms to execute, so the file would be renamed 415_STATUS_CODE_2571_fr000012.xml

It’s a fairly simple script and if you have a look at the XML format inside a FREB report you’ll be able to see how to adapt it quickly to your particular needed. Meanwhile feel free to use the example below, and I’d love to hear any comments or suggestions in the comments.

Oh, it does make one pretty big assumption… that your FREB files are going to the default directory. If that’s not that case then you will need to modify that line (I might get around to making the script more complete and add parameter for source and destination directories and some renaming selection criteria but right now this works pretty well for me

$frebDir = "c:inetpublogsFailedReqLogFilesW3SVC1"
echo "Frebbering...."
$fileEntries = Get-ChildItem $frebdir*.* -include *.xml;
$outDir = $frebDir + ".Frebber"
# Create the directory for the Frebberized files
$temp = New-Item $outDir -type directory -force
# copy in the freb.xsl so you can still view them
Copy-Item ($frebDir+"freb.xsl") $outDir
$numFrebbered = 0
foreach($fileName in $fileEntries) 
    [System.Xml.XmlDocument] $xd = new-object System.Xml.XmlDocument
    $frebFile = $frebDir + $;
    $nodelist = $xd.selectnodes("/failedRequest")
    foreach ($testCaseNode in $nodelist) 
        $url = $testCaseNode.getAttribute("url")
        $statusCode = $testCaseNode.getAttribute("statusCode")
        $failureReason = $testCaseNode.getAttribute("failureReason")
        $timeTaken =  $testCaseNode.getAttribute("timeTaken")
        $outFile = $frebDir + ".Frebber" + $statusCode + "_" + $failureReason + "_" + $timeTaken + "_" + $;
        Copy-Item $frebFile $outFile
        $numFrebbered +=1
echo "Frebbered $numFrebbered files to $outdir."

jsErrLog: now alerts via XMPP

June 13, 2011

Although it’s nice to know that the jsErrLog service is sitting there recording errors that your users are seeing it does put the onus on developers to remember to check the report page for their URL to see if there have been any issues.

To make things a little more pro-active registered users can now connect to an XMPP (Google Chat) client (eg Digsby) and every time there’s a new error reported the bot will send you an alert.

Because you might get a flurry of messages if you deploy a version and there’s an error, or a 3rd party component has a problem the bot also listens to a set of messages so it’s easy to suspect the alerting (or turn it back on when the problem has been fixed).

At the moment there a few restrictions:

·         alerts have to match a specific URL

·         for a given user all alerts are turned off/on (no per URL granularity)

·         alerting is only available to users who’ve made a donation or promoted jsErrLog

The reason for the first one is a limitation with the way AppEngine lets me query data (unlike SQL the GQL query language does not support the CONTAINS or LIKE verbs)… I’m looking for a solution to that

The second is a feature that I plan to add soon depending on demand.

The third… at the moment it takes a little bit of setup to add new users so I’m adding it as the first freemium feature though this may change. If you want that enabled please let me know the URL you are monitoring and your Google Chat ID and I’ll let you know what else you need to do to enable it…

To the Cloud doesn’t mean everything is in the browser

June 11, 2011

Everyone is busy yelling “to the clouds” at the moment and rushing to offload local workloads to computers in managed data centers. At the same time they are desperately trying to shoe-horn everything into the browser user experience because they are equating the whole idea of cloud computing with the concurrent hype about HTML5 and the new generation of browsers.

From the various document and image editors being ported to the web through to ChromeOS the browser obsessed operating system they are becoming more pervasive.

And they are wrong


They are not wrong that browser centric apps have their place but trying to squeeze a rich UI into the limited canvas presented by even the most modern of browsers is a compromise.

Try using Gmail and it’s calendar and contact partners then compare it to the Exchange experience. Contrast editing an image in Photoshop or Photoshop Express online. Try doing anything in a train tunnel or at 45,000 feet without paying  for WiFi access just to review the presentation you’ll need when you land.


Xbox with their forthcoming online account sync capabilities; Office 365 hosted Exchange; Apple’s new iCloud all seem to have grasped this, in common with the apps on Windows Phone, Android and iOS. In all these the rich native experience extended by the ability to share, store and synchronize data so it’s available where the user needs it, when they need it outweighs an online only experience “best viewed” in a tab.

There’s power in the clouds, but it needs the tangible experience to make it truly the way forward.

jsErrLog – now with XML

June 9, 2011

To help analyze data from jsErrLog – my Javascript Error Log service – I added a new feature today: An XML data feed for reports.

You can access a report as normal and view it in the browser, eg the sample report and on there you will now see a direct link to the XML version of the report.

If you know the name of the URL you want to report against then you simple access it via where the parameter after the sn is the URL you want to query.


Both the report and the XML show up to the last 500 results for the URL. I plan to add limits to the XML feed, and pagination to the HTML report in a future release (let me know in the comments what’s more important, and any other requests). I would like to implement a full OData feed for the data but haven’t found a good Python / App Engine sample out there yet…

One great thing about having the data available as an XML source is that you can add it as a Data Source in Excel and from there filter and sort to your hearts content


jQuery image animations

March 28, 2011

Working on a personal project over the weekend I needed a better way to provide a central image to a site. The image was the major draw card for the site and we wanted to place links and other content on and around the image.

As we wanted to showcase multiple images the easiest solution was to animate the image replacement with jQuery but we realized the problem with that was the links and floating content really needed to move depending on the underlying image.

A combination of jQuery, CSS and old fashioned Javascript produced a fairly simple solution where it’s easy for us to swap the images for new creative content and via javascript mapipulate where the captions need to move to.

Given a bit more time I’ll tweak the scripts to pick up the starting location from the CSS rather than hard coding in two places, and optimze the code and CSS a bit more, but as a proof of concept it was pretty effective.

After playing with the jsErrLog javascript error reporting code (a mixture of javascript and Python for AppEngine) it was nice to do something more front-end oriented.

update: New version of the Javascript debugger

March 18, 2011

Although jsErrLog, my “Web Watson” has only been out a couple of days I had a great suggestion to let developers add some additional context to errors that are being trapped.

To support this I’ve added a new parameter that’s a string variable you can update at any time (after the library has been registered on your page of course) and the first 512 characters simply get passed through to the report database.

To use this new feature simply add a line that updates what you want passed through with the data you want passed and if the error handler gets called then the data will be transferred to the database = “Populated the Info Message to pass to logger”;

Any other features you think are worth adding?

Facebook is wrong. The social graph isn’t flat

March 17, 2011

Many years ago when I was starting out in the workforce the brother of a good friend passed away as a consequence of a big disease with a little name and afterwards I did some fund-raising work for the hospice where he had been cared for. I mentioned it to a co-worker who didn’t think about the consequences and, thinking he was doing the right thing, tried to get others to support an event I was involved in. Short term the upshot was pretty bad with people assuming I was either gay, or unwell myself and reacting accordingly. Luckily in this instance we were able to clear up the misunderstanding and in fact raised both support and awareness.

But that’s not always the case when groups overlap and an innocent comment from one world crosses into another.


Watson for the web – trapping Javascript errors

March 16, 2011

A while ago I wrote a small piece of JavaScript code that I needed to be able to integrate into lots of different sites to help streamline the Silverlight experience, but it was important that I didn’t break anyone’s existing code.

While we did extensive testing with the partners before we deployed it there was always the worry that a combination of browser and OS and plug-in we’d not tested would cause a problem we’d not foreseen.

As websites get more complex, and HTML5 brings more of the heavy lifting back to rely on JavaScript to build really dynamic experiences so my little nagging concern was just going to keep on getting bigger.

While you can wrap every statement in a Try…Catch loop and deal with exceptions that way it’s not the most efficient, and if you’re integrating libraries from a  lot of different sources then it’s not really practical.

As luck would have it two of the browsers had already implemented the key to the solution… the humble JavaScript window.onError function. In IE and Firefox it allowed you to attach an event handler that would kick in whenever an un-trapped error occurred and allow you do to whatever you needed to manage the problem.

I took that functionality and build a small script that could be injected via a single line of JavaScript into the page you want to monitor that would catch any unhandled error condition and report back to a remote cloud service the script, the error, the browser and OS versions so a developer could quickly and easily re-create the test scenarios. The code is available at jsErrLog.

Then because Chrome, Safari and Opera didn’t support the onError function I rather shelved the project. Just a few days though with the release of Chrome v10 another browser could be added to the support matrix for remote error reporting (and as the fix is in the WebKit core we can only hope that a release of Safari greater than v5 will roll out support as well)

While I wait for Safari and hopefully Opera to catch up with this I’m making a couple of other small tweaks to the code to make it a bit more reliable, as well as adding some extra functionality to allow developers to pass additional information back to the reporting database to help with debugging their specific apps.

Check it out , kick the tires and let me know if you have any feedback…

Users don’t care about standards

January 8, 2011

HTML5. CSS3. Canvas. H.264 or Ogg for <video>

Web developers care. The folks who build browsers care (and boy are they competitive about it with their speed demos and compliance tests).

But users?

They don’t care about the technology. They want their game to run, their video to play and their photos of Aunt Bertha’s 50th birthday party to load.

Ask them what version of Flash or Silverlight they have, or even what a cascading style sheet is and they’ll give you a blank look. Heck, most don’t even know what browser version they’re running (with Chrome that’s becoming a challenge to keep up with updates!)

In fact, with sites like Facebook and Twitter, Bing and CNN or aps from the various app stores on Windows, Android and iPhones undergoing almost constant innovation and evolution users don’t have a good way to keep track of where things are.

So what does this mean for web developers? It means you need to write smarter code that tests for the features you need and degrades gracefully – on desktops, mobile devices, internet connected TVs and who knows what. Keep is as simple as possible and get the basics right.

And for users? Well, hopefully the new advances in capabilities will make for richer, faster, more capable apps, and better experiences. Hopefully this period of change won’t make for the troubles of the last “browser war” where users had to choose what browser they visited certain sites in, developers would post snarky “better with X browser” messages and nobody really wins.

Here’s looking for the next generation web … and hopefully smooth evolution without the pain of artificial revolution