Baby ProTip #4713

Little baby gotta take medicine? Aww, poor thing 🙁 Odds are you’ll be given a syringe which, whilst it works, is a bit of a pain to work with when it comes to delivering the liquid to the child.

Instead, measure out the dosage using the syringe then squirt it into an upsidedown clean bottle teat for the baby to drink from! No need to attach the bottle, just carry the teat over – careful to not spill any – and let the baby suck it from there. Make sure it’s a low flow teat, or it’ll come out on it’s own as you take it to your baby.

Hacktoberfest

I finally have a Github.com account.

I’ve been learning Git at work via an internal Gitlab installation for my Powershell/PHP scripts and it’s going quite well!

I have been told about Hacktoberfest – A few people I know have signed up and I thought “hey, why not give it a go?” It’s a perfect excuse to start contributing to projects I make use of, though I’m no coder I can probably do some documentation work, and maybe some basic Powershell stuff too if I’m feeling brave.

Eventually I’d like to put some personal projects on there, give back to the world a little bit, but for now I’ll just be logging issues or fixing small easy problems in other peoples repos 😀

You never know, I might get a T-shirt!

SIMS(.Net) is slow

I should preface this technical post by saying that I am in no way a database dude. I understand what they are and how they work at a basic level and sure, I’ve written some basic SQL queries in PHP or queried some stuff in MSSQL but as a typical “jack-of-all-trades” type I am no expert by any stretch of the imagination.

This is also relevant for any database, not just SIMS.Net.

What is SIMS?

Slow.

For those of you who don’t know, SIMS(.Net) is a Capita application used by a whole bunch of schools to record data about their staff, students and their parents. It’s a school MIS.

It’s quite renown as being very slow. There are many posts on the edugeek.net forum complaining about this, and there are many suggested ways of fixing it. Okay, that’s not entirely true. Lots of these fixes may grant you a slight boost, but the backend of SIMS was written a very long time ago (decades) and at the end of the day it’s just a slow bit of software. That said, there are some things that can be done to help, and this post outlines one of them.

The Database File

SIMS is a Windows client-server application. The server side runs from a single database, though there are some additional features which have their own databases.

Typically, the schools IT department will not install the SIMS server. It’s quite finicky and likes things set up in a very particular way, and is often handled by a third party organisation.

The client application uses a shared network drive for some data storage. Typically, at least in every school I have seen, this is set up on the same drive on the server as the database is stored in. This is generally bad practise when it comes to databases – you should put your database file on a disk/drive that has nothing else on it. No OS, no file storage, no nuthin’!

There are a couple of reasons for this. The most obvious is that if a file on that same disk is being written to or read from, the database isn’t being used. Your application must wait its turn before the database can be queried. Schools don’t really care about this as the slowdown is not noticeable by end users given the volume of non database data being read or written, but on systems where every mili- or microsecond counts this can be a big bottleneck depending on the frequency of use the other files on the disk see.

The second reason is related to the first, and it has to do with how the database file itself is initially set up. You can define the size of a database when you create it. You should really set it to be bigger than the expected end size of the database when it’s time to migrate it to a new system or replace it. Typically, if you know that in 3 years you’re going to migrate away from the system and it will have approx 10GB of data in the database, you will probably want to add 20-50% extra on top of this when you first set up the database to allow the data to grow into the file. So you go make a 15GB database and can sit happy knowing that you’ll likely never touch the sides.

You can set the database up to dynamically grow once you’ve filled it up, too. This is called “Autogrowth”. You start with a, say, 20MB database, but this quickly fills up. MSSQL is configured to allow this to grow, so increases the file size of the database in chunks. These chunks can be consistently sized (add 1MB each time) or a percentage of the current size (eg: grow by 10% current filesize. 100MB database grows into a 110MB database, which then grows into a 122MB database, and so on)

The default growth size for a database file to grow by is 1MB. This means that if you have a heavily used database with loads of data going in often, MSSQL will need to constantly grow the database by 1MB each time. This is obviously going to add some overhead to operations, however there’s another side effect to this when you have other files being used on the same drive as the database.

If you have a 50MB database, then write some files to the drive, then add more data to the database such that the database needs to increase in size, youre going to end up with 50MB of database data on the disk in a chunk, a bunch of files next to it, then next to that another chunk of database file data. You see a single 51MB file, but at a disk level there’s one 50MB chunk, random file data, then another 1MB chunk. This is called fragmentation, and it means that for the hard drive to pull data out of the database it needs to move a little needle (if you’re using old spinning disks, like us. What about SSDs? Glad you asked.) a greater distance and more often to get at the data you want. This slows things down.

What the Frag!?

Where I work, I recently found that the database had been set up with unlimited growth in 1MB increments. We went from a near-zero sized database at initialisation to what is currently a 26GB file. Each time we added data that pushed the database file to full, MSSQL would only ever add 1MB to the size of the file.

This, combined with the use of a network drive which has been configured on the same disk, has given us a horribly fragmented database!

There’s a SysInternals tool called contig.exe which allows you to query an individual file or filesystem and show you how fragmented it is.

Following this guide I queried the database to see how fragmented it was. Keep in mind, here, that the author of that guide made a 3.5GB test database and purposefully fragemented it 2000 times to show a “heavily fragmented” example.

Here are the results from my test.

PS C:\temp\contig> .\Contig.exe -a "E:\MS SQL SERVER 2012\MSSQL11.SIMS2012\MSSQL\DATA\SIMS.mdf"

Contig v1.8 - Contig
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals

E:\MS SQL SERVER 2012\MSSQL11.SIMS2012\MSSQL\DATA\SIMS.mdf is in 102951 fragments

Summary:
     Number of files processed:      1
     Number unsuccessfully procesed: 0
     Average fragmentation       : 102951 frags/file

Yeah. 102951 fragments for a single file. That’s insane. Every time the database is queried it likely needs to navigate around the disks dozens of times to get all the relevant data, slowing things down considerably.

Fixing Fragmentation

We can use the contig.exe tool to fix this. It requires that the database is offline so I’ve had to wait until this weekend to do this.

I took the database offline (via the MSSQL Server Management Studio GUI) and attempted to defrag the database file.

PS E:\MS SQL SERVER 2012\MSSQL11.SIMS2012\MSSQL\DATA> C:\temp\contig\Contig.exe .\SIMS.mdf

Contig v1.8 - Contig
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals


Summary:
     Number of files processed:      1
     Number of files defragmented:   1
     Number unsuccessfully procesed: 0
     Average fragmentation before: 102951 frags/file
     Average fragmentation after : 3 frags/file

After waiting anxiously for 40 minutes the results of the operation came through. We went from a database split into 102951 fragments to a database split into just 3.

I revived the database by bringing it back online, verified it was working, then carried on with my weekend. All in all, it only took me about an hour and a half on a Saturday to sort this out.

Results

Before I did the work over the weekend I took some rudimentary speed tests of the SIMS application to determine if the change actually had any effect.

I perfomed two tests three times. They wouldn’t stand up in a court of law but they’re good enough for my purposes.

I timed how long it would take to log in – hitting ‘Enter’ on the username/password window to getting the logged in GUI loaded – and I also ran a report on our on-role students containing their forename, surname, year & registration group code. A simple report.

Both of these tests were performed at approx 11am on a weekday. Nothing else was going on at the time (no large reports) but SIMS was actively being used by a few dozen staff. The results are in seconds.

Before defrag – Friday

Logging In

Report

  • 16.7S
  • 7.1
  • 9.9
  • 18.6
  • 15.7
  • 18.7

After defrag – Monday

Logging in

  • 10.6
  • 5.7
  • 5.8

Report

  • 14.1
  • 11.9
  • 14.3

As you can see, after the defrag has likely (assuming no unknown other reason for the slow results initially) shaved off a number of seconds from each run. The first login of the day is always the slowest as some stuff gets cached on your machine, but even that was sped up (by over 6 seconds!)

Overall, whilst not conclusive nor scientifically sound, I am happy with this approximate 30% speed boost and have begun looking into our other databases to see if they’re suffering from the same fragmentation.

I would advise you take a look at your SIMS database, too. Hell, any database you have. If you’re a database guru you likely know about this already and laugh at my realisation but it was genuinely surprising news to me, though obvious in hindsight. I know about file fragmentation, I just didn’t think about it in the context of automatic database growth.

Being able to say “I’ve increased the speed of one of our most critical applications by between 24-40%” sure feels good. Though it should have never been set up this way in the first place…

Behind the Times? Git Gud

I’ve recently decided to learn Git.

Yes yes I know, I’m over a decade late to the party. I haven’t taken a look at source control since I first played with SVN many (many) moons ago. I haven’t bothered for a few reasons. Mainly, I’ve not had a use for it. Though I have written some scripts for work and whatnot, I’ve not needed the collaborative advantages of using the tool, and neither have I really needed the version control side either.

Don’t get me wrong, it probably would have been useful, however I’ve not missed it or wanted the features it boasts until recently.

However, times are a-changin’. Some of the techs at work have started using my scripts over the last year and they’re beginning to identify issues or quirks which I would ignore or didn’t encounter. I wrote these scripts, so I know how to use them almost instinctively. These issues just don’t show their head for me, or when they do it’s sort-of by design and I don’t hesitate to work around it.

Since I’m now making small changes sporadically, and looking ahead I’m beginning to automate even more things now that I have a slither of free time occasionally, I’ve decided to jump head first into Git.

I’ve built an Ubuntu 18.04 VM at work and installed GitLab onto it. (Slight tangent, but their installation guides are very good.)

The Continuous Integration and Continuous Delivery stuff fascinates me, but I’ve disabled them from running on each project by default as I need to focus on learning Git first. I’m eager to learn more about this, though.

I’m going to make you cringe, but I’ve opted to use a GUI front end for my machine instead of relying on the CLI. This is because it seems to be a bit of a pain in the ass to run CLI git on a Windows machine (we’re a Windows network) and, although I will learn the commands eventually, I want to focus on the best practises of using Git rather than mess about with the command line syntax. The syntax is very simple, but I don’t trust my brain to remember it right now.

I’ve chosen to use the GitHub GUI for now. It works pretty well. I’ve moved six of my currently active scripts (all powershell) onto GitLab and have pushed commits to the projects.

I’ve also created a project for our network switch configs. I don’t know if this is something GitLab can do or if some other kind of automatic deployment technology is needed, but it’d be cool to make a change to the repository and for that change to be automagically applied to the relevant hardware. I can think of ways to script that myself, but is there a purpose built tool out there?

I’ve got lots of questions to ask and lots of avenues to explore. For now, though, I’m keeping it simple with version control & branching.

I’m considering eventually creating a public GitHub repo to put code out into the world. It would take some work to de-work-ify the existing scripts and remove any workplace data, but I could also eventually upload these scripts, too.

Boiler High Heat

We had a bit of a warm spell recently. One side effect for us was that some of our sites boiler control systems started to panic in an unexpected way.

Each boiler is fitted with a fire alarm which links into the site-wide system. Unfortunately it got so hot in a couple of the storage-heater boiler rooms that the temperature sensor started flipping out thinking there were flames causing the heat. Luckily, we caught the alarm within the 3 minute silent alarm before emergency services were automatically contacted and the site-wide alarm sounded, prompting an evacuation.

Overriding a firealarm long term is not a good idea, so we had to find a way to reduce the temperature in these small, cramped, dusty rooms.

Our solution was simple, but I liked it a lot – turn off the heating element, then run around the building turning on all the hot water taps.

This refilled the hot water storage tanks with cold water. The taps being on carried all the heat away from the room and within minutes the room had cooled significantly. It is a bit of a waste of water, which is a shame, and there was no hot water in the building for the afternoon, but that beats evacuating out from our cool offices into the high-thirty-C outdoors.

The simple fixes are the best.

Witholding number on external calls on Avaya IP Office R5 Manager

It took some googling to figure out, but eventually I came across the answer to this problem across a combination of a couple of old forum posts. I’m writing it here on the off chance someone else needs this. Or if I need it again.

  • Log into the IP Office R5 Manager
  • Navigate to the Short Code tree
  • Find the “?” entry – the feature name is “Dial”
  • Change the “Telephone Number” field to one of the following depending on what you want
    • “.” – this will withold the number you’re dialing from
    • “.S<number>” – this will show <number> when you dial

<number> should be your number. If I set it to a number I don’t own, it just shows the one I’m calling from.


Sometimes a business has some system or piece of infrastructure that just works. This is a good thing! Unfortunately, some businesses don’t like to invest in technology unless that technology breaks.

In related news, I recently had to figure out how to toggle a setting on some old software, Avaya IP Office R5. As someone who is totally not a phone/VOIP person this was a challenge. Add on to that the fact that the software isn’t very well designed and you have me fumbling about trying to understand terminology and remember where obscure settings are just to do the basics.

This software was managing a 15 year old phone system, and since its inception had been showing as a withheld/private number when calling out to external phones. Not sure why this was ever set, but it’s off now.

Offspring

We had a kid! Spawned a child process!

Having a child is a very strange experience. Being the father I have it pretty easy physically, though mentally and emotionally it’s quite… unique. It’ll take a while to fully digest this mental gear-change and I don’t think I could write about it accurately enough to do it justice, so I won’t attempt to just yet.

Like with most things, theory only gets you so far. You need to experience it to fully appreciate it, and appreciate it I now do.

I expect every birth is different at some level, whether it’s the process itself or the attitudes and reactions of the individuals involved (including family, friends, as well as – and in some ways most importantly – the medical staff, more on this below) but there’s one thing which I suspect is consistent across all births.

Shit me is it tiring.

He was born at the end of May, and I’ve only had the energy to post one small update here since then. In fact, this article has been written in short bursts since the previous one went up because it has been tricky to find the energy to post here whilst we’ve been home (apologies if it reads somewhat awkwardly.) There’s always something to be done, not including the remaining renovation work we still need to do. Being in hospital though? That is an entirely different beast.

We ended up being in the hospital ward for nearly a week. I was lucky enough to be able to escape once or twice a day (to feed the cat, or take receipt of our poorly timed new sofa delivery) but my Significant Other spent every minute inside a single small room. That look on recently rescued miners faces when they see daylight for the first time in months? I bet it was a bit like that for her when we finally left.

What didn’t help our stress levels was the two occurences of building work that went on in that week at the hospital. One was right outside our window, the view from which was simply of a different wing of the hospital across a 20m gap between the buildings, so not exactly a picturesque vista. We had to keep this window open too as it was at least 34C in that room at best. They were running cable or something, and heavy tools were out in use for two days.

The heat in the ward was almost unbearable. I know they keep it warm in there (to keep the little babies nice and snug!) but this was over the top.

It turned out the aircon was broken. This was the cause of the second set of building work. About a dozen intimidating big burly blokes climbing ladders in hallways and going into the suspended ceiling with drills and hammers taking apart metal ducting (loudly) to try and get the ward down to a decent temperature. Having all these workmen patrolling and working, covering everything in ceiling tile dust, couldn’t have been a calming factor for any of the women or babies in there. I felt bad for those unlucky enough to be in a shared room, though (typically) those women get to leave after a day or so at most.

After three days of this chaos they did get everything up and running. Unfortunately this was achieved the evening before we left, so we didn’t really get to appreciate it.

I hinted above that the medical staff’s reaction and behaviour to you is an important element in your perception of the experience. Special and unfortunate mention here for them: they, generally, sucked.

The saying “There are always some bad eggs” is an understatement of such proportions that it gets flipped on its head. We were pleasantly surprised when we spoke with someone who seemed to give a fuck, let alone show compassion. I have a great deal of respect for NHS staff and don’t blame them for being jaded or stressed. They are underappreciated, overworked and many roles are underpaid. But those who show this disinterest would probably do everyone a favour if they moved on to something else. It might kick the government up the ass a bit if everyone on the NHS staff started looking after themselves instead of taking the amount of shit they deal with daily on the chin. Unfortunately, the sick and injured will suffer. Rock, meet hard place.

I know it’s not as simple as that and voting for change is the best way forward. The ward we were on is fairly renown for being not that great once everything goes off-script (as the birth of our child tore up the script then set fire to it, this applies to us) but it’s difficult to fondly remember any part of the birth or the following week. And this sucks.

We’ve got a healthy baby now, though, and that’s awesome. But it doesn’t make the experience okay. There will forever be a bad taste in our mouths when we remember this in the coming years, but for the sake of our sanity, our happiness, and the small human being we now find ourselves responsible for, we have to move on as best as we can.

I expect that as time moves on and he grows (oh, that reminds me: they told us the wrong weight at birth. I don’t know how they got that wrong) I will find myself with more time for this site, and I will no doubt have more thoughts on fatherhood and being a parent in general. I’ve also got renewed focus on some technology stuff now that the home renovation isn’t exhausting us to quite the same level. I’m eager to write up some stuff on that front, too!

Onwards and upwards!

ps. Star Trek Picard looks amazing.

Hello, world!

Hi there.

Interloper

Hey. Been a while!

Spotted enemy number 1 the other day. The cat got into a fight a few months ago and we have finally identified the attacker.

We spotted this cat teetering on the edge of attacking our cat in our back garden a little while ago, but it was dark and we couldn’t clearly make him (or her) out. As soon as it saw us it ran (ineffectively being chased by our own cat – thanks for the assist but you wouldn’t have done anything if we hadn’t been there I bet!)

We’ve finally spotted him/her peering into our property in the daytime:

Evil incarnate

Didn’t manage to get any closer than this before the cat bolted.

I hope this cat and our own can become pals, but I expect it won’t happen. Our cat is too much of a pushover. Poor boy 😀

Catfight

So the cat got into a fight a couple of nights ago. We were merrily being couch potatos of an evening (as you do) when the cat appeared from the back garden. He sat in the doorway of the room we are temporarily using as our living room, looked at us for a moment with that expression of pity all cats are capable of, and started licking himself.

Nothing new there.

He didn’t stop, though. At some point we got up to check and noticed a trail of blood terminating at the cat and leading back to the bedroom. After checking him over (three claws have been damaged, one of which had been bleeding but had stopped by the time we realised something was up) we followed the drips of blood (splattered over our brand new floor, I must add) and it led us to the window the cat had clearly jumped in. There wasn’t anything alive (or dead, though looking for the corpse of something our cat had a fight with is giving the cat a bit too much credit) outside so we’ve no idea if this was the cat being a clutz or the cat being attacked, but our money is on the latter.

After a day the claw on his front paw hadn’t properly healed. He kept licking it, too, so suspecting infection we rushed him off to the vet. They confirmed our suspicions and gave him a shot and a cone of shame.

Poor boy

Since getting the cone he has become exceedingly affectionate. It’s kinda nice, maybe we should keep it on him all the time… just kidding, of course. His front paw is healing up nicely, though he has figured out that he can stretch his leg out, wrap it around the base of the cone, then push forward onto the floor or bed (yes, with his face) trapping his paw under the cone allowing him to lick part of it. He doesn’t do it often, though.