Welcome to the new SimonCook.org design!

+Ross Siggers is now responsible for a whole…

+Ross Siggers is now responsible for a whole new generation of "Oh Snap" messages…

via Google+
Categorised as Google+ and tagged as . | Leave a comment

Monitoring Bandwidth Usage on a Virgin Media Super Hub (aka the VMNG480)

In the past year I have come at heads with Virgin Media regarding their fair use policy, which is basically “use all you want at peak times unless you start to slow down other people’s connections, in which case we give you a warning”. Apparently I was downloading 60GB non-stop every hour (let’s ignore the fact that isn’t possible on my connection speed for a moment). After frustration that there is no decent persistent bandwidth logging on the router (it gives you the amount you’ve uploaded and downloaded since the last boot) I wrote a python script that polls the state if the router every minute to check these figures, calculate a delta for how much was transferred in the last minute and store that to a database. Now this script works (I’ve been using it since July) and I am now releasing it for others to use/improve.

Firstly, anyone who looks at the structure of the script will notice that it was built to function, not to be beautiful. This tool was built so that I could get a log as soon as possible, so I took some very unusual turns in it’s design. You will see that I am storing a string for all the data that I was collecting from the web server in the database every minute. This is because at the original creation of the script I was unsure whether the router counted in a decimal (i.e. 1000K in 1M) or binary (i.e. 1024K in 1M) fashion. Turns out it’s using the latter so I could trim that out. This data is also stored because at some point I intended to add a check function that would make sure all the deltas are correct, but that will be added later.

Writing this script has allowed me to find one bug in the routers firmware. At seemingly random points (but in my own experience this occurs after an automatic reboot), the router works as intended but something occurs to cause it to return 4GB for one or both of the two figures. As there is no remote reboot feature on this router, I have to manually reset it, though I may make something that allow me to trigger a reboot on detection of this condition. If I do that, I will document it here.

Originally this script sat in my ~/bandwidth directory on my server, logged to a file called bandwidth.txt and was called once a minute, with a support script being called at midnight that read the entire file, summing up every hour/day, and emailing the summed results for the past 24 hours and 1 day. As you can imagine over time this got slower and slower. It got to a point at the end where it would take almost 2 minutes to generate the report, at which point something had to be done. Which is where the MySQL conversion comes in.

The database was added as an easier store (its easier to request the last line from the database than read in the entire file and discard old results) as well as add more flexible reporting to the script. This conversion involved adding just the previously stored file data, with optimisation coming later. I have been able to create in addition a page that shows the live reports as a webpage as a result of this page. I haven’t added this to the source yet but I will tweak it to make the code look better before adding. You can see my version running on http://home.simoncook.org/bandwidth.

My current Internet usage statistics


This is where the project is. It is functional, but not elegant, and only works with one router, though I feel that it should be easily expanded as the web page scraping is done in one function, so anyone wanting to create a modified version for their router only needs to create an output-compatible version of this function and they’re good to go. I will modify this script over time both in terms of tidying it up and adding new features that I feel are of use.

The URL for the source for this project is at https://github.com/simonpcook/bandwidth-VMNG480 and if you feel you can make use/make changes for it, feel free to fork it to meet your own needs. I will flesh out some documentation soon (and the required schema will be added to the repo). I hope you find this of use.

Disclaimer: Using this script counts as the single user who can log in. Attempting to login to the router from another computer will give an error message, the current workaround is to administer the router from the computer running the script (or some equivalent such as using a proxy so the router sees the correct source IP) or to disable the script and wait for the login timeout when you want to administer the router.

Categorised as Internet, Programming and tagged as , , , , . | Leave a comment

Google do make awesome videos

Google do make awesome videos

via Google+
Categorised as Google+ and tagged as . | Leave a comment

Merry Christmas!!

Merry Christmas!!

via Google+
Categorised as Google+ and tagged as . | Leave a comment

William Keilloh and 9 others were tagged…

William Keilloh and 9 others were tagged in Simon Cook's album.

via Google+
Categorised as Google+ and tagged as . | Leave a comment

This is most odd, I don’t remember going…

This is most odd, I don't remember going here on the way home…

via Google+
Categorised as Google+ and tagged as . | Leave a comment

Reshared post from Webtagr

Webtagr originally shared this post:

Hello!

via Google+
Categorised as Google+ and tagged as . | Leave a comment

Why I might not build a PC again

This post might come across as something that sounds like a five-minute rant, but this is something a bit more than just what the title says. It’s just more of a trend of where technology has been going for the past few years, and how that trend seems to be likely to continue.

Before I get on to the main point, a bit of history, well my history. Since the age of 6 we’ve had a PC here, one that generally has gone through a replacement every 2 years, and each time it has been quite a bit of a significant upgrade. The first computer had a “very powerful” (for the time) Pentium 133MHz processor with a “MASSIVE” 16MB of RAM (factory upgraded from 8MB, quite a nice upgrade at the time) and everything was fine. It was acceptably fast, and as i remember, was characterised by the sound of the floppy and hard drive that ran in there. The amazingly massive 1.2GB of storage, something you’d never fill up. That was replaced with a new machine with an AMD 300MHz processor in 1998, I can’t remember how much RAM and a 6GB hard drive, which was a massive upgrade across 2 years, I actually even needed to use partitions at the time, due to the limitation of 2GB partitions under FAT. That was my main machine for a couple of years, 4 even maybe until being replaced with a 1800MHz P4 with 256MB RAM and a 40GB hard drive, still a massive upgrade for the time.

That was the past, this is now. I currently use a 2530MHz Core 2 Duo with 4GB of RAM and depending on what’s in there at any time, somewhere between 500GB and 3000GB storage. I built this machine in 2008 and the only changes have been the hard drives, as my capacity has grown and then moving the drives off into a different machine better suited to serving files. It is now 2011, approximately 3 years after building the machine, it is usually now that I start looking at what it’s replacement will be.

So lets look at PC technology over the past three years, I could move from a Core 2 Duo to maybe a Core i5, or even a Core i7, that would provide a speed upgrade, of course that’s just the Intel side, there is also the AMD side of the same fence, mid-high range systems would give a speed upgrade. As for RAM, the standard is either 6/12GB with a i7 or 4-8 with others so we’ll take that, and I’m happy with my disk capacity so we’ll leave it at that. I use my current PC mainly for gaming so I’ll add a graphics card to that. And for the sake of not doing too much maths (as the price changes all the time), we’ll assume it comes to £something.

So what do I really get for my money in 2011? A small upgrade speed compared to my current setup (compared to upgrades of the past), and more RAM, but what for? I have plenty already. As for the graphics update, I don’t really see anything being that over-taxing on my current system, so that’s a useless upgrade. Beginning to notice a trend? None of these updates are really worth getting, in fact in my (possibly bigoted) opinion, I haven’t seen an update in the past 3 three years to the PC space that’s been really worth it. Maybe solid state drives somewhat, but they are far too expensive for their capacity at the moment. It is this that I think is the issue with PCs these days, it has reached a point where it has matured and is at a stage that is “good enough”, and while that is good for most everyone, it has made the space boring, no really exciting developments, nothing really taxing a machine to make it worth getting an upgrade in the near future.

Now back to the point I brought up in the title, why I might not build a PC again. Put bluntly, there’s no point. Why put in the effort when for little to no cost difference I can just buy a PC that does what I want? Ok, so its “tradition” to build your own PC, especially in the gaming space, but really what’s the point? Where is the real benefit? It is also clear that the PC space is changing, the gaming space is changing, the technological world as we know it is changing. I sometimes like to make predictions for what we shall see in the few years ahead, I will write that soon, most will be clear why I think that, some maybe a little far out, but we shall see. But for now, this PC I am writing on will likely stay my PC for a long time, or at least until I change form factor.

Categorised as Computer, Random, Technology, Thoughts. | 4 Comments

Minecraft Admin Wrapper… now with Levels!

I’m writing a variation on a Minecraft Admin Wrapper, and this will act as a nice page with when things have been added (instead of me spamming new messages every few minutes, I’ll just edit this post)

16:30: Now with Levels! And now I’m going to go and get dinner, I’ll be back in about 2 hours, ready to program the next stage of the wrapper.

Now with levels (see, I'm root!)20:40 Version Beta 1 is being used on the server, hopefully it works fine! I will release the source code once complete.

Categorised as Games, Programming and tagged as , , . | Leave a comment

Minecraft Tools: SnapShotter 1.0

Although I did post this on the Minecraft Forums, I think I should post this here for anyone who wants to see how simple this script is.

What it does is to take a copy of the Minecraft map and copy it to a folder for people to grab (also good for backups when someone TNTs the hell out of your map). If you have any suggestions/improvements, feel free to comment.

(To stop the spamming of rubbish your RSS reader won’t understand I’ll put the code under the break.)

Continue reading »

Categorised as Games, Programming and tagged as , , , , , . | Leave a comment