Monday 6 December 2021

New Broadband Speed


Setting up at the new house and yes, the download speed is fine.. Upload however is not, not at all....

I've a guarantee for 17-18Mbps upload, and I've seen it peak at 6.  It's currently, during daylight running between 1 and 5 tops.

And annoyingly asking my provider for assistance they've still got my mobile linked to the OLD postcode, so it's becoming a bit of a struggle to get any help from them as they've not realised "I moved"... and they know I moved because they activated the new socket this morning at 7am.

Upload speed before 9am was marginally better, around 6-9Mbps, but still well below their guarantee,

Wednesday 1 December 2021

Ghosts.... From the BBC (A Fan Theory)

 Talking about Ghosts.... Sorry, I mean... 


I've gotten quite into this, watching them all over a couple of times, and I've come to a bit of a fan theory; which I'd love to think is true... Alison can seem to only see Ghosts whom have been murdered...

That's my whole theory, here's the thinking.

Mary - Burned at the Stake
Thomas - Shot in a duel
Fanny - Thrown from a window
Pat - Shot with an arrow
Humphrey - Beheaded by accident, but whilst hiding from being wrongly accused of plotting against Queen Elizabeth I.

Then secondary ghosts, she see's:

Luftwaffe pilots - you could say were murdered, killed in action, they're still "mid-flight".
Civil War (Round Head) - appears to have been skewered by a pike.
Hitch-Hiker - Literally says she was murdered.
60's Architect - looked like he had been stabbed in the head as he waved from the window.

And the whole basement plague pit are all found to have been killed by Mick bringing the plague back with him.

So, murder or killed, each has a known perpetrator of their death.

This leaves a few holes in my theory, which I would like to plug...

Kitty - It does seem in Series 3, Episode 5, we have the lead up to her adoptive sister murdering her... We're yet to hear the full truth, but it seems to be the way that is played out.

The Captain - Well, he's a soldier, stationed at the hall we can't rule out a bomb or accident taking his life, he certainly was willing to sacrifice himself by throwing himself over an explosive device; and his love interest subordinate had been posted to the middle east, so there's something there to be explored.

Assuming the above this only leaves us Robin and Julian... Robin lived in pre-history, the stone age, a brutal time, his death may very well have been at the hands of another, be it animal or human; it does not seem likely with his describing wolves removing faces and eyes, and keeping his fathers skin, that he met his maker from his fur bed.

Julian is perhaps the biggest stretch for my theory, as we know a lot about his death, "the perfect death, booze, bit of rumpy pumpy and out".

But it wasn't alone, clearly the woman with whom me was in congress had a literally deadly effect on him, and he found the whole episode to be the most traumatic event in his life...

So there's my theory, the persons who remain are those who meet their end at the hands, or by cause, of another; and they can't resolve it.

The only two I can't answer this for are Annie the maid and the Ghost Doctor.... We shall see.

Covid-19 : Has the Break Down of Society and Community Begun?

Dystopia and apocalypse are common themes in fiction, for many alive today Covid-19 is the first real taste of such a global catastrophe, the removal of social and stable norms of life, the dramatic secession of normal work routine and the imposition of lockdown put a massive strain on society; I have lived this.

And today ask Was That The Start Of the End Of An Era?  An era where you had relative silence from neighbours, a time where you had rules of sleep at night, work in the day broken irreparable, a time when pub, club, entertainment shifted unending from going to be entertains over to remaining at home to be entertained and that leaking out of your space into that of others?

Of course this is a subjective and very personal question, your mileage may very well vary.

However, I have had the vast number of reports from friends and coworkers that their personal space has been irreparably invaded by the actions and selfish nature of others.  I myself have lived this nightmare.

With social norms broken certain people seem to accept that they are going to party at home, be entertained at home, be themselves however they wish that means drink, drugs, music and other people - despite the lockdown.

For us this happened at two different properties (yes we moved) at the first people in the high vulnerability groups were happily accepting visits and then also crossing over visiting each other, in one case over 70's were receiving their grand children, who were out playing in the street with other children, and then they would walk into the houses of other over 70's... And then these self same idiots would ask "Why are we getting sick?"

In the second this happened because our neighbour, she wanted her drink, drugs, music and sex at full on volume, and literally said to me "I'm just trying to have a bit of fun".

So that's cause, people doing whatever they want, despite social restrictions, law and quite obvious risk and disturbance they are causing others who are similarly struggling to find some semblance of peace in these trying times.

How does that then convert into the break down of society?

Well, the agencies charged with resolving these issues, the police, the district and county councils, all seem extremely toothless.  Even in one situation we resorted to the extreme of a private prosecution; WHICH WE WON.  And the court was toothless to enforce anything.

People annoying others, loosing court cases, breaking the law and yet council police and commonsense do not reel them in?  What can?

Well, I believe violence, frustrated in such situations something has to give, you deprive your neighbour of sleep for a month and they will snap, they will be extremely antagonised, doubly so when they have spoken to you and tried to talk over the issue before all the other agencies were involved.

That is the first crack, the first chink in the armour of the old social norms breaking down, and I believe anyone in a property with an attached neighbour, a flat or any other con-joined property can and will run into this, but since Covid I think they'll run into this far more often.


Friday 26 November 2021

Naming a new Storage Server?

 Server names?  In practice I've always been in places or projects where folks are bad at naming things and I am as guilty as the next person in that realm.  I've been on projects naming releases for obscure lord of the rings characters, for characters in a random fantasy story the lead developer had written, for birds, biomes, planets and stars.... Generally these are very niche, if you know the reference you're fine, and it brings a little character to your server.

The trouble arises when a name becomes attached to the history of that thing, the worst I never had was a project with a release named Elrond, where the release itself was re-released, so we ended up with Elrond-2, 3 and 4, then Elrond4RC1 for an update to that successful update, it was just a minefield.

In servers, the worst I ever managed was a box called "Diomede", which would often fail because of bad (read that as cheap) hardware, so the name became inextricably linked to bad performance and issues, despite being a really nice Tomcat & IBM Websphere host with a near 99% up-rate, but that 1% let it down because EVERYONE worked on that one box.

At home at the moment I have:

* Wellington

* Napoleon

* Elba

* Ney

* Waterloo


I'm sure you can tell the reference, but I've had about three versions of "Waterloo", I've also had two versions of "Ney" and at least five "Napoleons".  The names are getting mixed up, as I leave a home project and come back I'll go look up my notes, pull up that machine storage only to realise "oh this was on the OLD version of that name" which was long whisked away into the ethereal world of my replication server or just lost to time.

As such, I want to have ONE big disk server, and I really want to make it nice and neat.   I've already retired all my older machines, like this one:


But I do now have TWO cases of this specification, with the many internal drive bays:


In one of these I have a low-power Core i3 T class CPU, I forget the exact spec, but it's a low-power chip (35W) just enough power to run storage backups IMO, so this is where I'm going to start my quest.

Spinning rust drives are the challenge, I have four 4TB drives just sat idle, plus a host of smaller 1TB drives lying around, these need sorting out, mounting, checking and I then need a strategy.

I'm very likely to go with ZFS creating a mirror across three 1TB for critical storage and then some striped storage across the 4TB drives.  I then want this to make files available across the network, both to my 10GBit and my 1Gbit LAN's.... That's going to require a bit of work to install the former, but the latter should be available out of the box.

This starts to completely retire my 4Gbit fiber channel interconnects too.

So what to name this first stepping stone?.... Comments below:

Elba
Helena

Since it's about storage, I think my theme of names points to one of the islands which hosted Napoleon in exile... but lets see what you guys come up with.




Wednesday 24 November 2021

What's Going On?

Well, we're moving house again!.... Yes, this has been a bit mad, there's a lot going on and logistics are in place, but I'm going to be getting my own little office room back again rather than having to split creative thinking with a bedroom/high traffic area.

There's no real reason for this beyond this house didn't suit us for our living needs of space and specification, sure it's very close to our horses but it's not the house for us.

We've made a modest profit on what we've paid for it, with the rise in the market happening all around, but that's been offset by our paying more for a target property than it is really worth, and it itself being inflated in price by the market.

But whatever, a move... so that's where I've been, as well as being very very busy with work.

I am also working 100% at home now, so I've found that break between wanting to program in my own time somewhat removed by being at home all day working at programming, and of course I can't talk at all about my work on these pages; one day maybe.

Today though, a head of the move, I've been thinking about my network set up, at the moment my network is rather broken up, some of my machines are already at the new house, some are in storage with the in-laws and others are here sat with me, but without power.  I have though received some nice kit from my employer to work from home... New screens and a lovely spec PC are the big ticket items, but generally I'm just in a holding pattern until we move.

Here however is my planned network...



We will go over this in a follow up post towards the weekend.  And I'm going to be changing things up a bit, I want to support PXE booting several things, replacing some of my servers/services with VM's on the lower-power machines I have.  And then only waking up the high power machines when serious work is required, and all that waking and sleeping going on automatically through scripts & network magic packets.... Lets see where this evolution goes.

Wednesday 6 October 2021

Home Engine - Loading PNG Textures into DirectX11 with SDL2

ANYONE Interested in my sharing the code to do this?  Leave a comment, 10 comments and I'll blog it.


I'm using SDL2 as the background framework for providing cross platform input and window handling, but I'm writing my own renderers for various platforms (DirectX11, 12, OpenGL and Vulkan).

All of them support coloured shape and line renderering to one extent or another, so I decided to take the leap into texture mapping.

First of all I put in all the framework to represent textures in my engine in a cross platform manner, and for ease I decided to use SDL2_Image to load my pixel data.  And I started with a simple PNG file I created in MSPaint....

Immediately I ran into issues, PNG is RGBA, the png I created had a transparent background as far as I knew it should all work.  I swapped to RAW pixels and I was getting 4 bytes per pixel, it was only after a bunch of reading and then stepping into the SDL_Surface format did I realise the data might be whatever format but the surface was clearly 3 bytes per pixel.  And funky things were happening.

My assumption that MSPaint was outputting 4 bytes per pixel was just wrong, instead it's 3 bytes, RGB.  And there's no matching DXGI_FORMAT for just RGB - least none I could spot.

A quick reexport in GIMP setting the explicit pixel format to 8bpc RGBA, which then of course just worked....



Therefore, it's official, using an SDL2_Image load of a PNG as your DirectX11 texture is perfectly possible.

And for me, this reduces the need to include yet another library (other than SDL) to handle image loading.

----

Not even sure how, but this older video got attached to this post, which is about "SuperSampling".... but really just changing the renderer to window resolutions...


Wednesday 22 September 2021

House Buying - Sealed Bids

Until yesterday I'd never heard of sealed bids, they are apparently common in Scotland, but in the five house purchases I've done over the years I'd never come across them.

Just parse that again, FIVE house purchases, that's above the national average, I've bought and lived in five different houses; I'm not talking about buy to let, I'm talking about my main house.

And in all those transactions the process was see the house, offer accordingly, offer rejected or accepted etc, so you knew your budget, you chose the value and off you go.

Now, as a vendor, this worked but you were never sure what other offers you might get, you certainly never found out whether the buyer was able to pay what they're offering; and recently that has been an issue for us, we rang up about £400 in solicitors fees only to find the buyer hadn't gotten enough from their property sale and they pulled out, so our chain collapsed.

Knowing a head of time if that buyer was going to be good for the offer they'd made would have been nice.

Indeed, I've only myself been able to offer once I was sold (subject to contract) and had a mortgage agreement in principle to offer against, this is what the vending estate agent is primarily paid to do, ensure the chain can be set up.

So 36 hours ago we offered on a house, lets say we offered £250,000.  This was summarily dismissed, fine instant feedback, I can live with that.

We therefore upped our offer, £252,000... a 2K sweetener, literally.   And we expected, just as the first offer, this to be accepted or rejected.

The vending estate agent they got our hopes for a simple transaction up by asking for both our agreement in principle and status of our sale, the proof needed for the vendor to know whether our offer was firm and real or not.

I duly handed these over, still expecting the call back that day saying "Great, accepted" or "No, rejected".... Now, I've shown my hand here, my agreement in principle was much higher than the price offered, I could offer more; much more in fact, and they now know this.

I don't know if there are any other offers, they've not just rejected my offer as too low, so I'm now flying blind.  I can spent more, but I'm not willing to unless I have to.

Only now do "Sealed Bids" appear on the horizon, I receive out of left field this request for "best and final offer by 2pm".

I don't even know what this means, and I ask, but get literally ran around until not only am I annoyed with the agent, but I'm annoyed with the vendors, they just rejected an offer, clean, simple and normal the day before, today there's some shenanigans going on?

They've decided, or the agent has decided, AFTER seeing we can potentially offer more, to go for sealed bids.  I literally say to her "I could offer more, but I'm not throwing money into the wind, either there are other offers and ours is now too low, or there's not and our offer can be accepted".

But she persists in this sealed bid, I don't change my bid.

And this annoys me, I'm thinking:  "Are they just pushing up the price by scaremongering?"  They've seen I can offer more, are there truly more offers in?  If there are more offers in, are they now getting pushed around the same as me?  or not..... Because the experience, the strategy they have here has just changed.

All in all I think it does the vendor down, this method is very off putting, they could get lots of low-ball offers, which any number of the potential buyers might be able and willing to offer more than, and ultimately it makes the buyer quite stressed.

Buying a house and moving is one of the most stressful things already.

And this model isn't even like an auction, lets take eBay, if I see an item bidding at £1, and I put a max bid of £20 on it, it doesn't just put £20 on the item, it puts £2.... then whatever up to the ending price.

That's not how this whole sealed bidding is presented, this estate agent wanted out best and final offer... it could have been £275,000.... and we'd be the best offer... except the next best offer might have only been £250,500... and we've just MASSIVELY over paid.

It's already stressful, the housing market is already crazy, if you run into sealed bids folks just don't get involved.

Monday 20 September 2021

Home Engine - Lines and Camera Interaction

 Yes, yes, it has been a while; both here and on the YouTube channel, I've just been very busy okay?... Okay.  Friends?... Friends.

So what have I been up to in code?... Well today I added line rendering to my home engine, this is still using the underlying "Triangle" raw data, so I have to always have a cleanly divisible by 3 (for the sides of a triangle) number of indices in the data, but otherwise it just seamlessly integrated.

Its using "LineList" as the underlying primitive type, which maps to the D3D11 type under.


I also noticed that these lines from 0, 0, 0 to 1, 0, 0 and 0, 1, 0 and 0, 0, 1 respectively are "backwards", that is my unbeknownst to me at some point my camera has started to spawn around in front of there my scene objects are, so I'm looking back along the Z axis not "up" along it... Am I making sense?

I also improved the camera some by linking the rotation of the camera to the mouse, which makes it super intuitive.

The failed part of the work this last month was an effort to update both the Vulkan and the OpenGL renderer implementation.  This was an utter failure, the simple reason being that I've gone too long with my limited knowledge with DirectX.  I'm sure the "port" to DirectX12 will be easier, but yeah, I've already gotten the other API's so far from my implementation (abstract base classes) that it's quite alien to return to them.

I'll circle back on that, maybe break down the API's with failed/broken builds until I can slowly etch away at the challenge.

Wednesday 25 August 2021

Hex Messages when Reverse Engineering

One of the things I did in 2018 was a bit of reverse engineering, the company I worked for had bought a bunch of older hardware which had to be reused, the trouble being?  They had bought the hardware NOT the software.

It look a lot of USB sniffing and signal trapping but eventually I had the device handshake and could see it spew me messages, from these I saw the header format was pretty simple just a pair of bytes and then a length byte followed by whatever the message was.

Interacting with the device stimulated it into sending more messages, so we could start to map physical actions to these USB packet ghosts, eventually we had all the ones we could just prod out of the unit, so it was time to work on more advanced interactions and actually try to tell the device to carry out actions for us.

This immediately met with problems, you see the messages coming out had a counter in the footer, it turned out that if you sent a message you had to use the next number... so receiving messages 1, 2, 3 and then you send 4 and receive 5.  Keeping this in sync was a little bit of black magic, but it soon made sense the unit was serial in operation, you could only talk when it was listening, and it only listened after certain choice messages it sent to you.

This all made sense.... What didn't make sense was a four byte message I saw every few minutes, this frustrated me no end....

10111110111011111101111010101101

I converted these to two into an integer... 3203391149... It didn't ring any bells, but I persisted and was rewarded when I switched it into hex...

BEEF DEAD

This is a common message left in hex in code, as a joke, but it was also apt, the board was not going to talk until a full handshake was given again and the packet series stream started over to order things.  Cute.

I've found other hex strings, but this one was the first on this particular board

Saturday 14 August 2021

That Time I Found a Pub

I don't mean just I was out in the country having a stroll and happened upon watering hole.

No, I was in my garden, and I found a pub.  Specifically the pub's kitchen floor.  The pub in question was the Miners Arms at Selston, obviously long since demolished, but they'd not broken the ground concrete up, just dug the nice neighbour diagonal's garage hole into it and so about seven inches down under my lawn was the white tile floor.

This made my lawn growing efforts a bit of a pest, they kept drying out.

Tree's also rooted along the tile level and it was impossible to landscape effectively.

The ground itself, the natural ground was very clay riddled, clay deposited during the last ice age as part of Alma Hill.  But still a challenge to dig out.

Not as challenging as the neighbours, but then, I've mentioned their mania before.

Tuesday 3 August 2021

Music : A 40 Something's Service Announcement

If you hear someone playing Rage Against the Machine's "Wake Up", but only know it as "That song at the end of the Matrix...


Or you spot a 40 something co-worker in their Nirvana T-shirt and comment "I didn't think you'd know who they were"...

Or you hear a bit of Beastie Boys' Sabotage peeping out said coworkers headphones... You do not ask "Is that the song from <insert film here>"....


Sunday 1 August 2021

My Home Game Engine - Motion Decay (Physics) Bug

A few of you may have noted I've been writing my own graphics engine at home, this has fast become my own home game engine; which is more or less just a play ground for me play about with.

And over the weekend I've started to flesh out the physics engine, beginning with a physically reactive camera.  I want to make this thing tilt and shake and move like it's organic, not on the end of your keyboard or mouse.

The motif is going well.

I designed a head for many edge cases I expected, one of them being floating point in accuracy and so I built two things into the movement, first a dead-zone, so zero isn't the ONLY value which doesn't move the camera, instead an area of 0.0004 around the camera forms a null - don't move - zone for all my motion calculations.

And the second was the force of friction or wind resistance, this is just called "Decay" in my engine, you decay from moving to  no longer moving.  Because wind, water or surface friction are going to come into play at different times and from different directions on each object.

Anyway, do work out the motion which needs applying to any object I build a vector of motion actions, these themselves are stored in a set of efficient constexpr static arrays per object type; for not I have so few object types this is fine, it leads to faster code (one day, if I have more than ten moving object types I may need to revisit this.

Alas, this smartness immediately bit me in the arse... And I just spent nearly half an hour pawing over the wrong piece of code to figure out why when switching to an object known to be at rest (0, 0, 0) with no actions on it... it'd slowly jiggle backwards at a very slow rate.

I checked my maths, my direction vectors, my initialization of the actual speed of the object, everything checked out.  I made sure I was giving no inputs, so I wasn't landing in the accelerate or decelerate motion actions.

So I was properly confused, I took a moment and I re-read the code I'd done yesterday (oh the difference a day makes) and suddenly I realized I had two kinds of decay... if you're moving forward you slow down... and if you're moving backwards you also slow down... both heading to zero, or at least the 0.0004 null zone.

Other objects were not moving, just this one particular type... and having a quick squizz, sure enough the acceleration and deceleration decay were BOTH being applied, even at rest this object would jump to a speed and start to decay, this would then swing it below -0.0004 in the null zone and the deceleration decay would kick in... and the deceleration was MORE than the acceleration so then the object was trying to decelerate a little but more each third frame... zero to backwards to null zone to backwards to nullzone... on and on, tiny increments.

This was a flat out bug, the decay should have only been applied to make the object come to, but not beyond the nullzone.

However, I was still perplexed how the forward decay was being applied, sure enough it is, in the above call to "GetMotionActions" we can see it's both ForwardSpeedDecay and BackwardSpeedDecay are "valid" motion actions for objects receiving no input.

And they'd been doing this all the time, every frame... the specialty of this one particular object?  Just the numbers, the profile for motion, specifically the braking, was a larger number taking it beyond nullzone.  And this is multipled by delta time for the frame... all following frames are small, short, but the first frame?... or a frame after a break point... HUGE....

In short I made a bunch of mistakes, but I learned, and I enjoyed myself.  This is perhaps the key thing when trying something new.

I also have a healthy appreciation for just taking a physics engine off of the shelf having done some of this ground work - and I'm literally just playing.

Thursday 29 July 2021

Annoying

I have no idea why some of my posts are coming out with white backgrounds to my text... so annoying.

Wednesday 28 July 2021

Comprehensive Computing (1990's and my meeting the Acorn A3000)

When I went to comprehensive they had BBC Micro's... I had an Atari ST at home... the school then upgraded to Acorn A3000's.  Now the ST, Acorn and IBM PC used very nearly the exact same floppy format (there was one byte difference between the ST and the PC basically, and nothing with the Acorn Archimedes series)....

The teachers, totally no idea how to use these machines.  Sure they could run applications in pre-packaged orders, but they never delved into them.  The Acorn had a whole host of built-in software, the OS itself came with a RAM disk, one teacher once saw me cache all my work on a 1MB RAM disk and work hundreds of times faster than anyone else in the lab, but they had NO idea how I did it; and didn't want me to explain it to them.

So they often found me in the lab... despite it being locked...

You could get in via two routes, one was to go in through the neighbouring classrooms air vent between the two back-to-back store cupboards... One day I found the grill had been screwed back in place and sealed, which put a stop to that... And no matter how often I asked teachers would NOT let us into the lab without themselves being present, and quite simply they didn't have the will to help encourage learning, it was a dangerous prescient for them in the 90's to admit that there were those with a natural talent in a field the staff had no interest nor experience in.

So what next?  Well we had to climb out the window, shimmy along the ledge and climb back in... Usually only one person did this and then unlocked the door for the others, but it was a bit hairy on windy winter days.

 But literally, the school didn't want the kids to use the computers, either scared we'd break them, or more likely we'd steal them, ever seen the size of an A3000 and the bespoke monitor?  yeah, I can really not imagine how they thought we'd sneak them out the building unnoticed.


Anyway, one day, I'm there with some code in the RAM Disk, playing about with the Basic interpreter and I had a new thing called a "Compiler"... I think it was for Pascal, but it's lost to memory.... The door unlocked and a teacher pounces in Alan Partridge style... "A haaa, I caught you"....

Yes sir, you caught me.... trying to better myself, please put me in irons and take me away.  Basically, I can only assume; after the fact; that in this school we're all meant to be preparing ourselves as manual labour, I know!   (Top Valley Comprehensive, represent; it's now "Top Valley Academy" or even just part of Red Hill Academy, because you know... We're not allowed our little tribal enclaves anymore).

But this teacher takes a look at I'm doing; I would hazard a guess he expected a game instead he see's code and the dozens and dozens of disks I have, "Come with me, I know what punishment you must receive".... Bit worrying, but we trusted everyone back then, and I followed him to the store cupboard.

And he slaps a brand new unopened packet of 10 disks into my hands then rummaged in a plastic disk box for another grubby one with tippex all over the paper label, which is so tatty it must have been reused until the plastic platter inside was an atom thick.

"Right, I need 10 copies of this disk by tomorrow, else you're in front of the head master"

In hindsight I should have said "Can I go talk to the headmaster about your not encouraging me to learn and explore the machines which are taking over our daily lives".... But alas I said "yes Sir"

I didn't even think about the format issue, I just went home and made an exact sector by sector duplicate on my ST, assuming it was either an Acorn or PC compatible bunch of data, I couldn't tell until the morning, but I made a copy for myself too.

Arriving back I handed him the box.... His stunned face was quite a thing to behold, I think he expected it to take a long time... But I got two drives, yeah baby, rocking the power set up!

But during break, and after scaling the building again, I popped one of the disks into a drive and let it boot....


Lemmings... For the Acorn A3000 series, it was ported by some other company, it wasn't the DMA/Psygnosis original, I kind of remember it being some butterfly logo in purple... But it was lemmings... And I'd made eleven pirate copies of it as "Punishment".

Pretty sure the wrong was all on the other side.

I did get permission from one of the deputy heads to use the computers from time to time, but by the time I finished at comprehensive I was learning Pascal for my ST, and even writing and released my first program as a kill counter/leader board for Elite II Frontier; that was the first piece of software to earn me some money (£25 one weekend, with five sales) so I was hooked; no thanks to any part of my education experience at comprehensive level.


Monday 26 July 2021

Your Best Work?

The best piece of work you've ever done?

This is one of those subjective questions you can pose people, and you always hope that there's better to come, so really what we're asking a software engineer is "What is the best piece of software or project you've done so far?"

As technology is always marching on and new ideas are always emerging you can often say you're going to make something better, which is great, but it makes it harder and harder to pick out the best pieces of work from your portfolio.... Do you judge it by the number of users or downloads or how much money it made the company or even how much you were paid to do the work?

Monetarily the most money I've ever made on a piece of software was for a website I wrote in about two weeks in ASP & javascript in about 2002, which netted me the grand sum of £4000 for 80 hours work, literally £50 an hour.  But it wasn't the best work I ever did; I mean (snear) it was javascript.

The most interesting work I've ever done is the work I'm doing right now, but I can't talk about that.

So this leads me back a step to my long tenure at my prior employer, the best work I think I did, was a project to port the existing system to a new hardware platform; this involved reverse engineering the hardware interface and writing a new interface for the hardware abstraction layer for that particular hardware, which worked seamlessly and the whole system was agnostic as to which hardware type it was booted up upon.

This was not how that particular system was engineered, so in about four weeks I not only made the hardware interface an abstract interface, but also developed a test bed for the new hardware and then sewed the two together; four weeks in that environment was an incredibly fast turn around.

And it was extremely enjoyable.

That section of work was one of the best pieces of work I ever did.

Years later the creator of that hardware came to work for the company, he saw his hardware but our software and asked a few pertinent questions, for he thought his hardware was secure and could not be made to work on another platform without his secret sauce.  Let us just say it was fun to NOT tell him quite how I'd done the reverse engineering; unfortunately this reverse engineering nous set me up for the next big reverse engineering jail break required by the company, and it was a totally different kettle of fish and worthy of it's own post later.

Thursday 8 July 2021

Explaining the "three dots in Chrome"... A marital skit by Mr and Mrs Xelous


Mrs> "How do I make this page bigger, it's all small and tiny?"

Mr> "Have you zoomed out?"

Mrs> "I don't know"

Mr> "See the three dots on top of one another, top right, just below the cross you close the page with?"

Mrs> "That's just closed the whole page"

Mr> "The three dots?"

Mrs> "You said the cross"

Mr> "I said 'see the three dots just below the cross'"

Mrs> "I only heard cross, don't get cross"

Mr> "Just open the browser again"

Mrs> "The what?"

Mr> "The internet, open it again, and in the top right you see three dots stacked on top of one another just below the cross to close, not ON the cross, BELOW the cross"

Mrs> "Yes, do I click them?"

Mr> "Yes, just left click and you see zoom"

Mrs> "Oh zoom, I can do that my hold CTRL and using the scroll wheel can't I"

Wednesday 7 July 2021

1980's-1990's UK Education Review : Pt2

Today I'm going to be using skills that I formed after being utterly humiliated at school, English.

I basically went from Junior school (ages 7 - 11) unable to spell, form structured sentences or really converse in writing.  Plus my handwriting was appalling; it's still bad.

The reason?  We didn't really get pulled up on writing, Maths we had a focus on, we had to learn times tables and stuff - more about that next time, but writing and spelling wasn't really bothered about, I can only recall two times my writing was questioned.

The first was with a supply teacher who noticed that myself, and a bunch of other kids, started writing in the top left of the page, and we would rotate just our wrist around, so our writing went in a rainbow like arc across the page from top left corner to nearly bottom right... Then we'd flip the page over.

I can recall this vividly as she was just utterly perplexed at these 10 year olds not being able to write along a straight line, she made the whole class make a lined page we could use behind our actual writing page and guide our hands.  She also showed us to use a few other sheets below to make our pen/pencil strokes more formed.  Our actual teacher was genuinely annoyed with us "wasting paper" when she returned to find us writing on one page with two or three below.  But the lined pages remained.

The second was when writing about a visit by the police to the school, they showed us a police dog and engaged with us, it was the police being a friendly force and to this day I trust the UK police because of efforts like that (no matter how ineffectual they can actually be, they try).  But we were writing about little the day in little events and had to write out the phonetic alphabet.

I got the alphabet wrong... I was like 7... but I got the alphabet wrong!!!

Just take that in, you can see this blog, how long I've been writing, at 7... I did not know the alphabet.

My teacher, a male that year, was more bothered about us being quiet and well behaved, he was actually busy planning a road trip across the USA that year, and that's what I remember more than any teaching, he left at the end of that first year; which must have been his first year after graduating as a teacher.

All this problem built throughout my time at junior school and at 11 when I walked into senior (comprehensive) they immediately identified I could not spell, could not form sentences, could not really write.  And my mother set about an intensive scheme at home of fixing this (we'll ignore she hadn't noticed before hand).  The school certainly hadn't noticed before 1989.

Friday 25 June 2021

1980's-1990's UK Education Review : Pt1

In this series I am simply going on a tour of my memory, mainly over my time at school.  My schooling started really at Junior School (7-10 year), we learned to roughly read in Infant school (5-7 years) but that was literally it, I just remember playing with toys at Infants and then being made to read at home.

So we'll start there infants school, we painted things, made collages, I do not remember a single day of structured learning.  Everything seemed to revolve around playing.

Highlights include anything with some structure, this included one day going from a classroom at the front of the school to a classroom at the back of the school, I'm guessing our teacher was suddenly ill so the class was divided between the five others.  And going into that other classroom the kids had "grown up" toys, this was lego - and lego technik - they had a TV with a video recorder and a programme of watching structured learning tapes.  There were actual projects on the various boards around the room, things the children had gone.  They'd done tadpoles, with the kids drawing diagrams of each stage f the tadpole development and they were currently doing cress.

I drank all this in, it was like night and day.

When my little brother came into the school three years later, he was in one of those more complex classroom, not the very plane almost dumb class I was in.

That very much reflects my opinion of my time at infant school, I was put in the dumb class, we weren't encouraged to read, we didn't do math, there weren't any really interesting projects, yet I saw this going on elsewhere.

My mother made me read with her at home, when it became very clear I was not learning at school.

And my grandfather I remember him watching me write and coming over to correct me, I remember very distinctly his showing me how to make the "8" shape rather than just drawing two circles atop one another.

So yeah, not very good, this takes us to 1989.

Wednesday 23 June 2021

My Funniest Amazon Review?

Yeah, got to be said this is hilarious even to me... And they've accepted the review!

https://www.amazon.co.uk/review/RNF13I0DO7R11/ref=cm_cr_srp_d_rdp_perm?ie=UTF8

Tuesday 15 June 2021

A rack Mount Mistake (but not by me)

Many moons ago, in a job role nothing to do with me anymore, I was tasked with looking at running/building some software on Linux, the distro wasn't up to me, nor was the installation, one of the key things was that I couldn't have root on this machine, it was all set up by the IT department, hosted on one of their servers.

Fine and dandy, in fact I was all happy about this as it was far less for me to worry about... Or so I thought.

You see, I expected to be handed an ssh account and IP (or name) to connect to... And this is where the wheels came off, for the IT guy had no idea really about running a linux VM and it just being a terminal session, he'd installed a full on desktop (XWindows running KDE I think).

OOoooohkay, I'm not root... can I get OpenSSH Server installed?... No.

Because he can't control that, but the desktop session he can control, apparently.

This first project lead onto a second, which itself required some OpenGL, no problem the machine has a desktop running I can use the reference (Mesa) implementation and yeah it worked.

About a week later though the IT guy said that this VM was taking a whole CPU core on his server.  Not really my problem, I'm not the host, and I'm not actually using it right now.

He reboots, the problem goes away.

Next day, same deal "your machine it taking up a whole core".... I was a little exacerbated about this, because really the machine wasn't mine, I knew nothing about it, not how it was set up, not about any of the items he'd installed, to me it really was just a remote desktop I opened in order to open a terminal... and I wished it was a totally headless machine, but he really didn't seem to realize this.

So, fast forward another day, and the IT guy comes over, he has figured out what suddenly made the machine, when not in use, go to 100% on one of his CPU cores..... Drum roll please.

He had installed the desktop environment...

And it had a screen saver!

Not only a screen saver, but a 3D OpenGL screen saver.

Thursday 10 June 2021

The fastest Salesman in Hucknall

So, I went to the opticians and had a new pair of glasses with a set of film coatings, and in picking them up I met the fastest salesman in Hucknall.

For quick as a flash he asked "how do you clean your glasses?"

"With water" I replied....

"Water, far too strong a solvent, try this" and he pulled up a concotion spray thing of 5-Chlor-2-methyl-2H-Isothiazole-3-on.... Yeah... "Water too strong".... Well played pay, well played, but... No.


Friday 14 May 2021

Where's Me Wardrobe?

Everyone is going on about the microprocessor shortage, but has no-one noticed the completely missing "wardrobe" supply?

Thursday 13 May 2021

Now not

Why it is that most of the time when I come to type "now" I type "not"?

Anyone?... Anyone at all?... Muscle memory fail.

Saturday 8 May 2021

Loving Amazon Recommends....

I just laughed loud... Amazon, recommending my own book to me...


S'good book, you should buy it.



Saturday 24 April 2021

Bad Files and Smart Cards in a Project from Long Ago

I need to anonymize this code, so we'll be doing it in a pseudo C# style.  So one of the last tasks I had at my prior employer was to inherit the entire code base for a project I had been bitting and bobbing in for years, I'd seen this project start, release (many times), mutate and ultimately age.

As I took control it needed replacing, which is a whole other story involving C++ and dragging people kicking and screaming into touch.

This product though was like your grandad, it sat quietly on its own sucking a Worther's original waiting for a war film or Columbo to come on the tele.

The difficulty was the fault rate, between 9 and 14%, of machines were off in the morning, if a pack of updates were ever sent (for content) then that was around 46%... Image the calls there, the service manager and his oppo having to field 46% fault rate because of your update.  Indeed on one occasion I remember driving to a customers site and physically handing them a good update DVD rather than our leaving them to wait.

So what was so bad?  Well, it all came down to.... Lets look at a piece of code that is seared in my memory:

FileStream file = new FileStream("C:\\SomeFile.txt", FileMode.Open, FileAccess.Read, FileShare.None);
byte[] buffer = new byte[file.Length];
int bytesRead = file.Read(buffer, 0, (int)file.Length);
file.Close();
            // Do something with buffer to give us a new buffer
            int newDataLength = 64;
            byte[] newBuffer = new byte[buffer.Length + newDataLength];

file = new FileStream("C:\\SomeFile.txt", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
file.Write(newBuffer, 0, newBuffer.Length);
file.Close();

This is part of an update sequence, where the existing file would be opened, the new update delta calculated and it intended to append it onto the end of the file, and this was fine for years, it worked, it got shipped.  It went wrong about five years later, can you see how maybe?

A hint is that this was a 32bit machine.

Did you spot it?.... it's line 2...

"file.Length" returns a long, but then all the following file operations work on int.  The file started to go wrong after it was two gigabytes in size, because the range of int being 2,147,483,647 if we divide by 1024 three times we get kilobytes, then megabytes, then gigabytes and we see this is roughly 1.99 gigabytes.

But then think about that, this is a 2GIGABYTE file being opened in a buffer in RAM!?!?!?

It just makes a pure RAM copy of itself, then opens the file and starts to write over the original from zero to the end.

YEAH, so it's over writing the whole original file.


It's so wrong in so many ways, the massive buffer, the overwriting of existing data already safe on disk, the fact that this all took time too... this operation happened at a reconcile phase, it was all asynchronous, whilst this system portion was doing this mental tossing about another part of the system had changed the screen... to say "Please Power off or Reboot".


So people did, they literally pulled the power.  So they lost their 2gigabytes+ of data, and when these files were getting large they were nuking them by pulling power too!

The solution is simple, open the file for append, or just seek to the end and add the new data on.

int newDataLength = 64;
byte[] buffer = new byte[newDataLength];
// Get the new data into the buffer
FileStream file = new FileStream("C:\\SomeFile.txt", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
file.Seek(file.Length, SeekOrigin.Begin);
file.Write(buffer, 0, buffer.Length);
file.Close();

This was only part of the problem, the functions using the data from this file took it as a whole byte array, it literally had no way to chunk the file.  I can't go into the details, but I had to break that up and start to stream the data through that system which then let me add the resulting new delta array (which was always smaller than 2MB) to the end of the file.

That was only one part of the system which kept be awake, another good one, used a lot was a pattern to also overwrite small files, mostly the json files which controlled the settings.  So the users would often turn these machines off by simply pulling the power out of the back.

Whenever it was saving a file it would basically be doing:

File.WriteAllBytes(thePath, allTheBytes).

Yep, it'd just write over the file.

My fix?  Simple, when opening the file at a time when we didn't expect the users to just pull the power - or at least it being less common - make a file back up "File.Copy(source, dest)" and these destination files were numbered 1, 2, 3 which we could configure... so sites where we knew they had a high fault rate we could stack up 5 or 7 backups of these files.  but machines with a better hardware, or SSD's we'd only need 3.

I don't even think the service manager knew about this "fix".

But armed with these backups we could then leave the original code alone (which was quite convoluted and I didn't want to fix to be honest) but then on next load if the opening failed I'd have it nuke the back up it just took, then use the last best aged backup.  And if now there were more backups then we should have we'd delete the oldest.

Settings didn't change very often, but this did let us solve this issue.

The final worst piece of this system was the licensing system, which used a USB connected smart card reader, and a custom decrementing secure card format to license the machine time.  This was fine for years, it used a nice Gemalto reader and cards, and all was fine in testing.

The machine tested the card whilst in operation once every five minutes, so no big deal.  When in service mode it checked the card every 10 seconds to update the license level display, but the service mode was never intended to be left for more than a few minutes.... So what happened?

Yeah, a customer opened a machine and left it open for a week.... And their machine went out of operation, when we got this particular machine back I just opened the door, took the card out and pointed to the literally charred burned back of the smart card chip... It was a white plastic card, and the back was deformed and light brown... I did chuckle, sucked for the customer, but we never worked out why they had the door open in service mode for so long; they weren't meant to.

But worse that that isolated incidence was a new tranche of machines being released in 2015, suddenly all had faults, there was machines out of order, machines not allowing play, machines rebooting... Nothing seemed to clear them, and some were reporting "Out of Licensing"; despite people having paid for brand new cards.

They were issued a new card... The old cards came back, were reworked... so randomly once working sites got either a new card or a reconditioned card from any other random site.

New machines had a new brand of card reader, old machines had the Gemalto.  New cards were all these new brand of card, and the old cards were the white gemalto ones... this mix just went on... and soon we had a rising fault rate.

The diagnostic view was at first a little mixed, sometimes a new reader was fine, sometimes a new reader was bad... all customers reported "my new card", they had no idea that the brand had changed under the hood... and in fact nor did I.

You see to save a few pence per card (12p per card to be precise) they hadn't gone with the grand 34p GemAlto cards, they'd gone with 22p Chinese copies... Inferior copies as it turned out, they had around 1/8th the life span, so over time ALL these "new" cards failed.

But then, in the GemAlto reader they were all fine... So the new reader?... Oh that was ALSO a cheap Chinese knock off, and these things had strange problems, I suspected sometimes they were putting the full 5V USB current through the cards (rated at 3v) killing them.  And was proven right.


This unholy quartet of product caused havok, but I eventually found that new readers could kill either new or old cards, they had to be recalled... Then new Cards could die randomly in even old reliable readers, they had to be recalled.  Which means we slowly struggled to find old readers and old cards.

All of this was a purchasing foul up, unfortunately managers saw it as an engineering problem and so one had to code around poor hardware.

The first thing we did was add two toggles, one for "old card" which I could detect from the card chip type being read on reader access.  This slowed the reading of the card down... form 5 minutes to every 30 minutes, so we ricked giving customers longer before an unlicensed machine went out of action, but it was accepted to give us a much longer read life for the card cell.

Then we deferred the first read of the card, on boot up we literally leave the USB device completely alone, let windows start and everything settle on the desktop driven system.  And after 5 minutes we'd start our licensing check.  It was accepted that a user could technically receive 4m59s of unlicensed use and then reboot to get more time, but that would be a little impractical in this usage scenario.

Doing these two things we could just about use the new readers...

But the new cards were just so utterly terrible, we did eventually have to buy better cards.  I never heard if there was a refund on the originals, but I can assure you my time along cost more than the £120 they saved going with these cheap cards.

Wednesday 31 March 2021

Final Thoughts for March - Apple M1

I've been looking at the new like of Apple equipment, now I'm not an Apple guy... I only recently acquiesced to buying a second hand Mac Mini (Core i5, very old) not really to play with the old version of Mac OS it could run, but to use it as a Linux box.... Of course I took a look at the Mac OS and the hardware.

It is very neat tidy design, but awfully bespoke, terribly difficult to repair, but not impossible, I actually was able to fit new SSD's, upgrade the memory and fix a failed fan.

That's the bare minimum I'd ask of a piece of kit, to be able to change the storage, upgrade the RAM... fix a fan... Hard drives, be they mechanical or solid state fail over time, they literally wear out.

Hearing that some Apple models have their only storage literally soldered onto the main board was a real turn off, how can such a thing be upgraded or repaired?  Well it can't.

And this ability to repair something is pretty key to me, and I presume a lot of other people.

Soldered on, fixed in position, storage is just a no-go... And as I understand it this is how the new M1 Mac's all work, they have a fixed amount of storage, no additional storage interfaces (SATA etc) sure you could use an external USB drive, but that's... that's not going to stop the main boot drive taking a battering.

Worse still I've anecdotally heard about the massive swap usage on the M1 Mac's, which prematurely ages the storage.

It is the perfect storm to leave a lot of electronics in ruins and the waste of resources and environmental impact of all this just has be aghast.