Virgin Media Broadband Download Speed Test Moved

July 9th, 2009

My simple and popular Speed Test for Virgin Media Broadband users has moved from its old site on D04 to a dedicated domain name – www.updn.co.uk

click >  Virgin Media Broadband Download Speed Test < click

As before, simple click the button to download a 3.5MB file from Virgin Media’s servers. The site will time how long it takes to download on your broadband connection and plot your broadband speed rating on a bar chart, allowing you to compare against other standard(ish) download speeds.

This is mainly to help with Google spidering, since the d04 subdomain doesn’t lend itself to website promotion as well as a dedicated domain would.  Since I had the domain sitting spare, it made sense to bang Google Analytics on there and do some promotion for it.

The updn bit of the domain is an ambigram as well, which is nice.

Update:
To aid diagnostics (and show off a little) I’ve also written a scraper to take the content of Virgin Media’s Status page and plonk it into a table on the site. There’s even a Google Map showing the approximate location of the majority of the tickets.

Virgin Media UK Broadband Speed Test

July 7th, 2007

I’ve reinstated the old Broadband Speed Test since NTL were rebranded Virgin Media, and put it back online at www.speedtest.d04.net www.updn.co.uk for you all to play with. This is seriously broadband only, and it’s really only good for Virgin Media Broadband users.

K and myself have definately been upgraded to the new 20MBit package. Upload speeds (using other broadband speed tests, since mine only does download) have topped out somewhere around 720Kbit and my downloads this morning look ike this:

Virgin Media Speed Test - Click to Enlarge

Virgin Media Speed Test - Click to Enlarge

It may be that I am limited by my cable modem. Despite being good got approx 40MBit, the Motorola Surfboard SB4100 that us oldies (K, BB and myself) use is getting on a bit. At this time of the morning I can consistently download at 12MBit using IE, with FireFox being slightly slower.

23rd July ‘09:
I’ve added the list of current service tickets as well, so you can see if there’s a problem in your area that may affect your download speed.

Vertical Scrolling Text / News Ticker in JavaScript/DHTML

January 9th, 2007
Download Files
Click Here to Download
the HTML source.

This code allows you to create a vertically-scrolling text box of information – such as a news ticker – to your website quickly and easily.  It does not use an IFRAME so the scrolling content is actually part of your document, making it more Search Engine friendly and easier do produce by simply populating it with content from your database.  This makes it XHTML Strict as well.

The DHTML vertical scroller script has been tested with the following Windows browsers, if you experience any problems, please let me know:

  • Google Chrome 2
  • Firefox 3
  • Internet Explorer 7
  • Opera 9.50
  • Safari 3

The vertical scroller works by having two DIVs, one inside the other.  The outer DIV acts as a display frame for the scrolling content, while the inner one holds the content itself.  First of all, then, we need two DIVs:

<div id="scrollBox" class="scrollBox">
<div id="scrollTxt" class="scrollTxt">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vitae
enim eu mauris rhoncus malesuada. Suspendisse et tellus diam, et ullamcorper
nisl. In nec nibh dolor, et auctor nibh. Duis pretium faucibus bibendum.
Suspendisse eget leo in eros faucibus consequat a id nisl. Quisque cursus
lacinia consectetur. Nam mattis sagittis diam, ac posuere risus porttitor
<a href="#" onmouseover="scrStop();" onmouseout="scrMove();">MOUSE HERE</a>
sed. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos. Phasellus tincidunt eros at risus consectetur feugiat.
Etiam id erat vel lectus pharetra posuere. Maecenas rhoncus est vel lectus
posuere dictum. Curabitur rhoncus ligula laoreet nisl rutrum sit amet
convallis purus tincidunt. Ut ullamcorper lorem eu odio tempus placerat.
Proin cursus semper elit sed pharetra. Nam convallis, quam vitae facilisis
varius, ligula purus egestas justo, vitae eleifend metus turpis ac felis.
Aliquam tempus nisi id ligula semper sed porta odio dictum.
</div>
</div>

As you can see, the two DIVs are nested, and I’ve filled our example scroller with typical Lorem Ipsum text just to pad things out.

Our next step is to apply some CSS styles to the boxes to ensure they appear one inside the other.  We do this by adding a small stylesheet in our document’s header:

 <style type="text/css">
  .scrollBox {
   /* The box displaying the scrolling content */
   position: absolute;
   top: 30px;
   left: 200px;
   width: 180px;
   height: 200px;
   border: 1px dashed #aaaaaa;
   overflow: hidden;
 }
  .scrollTxt {
  /* the box that actually contains our content */
   font: normal 12px sans-serif;
   position: relative;
   top: 200px;
  }
</style>

For this example, the box is positioned at coordinates 200,30 from the top-left, but you can essentially do whatever you want with it.

All that remains now is to animate the inner box, moving it inside the constraints of the outer box and looping when it is no longer visible.  We accomplish this with JavaScript, but there’s an important point that needs making here, and that is: You don’t know the height of your content until it is loaded.

What this means is that we don’t know how far the scrolling content inside the box has to travel until we’ve loaded it.  The box may be showing five lines of text or it may be showing fifty, we don’t know, and so we need to calculate the content height once the page has finished loading.  Normally, you would use:

<body onload="doScroll();">

Which would only fire once the page had loaded all elements.  For this example, however, I have called the doScroll(); function immediately after displaying the nested DIVs, since the box only contains text and already has a font assigned to it, and therefore the height of the inner box is already finalised.

Here’s the JavaScript required to get the height of the scrolling content and start the scroll loop:

<script type="text/javascript">
 var scrollSpeed =1;   // number of pixels to change every frame
 var scrollDepth =200; // height of your display box
 var scrollHeight=0;   // this will hold the height of your content
 var scrollDelay=25;  // delay between movements.

 var scrollPos=scrollDepth; // current scroll position
 var scrollMov=scrollSpeed; // for stop&start of scroll

 function doScroll() {
  if(scrollHeight==0) { getHeight(); }
  scrollPos-=scrollMov;
  if(scrollPos< (0-scrollHeight)) { scrollPos=scrollDepth; }
  document.getElementById('scrollTxt').style.top=scrollPos+'px';
  setTimeout('doScroll();', scrollDelay);
 }

 function getHeight() {
  scrollHeight=document.getElementById('scrollTxt').offsetHeight;
 }

 function scrMove() { scrollMov=scrollSpeed; }
 function scrStop() { scrollMov=0; }
</script>

As you can see, doScroll(); calls itself automatically once it’s started, so all that is required is a single call to set it rolling. You can change the variables in the JavaScript so speed up the scroll or change the frequency of movement by adjusting scrollSpeed and scrollDelay accordingly.

Update:
I’ve added a link in the sample content that will stop the scrolling when you put your mouse over it.  This is achieved using two functions, scrStop() and scrMove() which stop and restart the scrolling text, and are placed in onmouseover=”" and onmouseout=”" respectively.  You can add these so that your users don’t have to chase a link as it scrolls up the page.

You can see the code working by clicking the link in the ‘Download Files’ box at the top of the page.  It will open the document in a new window, and all you need to do is view the source code.  Please leave any comments or questions below, and feel free to rate this post while you’re here – I might even respond at some point.

Stretching a Backgound Image using JavaScript and CSS

August 14th, 2006

UPDATE:
Thanks to viveka for pointing out that this code didn’t actually work – I’ve fixed the two stupid buglets and tested it and it does now. Apologies all round!

Anyway, previously

——–

I put a rather nice website design together a week or so back for a prospective client which used something I had never attempted before – a background image that is scaled to cover the whole page, no matter what dimensions the browser window is resized to. All well and good, but it turns out we got the job and I had to actually implement the bloody thing.

First up, we don’t actually use the BODY to display our background image, but a DIV (ID=bg, below) with WIDTH and HEIGHT set to 100% so it always covers our entire document display. To prevent scrollbars appearing on these elements we hide the overflow on them, so our main document looks like this:

    <BODY STYLE="overflow:hidden;" onResize="imgResize();" onLoad="imgResize();">
    <DIV ID="bg" STYLE="position:absolute; overflow:hidden; top:0px; left:0px; width;100%; height:100%;">
    <IMG SRC="test.jpg" WIDTH="800" HEIGHT="600" BORDER="0" ID="bgImage">
    </DIV>
    <DIV ID="fg" STYLE="position:absolute; top:0px; left:0px; width:100%; height:100%; overflow:auto;">
    Content in Here!
    </DIV>
    </BODY>

The content actually sits in another DIV (ID=fg,above) with it’s overflow forced to ‘auto’ so that we always see the space for a scrollbar, even if there’s nothing to do with it, and it resembles a regular browser window as closely as possible.

This setup allows us to access the image using getElementById and control it’s width and height according to our requirements. Naturally this requires some JavaScript:

    <SCRIPT language="JavaScript" TYPE="TEXT/JAVASCRIPT">
     var winWidth=0;
     var winHeight=0;
     var imgWidth=800
     var imgHeight=600
     var newWidth=0;
     var newHeight=0;
     function imgResize() {
      var bgImage=document.getElementById('bgImage');
      if(window.innerWidth) {
       winWidth =window.innerWidth;
       winHeight=window.innerHeight;
      } else {
       winWidth=document.body.offsetWidth;
       winHeight=document.body.offsetHeight;
      }
      if(winHeight>imgHeight) {
       newHeight=winHeight;
       newWidth=winHeight*(imgWidth/imgHeight);
      }
      if(newWidth<winWidth) {
       newWidth=winWidth;
       newHeight=newWidth*(imgHeight/imgWidth);
      }
      bgImage.style.width =newWidth;
      bgImage.style.height=newHeight;
     }
    </SCRIPT>

There’s some aspect-ratio related checks in the JavaScript to ensure your background image doesn’t get stretched out of shape as well. With some experimentation I’ve found that a background image of 800×600 gives great results at pretty much all sizes and isn’t too big – a nice balance between image quality and file size.

The DHTML Window Thing

March 24th, 2006

I put a bit more work into the OS-Style website this evening and the resizing is done now. I tried the getElementById() approach first, changing the width and height of various elements via their CSS properties, and it seemed to work just fine. I had to make some consessions with the ‘grabbing’ of the resize gadget in that you always grab it right in the middle, but the effect is unnoticable and – what the heck – it works.

All that remains now is to get the windows to disappear when you hit the ‘close’ gadget, and since they’re in a DIV anyway, all I need to do is set their visibility to invisible.

Coming Soon…

March 24th, 2006

I know I’ve been stupidly busy over the past few weeks – hence the complete disregard for site updates – but a few days ago it occurred to me that I could quite easily make a box that followed the mousepointer around the screen. This was an offshoot of some mouse-tracking stuff that I’d done for another website. I knocked together a simple demo that had two ‘windows’ on the screen. They were mere tables comprising a Title row and a Body row but they did the job. You can click the title bar and drag the window around the screen muich like an OS, and click on a partially hidden window to bring it to the front – again, just like an OS.

I spent all yesterday working like crazy once again but giving occasional thought to how I could implement this into my website. Yes, it’s time to re-design the bl0g! The new one will be going back to it’s ‘green bar’ roots but will look more like some weird, web-based version of Linux. Everything’s going to be redone from the ground up which will mean the forums stuff will take ages, but it’ll be worth it.

Last night’s technical challenge was to stop the mouse-pointer ‘dropping’ the window if you moved it too fast and went outside the boundary of the title bar. It all stemmed from the fact that I was using an IFRAME to display a second content file and replacing this with a DIV, style overflow:auto, fixed the problem nicely. This has the added advantage of making all of the content part of the ‘desktop’ page rather than a seperate file, which in turn helps with search engine optimisation.

I think tonight’s fun (after I’ve been to see Booty will be to get the window resizing working. Currently you can drag the windows about the screen but they’re a fixed size. The resizing presents it’s own problems because the windows have PNG dropshadows, and the only way to get those to work on IE is to use a behaviour fix that only works for the IMG tag – PNGs as background images don’t work.

I think I’m going to have to use innerHTML and redraw the IMG tags as the windows are being dragged larger. There are seven PNG files to redraw so I’m not sure what the speed is going to be like. It may be possible to hook into them using getElementById and adjust the width/height (where applicable) CSS properties which I *think* will be faster. Obviously some experimentation is going to be required.

Right, I better get ready for work…