Poisoning the internet

This news item struck me as interesting and even borderline alarming – as it suggests that 18% of all traffic (and 41% of UDP traffic) on the Internet is from one attempt to poison BitTorrentnetworks worldwide: a truly extraordinary finding, but one that seems well grounded, at least on first blush.

TCP or not TCP? That is the Question
TCP or not TCP? That is the Question (Photo credit: dullhunk)

For those who do not follow the technology: user datagram protocol (UDP) is the communications protocol used on the internet to deliver higher-speed, lighter weight communications – e.g. streaming audio (IP telephony) and video will be sent by UDP, as if you are watching live video you don’t want to recover old frames that did not get there the first time – you just skip them and move on to the next. BitTorrent uses UDP to share files – probably most often used to unlawfully spread copyright protected material but also used quite legitimately and lawful to share large files (BitTorrent is a peer-to-peer system that sees downloaders also help spread the sourced material by “re-seeding” the bits of the file already downloaded with other users).

If 18% of internet traffic is really from just from one – broken – source, as CERT Polska suggest – then plainly the scope to destroy the whole internet through congestion by deploying a few dozen similar attacks must be huge. Of course – such attacks could then be stopped by ISPs choking off BitTorrent traffic – which is perhaps what the attackers really want.

Personally, though, I’d suggest this is more likely to be some Russian gang flexing their muscles – the file which is nominally being shared by the broken BitTorrent is a movie about the August 2008 warbetween Georgia and Russia – a favourite subject for Russian crackers – who frequently mount denial of service attacks on Georgian and pro-Georgian government internet sites.

How should I handle the :q command?

If you are a Vi user then you will know that :q closes the editor (assuming there is no unsaved edit).

hex (Photo credit: elmer.o)

Should my hex editor, Hexxed, which I am aim to give a Vi-like interface to, do the same? Currently it does not – :q instead unloads the current file from the editor but does not close the editor itself. This feels like a more natural way of doing things with a GUI application than simply closing everything but, on the other hand, it is not what Vi users would expect either.

Who needs a free hex editor then?

OK, Hexxed, the hex editor I have been working on, is nowhere near being finished but it does seem to be in a good enough state to find testers.

It’s very rough round the edges but it will allow you to open, edit and save files. I have given it a Vi-like interface and I would be most interested in knowing what people feel about it – if you are a Vi user does the interface feel natural enough to you?

I guess, at this point, any testers will have to be familiar with running a Groovy project – and you can pull the sources from GitHub.

But if someone just wants a .jar file to run, then let me know and I will package it up.

How many languages can you recognise?

Java (programming language)
Java (programming language) (Photo credit: Wikipedia)

This site has an extensive online quiz on computer languages.

I managed just 11/75 (actually it was 12/75 but I pressed the wrong key when typing ‘Java’): a miserable 14.67%.

I missed some of the languages I use regularly yet got some I have never used, or maybe not used for close to 30 years (though I did, relatively recently, translate the Reingold-Tilford algorithm for drawing Red-Black trees from the original Pascal into C++, so maybe that helped.)

Love to know how you score.

Volume of a ball

As ane fule kno the volume of a ball (ie., the interior of a sphere) is \frac{4}{3}\pi r^3.

But I have just had one of those “why’s that then” moments and sought to prove to myself, using integration, why this would be so.

But my logic is flawed and I get the wrong result – so risking looking stupid – I am asking for someone to correct the error in my logic.

Starting from the start and a familiar (I hope!) lemma:

\pi is the ratio of a circle’s circumference (c ) to its diameter (d ), hence c = \pi d or, more familiarly, c = 2 \pi r where r is the radius of the circle.

Now the area (a) of a circle can then be found by integration:

a = \int_0^r 2\pi x dx , giving the familiar \pi r^2

So, my reasoning runs, the volume of a ball would then be:

2 \int_0^r \pi x^2 dx or \frac{2}{3}\pi r^3 , which is precisely half the figure it should be – so where have I gone wrong?

Update: with thanks to Hugh in the comments – of course what I have described is a (double) cone with a height equal to the radius of the base. Cones and circles are not the same, obviously.

A pleasingly retro look and feel

I have done almost all my development of Hexxed on a Macbook, but have now updated the git repo on my Linux laptop and run it Hexxed on Linuxthere – some interesting differences:

  • the Linux app has a pleasingly retro look and feel to it – no anti-aliased fonts here
  • on Linux key reptitition works as expected – ie if one holds down a key the application is sent multiple key events, which is what one expects and which works well with the vi-like interface I am building
  • On Linux the first file open dialog is a really crude/retro looking box (think Windows 3.0), while subsequent file open dialogs reflect the system windows toolkit.

The screenshot is of a VMUFAT volume, it was my experience of writing that driver that gave me the itch that Hexxed is meant to scrtach – in particular I wanted a hex editor that would allow me to display 16 bit numbers in a given endian form and partition the memory space by arbitary block size (VMUs use a lot of 16 bit little endian numbers and a 512 byte block size). Hexxed does both of these things now, though it still has no editing facilities – just viewing.

As for VMUFAT itself: Sadly no one on LKML seems much interested in that – the first posting got some helpful comments, but since I posted the corrected code six or so weeks ago, nothing. Suppose I will have to start poking people with an electronic stick.

Adding vi-like functionality to Hexxed

A diagram showing the key Unix and Unix-like o...
A diagram showing the key Unix and Unix-like operating systems (Photo credit: Wikipedia)

I have decided that I will model the keyboard interface for Hexxed on vi.

I know that is not what many/any coming from outside the Unix world will expect, but then there are plenty of Hex editors out there and I want to make one that will appeal to at least one niche.

As I instinctively type “:w” in all sorts of places these days, I think there will be some other people out there who might like that sort of functionality too.

Adding keyboard functionality to JTable

I have spent a day chasing this down, so I thought I’d write it up for others searching for a solution.

For Hexxed I have the data displayed using a JTable class inside a ScrollPane.

I wanted to add additional keyboard driven events to this, but could find no way to get a KeyListener to work – it just seemed never to fire.

But the secret was to use key bindings to the JTable – like this:

	tableHex.getInputMap().put(KeyStroke.getKeyStroke("SPACE"), "Backwards")
	tableHex.getActionMap().put("Backwards", new HexxedBackAction(this))

Then with the Action class like this:

package hexedit

import java.awt.event.ActionEvent
import javax.swing.AbstractAction

class HexxedBackAction extends AbstractAction {

	def windowHexxed

	HexxedBackAction(def wHexxed)
		windowHexxed = wHexxed

	void actionPerformed(ActionEvent e)

I don’t fancy writing masses of Action classes for each key stroke, so I will investigate/remind myself the Groovy Meta Class interface for this – but at least the key functionality problem is cracked now.

How much control can Microsoft exert in the development ecosystem?

It’s a long time – over a decade – since I last used a Microsoft development tool. For what it’s worth, I quite liked Visual C++ back then, but in the middle of my subscription (in 1998 if I remember correctly) Microsoft just tore up the contract and offered me something of less use. The details escape me now but it was a formative moment – I was not willing to trust them any more and suddenly the idea of using Linux had new appeal.


(At the same time I was teaching myself how to use Unix on the Sun OS system that hosted the Labour Party’s Excalibur EFS document system: after the 1997 general election there was nobody left in the team but me and so I went out and bought the venerable Essential System Administration: Tools and Techniques for Linux and Unix Administration: Help for UNIX System Administrators – which helped but it was still hard going to escape from the Windows monoculture. The Party’s IT staff essentially said “Unix? Does anyone still use that?” – this was truly the apogee of Microsoft’s monopolistic drive.)


Today the world seems very different. But if Microsoft have taken a few knocks and people are almost as likely to think of Apple and even Google as the enemies of software diversity and freedom, we should not underestimate its raw power in the market. Most desktops in most workplaces are still Windows boxes and writing for the mass market means targeting Microsoft’s operating system.


The Windows family tree.

Not surprisingly many, probably most, of the people who are doing that are using Microsoft’s tools and compilers. That gives the boys and girls in Redmond a lot of power and they don’t have to be acting in a malicious way to have an detrimental impact – as in their refusal to support the C99 language standard. The only mantra that C is a proper subset of C++ (which Microsoft fully support) has been dead for a few years now and there are features in C99, which is the standard in general use in the Unix/Linux development world not supported in C++11 (the current standard there which Microsoft are working to support). Microsoft do support the twenty year old C90 standard but have essentially said that they are not going to develop that any further – you can read more about this here.


In response to this some C++ developers have done so far as to say “C is obsolete” – perhaps reflecting a new confidence in the C++ development world, as that language has been making something of a comeback in the last couple of years (not least because Microsoft have promoted it so heavily).


That may or may not be the case – personally I doubt it very much. But since when did we allow tool manufacturers to make that decision for us?


As I did in 1998 maybe it is time for the developers to look at the alternatives. There are plenty of industrial strength compilers and editors out there that will free them from the caprice of a company which is once more demonstrating it just doesn’t get it.