Showing posts with label Arguments. Show all posts
Showing posts with label Arguments. Show all posts

Wednesday, 26 July 2023

My Worst Development Argument Ever

I have had a really excellently interesting sprint with the work I'm currently doing, like you know one of those sprints where you get a real technical tooth into the pie of problems.

That however is neither an interesting story, nor one I can actually tell.

Instead I will fling my mind back a score of years and we'll discuss THE WORST DEVELOPMENT ARGUMENT I HAVE EVER HAD!

The problem started with the platform I was then working on, it was a quite low-powered single core Celeron PC base, running a favour of Windows for Embedded systems (I think it was Windows 2000 Embedded), but it was basically used as a host for a C# application stack which itself was more or less a wrapper around a C hardware driver talking to the various light, button and money handling mechanisms in the machine.


This system of ours then simply would process launch, at the shell level, another child process which was the actual game content.  And there were lots of different games we could fire up.

Our menu and the hardware polling all would back off, it was actually only polling for button and light IO and every second polling for cash changes from money physically being entered; so that was slow to update, but otherwise it was fine and backed off.

Being a Win32 environment it was fairly easy to back off most all the threading and just launch the child process.

Our testing showed that we had a 92/8% CPU split, the system would take on average 8% CPU whilst in this active child mode; it had a few spikes and it had a few troughs, that included windows itself.  Otherwise it was pretty much that most all the CPU was available to the child process.

It was therefore with some scepticism that we had the development manager in the content area wonder over complaining that one of his guys was having issues getting smooth frame rates from the platform.  We accepted the install and ran the child process, indeed we immediately saw the issue.

A popular UK TV show game, with a target circling the board...


The target would stagger and slew around, this was immediately explained to us that the system was so busy the game was being forced to drop frames, the frame rate icon the game had programmed into it went up and down like a pair of kangaroo's in the mating season.  This was the whole argument, our game drops frames your system takes too much time on the CPU.

It has to be pointed out that our manual actually said we only make 75% of the system time available to the game, our demonstrating we were making over 90% available was well within tolerance, and this is the only game showing this kind of issue.  We were therefore skeptical about the claims being made; especially about the high quality and tested nature of their content executable.

After an amount of head scratching we decided to measure how often the "Present" function was being called in DirectX, a little hackery later and we had a measure... Was Present being called consistently and then the system not presenting, or was the game itself changing the length of time a frame took, staggering when it presented?

Yes, the game itself was almost immediately measured to be staggering how often it called Present.  So the question came up "When you move these items are you interpolating between the position and so smoothing where the target is?  Or are you moving them a fixed distance each frame?"

"The frames are a fixed length"... The developer and their manager said.  We had just measured and shown that the frames were changing length, we couldn't look at their code, so we'd had to hack about but we'd shown their code was calling the present with the same staggering it was not a fixed frame rate as they said it should be.

We video recorded (literally with a camera on a tripod) measured the frames on the camera and calculated the stutter.  Then measured with our test harness when present was being called and saw a direct match, when they called present the present happened.  Our conclusion, the only conclusion really, was the content executable needed to be calling present more consistently; or their DirectX present be set up to sync with the screen or something.

The argument then began, they insisted that their game was presenting at a fixed interval, it was fixed to 30 FPS; they refused to turn on VSync, their platform did not allow this setting to be part of the DirectX initialise... It really should have been.  But we had explained the staggering, the delay in present being called, neither were o do with the system all appeared to be in their code.

"But the system is taking 100% CPU"

Yes at this point three member of my department all pulled this face:



It has to be said the manager in charge of this developer is perhaps the worst development manager I've ever met, a man so inept he alienated and lost developers at a prolific rate, who spent £40,000 on migrating to Perforce rather than paying his team and just using git.  Who seemed to think he could pick up modern development techniques by osmosis.

The developer himself?  Well, lets see how he handled all this evidence from the camera footage....


That's right, he lost his shit.

Despite myself, a coworker and our manager all confirming our observations that the hitching and stuttering were coming from the child process itself seeming to go idle and so it calling present at differing intervals he clearly took this to be a personal attack.  He stood in our development lab and basically tore into our system; our whole team took a verbal berating at this juniors gob and his manager relished it (this was one of the earliest examples I saw of this manager relishing in his minions going to town on others instead of his reeling them in).

Rocked by their insistence and being in the unhappy situation of having to prove our innocence our manager asked for us to be able to review their code.  They refused.  There were some issues, because our company had just conjoined with the place this developer worked with, they still saw us as interlopers.

My colleague was known to be somewhat more volatile than myself, so our manager left me on this horrible issue, trying to figure out what was wrong.

Come the Friday, and a little exacerbated after two days, I started to decompile their executable.  It appeared to me that their main loop was miss-behaving, it seemed to be just calling Sleep with a fixed value on top of the work it had carried out each loop.  And sleep takes a variable amount of time.... It was not taking a check of how long their update took and then sleeping for the difference to meet the frame rate target and then it dawned on me.... Did you spot it too?

They were calling SLEEP.

The Win32 API documentation literally says sleep is not a fixed interval, it relinquishes your thread for the remainder of your time slice up to or more than the sleep time given, returning when the windows scheduler next wishes to make your thread active.

It still says similar today, the time slept is not guaranteed.

This client process main function seemed to be calling sleep with a fixed value each pass, it was hardcoded into the executable.  If you sleep for X+Unknown, you are going to see exactly this staggering.  Our demo child application has a busy wait, it never slept, it yielded by passing a sleep of zero (which make it give up its time slice but remain ready, and it would more or less always be rescheduled before the fixed frame rate next time point, plus we interpolated our animation example).

This child process was just proving more and more to not be to specification.

Their manager insisted it was to spec... Which was very frustrating, as he grandly declared "I have read the code, I know it is correct" and "when we run it, we do not see this issue".

It felt like a fundamental miss-understanding, none of the folks on the team I was within were being treated with any respect, nor acknowledging our collective experience and understanding.

I stewed on this all Friday, come the Monday things were getting fractious.  This game had to be out!  It came up in the master development round up that this game was held up by our system.  This started the direct antagonism.

Everything I did, everything other members of the team did, all showed this content application was just staggering and stuttering on it's own volition, by design, by intent it staggered.  It was not our system!

To prove this I therefore set about writing a harness, which would just give the client process the same DLL to load, but they were all stubbed out calls, and it would run WITHOUT our system.  The content could be tested locally and checked.  We got one of the same Celeron PC's, just a flat install of the OS and double clicked my harness.... Sure enough the game staggered about in the exact same way!

I presented a A4 page example and showed how the loop in our example application worked, explaining that Sleep is not a fixed time interval and a busy loop should be used with a yield not a time span anyway.  I recorded this with my harness and their game, I presented both recordings too.

The developer went apoplectic....


He literally shouted at me that Sleep was guaranteed to come back after that amount of time, and when he ran my DLL shim locally it ran really smoothly.

He was right, it did, but he had a much different dual core machine with 4GB of RAM and a graphics card.  Our platform was a single core Celeron 1GB of RAM and built-in Intel graphics shared vram, in short very different.

At this point the director who sat between my manager and this development manager ordered that I be allowed to look at their code.

The worse development argument I have ever had then hit a peak, as I walked over, flanked by my manager and their manager.  I lent over his shoulder and pointed to the sleep function and said that is not going to be a fixed period.

That was all I said, he never let me explain any further, he just went MENTAL!  He started shouting, screaming, and called me a few choice names.  He would not accept all the evidence that his loop was not a fixed length, that it was changing from frame to frame, he just could not figure out that:

{
    UpdateStuff();
    Render();
    Sleep(33);
}

Was not going to always take a fixed amount of time, first of all I pointed out that doing anything and then sleeping like this will be the time the work takes plus at least 33, and then there was no guarantee that the sleep would immediately come back.  The windows scheduler would decide when you can come back after at minimum that amount of time rounded to the nearest platform tick.

His manager immediately backed him up and agreed with him, they both talked down to me.  They insisted loudly and angrily that sleep was fixed and the functions they have took such a trivial amount of time they were not worth measuring.... 

Even my manager backed me up here, of course doing a function call, any function, will take some amount of time and they need to take that into account.

I had just had these two idiots literally shouting at me, whilst I had to stay so calm, it took an icy handful of minutes for them to accept the argument that 33+N is > 33 where N is none zero.  It was just fundamental and they were not having it.

Their code became:

{
    startTime = Now();
    UpdateStuff();
    Render();
    endTime = Now();
    Sleep(33 - (endTime - startTime));
}

Slightly better, but we still saw hitches and stutters, they were far far less frequent now.

This massive drop in frequency I immediately and without changing my argument pointed me to the sleep, as I said the sleep is not a fixed time, it was not going to sleep for X and come immediately back, that's not how Windows worked.

Their argument was that Sleep was fixed, that it was guaranteed to return after X.

They were very loud, very obnoxious and very adamant.

We returned to the developers desk:  "Show me why you think Sleep is fixed".

I expected him to bring up some code, some harness, some proof of his thinking.  Instead he opened Internet Explorer, went to MSDN and showed me the Sleep function documentation.

Sure enough it said "fixed interval".  He was so smug.  So infuriatingly smug.  His manager was ultra smug too.

I reached down, scrolled the mouse and pointed to the screen.... 



He was reading Sleep in the Windows Mobile SDK.  He's right on Windows Mobile sleep is a fixed interval.  However, we're not on Windows Mobile are we.

My manager looked at the screen, I looked at the screen, they looked at the screen.  And immediately the developer called me a horrible name, yup, just straight up called me a name.

I have to admit I didn't react well, fisty-cuffs didn't happen, though the way he erupted out of his seat raging I expected the guy to swing for me.



He could not take it, his manager still argued he was right, so invested in their mistake were they that they could not admit their miss-understanding.  The manager always claiming he only hired the best minds, this guy being quite arrogant and the whole lot of them generally being very dismissive of both myself and the department to which I belonged.

I walked away with my head up high.  My manager stood and pair programmed with both their manager and their developer for maybe twenty minutes and a new version of the content executable quietly appeared without any stutter; even when we ran obrut!

It was a horrible moment in my time with that employer, I remember how the guy never apologised, that development manager never apologised and the game went out without any further delay, but they never received any censure for the episode.

Our department also never shook this kind of effect either, for some reason because their manager had gone to bat for them from the off every following time a performance issue arose we had to prove everything to the Nth degree without ever seeing the other side doing the same.  Very rarely was it ever truly our issue.

I have never forgotten, I have never forgiven.

When you foul up, just admit it, owning it and learning from it is far more wholesome than being uptight and obtuse.

Friday, 24 January 2014

No Rolf.... Sexual Court Case Equality

Its interesting they don't mention Rolf Harris....


Now, he's in court on some abhorrent charges, but in this country you are innocent until proven guilty, and guilty or not Rolf Harris was part of UK culture linking us to Australia for decades, one can't simply change the list of Aussies in the UK because one is in court...

This is a little like mentioning iconic German leaders and leaving Hitler out cus he was... well Hitler.

And I know mentioning Nazi's derails my point, it always will, but the case against Rolf Harris is still on going, his name is mud either until the end of time, if he goes down, or he's exonerated by being acquitted, either way we simply don't know at this moment... But the media stance, and the naming & shaming is interesting.

I don't believe that these court cases about kiddy fiddling and sexual charges against the likes of Harris, or DLT, or Bill Roache come up for no reason.  I think some are genuine, some are money grubbing and some are delusions seeking attention, but I think some of the cases where the accused are named & shamed before their day in court, like Michael LeVell, Jim Davidson & Fredie Star only for them to be found not guilty don't result in their names being restored.

Indeed I feel in the latter case where the accuser maybe found to be guilty of lying there should be a case against them and they should be named and shamed, its perhaps not as cut and dry as this, I personally have experience of a situation where two sisters were sexually assaulted from the ages of 3-5 to their early teens by their step-father and when it came to court the step-father was found not guilty, but you can see in those girls (well women now, they're both in their 30's and early 40's) the psychological shadow of the past and also the shadow that he got away with it.


I'm no legal expert, I do think I'm a bit of a common-sense expert, and so I think maybe total anonymity should be imposed, on the case, the persons and the press.  And breaking this before the conclusion of a case in court should be contempt of court.

Otherwise lives maybe ruined, both of real victims, to falsely accused defendants to real abusers and rapists.  (Of course the last case is fine, ruin them all, but the former two categories I think out weigh the latter in the current atmosphere of the press).

Wednesday, 31 July 2013

World of Tanks - Cockbites a Bound

I continue my current run of game play with a bit more world of tanks - I've got screenshots of my games and replays to record if anyone were interested - but you're not.

So, I'll jump to something which is publicly available and which I've already touched on, my play stats.

I am still sick and tired of people incorrectly using XVM mods with the stats enabled to cry havoc at people, last night was a good one, some twat kid in a Matilda whom has had an account since March and only unlocked two tier 5 tanks on the Russian line and up to the Matilda (according to my viewing his player profile - 23rd March he started playing - I unlocked my Crusader in under a weeks playing quite casually - so this guy must be shit) and I noticed this guy had no artillery unlocked, he's not played them... yet he quite happily sat there calling me a noob... "Shoot noob arty"... "shoot"... the fact that, a) they were not spotted - hence I had no idea where to aim b) had already shot and was reloading and the reload is SLOW on a Grille (without any crew skills or a gun rammer I was) and c) he has no fucking idea how they play himself... I was the noob... No "nico__30" you're the cock bite noob, and I told you so - this replay will go up soon.

But that evenings play was not a total bust I played the Grille last, just once before selling it - I have it elite'd but don't like how arty play now - and wanted a garage slot for my Comet - coming soon.



My run of wins ran through all three Brit tanks I played and out into my German line, and I had some real fun, getting my mastery badge on a couple and some massive results.

But then I thought I'd sort out my JagdPanzer IV streak, it was down around 46%, and I want all my tanks to be over 50% win rate.  So I started to play, and it was just dire, first match out I was dead in seconds, even with binoculars I didn't see the IS who ammo-racked me, and from his position I had no idea he could see me, maybe a forward scout spotting for him, maybe a cheater, whatever it was I just exploded... and the evening continued like that for me in my JadgPanzer IV.

40% win rate I pulled out of it in the end, and then I played the infamous Grille game mentioned above and thought - fuck it I'm going to bed.

but this was not before Mr Jingles passed 100,000 subscribers, he was at 100,004 when I looked earlier in the evening and was over 100,300 this morning, so good on him!

I'm not going to even attempt to run for his competitions, I don't get games like that, my games are mediocre and for my own laughs.

And I say that because though I'm there having a laugh, I seem to meet every cockbite going, I really do, nico__30 is just the latest in a long line of cockbites, and I hope that little shit chokes on the next dong he swallows... "hmmmm yes my headmaster"... slurp slurp slurp... cockbite!

Oh and I just noticed, I'm in the top 10 Crusader drivers on the EU server, I'm actually second, suck on that nico__30 you prick.


Monday, 30 April 2012

Laptop From Ebay - Maternal Strife

Aside from running all over the shop this weekend, I had a laptop zonked on me by my father, to have a look at sorting it out for him, this laptop cost £60 off of ebay, and it was as old as the hills... A single core (core 1) with 2gb of RAM and an ATI graphics card.... Its dirt slow.

Best thing I could do was not bother to open windows, in fact, I opened windows on it and noted six different pieces of user monitoring software running in the open; clearly the seller wanted to phish for personal information from this machine.

So, I wiped the machine with a blank copy of windows XP (its licensed OS) and low and behold I booted up and the malware was back...

So I got out my trusty Linux boot CD and fired up into a version of Linux Mint to take a look around.  Dead sneakily whomever had sold this laptop had a hidden partition on the hard drive, it was booting into that to restore whatever malware onto the disk on the main partition and then letting the OS Boot.  It did this with a custom copy of Grub, with the text turned black and a zero time out... Very very sneaky.

I cleaned this all off, installed Mint onto the machine and it was a decent little box, I could imagine a developer (who doesn't mind the slow clock speed) enjoying the machine, it has a very tall screen (over twice the height of the screen on which I now write this mail to you guys in fact)... Crispy tall screen, I was almost tempted to have the machine off of him for my Pascal efforts, but I resisted...

But what a palava... what a lot of work that laptop seller must have gone to in order to set up that machine as a honey trap.

The machine is now sorted, however, all this is immaterial, what really bugged me was how much I had to say "No you can't play games on this machine"... to my mother... She had this plan that they'd get me to fix this laptop up and she'd sell it onto a member of the family so they could "browse the net, do homework and play some games".

Well, they can do all those things on it, but not play the games I think they thought they were going to play... First of all, the machine was very very low spec... I tried to explain this to my mother... "My gaming machine has eight processor cores and £470 worth of graphics cards inside... this laptop is ten years old and cost £60, its not going to run games".... But she insisted it would do...

No, it won't....

Yes, it will.....

Now, I'm no expert on my mothers education, but since it ended in the early 70's I'm going to pretty much assure you all right now that it contains absolutely no IT or computer related knowledge.  In fact, apart from her typing a few letters on our Atari ST as kids, and her briefly using e-mail in the modern era, I don't remember my mother using computers all that much; she's an SMS expert but a computer numpty.

I however, have been gaming longer than I care to recall, have a degree in Software Engineering, am lucky enough to be a computer programmer for a living and I live and breath this industry as it is my life blood...  Yet, sat in my own room, on my own turf, she was willing to argue with me about this, to basically try to play off the "I'm your mother, I know best" card on a topic about which she knows nothing.

Now, some of you out there may know my Mum, so when I say "She ended up pulling a face like she thinks you can't see her" you'll know what I mean.  But, for the rest of you, she pulled a face like a turtle straining to take a shit and not blow itself out its own shell.

And, this made me very angry, not least because this is my area of expertise, don't put me down.  My brother and sister-in-law are hairdressers, would I argue with them about dandruff?... No... Would my mother?... No... So why does my Mother and pretty much every fucker who's ever typed an e-mail (and little else) on a PC think they can argue with me on the topic?...

I've blogged about this before, but not from direct close family, that was extended family; whom may not beware I did a degree in this stuff... And not aware I've ALWAYS - for thirteen years - worked in this industry; and not aware I live and breath this both mentally and physically.  My mother however should be more than well aware of my experience and bow to my judgement, not argue with me.

If I had cancer, and my son was a doctor, I'd defer to his knowledge and experience on the old diagnosis front.  So why can't people back down and accept someone might know more than them about the IT trade and the piece of shit laptop they just bought off of ebay?

Maybe they have to defend what they just bought?... Maybe they're embarrassed this heap of shit ain't going to play Crysis...?  Whatever the reason, they have to suck it down, because I'm getting right fucking tired of being back chatted to on the topic.

The other angst which came up was also related computers, you see, every weekend I had to do an online shop for my Nan.  Its not a big deal, but lately I've been getting back chat to about what I've ordered; I have only ordered what Nan asked for; but my Mother thinks she can talk to me like I'm a fucking idiot that forgot to order disinfectant... if the old gal don't ask, she don't get, if I just bought things there'd be hell to pay.  If the old gal has forgot to ask, fair enough, but don't talk to me like shit because of it.

But anyway, this old saga of doing this order has gone on for YEARS, I have hundreds - no shit - of receipts for all the orders I've done, and we have the pattern of what to order down easy, but this weekend I've had family visits, I've had to travel to Leeds, I've been pretty fucking busy - even before I mention my wife being extremely ill last night and this morning... Above that we have a weekend away planned soon, so in anticipation of problems I printed out a dead easy to follow cheat sheet for my Dad to follow to do the shop.

I gave him this, and said "we're going away, so you'll need to do the shop that weekend"... nothing more, nothing less... The action in the sheets involve typing in the web page, a username and a password and then basically using the mouse to click the list of favourites that site holds for my Nan... its about 21 key strokes total.... Remember this list of instructions has just been handed to a man you've witnessed is happily using ebay, is using paypal and whom plays computer games all the time...

And you should see the comedy text reply my mother has sent me... here's the first:

From Me:  "How's Dad got on with the shopping list?"
Reply:  "Do u mean the How 2do an online order?  If so he's lookf n gonna try.  Friday he helped me with a brief e-mail as i can no longer see letters n numbers.  It took 3hrs.  He's limited when using his fingers as he has 2keep them in creans n cover them with plastic dressings.  There4 it'l b hard using his fingers n hands as their so sore.  We've been 2nan, collected her order n explained the change.  She got very upset as she was happy with u.  Was really hard telling her."

Now, lets parse this over folks... My Dad has a hard time with cream on his fingers... yes he does... but he manages on ebay and paypal - activities which take more typing than this online shop for Nan... And comparing ebay, paypal or the online shop to typing an actual e-mail is just retarded... Not least because my Dad ain't the most literate bloke on the planet, indeed he only seems to know where the ASWD keys are because of playing shooters all the time... So, stupid comparison from a stupid woman as far as I can tell...

As for his fingers hurting him, I've counted 21 characters need to be typed to do this shop... all the rest is clicking pre-existing items on a list...

I might suggest he get one of these though, since he's on ebay, I'm sure he'll find one...


Next thing to parse out of this mail... She's been to Nan, a vulnerable, confused old woman and told her god knows what story about my not wanting to help any more... Scaring her, upsetting her... When... These instructions were only for a rainy day (and its rained this weekend) or for the weekend we go away (soon) and possibly for covering whilst we go on our delayed honeymoon... Never was it mentioned I'd not do it any more...

But my mother is an over dramatic theocratic obtuse pain in the rear end, so she's decided to make a drama out of this.

This has me incensed to actually stop doing the shop altogether, firstly because I consider my mothers actions ridiculous and I think my father should have shown some back bone and gone "whoowhooowhoaaa there, stop and think about this, these instructions are only to cover, or in case he gets hit by a bus"... instead... off they trot to rain on Nan's parade...

But also to receive these stupid messages as text... It incenses me to be angry, to "FIT RAGE QUIT" because they've been... well they've been fucking arseholes...

AND THEN....


To really annoy me, more lies are crawling out the wood work... I have the text saying they've just got the shopping list right... its timed 19:13...

I have an e-mail timed 20:32 saying the shop has been done... 

So it took about 1 hour 30 minutes to drive home from Nan's, settle in, get the machine on, digest my instructions and type in the whole shopping list... right... That's an hour and thirty minutes.... When I'm on the phone with Nan trying to get sense out of her, that's about the same amount of time I waste... Not doing bad is he, for a guy unable to use his hands...

But then... at 21:13... So, two hours after the first text... (TWO HOURS)..... I have this text arrive....

"Dad just done nan's shop - Took him 3hrs from list. x"

No, no it did not, it took him at most an hour and a half, and you took only two hours to reply... Where does she get three hours from?... I have irrefutable proof of 1 hour 30 minutes, assuming she sent the text about getting the shop in the car (which I admit I assume I do - but its the most likely scenario).

1. Go Nans & scare her, take written list.
2. Drive home - whilst driving send guilt riddled text to fuck with mind and set my resolve NOT to shop again.
3. Get home - fuck about - get on machine do shop
4. Confirmation of Shop being done arrives at my inbox.

My mother in unaware I had a live mail tell me about the confirmation, she has no idea that I know this discrepancy exists... But she's quite willing to lie to me about the time taken...

Its not the first lie she's been caught out with... There's a few others out there in the ether that she'd rather gloss over... But, I'm getting tired of this attitude from her.

Tired of this, I'm holier than thou, I know more, I am bending over backwards for you... She has this air...

I spoke to my wife about this earlier, my wife lived at home with her parents well into her 20's... I was gone out the family home at 19... to Uni... My younger brother left at 16 to live with his girlfriend... My parents have had years together as a couple to live their own lives before they were married and now long after, they've had more time living their own lives as a married couple doing their own thing, than having kids at home... But they go on like they've been tied down to us kids for ever... They've not...

They've travelled, they've been all over and have a rich social life... And if they (specifically my mother) wants to come to my home and argue with me about my specialist topic, and argue with me about life and then weave this web of guilt and bullshit about this whole shopping insignificance, to be frank I can do without visits from her, until she can buck her ideas up and stop arguing...

Other arguments with my Mother in the last 30 days:

> "You've never lived in St Anns"...
< "We lived on St Anns Wells Road for two years odd, and I lived on Abbortsford Drive, St Anns, for a year whilst at University"...
> "You never lived in St Anns"...

Even my Dad looked at her sideways on this one, because we've always said we lived in St Anns, its always been a fact and a simple, proud one...

> "You written your game yet?"
< "What?"
>"You were writing a game on the computer?"
< "You mean my project at work, the system software I was writing?... yes I checked it in last week after months of work".
> "But its a game?"
< "No, is a software system"
> "But you play games on the computer"
< "Not at work"

This was about my work... Nice to know my professional conduct is considered playing.