Aug
21

Porky's Norovirus: The Revenge 2017

It's been days since I last posted and I refuse to let this blog go the same way as all of the previous ones, so here's a post about pork. Yes, bloody pork.

There was supposed to be a post a couple of days ago as I was on the verge of making a new software release - an entirely new product, in fact. But I got mired in reworking one of the (user-)controls that it uses and then made changes to the Metro-style interface. The following day: I got Norovirus. Never heard of other countries getting it but I assume it goes under a different name; the UK gets it yearly, and I get it really, really bad.

I got Norovirus once back in 2001. I've never had it before, I never heard of it before (it didn't even have a name AFAICT), and the doctor didn't even seem to know what it was. Speaking of the doctor, a quick, cringey tale:

When he arrived on the house call and he saw me riddled with this Noro-thing, I repeatedly said to him that it's so bad that I frequently wished I was dead. While he tried to remain professional, I could tell he was mad and irritated.

The following day I found out his dad died that very same day.

It lasted for a week and was probably the worst thing I've ever been through (barring personal tragedies and the like, of course). It was a week, but it honestly felt like it lasted for multiple as in my mind time slowed down to such a degree that I was physically - literally - moving in slow motion. Bonus Fact: I got a PayPal charge-back during that week as I was unable to process an order someone made for my first-ever (PC) shareware app.

That was the first time that I ever got the Norovirus, and thankfully the last time I experienced the slowing effect.

It was hell. Possibly literal to some degree as my spastic-mind imprisoned me in my very own bullet-time nightmare. The day it ended, my mum made me fried-spam-in-toast sandwiches. I got a craving for them; guess that's what happens without food for a week.

When my niece and nephew appeared years later, the Norovirus became a regular feature of the year - sometimes even twice a year as they were getting it at different times. I may seemingly be partially-immune to getting the cold or flu (when I do get them, it lasts for around 10 minutes - a really un-fun 10 minutes), but Norovirus? It's my jam.

It always starts the same way and it always ends the same way.

I'll get a sore throat. I never get a sore throat for any other reason. Once that happens, I know the following six days are going to be horrible. The night of that day I get woken up to a pounding headache, dizziness, weak and sore joints and muscles, and a weird feeling like my head is continually expanding; a form of headache, I assume. The rest of the night I'll wake-up and fall asleep around 20-50 times, often within a minute or two between each "event". I'll actually sleep for an hour when it starts to get light, presumably because of how exhausted I am.

The following day I'm a shambling zombie; everything hurts and my brain is wrapped in cotton wool. The day is completely wasted... until I discovered something.

If I carry on through the day as though nothing is wrong, the symptoms of the Norovirus essentially disappear for that day.

I didn't do that this time and consequently I wasted the day on the settee somewhat watching TV. I haven't done that in a long time, and I kinda enjoyed it. I had to start watching stuff on the HTPC because live TV appears to just be full of boring, tedious shite.

The following day - today - I'm sat here writing this. I want to at least be somewhat productive. I'll try and release that new app, too. I've got two more projects to update and release, too, and a lot of website stuff to get done. In one of those rare times, I'm actually busy.

What? Oh - oh, right: pork.

I mentioned pork at the start of this post. Yes.

Over the last few days there's been reports in the British (British? I remember when we used to say English - when did that change?) press about imported pork being infected with Hepatitis E.

It's only today that I've finally been able to find out which supermarket may be responsible: Tesco.

I do most of my shopping at Tesco simply because the one near me is massive and I love their reduced section because I exclusively eat meat and dairy and the reduced bit has an abundance of those (from their deli) at half price.

Now it turns out their own-brand - assuming Tesco is Supermarket X - pork sausages and ham may have Hepatitis E. The ones that aren't labelled British; as in, imported from the EU.

I bring this up because the symptoms of Hep-E appears to be the same as Norovirus.

When I got Norovirus yesterday, something was different: I didn't get the initial sore throat the day before. I got plunged directly into the middle of the second day with the weakness and all of it.

Just before starting this post it appears this whole Hep-E thing happened 2014 - 2016, so maybe it's unrelated. Still, in all these years I've never once not had the sore throat signalling that the end-times are coming.

Aug
16

Spurious/Incorrect .NET Form.Activated() Event 2017

Notice: Using the "fix" below can result in the form's Activated event not being fired when it is restored from the taskbar. I guess this isn't a proper solution, after-all. Adding checks for the form being minimised/restored may be a solution but the Form class is firing those events are weird times, so.,,

Notice 2: I've added another version below.

A couple of new categories for this blog: Development and .NET. I'm surprised I haven't written more on programming in general, to be honest. I think I'll have to port across my post from an older blog on the whole BadImageException problem which drove me mad for far too long.

But, let's continue with the subject of this post: the Form.Activated() event incorrectly firing on a Form.

Quite a few years ago I created my own Metro-style form based on the idea of Microsoft's flat-style interface. Metro was approximately a couple of years away from release and there wasn't really any screenshots of what it would look like. I ploughed on with my version - including a break of a year because it took a long time to get it working correctly as working with forms that have their FormBorderStyle set to None in .NET is just outright annoying. This changed in WPF, but we're using WinForms here. #winforms4lyfe

The biggest issue was getting Windows to treat the borderless form as a true window; it just didn't give a crap about it. A quick way to tell if Windows regards a form as a true window is to minimise it to the taskbar. Does it immediately disappear from view? It's not a true window. Does it animate down into the taskbar? It's a true window.

There were two issues remaining (that I remember, anyway): restoring the window from its minimised state causes the window to gain an extra X number of pixels on its height. That's still an issue and seems random as to which form it affects. The fix I put in-place seems to work most of the time, but regardless, the child controls gain extra height with/without the form growing in size. Clearly more work to be done, there.

The second issue which I'm going to talk about here is the form's Activated() event firing when the form hasn't actually been activated. I don't know why this occurs, but it's annoying and obviously unexpected.

It seems somewhat random when it happens, but here's how it generally goes:

While the form is activated, deactivate the form by clicking outside of it and then move the mouse cursor over the form without clicking; chances are the form will receive the Activated() event. Despite this event firing, the form isn't actually activated.

This causes a problem in my particular case because I handle and expose the activation event via a WindowActivityChanged() event, and I also change the form's visual style depending on its active state.

For example, here's a (currently work-in-progress) form that's active:

Active Form

And here's that same form when it has become inactive:

Inactive Form

As you can see, having the form become active when it actually isn't is confusing to the user. And extremely irritating to me.

My first quick go at fixing this seems to work; I'll have to keep testing it over the long term but it seems like it may have solved it. Not a fan that I have to do this in the first place, but what can ya do?

Have this at the first line(s) within the Form_Activated() event [VB]:

' Filter out any spurious activations.
If Not ActiveForm Is Me Then Exit Sub

Here's another version (see notice at top of this post):

If Me.RectangleToScreen(Me.DisplayRectangle).Contains(Cursor.Position) AndAlso Not ActiveForm Is Me Then Exit Sub

ActiveForm is a Read-Only property on the base Form class and contains a reference to the form that is currently active (within our application; it's not system-wide or anything!), so we're checking to see if the active form is actually me (or this in C#) rather than just blindly accepting the fact.

It appears ActiveForm is set before Form_Activated() is fired, so it does what we want.

I'm not sure if it's worth putting a check into the Form_Deactivated() event to ensure that the form is truly deactivated, but I don't recall ever running into that particular problem. I guess time will tell.

Aug
14

Server Going Offline 2017

Well, I'm not surprised in all honesty.

The server this and my other sites are hosted on has started to go offline for 10 - 240 minutes per day, at (seemingly?) random times.

About 15 years ago (christ, really!?) UK2 moved me from my original server when I upgraded my hosting and since then it's been going to shit. I - finally - got them to move me about within the last year to another server after constant down times, except within the last week it's all gone to shit again.

The difference is that before this server change, the sites were going offline for (typically) a few minutes a time numerous times per day around two days out of the week, but on this new server the sites are going offline for extended periods of time once or twice a day every other day.

Compared to other hosting providers, UK2 isn't actually that cheap; I haven't switched providers because there's two decades worth of infrastructure I've built-up with UK2 that I really can't be arsed sorting out.

Aug
12

No, I Haven't Binned This Off 2017

Still here.

I haven't posted in a couple of days because I didn't have anything to write about. While I begin working on a new program yesterday and got a bulk of it done today, I'm not going to write anything on it until it's near being released. It's more of a "tool" than a fully-feature application, but it's still useful for those wanting, er, it.

Aug
09

In the works: Voting 2017

A new feature is coming and that is...

Voting!

Each post will have a thumbs up and down buttons. This'll allow posts to be voted on and will give me an idea of the types of posts to make more of in future - or fewer of.

It would've gone live today but I'm having a bit of a pisser of a time when it comes to actually displaying the voting results to myself. For some reason, a value of 1 is being returned for each and every post, regardless of the number of actual votes cast. Although I did receive a value of 2 at some point but that was lost when I re-seeded the database.

I can only imagine it is something to do with the count being returned for each actual post rather than the number of votes made for the posts. This reminds me, I'm going to need to do more than just return a number as I'd rather have the sum of the positive and negative posts and display that; displaying positive and negative posts separately is just a waste of space, I think.

Once this is fixed, then I'll upload the changes.

Aug
07

Formatting Fix for Mobiles 2017

I was just about to go to bed and then thought it would be a great idea to jump right into PHP and sort out the mobile-issue with the quote above. D'oh.

Alright, the blue quote at the top of this page seems to be a bit too long for mobile browsers and overflows out of its header bar. The solution? Don't show it on mobile browsers - sorted!

Did a quick search to see if I could just detect mobile within the User-Agent and sort it that way. Instead, I found some library that kept getting referenced and decided to just go ahead and make use of it: the Agent library, with Laravel support - hurrah.

This somewhat goes against my own lightweight way of doing things, but presumably it's not quite as easy as detecting a mobile sub-string as otherwise why would there be a dedicated library for it? In fact, don't answer that.

Integrated it and all that and then the site stopped working due to an exception. Deleted the vendors folder from the server - which took minutes - and then re-uploaded my local version as no doubt something was missing. A few minutes later - it all works. Phew. Oh; as a bonus, a load of libraries also got updated with a quick composer update, so that's nice.

A quick addition of

if (!Agent::isMobile()) {

along with a change to remove the appropriate <span> and such, and it was all done.

Does it work? No idea. Haven't actually tried it on a mobile device yet (although inversing the logic works so I'm hopeful it's all fiiine) as my phone is elsewhere in the house. But, there are no errors and so worst case is that it makes no difference.

Aug
06

Documentation - is it worth it? 2017

It feels like I should be writing another post as it's been a few days. While that's technically true, there's been posts every day now but they were actually written earlier in the week and published once per day with the new timed publish update.

So I'll write a quick post about documentation. Specifically, the FileSieve documentation.

I haven't done any programming for the past couple of days and so thought I should at least do something, and that something was some FileSieve docs. I remembered a thing: a couple of days ago I looked at the Analytics for the FS documentation and it appears hardly anyone even looks at it.

So, really; am I just wasting my time with it? Honestly... yes, I think I am. I started reworking the single Automation page into an entire section before this realisation and now I'm starting to wonder if there's any point? Unlike a lot of the rest of the application, automation requires documentation.

Maybe I should just shove out the required info (and not bother polishing it all up) and be done with it and spend any other FileSieve time on the application itself.

Aug
05

Timed Publishing? In! 2017

Woke up yesterday morning and had a thought while I was on my way to the bathroom: timed publishing doesn't need to be Cron-based. Just set a date on the post and display that post if the current date/time is past it.

It seems I got somewhat fixated on the whole Cron job method of allowing posts to go live based on a set date and time that the obvious non-scheduled way of doing things just passed me by.

I spent yesterday getting the feature in and made it live. Posts are now displayed based in their (newly added) published_at column rather than created_at. Of course I had huge amounts of fun with timezones. sigh

I gave the site a quick test on mobile after someone mentioned it doesn't work. Seems it's just a minor formatting issue, at least on Android Chrome, involving the quote in the header at the top of the page. I'll probably just not display it on mobile browsers; presumably there's a mobile substring in the User-Agent header.

Didn't quite get around to sorting out the categories display (click on a category at the top of this post) and so viewing a category right now doesn't work quite how you'd expect. I probably should've gone with keywords rather than rigid main and sub categories.

Finally, I added a set of badges to posts so I can see at-a-glance if any specific flags are set rather than having to rely on remembering what their background colours denote.

Post Flags

Aug
04

FileSieve Documentation 2017

I seem to be on a major productivity roll lately. I realised why, too: this new Corsair K95 RGB Platinum keyboard (US version can be seen here). It might seem like I'm babbling on about mechanical keyboards like a zealot, but I had to plug in my previous rubber-domed Logitech G19 keyboard recently and holy crap. The holiest of holy craps.

Rubber-domed keyboards are genuinely 'orrible to type on!

Since I got this new keyboard (a week or two, now?), I just can't stop typing on it. I'm having to come up with excuses to work on something just so I can use it.

The upshot of this is that my productivity is going a bit insane. Even these posts you're reading are starting to be written days in advance - that's how much I'm writing now.

In fact, I've decided to add a whole new Automation section to the FileSieve documentation!

I don't even want to imagine how much output has been gimped while having to use that previous rubber-johnny keyboard. Ugh.

Aug
03

VB Runtimes Pack, release 8 2017

Speaking of unexpected happenings, I got contacted a couple of days ago by someone asking me if the Visual Basic 6 Runtimes Pack was free for enterprise use (spoiler: it is).

The pack doesn't require me having to recompile anything using the Visual Basic 6 IDE, as I haven't had that thing installed in well over a decade, so I thought I'd repackage it in an updated installer.

Running the original VB Pack installer itself shows that it was littered with errors. Not errors in the files it was installing (well, maybe a couple - but more on that later), but in the instructions and license.

As with all of my software installers, there are three text documents the installer shows to the user.

There's the License that is shown at the very start which contains the licensing terms that must be agreed to before the installer will do its thing.

Second is the Before, which contains general information. In this case, it outlines what the pack is and what it'll install. Also included is the pack version and its release date, just like the other two docs.

Thirdly, and lastly, is the After. This is just a quick message letting the user know that everything is installed.

The problems are down to the site each document points to: they're wrong. As this pack was originally released way back in 2002, the URLs are pointing to my old site www.tnk-bootblock.co.uk as opposed to here.

Another problem is the release date. Each of the three documents mentioned above have entirely different dates! No idea how that happened.

Oh, the file errors that I alluded to above. There was a note in the Before text saying that any .dll registration errors that occur can safely be ignored. While setting other properties within the installer, I noticed there was a flag for ignoring any errors that are thrown during the regsvr process. Now that flag is enabled so the errors are no longer shown, if they indeed occur at all this time around.

As well as general quality control, I wanted to get this site properly advertised in there as there is a huge amount of downloads of that pack. It seems people and companies just tell their customers to download the installer from my site. I might as well get a little bit of advertisement from it as it's not exactly like I'm gaining anything.