Jacek Kuzemczak

How to Cancel an Ongoing VHD Coalesce in XCP-NG

Sometimes a VM will be writing to its disk faster than the VHD file can be merged with its parent. If that happens it can affect performance of other VMs on the host. If this goes on for too long it might be best to stop the operation until a time where it can be left alone long enough to finish.

To cancel a coalesce use this script.

/opt/xensource/sm/cleanup.py --uuid <sr-uuid> --abort

You can also set a flag to stop the server trying again

xe sr-param-set uuid=<sr-uuid> other-config:leaf-coalesce=false

Now you’ll be able to migrate the VDI and it won’t try to merge the VHD files first.

Readonly Properties In PHP 8.1

Readonly properties are being added to PHP 8.1. Lets take a quick look at why that’s so great!

(more…)

Raw packet logging with iptables and Wireshark

I’ve been doing a lot of work with Asterisk and SIP recently and have found that viewing the raw SIP packets in Wireshark is an incredibly useful tool when debugging. The logs that Asterisk and various phones provide tend to give fairly cryptic error messages that don’t really resemble the issue, plus some problems are caused by a packet not arriving at all due to the other end sending an incorrect media address etc.

(more…)

Inline styling via classes is just as bad

Something that has really started to bug me about frontend development recently is how it seems so common to stick a class on something that only applies one style. For example

<p class="bold">This is some important text</p>

and then

.bold {
    font-weight: bold;
}
(more…)

JavaScript library to capture HTML elements being created

I’ve written about this technique for capturing HTML elements being created before, it’s a pretty cool hack using the animation start event and a uniquely named CSS animation to catch newly created elements being added to the document.

I’ve created a small library to abstract this fairly awkward thing away and provide a simple function that can call a provided function when anything matching a CSS selector is added to the document.

(more…)

HiFiBerry DAC for the Raspberry Pi

For a long time I’ve been looking for a way to play music from Spotify on my phone through my home stereo system without having to connect it to the amp directly. There are a couple of reasons for this with the main one being that the DAC (the thing that converts digital music to analogue so that it can be sent out via the headphone jack) in all mobile phones is very poor, not a complaint really as they’re designed for headphones and to be small, not suitable for use with a nice amplifier at all.

(more…)

Using tables for layout purposes

Okay let’s start off by saying using tables for layout purposes is a terrible idea – the web has largely moved on from that sort of thinking. The focuses on semantics and responsive design have become much more important than “that works” could ever be. The reduction in tables nested in tables nested in tables nested in wrapper tables is a huge step in a very positive direction in my opinion. However, this dodogy HTML did make some layout desires very very easy and some of those are quite awkward with sensible HTML and CSS. Apparently we need some sort of middle-ground compromise. Time for an example.

(more…)

The second best thing about PHP 7

Following on from the previous theme I’ve picked out another of my favourite new things in PHP to talk about – general strictness. In current version of PHP there is no way to define the type of thing that a function will return or accept as a parameter – very different to most other languages.

There are quite a few cases where passing the wrong thing to a function can cause weird behaviour – imagine a search page where you accidentally passed the query string as the page number, you’d always get page one with no error message. With PHP 7 though you can specify the types

(more…)

The best thing about PHP 7

With PHP 7 finalised and almost here I thought I’d take a look and pick out a few of my favourite new features that it introduced. I do a lot of my daily work in PHP but do know a few other languages fairly well – there are some things being added that PHP has been lacking for a long time so, to me, this feels like a big catch up.

(more…)

More realistic local web development server

One of the most common tools used to test and develop web projects is XAMPP. The idea is simple, you run a small web server on your local PC and use it to host a copy of the website you’re working on. The problem with this is that it is not that similar to the environment that the site will actually run under, hosting companies very rarely use Windows for starters.

(more…)
Next Page »