Saturday 29 December 2012

New Year, New Sir...

The new years honours list came out yesterday, for those of you now aware the honours list is drawn up of people who have contributed to the fabric of society, either through academia, deeds or experience shared with all, my own Aunt was appointed to the list as a Member of the British Empire (MBE) for services to her community.

I've always held the tradition, and I call it a tradition because there is no empire any longer, in high regard not because of it representing anything in particular but that  it represents an accolade to the, most part, worthy.

Sometimes items on the list however are contentious, such as Cherie Blair being made a CBE for her work on "Womens Issues"... as far as I can tell she's married to a war criminal, so she shouldn't be on there.  Anthony her husband was the first prime minister to leave office and not be automatically appointed a KBE for these very contentious results of his decisions in office and his successor Gordon Brown was the second to leave office and not be given a KBE gratis as well!

But that's politics for you, a dark and murky world, and so its to a second dark and murky world we turn, SECRETS.

The work during the war at Bletchley Park spark my imagination whenever I hear tell of them, indeed only last week I read a booklet by Tony Sale about his work with Colossus.  However, I also saw the documentary on the BBC last year about the work of one Captain Roberts, forming his part of the Testury breaking the much more complex (than the Enigma, of Robert Harris book infamy) codes of the high command.

The work Captain Roberts and others carried out was so secret and those brave, brilliant, people kept their secret so long it completely skewed the history of early programmable electronic computing such that even now people don't believe we British were there first.

But Captain Roberts makes his mark and finally at the age of 92 he has been awarded the MBE in the honours list, a worthy honour, however, given its grave importance, its secrecy and the fact that he is the last surviving member of the Testury perhaps he should receive a slightly higher honour?  Others on the team received no honour, no recognition, indeed members of the same team died with no recognition, whilst others received only recognition for work after the war, such as William Tutte who was made a Fellow of the Royal Society.

Perhaps Captain Roberts deserved something higher, in my opinion he certainly does.  But quite what would be thanks enough for him and everyone who worked at Bletchley I could not say, behind my own grand fathers (one in the Infantry whom guarded Rudolf Hess, fought on D-Day at Normandy and across France, the other whom served on HMS Belfast from 1942 until long after the war) the men and women working on code breaking were, and remain, the highest heroes to me.


Thursday 27 December 2012

Guinea Pig

Our last guinea pig just passed away, she was a lovely one, she loved being picked up and fussed, she'd chirp and sing when stroked on her neck, and would come when called with a noise I make through my teeth like a whistle but with no whi...

On Christmas Day she was proud as punch to get the sprout peelings, one of her favourite treats, and she had new hay and feed too which she tucked into.  On boxing day she had some chopped lettuce as an extra treat giving squeaks of delight and carrying pieces of lettuce around happily.

But when we got in from out evening walk with the dogs I went to check her and she was acting strangely, it seemed she had had a stroke.  One side very limp and she seemed confused, brought her in and she had a cuddle and we decided she'd come in, so I sorted her inside cage out, lined it got her blanket and things as well as a new hollowed box, but she didn't seem to want to stay in the box and struggled out into the hay, rolling and lolling.

Over the evening she got worse and by midnight she was not walking, she had a cuddle with me, and even though her breathing was laboured she chirped and tried to sing as a fussed her.

She passed away between 1 and 2 this morning.  And I'm not too proud to say I'm gutted, she was lovely.

Monday 24 December 2012

Nerd Porn

http://www.ebay.co.uk/itm/VT-100-Terminal-Emulator-Cartrige-Atari-ST-STE-New-Box-/130823670482?pt=US_Vintage_Computers_Mainframes&hash=item1e75b2cad2

I wish I had this for xmas... But I don[t know why... I think I'd try it and then just leave it on a shelf, but I would have it.

HTML5 SSE

AS of about 4pm this afternoon I knew nothing about HTML5 specific code, nor the SSE (Server Sent Events) mechanisms.  I was blissfully living in the past where you had to do client pull to get data onto a browser.

But at 4pm, I started looking for a piece of code, the reason I was looking at this code was work... Remember that project I mentioned I had delivered, well that project was to convey some data from a source machine to a target over TCP/IP, the conduit being a Raspberry Pi, but the target machine was going to be a database, from whence there was to be a website doing alerts straight onto the screen...

This I was all shown before I left work, this was a big deal, my project had taken its time to arrive, this other chap with the web stuff had started before me and was delivering a demo of these alerts on screen from my newly finished feed... He had made a big whoo-haaa about how much work he had done for this... Big deal, the manager was wowing it up and lapping  up the progress.

So, this peaked my interest, so I wanted to see how from basically a web server I could get an alert onto a screen from such a feed... so... Imagining I had the same feed, to a database and then a website... I wanted to see a value go into the database and go out onto the screen...

I had imagined needing some javascript loop on the client to make it refresh some iframe or load values into hidden elements and then transpose them up the DOM into some visual controls.

But, actually... All I needed was SSE, and I had this working, showing me an alert (at least in the javascript console) in about 10 minutes.

<HTML>
<HEAD>
<SCRIPT language="javascript">
var source = null;

function LoadPage ()
{
    source = new EventSource('update.php');
    source.addEventListener ("message", Tick, false);
}

function Tick (event)
{
    console.log (event.data);
}
</SCRIPT>
</HEAD>
<BODY onload="LoadPage()">
</BODY>
</HTML>

Right, so this page opens something in HTML5 an event source and on each time the server pushes an event of the type "message" the "Tick" function is called, and the "event.data" is the string of raw information from the server.  So I want to create this "update.php" page which will send the event:

<?php
header("Content-Type: text/event-stream\n\n");
header("Cache-Control: no-cache");

echo "data: " . "HelloWorld" . PHP_EOL;
echo PHP_EOL;

do_flush();
flush();
?>

And this is "update.php", you see we manipulate the header returns to we're streaming events back, and then we send one event the "data:" line is the event with the string "HelloWorld", but we could stream json, or XML or whatever we like there and our "Tick" function on the web page will handle it.

What the browser (at least what Chrome) then does is it'll poll around again all on its own and you get this PHP page reloaded after 3 seconds, when the PHP page loads, with this code example in the JavaScript console (opened with F12 in Chrome) you see it log "HelloWorld", and then count following events of that type.

I did this in about 10 minutes, and that included copying the examples from another website... I can see great potential for this for the project at work, I can see a dozen or more messages I already transmit being hoisted out of the target server and streamed to a browser with a HTML5 canvas displaying a live read out of the source machine status, and I can see that being a real killer application for the project.

But you know what, the guy doing it has had months to work on this, and he's only just got this eventing stream thing working, something that took me about 10 minutes has taken him days, if not weeks, of his project.  Either he's shirking his time, or he's simply not doing the work.

Sunday 23 December 2012

Strange Nocturnal Activity

So, this afternoon when the wife was popping out to work, and I was out helping her clear some stuff out the back of one of our cars the neighbour, whom has ignored us for like two months and gotten himself into bed with the local knob neighbour says to the mrs... "Someone's broken into me garage".

I couldn't give a toss about this, like I've said before I've put my neck out helping people around her and had myself verbally abused in the street, so this numb wit can get on with his own shit.

But, interestingly, we leave our gates out the back open, there's tables, metal poles, cages, bike and two cars on our property, sometimes the wife even leaves our car windows open.  We've not seen any problems, nothing missing no issues...

Yet this guy reckons someone has targeted his locked, secure garage?

They could walk through a gate, and have a whole plethora of power tools off of our back, but someone has purposefully gone into his difficult to access garage.

I've purposefully not asked what's missing, if anything, because I don't want to know.  If I don't know and someone asks I can't get accused, that's how I'm sitting on this one.

However, one has to look at this more pragmatically, he's in with the local toss pot, an out of work wanker who's already been discussing doing drug deals out on his rear garden... So, this chat with the garage... mentions to this wanker "I've got X in the garage", wanker waits and boom takes it... Its, pretty simple to see...

There is no crime around here, there are no louts, there are no kids, there are perhaps a few poachers, because its to rural and the nights have been so cold, people don't purposefully come here to commit crime, if they've committed a crime there already here... And I reckon its the wanker, there's no bones about it.  I've already seen him casing  up properties, seen him stopping to talk to random people, and its that common knack with people that's gotten him into everyone's good books, but really, he's casing them up.

But I'm not going to point this out, let them suffer him, whilst I protect my own.

Saturday 22 December 2012

Preaching... Software

When I talk about preaching, and I'm afraid you'll have to forgive me out there in the world, I think about people standing in a pulpit telling other people to do something (be that believe in a god, follow some ethos or buy a certain brand of snake oil) which is not particularly in their best interest.

In software I think there are many source of miss-information, which try to guide but result in causing harm, I'm sure  many of my own posts are of this exact bent, but at least I warn you I'm trying to meddle (its in the very name of my blog) and I do also warn I'm a bit of a ranter...

But, the particular preaching I'm going to cast down today is the kind in print, and by supposedly high standing persons in C++ circles, I'm going to talk about a book I really hate... C++ Coding Standards by Herb Sutter & Andrei Alexandrescu.

I really don't like this book, I say as much when I reviewed it on the Amazon site, but it seems I am in a minority.  Many people love and dote on this book, they take its lessons to heart, and there are a few good lessons in there, but the more I force myself to read the book the more negative items I find within.

Not least the book itself does not follow its own preaching, how many ministers have we caught taking a tipple themselves after advising others to avoid the bottle?... Well, this book is that exact bloody thing, here's a good example...

"Don't use Macro's"

"Define your own Assert Macro"...

This is, so annoying... Then the assert Macro section itself... Page 130-131 of this damn book... they given an example, and I like to think in a book then the author thinks to give an example they give a good and poignant example.  But they don't... Look at this:

"For example, your whole design might rely on every Employee having a nonzero id_."

Right, so a none zero value to a variable, and they carry on to say:

"you can assert (id_ != 0) inside the implementation of Employee wherever you need to make sure an Employee is sane:

unsigned int Employee::GetID() {
    assert ( id_ != 0 && "Employee ID is invalid (must be nonzero)" );
    return id_;
}"

Right, people read this, and they think, yes... Yes I can do this... But you know what, its utter rubbish, this book is about C++, we can all go look at the C++ type and there's a much easier way to assert that the id_ here has a positive only value, and not only that but they do it!!.... Just the value a bloody unsigned.  Then it can't ever be a negative, its unsigned by definition that means 0 and above!  Gah, here's how I'd do it too...

class Employee
{
      private:
              unsigned int id_;
      public:
              const unsigned int GetID() { return id_; }
};

And my code is a lot better, for example, I can choose to make the value _id public, as the type enforces the usage for us, we can also make our return type constant, as the ID of am employee might very well stay the same so we can track them down.

And this code of mine is not just created off the top of my head on a whim (it was, but read on) no, I was guided by reading a much better primer into better code by Scott Meyer, yet it seems more people I run into put more stock into Herb & Andrei's stuff than Scott's, and I write this here post to put that to rights.

Go read Scott Meyer's books for a better insight into why I gave my counter example the way I did.

Thursday 20 December 2012

When I were a lad...

As I sat this afternoon waiting for a compile to finish, a really long compile, I was struck by something, the complexity, number of libraries, patterns, algorithms and tools I use to write a program for the PC are far more in depth and wide ranging than I ever imagined whilst training as a programmer.

During my A-Level years, when I first cut my teeth on PC programming - creating programs in Turbo Pascal 7.0, from Borland, and later retro porting them back to Personal Pascal on my Atari ST (because I didn't own a PC and wanted to continue programming), then things were very simple.

I had some memory, usually around 500,000 characters tops, split into - I think from memory the the excellent Borland compiler output/progress - around 34,000 lines top...

This was a big program back then for me, it was a stock control program, emulating the features of just such a program I'd seen being used on a Coop POS Machine and wanted to ape in an effort to make some money.  The program never shipped, it never sold, it was finished and I printed it out and it became part of my project for my A-Level the following year.  But it was a whole program, debugged pretty well, with a DOS based 80x40 character display (so I pretty much wrote my own ncurses before there was an ncurses) and I could supply it to support a serial port driven barcode scanner, or a parallel port scanner and parallel port printer - though no machines I could find ever had two parallel ports for testing this.

I presented this program to two potential customers, small local mini-markets but they just shrugged at the cost of a whole PC just to be a til, "We have perfectly working tils and I can add up on a calculator" was the general feel.  So, my software never shipped, despite being just £100.  Where a commercial scale stock in/out/POS system was in the 10's of £1000's at the time.

And all this system was a mere 34KLOC.

When I went to Uni, in the first year on the of the modules was the history of computing, they should really have made that module be "The History of American Computing" because it took no stock of the input of the Poles pre 1939, nor Britain through the second world war, nor the machines from Manchester and for Lyons post war.  It just lectured on about PDP machines, DEC, IBM.   We were a generation of programmers in the embers of the 1990's still being brought up to think about BIG IRON.

To think about programming for a machine which is going to support hundreds of users, time-sharing, indeed, for a time I worked with IBM machines running AS/400 and then I saw a seed change other large scale servers were well spec'd PC's (I remember the first Pentium III I saw was actually a Compaq machine put into a 4u server wrack and used to run a custom cut of SCO Unix) and these well spec'd machines became the lead for enterprise serving of data.

I worked at the turn of the millennium on, what was then thought to be a hot topic, web-servers hosting application platforms.  Things like IBM Websphere, Apache TomCat and Jakarta.  Creating applications melted from being very specific tuned code, efficient, small, effective, to Java...

IDE's went from being text editors and technical manuals to being code completion driven, supportive environments, programming became easier.  The Script Kiddy was born around this time out there in the world and as a qualified Software Engineer I saw a wave of kids out of college whom had not learned to program Pascal, or even Java, they'd learned to throw together VBA inside Access or Excel, and they were being taken on as Java programmers and not one of them had any idea about proper memory management.

And I have to admit, at the time I fell into the web if lies, I relies on the JVM.  I moved back and forth in different web based programming jobs, working for Gas Companies, not delivering very much for another company doing metering devices before being laid off, and then I did consultancy work for people wanting web sites.

Lucky for me, the .com boom went bust and I had to get a proper job, and that job was C++.  But I was out of practice, and some of the software I created at that time was pretty terrible.  We're taking the time in C++ where there were no libraries to help, no STD, no boost... You were on your own, you want a linked list, well you better fucking write on son.

But, C++ like me, like the PC hardware I write for and use has matured.  I'm sitting now with oodles and oodles of horse power in my machines, this laptop alone has 8 cores and 8 gb of RAM before we even look at the massive nVidia graphics card within its bowels.

And so I find my self reminded "with great power, comes great responsibility" for I'm trying my damnedest to create really good code.  Thread safe, memory leak free, timely and working code, my chosen medium for this is C++.  And I'm proud to have delivered early (yes a whole 3 days early, but early none the less) my latest and first official C++ project in about 5 years.

Its a completely C++11 compliant project, using elements of the STD and boost, and I'm quite proud to say its a nice piece of software, one I'd be happy to hang my hat on.

However, C++ is not the main focus of my employer, this is good and bad, good because in being the only person working in C++ and the only person working on this project I was able to inject my own ideals into the mix, I applied my own work ethic, my own design and my own coding style.  I've been big on a C++ coding style for a while and elements of it have worked so well they've moved into the other languages I use.

This whole C++ project by the way had code totalling (written by me) about 224,000 lines of code.  It uses around 5 major parts of the boost libraries, not to mention linking about many linux libraries, and it uses a plethora of parts of the STD.  It compiles on my slowest machine in around 30 seconds, it compiles on the target hardware my employer owns in about 6 minutes - yes I have nice kit, but they've not bought decent kit in about ten years.

And whilst sat in one of these 6 minute stupors, I got looking at the code files, one of the class support files, this is a large header only implementation of around 100 functions - which I port around rather than libraries as it compiles on Linux, Windows OSX and Android easily - this file alone was over 34.2 kilobytes.  My first computer ever a Commodore 16, only had 16 kilobytes of data.  The first machine I ever programmed could not hold this one code file completely in memory at any one time.

This was in sane.

This thought immediately grounded me, back to thoughts of writing for BIG IRON.  Looking at the code thinking, has any bloat got in there, have I fooled myself into thinking the code base if decent?  Am I not seeing the elephant in the room that there is some fault.

And I realised, this was the teaching I had had all those years ago, from programming myself on the Commodore, I'd then moved to the ST and then to the PC and I learned to program by always taking the work I was doing now back a layer, I did commodore basic on the C16, then Basic on the ST, then Pascal on the PC and then back Pascal on the ST... its a chain.

So now, with a leap I have to take my latest C++ and look back to that first time I was learning C, to evaluate the code not for the machines of today, but to make it run that little bit better over all now as if it were on those limited machines I first worked on.

My first PC was an 80486SX2-50Mhz with 4MB of RAM, the SX chip could not divide or multiply on the chip, it did it as a software shim as additions and subtractions, I didn't know this at the time, I just organically looked for the best solution to a problem.  Like for example checking for a remainder to see if something is odd or even....

int i = 245;
int j = i % 2;
bool isEven = (j == 0);

On a processor able to work out multiplications, with a math co-processor, this is the fastest code, however on an SX it turned out, back then with the shitty compiler I had that actually to remove any digits above the last and examining it were faster...

I can articulate this now, I understand why I did it, I'm not intimidated by not knowing that there was a better way.  But back on a day in 1996 I was very afraid of not knowing why, or how.

Now-a-days you'd just pick up the internet connection and look up such a piece of code and see tens, perhaps dozens of suggestions of how to do that task, but not-one would teach that sometimes you have to write for the bare metal.  Sometimes you have to optimise for the task at hand, for a specific job.

Languages like Java, C#, python and others running in virtual machines/interpreters don't teach you to bend your machine to its best ability, they teach you, or nail you over the back of the head with it time and again, to write code to best fit their runtime, their rules and their reasons.

So, my employer?... Their main effort is C#, their main product is C#.  Its slow, its clunky and its really pushed the hardware to its limit...

If the same system were worked in C++ the hardware being asked to run it might live another 5, maybe even 7 or 8 years.  I told them this a year ago, I've now delivered a highly specialised C++ custom tailored solution just for one set of hardware and unlike my C# projects - which spend a protracted amount of time debugging to suit the C# virtual machine rather than the actual machine we're running upon (which is a constant machine, not changing spec) - which seem to take up the maximum amount of time and even then want more time to get themselves done.

Why am I writing all this down?... 

To be honest, I don't know I just had all this junk on my mind, it has no point, no purpose, if you read it sorry... but sometimes I just need to rant.

Sunday 16 December 2012

Live Streaming Programming

Until tonight I've never even thought of this idea, but like all good ideas someone else got there first, and that idea was live streaming programming.  After a little searching around I actually found a live stream of nearly 4 hours duration of Notch, creator of MineCraft, coding in java.


A really strange, interesting and informative thing to watch.

I got wondering whether the Raspberry Pi needed things like this, examples of people programming on them to inspire the kids.

Friday 14 December 2012

TF2 - Linux

Its running really great... Just need to find where to give feed back on the Steam pages... Humpf.

Wednesday 12 December 2012

Linux Steam Beta

I'm in the Linux steam beta just now, I just took the mushroom and updated my Laptop from the wholly unsupported Ubuntu 10.10 to Ubuntu 12.04 LTS, the up shot is I have Team Fortress 2 Beta downloading now... 

This is all fantastic, I can't say how great it is to see a real game company port a real game to Linux...

But the download is HUGE, its like 12.2GB... 12.2GB what the hell are they putting in there?... I feel like Doc Brown being told how much electricity a flux capacitor takes.


Books About Programmers


Its that time of crunch, at work there's a project coming to fruition, today I've spent most of my time breaking through to people that my code does in fact work and I've discovered a big bug in the source software - on another system, which everyone insisted "has been tested to death", but which infact was "oh nice find, we've never tested the system like that - which was to say, they never tested this particular system.  Anyhew, I handed over my code and it all worked, I then had to give a small introduction to one chap on how to use linux... which was basically "change directory with cd" and "use ctrl+c together to end a program"... This was pretty much DOS stuff, so I was a little worried by how wild and strange he looked at me when he asked me for a demo and I said, "its just like DOS cd... Ctrl+c etc..."

But my other thing I've bene up to is reading some books on programming, I've gotten through a few recently regarding C++, and I've updated my knowledge greatly, this has run in time with the Standard Library evolution into C++11 from C++0x and C++98 before that.

However, I've also taken to reading books about great programmers, I read a bit about John Draper, and Kevin Mitnick last month, I've covered a few of the google employee books out there and I came across this, which I'm finding interesting.


Saturday 8 December 2012

Annoying People

I've run into a bunch of annoying people today... Here's a few of the examples...

1. I bought a car in 2002, it is now 2012 - someone argued with me that I had not had the car 10 years... In short, they can't count.

2. This car has a catalytic converter which comes out of the front of the engine manifold, so this catalytic converter is CLOSE to the engine, under the bonnet, then the exhaust system sits below all that... Someone argued with me... and I quote... "You can't possibly be right saying that".  Their reason for knowing I was wrong and they were right... They cut hair for a living and have never owned a car of the same type as mine... Where as I know where the cat is because I've looked at the exhaust system I can install on a parts database, I've consulted an exhaust specialist supplier.. AND I HAVE FUCKING LOOKED AT THE ASSEMBLY AFTER JACKING THE CAR UP!... In short... they're a tosser, a know it all tosser, but they cut hair for a living so they are actually just living up to a stereotype there.

3. I have been to a company where the person in charge would not talk to their customer, they would only talk to their customers through two other members of staff, making all interactions with them a primitive form of Chinese whispers.  Their reasoning... They don't like their customers to know who they actually are... DODGY... but stupid, because they're a registered company director, you can google and get their fucking name off of the internet, not to mention their postal address and all their age and the list of other companies they run... in short, a tosser.

4. I've had a discussion with a person in a shop, where I was looking at a sofa to buy, where the person asked me... "Are you comfortable"... sitting on the sofa... in an Ironic tone... I exchanged the standard "are you serious look" and then stood up, and he walked off... clearly reinforcing his... "get up you're just sitting on our sofa's we're trying to sell".... YES YOU WANKER, YOU MIGHT JUST HAVE SOLD ONE TO ME!... In short... A fuck wit.

5. My own mother... I phoned up and asked to speak to my Dad, as his mobile was off... AND SHE ASKED ME TO MAKE AN APPOINTMENT, SO AS NOT TO DISTURB HIM... I was like... "What is he off to do open heart surgery?"... "Are you driving a long distance?".... no No NO... he was off to see SANTA.... In short, annoying.

Thursday 6 December 2012

Captain Crunch Cameo

On the Fedora front page are a series of pictures, when the one regarding community comes up I was immediately struck by the chap with the flame ginger beard, not that I have anything against him, but he attracted my eye... And its a good job he did, because to the left, sort of hedging into view is a chap whom to the casual observer would look like a guy who was dragging in off the street.  Literally from laying a sleep on the street.

But, the casual observer would be oh so wrong, take a look:


You see, that awkward looking chap with the beard and very new looking Fedora hat, is none other than a hero of mine, John Draper.  Affectionately known as Captain Crunch.

He is one of the original Phone Phreaks and original Hackers, and when I say hacker, I mean great programmer, this guy was at one time locked up in prison and only let out to work during the day, so he would work all day on software (I think) and then as he had to report back to prison (for being prosecuted for phone phreaking) he would take a copy of the source code with him and work on the source code so his following day would be doubly productive.

Now that is a great programmer.  I wish I have ever had the balls to try that, I suppose with a modern operating system and all the different threads, libraries and dependencies such work would be near impossible.  But back then, he did it... 

The software he wrote is also a piece of software a lot of people have probably heard about, or even use, it was EasyWriter for the Apple II.  One of the first Word Processors in the fledgling personal computer world.

John himself has appeared on a few documentaries in his time, and you can find some of them on YouTube.  You can read more about him on Wikipedia, and unlike other Wikipedia pages his entry is rather accurate (least according to the other books I've checked it against - books I might add which pre-date the internet and wiki's, so I trust).

The only two questions remain... Why is John stood there?... And quite why is he Scratching?

By the way, there was a webpage up earlier in the year about "Saving Captain Crunch", I believe John suffers a motor neurone degenerative disorder, and the site was up to try to earn some spondulix to pay for treatment - John - Pop to the UK, the NHS'll take a look, I pay enough National Insurance you can have a bit!


Tuesday 4 December 2012

New Company Culture... be Obstructive


It is a new world we live in, with new rules and new concepts... Here's a concept for you... I mentioned a few weeks ago I was working on the Raspberry Pi at work...

Well, that work is near completion, so I went to ask "Where are the Pi's belonging to the company?"... Since we've been working exclusively on hardware I bought and brought in, I thought it a little strange we've still not seen any actual kit belonging to the company.

And the answers I got, from two different individuals, begger belief... First I was told... "We're not ordering anything until its all proven they can work"... They do work, and the Raspberry Pi use is only a stop gap measure whilst the real hardware team work on things, but we need to do a demo of this for a trade show in February and the real hardware will not be ready until June, so the idea was to use the Pi and get proof of concept and demo done...

Well, the proof of concept is ready, we just need real company Pi's to run it on for the demo... I point this out.



"Well, we can't just order them, they have weeks and weeks lead time on RS & Farnell".... he is right, they do... "so we've not bothered to order them yet, until the lead time gets shorter"... The logic of this one started to make me boil.  They take a lot of time to deliver, so we won't order until the time to wait is shorter... so rather than wait and get that time over with so they turn up soon ish, they're waiting to wait for their wait... and then ordering them whilst not waiting... the logic... just... makes me cry... Order the things now, get them in the pipeline, then IF we can't get them before January 14th, hit ebay.

Or, better yet, order them from ebay sellers (like I have personally) now and get them next week (like I did and my boss did and the head if IT did and the hardware department did)... No, we can't use a company credit card on ebay... You don't you tard, you use the credit card with PayPal, which is safer than you're clearly aware of with your "t'internet is too new" attitude.  Get with the times, order the things on ebay... No...

Right, I'll order them, and the company can give me the money back as petty cash, or in my next pay day... "No because"... get ready for it... he actually said this... "no because that looks like the company is buying you special toys".

Special Toys... And buying Me...?... So, I bought something the company needs, which I already own and hence don't actually need any more of, and then I charge the company for the equipment it will own and he says it looks like the company buying me toys.

So, at this point, I went to ask a higher power... A director no less... His attitude...

1. We can't buy them until you prove their purpose
2. We shouldn't be using your personal ones
3. We can't buy off of ebay.

So... I'll just delete all this work then, put a hammer through my own personal Pi and wait for Farnell or RS, with the huge long lead times?

And, this whole they won't pay for things on ebay... I bought a book, £45 worth... It proved so useful the company simply took the receipt and paid me the difference back in my wage packet... WHAT IS DIFFERENT BETWEEN THAT AND MY BUYING THESE PI'S AND CHARGING IT BACK?

I swear to god, when you're bringing into your work better tech than they purchase and you are offering every possible avenue to not block work and progress, and all you get is slogging messy stupid obstructive attitudes it really sucks the life out of your efforts.

I have just had a massive rant about this situation to my manager, his answer... go and tell the original idiot I was ranting... Not tell him why, not empathise with my frustration, or even just tell me to calm down, no, his answer was... "haha, he's ranting"...



It is all so tiresome... If I just didn't bother, NOTHING would get done around here... and with NOTHING getting done, I'd be the first fired, this is the irony of it all.

Monday 3 December 2012

Always write good code!


I was reminded over the weekend of a system I wrote way back in 1999, it was a crude CGI based gateway to the internet for a pre-existing software product and because of the tools available being so limited and the company not actually being on high speed internet I was limited to implementing this application in C.

So, armed with C and the CGi specification I set about working out ways to get this dynamic content on the screen.

And one of the ways was to let a web-savvie developer create the HTML pages, then upon requests my CGI simply loaded it, parsed and replaced element names and voila output a dynamic content page.

The symbols I used to denote a replace being needed was <%=VALUE%>.  All these years later it strikes me as being so very very similar to PHP but predates its definitive v4 incarnation by a year, and even rivals the v1 Zend Engine PHP release in age.

The reason I was reminded of it was someone had found the code, found my name, looked me up on the internet and came to this blog in a round about fashion.  The reason being?...

THAT CGI C code is still being used!

Its over 17 years old, and its still in use... And I was paid a pittence to make it work...

They offered me a small, cheap, contract to support the code... I have had to decline, not least because I already have an employer whom would frown upon moonlighting, but also because I really think they should pay a professional web-developer to re-work their portal.  And secure it.

The code is being run on an old Pentium III, top of the range at the time, server.  With Windows 2000 SP4 I think he said.  "Its a machine we just leave on, well it went off the other day and we noticed the live clockings were not going in, so we figured that's what the machine does".

If its the same cheap ass beige box from all those years ago, I'm impressed its still running, not least because it's moved properties three times, going from my then employer in the wilds of Warwickshire, to I think Oxford and now sitting in a ratty office near Southampton.

Sunday 2 December 2012

Can the world....

Can the whole world just fuck off for a few hours and leave me alone please?

I've not stopped all day, I've shopped, cooked dinner, cleaned three rooms, steam cleaned the bathroom, bleached the kitchen work surfaces and cupboards, walked the dogs (twice), taken my brother in law shopping, hoovered the whole house through, handled calls from everyone and their dog AND been nice whilst doing all this, despite running on near zero sleep because of my code kicker last night.

And, now I'm trying to get some more done, so I actually have something to show and tell tomorrow... And, so far I've gotten two functions (about 10 lines) written before I'm being disturbed...

I just want the whole world to fuck off.

Idiot C# GUI Strategy

I've had a couple of complaints about my views in the last post... And folks, I appreciate you have your views, these however are mine... Sorry...

Now, I've also had complaints that I have been knocking other peoples ideas about code and system design, certainly I have been, and I have made out that I ALWAYS get things right... I don't folks, this is one of the first things GOOD programmers will admit and great programmers know.  I consider myself good, not because of my technical ability being better than others but simply because I know I don't always have the answer and if I do have an answer someone else might have a better one.

And this is one of those times, I have been recently programming in C++, this means passing parameters and pointers and working in certain ways.  And then I've in the last couple of days gone back to making a GUI in C#...

And I came up with the data, I came up with a bunch of clever looking GUI (forms) and I have each one linked to a type of data class... And I had one instance of the root data class in the main program, but I for reasons I can't remember... Didn't decide to pass the reference to the root data around and manipulate it in each form at each step...

No, I decided it was better to keep that one root instance safe and pass dozens of delegates up into each higher user facing form to allow that form to manipulate down to the data.

The end result was a teetering  tottering, staggeringly poor implementation, unable to evolve, unable to be clearly documented, with a bloat of each layer needing to pass the values in to the preceding delegates, or set them into the succeeding layers... In short it was a bloody mess, like someone had taken a 9mm to a telephone junction box, wires everywhere but these wires were delegates.

I have of course this evening, in the last 45 minutes in fact, removed nearly ALL of this code.

And replaced it with the old standby, best practice  or passing the actual reference to the root data into each sub layer, and to allow each sub layer to see the Parent control, by passing it as the parent...

Now, from each layer, I can manipulate the data in root directly, finding and altering whatever I like in each control and form.  And I can call back down the layers to say roll back a page, or call to reset some value...

All in all, simple, clean, easier... And... I did not see that solution first time.  Everyone does it folks... No programmer is infallible, not even me.