Monday, 8 January 2024

The 2023 Great Laptop Shop...

It is that time of life again.... Time to shop for a new Laptop... And I am finding a new scourge in the mix, that is "Soldered".

I am so absolutely sick of seeing "Soldered" next to the RAM specifications, like I get it for budget machines, I get it for tiny integrations, but for actual working laptops?  For laptops marketed as "Business" or as "performance"... oh my word, why are they doing this?

I really hate this whole phase.  I have hated the laptop hidden gotcha's for years to be honest, and I'm upset Lenovo have joined the price crunch unupgradable ewaste train.

My current machine being a Lenovo E480, I can and have upgraded the RAM, it has two drive slots (one SATA and one nVME), you can change the battery and it has plenty of USB and aux IO ports all around.  The issues I have with it is that one RAM Slot has gone bad; I simply doubled the RAM in the one remaining slot - but really I'm not at end of life.  And the CPU being an 8th gen is struggling with my workloads.

My options are to soldier on with the E480, maybe even move all my work into remote virtual machines and use this simply as a terminal into them; but then I would always require network access and that's not always possible.

Or get something new and locked down.

Or a Framework offering, which lets me upgrade to a point.

Or keep shopping... But the ease of finding what I want is very much on the low-side, and I'm a technical user, finding what I want should be simple.  But the deck seems stacked with both retailers and system integrators wanting to pass off this shovel ware crap on me.

Monday, 23 October 2023

Job Interview : switch(char) again! Twenty years on!

I've spoken about some of the strange interviews I've enjoyed over the years; notable engineering highlights were having test driven development spooned to me, when I simply didn't know the particular syntax they were demanding, or having StringBuilder suggested for a C# task where they actually needed to cross-core thread their problem, or pointing out that the CI solution being described would lead to an alien environment of folks being paralysed by fear of red flags; only to witness their development floor being paralysed by exactly those issues as I walked out the door.

Today however, I'm going to go way back and talk about one of the very early development interviews I had; this maybe like the third interview I ever had after graduating, it was with a rail rolling stock company, in a very bright and sunny room with three guys who seemed to know their entire universe was correct and they'd take no new information into their sphere of understanding.

I share this one as a friend of mine was in touch over the weekend, he had an interview, and strangely he had the exact same conversation I had... THE EXACT CONVERSATION, twenty something years later.

Let us start by sharing some perfectly valid C++ code:

bool validate(const char& value)
{
switch (value)
{
case 0: return true;
case 'x': return true;
default: return false;
}
return false;
}
int main()
{
const bool isValidOne{ validate('a') };
const bool isValidTwo{ validate('x') };
const bool isValidMe{ validate(12) };
}

Read this code, we should see an output (if we output the bools) of "false", "true" and "false"... I think we can all agree.  This is perfectly valid C++.

It isn't very clean nor pretty, we're relying on the compiler standard decaying char to int and vice versa; which is not very nice and I wish compilers would complain here, that we're comparing int to char in the first case and we're converting the integer 12 to char, I think it should really strong type this.

But that is not the point, the point is that both in my friends case and mine all those years ago the interviewers got really uppity about that "switch" statement.  They insisted that you can not "switch" on a character type...

Just flat insisted.

I remember in my experience they had me write up what they wanted on a blackboard, with chalk, and they wanted me to go through the code line by line; I wrote more or less the above, they insisted they had a character not a byte (uint8_t: though there was no standard for this at the time) and then they went off on this tangent amongst themselves about the value of the if-elseif-else stanza's they insisted would work over my solution above.

Now I was talking to these guys in the early 00's, my friend however was talking to them in 2023.  He jumped on this with the point of "well if the character is known at compile time, yes then constexpr maybe of use" and he showed them:

if constexpr(foo) and if consteval(bar) examples.

He described their faces screwing up and two of the chaps he was talking to staring at each other before making subtle notes on their paper.

It was very clear at this point that the CTO performing the interview was not keeping his knowledge up to date, the group seemed to cluster onto the idea of just maintaining what they have, stagnation like this in our joint experience can be problematic.  Both team morale and high turn over of engineers always happens when things stagnate.

I have to say in my interview I actually sat it out from beginning to end and just knew I was not interested in the role; and I did not hear from them again.

My friend however, he was genuinely concerned he'd done a good interview and they'd be offering him a role, they kept him talking for over an hour and a half!

He's a late 40's engineer of 25+ years experience, just like me; the three chaps interviewing him, including the CTO, were ten or more years his junior, it seemed they were looking to back up their team with an older head to lend legitimacy to things; and they had lost two original engineers of their project to literal retirement without replacing them.

He saw the issues and he thanked them for his time and left, with a negative to whether he would be interested in going further.  This stunned them.

It has to be said, so many interviewers forget that though they are interviewing you, you are also interviewing them like most all human interaction it is a two way street and it's crucially important to remember that in a job interview.  We spent a significant amount of our time at work, if you are not comfortable there or feel you are going to be acting out a role instead of filling one and making it your own.

Thursday, 14 September 2023

C++: I was today years old when I learned this about shared_ptr

I was on a review for a colleague and there was this piece of code which stood out to me, I could not figure out what was being achieved.  Without being specific it was essentially

static std::unique_ptr<B> Create(const std::shared_ptr<A>& referenceToA);

Just the function prototype didn't sit right with me and the use case was even more strange to my eye for the "B" structure here being created has the shared pointer in the members.

struct B
{
    B(const std::shared_ptr<A>& referenceToA)
        : mMyA(referenceToA)
    {
    }

public:
   static std::unique_ptr<B> Create(const std::shared_ptr<A>& referenceToA)
    {
        return std::unique_ptr<B>(new B(referenceToA));
    }
};

private:
    std::shared_ptr<A> mMyA;

And my head just lot it.  To my eye this API, the create function here, is given a constant reference to the shared_ptr and what can be constant about a shared_ptr?  Well the internal reference count, or so I thought.  I believed this was a mistake, I believed the compiler would throw this one out and say "No, you can't change the reference count of this const object".

Never had I ever thought that the shared_ptr is actually referencing some other controlling block elsewhere.  My understanding was therefore flawed and I'm happy to admit naive.

So what would happen here?  Well, the B constructor, actually copies the shared_ptr control block, it therefore does and can increment the reference counter to the shared_ptr.

As counter intuitive as the const is therefore.  We aren't actually saying the shared_ptr itself is constant, rather the reference to it is, we should be reading the parameter type as std::shared_ptr<A>const &  referenceToA.

I felt rather silly for not realising this earlier, not least as I did once write a C program to switch out the qualifiers on a function call to make things like this stand out in formatting my code!!

But it has slipped my mind! Okay! I'm old, shut up.

Here is the full code of what I put together to understand this: 

#include <memory>
#include <mutex>
#include <queue>
#include <string>
#include <cstdio>
struct A
{
A()
:
mIndex(GetNextIndex())
{
}
~A() = default;

const int mIndex;
private:
static int GetNextIndex()
{
static int index{ 0 };
return ++index;
}
};
struct B
{
public:
B(const std::shared_ptr<A>& parent)
: mParent(parent)
{
}
std::shared_ptr<A> mParent;
static std::unique_ptr<B> Create(std::shared_ptr<A>const &  referenceToA)
{
return std::make_unique<B>(referenceToA);
}
~B()
{
mParent.reset();
}
const int& GetParentIndex() const { return mParent->mIndex; }
};
int main()
{
std::shared_ptr<A> original{ std::make_shared<A>() };
printf("Original %i: %i\n", original->mIndex, original.use_count());
auto createdB{ B::Create(original) };
printf("Copy %i: %i\n", createdB->GetParentIndex(), createdB->mParent.use_count());
printf("Original %i: %i\n", original->mIndex, original.use_count());
}

However, I have to say, I still don't like this; clever as it is, there's a hidden copy going on, in the B constructor the copy of the shared_ptr control block and it's reference count incrementing from 1 to 2.

It does quite neatly move ownership of the pointer, but the const and the reference just make my brain spin.  So where this can only gain 10/10 plaudits for C++ smarts, it only gets a mere 3/10 on the maintainability ladder for me, and only when we have the const& together, when written as at the top of the page this drops to 1/10.

Performance is also a factor here, if we wanted better performance we would have to consider whom owns the original A here.  If no-one and it is always added into the shared member in B, well move it... Create once and move it, this code doesn't communicate that as an option, but it certainly could be.



Wednesday, 30 August 2023

tBs - My First Clan

Today I want to regale you with a story of my past gaming glory, before Eve... before WoW... Back in the days of 2002 I joined a clan.... Now, I've read Ready Player One over and over, I do not get this whole "I don't clan" ethos in that writing because back then being in a Clan was the thing.

Guilds and corps in my later gaming life are very different things, this clan was cut throat.  We were

{tBs}

The Butchers

This is where I met my long time co-killer Chaplain (wave, hi chap!) for we were together the scourge of Avalanche.


This is in the Half Life engine mod "Day of Defeat", and it didn't look this good (this is from the later Source version); all important in this game play was the tick rate of the server, most serious clans hosted their own servers and they tweaked them to the max.

I remember our server admin was a chap called Twister, but that's about all, he never much liked any input about the status of the server.  He didn't play very often, so it was always quite curious that us experienced players were not welcomed into giving him feed back; let me tell you as a now professional game developer and server administrator listen to your expert users, they will know when things are off, they may speculate, but they will know and help you spot issues up front they're a resource, use them, never dismiss them.


Anyway tBs were well known, playing on the European Enemy Down ladder we were very often top 10 in Europe, one time top three, playing on again off again matches against the other members of the ladder; we were effectively the second most active clan behind "Scotlands Finest Highlanders" or SFH.

At one time I myself organised our own "Butchers League" and for four weeks in the summer of 2003 I ran the website and helped organise five guest teams to play pre-arranged matches in a knock-out for the win.  SFH won.  Yes, SFH won the tBs League.  That was fine.

What wasn't fine was the reaction of another clan OAP or "Old Aged Players" they kicked off big time, they could not connect their players to the server; they didn't do any preparation up front and get really really angry, really for no reason, when they were disqualified from a match they simply could not raise five players to compete in.  They were offered a different match slot, but they even turned up to that with only four players and a bad attitude.

Within tBs ourselves there were a bunch of interesting characters, but lets talk more about the game.

Day of Defeat

I loved that game, or mod, my favourite map was Avalanche, a wholly unfair map for the allied side (and yes, I admit I enjoyed playing the German side more) but Chaplain and I were demons of the Church.

The Church, pictured above sat on the flank of the map, entered via the smashed bell tower at the top or the rubble strewn wall at the bottom, the actual doors were closed.  Inside you had two side by side, but slightly offset rooms on the ground, then rubble streaming up to a mezzanine level, with then either the option to climb a ladder to the exposed but dominating tower top, or to carry on up and through a wall to the tiled rooves beyond.

As an axis player you began from the top side, coming into the church via the tower.

As an allied player you began on the ground and were forced up through the rubble.

Defending that tunnel route was critical to holding the map, you controlled access to the opposite side for the allied players, you pinned them in their spawn.

Or you held the tower and dominated the center.

It was probably not well thought-out in design terms, but it was such a wonderful piece of level spacing I loved it.

My best memory came playing another clan, we as axis and they as allies.  For some ungodly reason they had a machine gunner run right up into my door way... and it was my door way, I had gone from spawn, swept over the roof into the church and down in sprint fashion time.  This guy thought he could take my church and lay MG fire on my team from my church tower?!  Nope.  A burst of MP40 and he was down, but do was his MG.

Now it was not often ever we took the MG to the church, it wasn't practical in the close-quarters environment SMG was the usual call to arms.  But this day I could not resist, I lay in the rubble pounding their own MG fire down on them.  Their only hope to remove me was to pre-cook a grenade and time it perfectly to explode in my face.  They did not do this; my score was astronomical with chaplain bringing me a reload of ammo and they throwing himself into fire to respawn and bring me yet more.

That was our church on Avalanche.

A few other maps floated our boat, but were were just so good at that map, specialist even that when we played on open public servers we were often accused of cheating, being so good someone is convinced you are cheating is just the ultimate thrill.  I've only managed it through good strong team work.

The other tBs characters though:

Weeman - constantly threatening to self-harm, a disturbed kid to say the least.
Hopper - Cheating chap, he blanked chaplain and I after botting in WoW (and obviously so) undermining any respect we had for this "skills".
Remus - an older guy, interesting fellow to talk to.
Twister - the hard put server admin, who didn't want to know really about our issues.
Dodi - a nice lad who came and went.
Mako - Not the shark he thought he was.
and of course "The Butcher" himself, Butcher being his surname... Always in charge, but never there.

I learned a lot from this, my first clan, I learned about team work, about trusting others and appointing them correctly and appropriately, all from a computer game, backed up with my martial experience in karate I believe I'm quite rounded in letting people both prove and earn their reward and garnering them with praise for a job well done; whilst also being even handed.

All experience for a computer game, and they call is a game; well, isn't life just one big game too?


Monday, 7 August 2023

Amber Valley Planning aren't very good

I think I've come to the conclusion Amber Valley Planning Department are either incompetents' or simply idiots.  Having had to interact with them myself and now in relation to a nearby development, they've demonstrated incompetance which can't easily be explained... Let me explain.

You see a development was proposed, ironically the owners only sought planning permission after the fact, fine whatever get on with it...

So the ground-works and building are complete?... Yes.

The official visited the site?... Yes, there was a woman with a clipboard.

Does the block plan represent the reality on the ground?... No, not even close.

Any school child with a ruler and pencil would be able to very quickly look at two reference points on the ground, extrapolate two lines then compare them to the building work which took place.  They don't match, not even close.

Further more the building work significantly changed the levels of the area in question.  This is not mentioned on the planning permission request at all.

And the newly raised area is several hundred tonnes being held back by concrete posts... No no structural engineering posts, we're talking 4 inch garden posts, with postcrete and concrete weather board.

In the July & August ran we've had they're already bowing ominously.

And I find these two points extremely curious, for you see we were the ire of this department having skimmed 2 inches of soil and spread road stone we had to account for a "Change of level"... yet someone else can dump several hundred weight and build up a new embankment to around 6 feel of altitude?

We presented drawing plans from overhead shots, real shots from Google Earth, showing the true scale and location; it being a photograph after all.  We had to go back and be exacting, that was the order "be exacting" in the block out diagram shown.... Yet someone else can be approximately six feet off level of reality in two axis?

When this goes over, and it is likely to, could it be a danger to life?  Yep.  Will the planning department comment?  Will they heck as like, they just tick their box and waltz off, it is almost criminal in this case.

Either the planning are incompetents', and I strongly suggest they explain their decision; oh but wait, one can not challenge them, only the applicant can appeal?!?
I must therefore air on the side of caution and suggest they're merely idiots, bureaucratic machination maniacs of the paid civil servant ilk just there to tick the boxes and dot the lowercase J's, since the service... Clearly the service is broken.

Want to know the major comment about the works carried out?  That they must ensure the hedge remain for at least 5 years.  This is a hedge in which (at least further up) I found bottles tangled in the roots with a date of 1914 on them, so this is already very much an older hedge... so a) 5 years makes no sense, b) you ignored they changed the level, c) the works do not match the plans provided - and I told you of this! and finally d) they're already subsiding, dangerously so!

Incompetence demonstrated, well done Amber Valley Planning Department, well done.


I am extremely glad my hard earned council tax money no-longer goes to them, indeed I've spoken to my local duty planner, they were highly available very interested in my requirements and helped me out immensely; Amber Valley, not so much.

Saturday, 5 August 2023

Wiley IT Manager Saving on Microsoft Licences

It is late 1998 and I observe one of the smartest PC acquisition steps ever; the company I work for is reequipping every one using a certain application to a new specification machine.  This means a major purchase and roll out for those of us in IT.

A little background first the company I work for has one customer, just one single customer, this may sound crazy but at the time it made perfect sense and the customer was a reassuring British stalwart of the high street the business was rock solid.  They were however also extremely protective of their brand and selling our whole product line exclusively they knew they could tell us how to do everything.

One of the key things they specified was a hard encryption model to their stock and control system software, we had to run the software they provided, we had to run is with "secure" physical dongles performing periodic security authorisation checks and we did all this on a specification of machine they laid down to us.

So it was in 1998 a new version of this software was hoving into view, the specification leapt from a mere 486 running 25hmz to a Pentium III running at or over 120mhz.  The RAM requirements went from 4MB and windows 3.11 for workgroups to the then brand new Windows 98.


So it was my boss (shout out to Dave) set about working out the best platform for this.

He had previously been in charge of the purchase of new server stack from Compaq and with a positive impression he turned to them.

With a little wrangling I believe he had a roll out of 30 machines, with three years support, for £890.  In terms today this is approximately £2000 a seat and was just for the machine a 17" monitor, keyboard, mouse and windows 98.  Nothing else.

Folks had to do other tasks on these machines, not just this customer software, therefore he set about buying Office.  Homogenising the previous smorgasbord array of different spreadsheet and word processing software variously in use.

Adding Office 97 SBE unfortunately pushed the machines up another £80 per seat, this included £19 off for bulk purchase, but it was a crazy price.

But then Dave taught me an extremely valuable lesson, to play the edge cases.

Could you get Office 97 for les than £80?  Yes, you could get it for £49.95 a seat.  But only if it was an upgrade.  Hmm, what could we count as an upgrade from?

Well, it turned out Office 97 could be an upgrade from MS Works 95.  At the time Works was my go to office package, I've never felt the ease and familiarity with office ever again since.  But works was canned by Microsoft; probably because of Wiley IT managers like Dave.

For a full new copy of Works would be had for just £12.95.

Doing a little mathematics, £12.95 + £49.95 is a mere £62.90.

The company was already duty bound to pay me as part of my regular services, so installing Works and installing Word over the top, taking hours to get through all the machine did result in quite a saving.  About £400 for the whole project; meaning Dave was well under budget and everything worked as intended.

It did however leave one literally huge problem; for the next working year our already tiny IT office was overrun with these dozens of double boxes of Works and Office upgrade, just in case Redmond came knocking asking about licenses.

Monday, 31 July 2023

Blog Security Updates

Blog Security Updates....

I have just enabled a forced HTTPS redirect on my blog, unbeknownst to me you could still get to it via an unsecured link!  Thanks google for not making that more obvious.

I've also changed the comment rules to require you to have a google account to comment.

Believe you me I do read every comment, I reply to quite a few.  But for the most part I spent time removing adverts, and I have had some bizarre adverts posted as comments.  However today I had the most in appropriate advert ever for illegal items, which I not only completely disagree with but found abhorrent could be posted anonymously.

So you now need to have a google account.

Thanks for sticking with me!