Link o Blog A life in a world without boxes Fri, 08 Dec 2017 18:30:00 +0000 en-US hourly 1 Python on Windows not using Visual Studio C++ compiler Fri, 08 Dec 2017 18:30:00 +0000 Continue reading Python on Windows not using Visual Studio C++ compiler ]]> My current work has me using Python2.7, which on occasion requires a package with some yummy C++ at it’s core.  Obviously this will require compiling before it can be used.  This is handled by “pip” quite nicely, but it can be a little brain dead.

As I am also working with various other languages I have Visual Studio 2015 installed, with C++.  So when I came to install a package and pip claimed there was no C++ compiler and to download a custom C++ 9.0 package from Microsoft specifically for Python I was a little confused.. (SPOILER: The Microsoft package, whilst nice of them does seem to be missing a few headers.. stdint.h for one.. *sigh*)..

Anyway, thankfully there is quite a simple fix via the power of environment variables.  If you run the command “env” within a command prompt you will get a list of that instances current environment variables.   Look through them and you should find (in the case of Visual Studio 2015) something like: (If you have a different version of VS installed you will see a different VSnnn)

VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\

Now what the Python build environment is looking for (in the case of 2.7) is “VS90COMNTOOLS” environment variable…

Thankfully the Microsoft compiler takes the same options between versions, so a quick fix is simply:


which will set the environment variable Python2.7 is looking for to point at the VS install.. hey presto!

However! this will only affect the Command Prompt you are currently using.  If you wish to make this more permanent, you should set this on your systems environment variables within control panel (and remember to restart your Command Prompts!)


]]> 0
Courier IMAP problems with STARTTLS (Checking mail server capabilities) Sun, 16 Aug 2015 23:18:02 +0000 Continue reading Courier IMAP problems with STARTTLS (Checking mail server capabilities) ]]> I have recently upgraded my mail server from Debian Wheezy to Debian Jessie, which along with it brings new versions of software, including Courier. For the most part this hasn’t been an issue except when it came to the IMAP service. On Thunderbird clients you would see “Checking mail server capabilities” and nothing more when connecting to the server, other clients I assume would have differing error messages, or just flat fail to connect. A quick fix was to switch the clients to SSL, BUT this I don’t think is a good fix as it requires your users to have to make a change. I have thankfully after much googling discovered what seems to be a fix (works for me ™ ).

Courier now uses dhparams.pem (Generate Diffie-Hellman Parameters – OpenSSL Wiki article). Now my fresh new courier install already had one of these present, but I suspect this may be too small. Regenerating this with a nice big 2048bit version rectified my STARTTLS issues instantly (well I did restart courier-imap and courier-imap-ssl too 🙂 )

The command I used is :

openssl dhparam -out dhparams.pem 2048

(This WILL take a fair amount of time, don’t worry it does finish 🙂 )
whilst within the /etc/courier path, followed by a restart of the imap services. My original dhparams.pem file was 201 bytes, after generating a new one it is 424 bytes 🙂

Hopefully this will help save someone’s hair 🙂

]]> 5
Mallorca with team Glow Sun, 03 May 2015 10:34:45 +0000 Continue reading Mallorca with team Glow ]]> Late last year Aileen joined Team Glow (a womens cycling club), and this last week has been their trip to Mallorca. Thankfully I was able to go too (yay!) and join in on the rides. Also strapped to my noggin was my trusty GoPro Hero camera for recording going down big hills very fast 🙂

And this is what I’d like to post here 🙂 In a rough order of when they occurred 🙂

First up, the descent from Col d Orient, this was on our 4th day, and was part of a 72 mile ish loop with 4000ft of climbing 🙂

There were two descents, the first being from the top of Col d Orient trough the town of Orient and then climbing up to Col d Honor.

I much prefered the climb to Col d Honor to the one of the Orient, felt faster for some reason!

After climbing that, next thing to do was to descend into Bunyola! 😀 Really enjoyed this descent, just wish I could have gotten past the guy in the BASF jersey towards the end :/ ah well next year perhaps 🙂

Day 5 was a rest day, so just a 16 mile jaunt along to Alcudia for lunch with Aileen, saving our legs ready for Day 6, which was Sa Colabra!

Unfortunetly my Garmin had a funny (possibly heat releated?) and mislogged some of the points on the climb so I didn’t get a time from top to bottom 🙁 my first ever cat 1 climb and part of my data is messed up! typical.. next year I guess :), thankfully the GoPro didn’t fail to record my descent. Probably could have got a better time down if it weren’t for all the damn Armchair warriors sat in this airconditioned bloody coaches.. bloody tourists ;D

After climbing back up there was the ride back, which also meant a descent of Familla which I missed recording on our Lluc climbing day. Possibly my fave descent glad I got to do it twice, and this time record it, and race along with team Glow 🙂

Our last day cycling, so why not go for a nice easy ride along to the Cap d Formentor (Lighthouse)… easy… sure… 🙂 And we even added in some extra climbing too, you know.. because :/ 😀

Had another sprint along on the way back towards Pollenca too.

These are my video’s so far, I’ll add a few more as I get them processed and uploaded 🙂

]]> 0
State of modern ‘Arcade’ games and perhaps society? Tue, 14 Apr 2015 10:26:28 +0000 Continue reading State of modern ‘Arcade’ games and perhaps society? ]]> Had a play on some modern arcade machines at the weekend.. what a sham! £2 to play and I suspect player involvement is fairly optional to the gameplay on the most part. I completed the 1st section/level was told well done and then insert another credit (£1) to continue.. WTF!

Utter conning robbing garbage! They had 2 similar designed ‘pods’ one a Star Wars x-wing fighter ‘sim’ the other a Jet fighter ‘sim’ both pretty much identical games with essentially different gfx and sound.

Was highly disappointing. That coupled with the ‘ticket’ based rewards ‘games’ where it’s not possible to NOT get tickets, and what you do get are pretty much worth less than the paper they are made of. Is everything these days so dumbed down so as to appease low attention, unskilled, drooling muppets looking for constant gratification? For me its a depressing glimpse into society as a whole 🙁

]]> 0
GRUB physical volume pv0 not found – one fix Mon, 03 Nov 2014 00:41:57 +0000 Continue reading GRUB physical volume pv0 not found – one fix ]]> I have had one of those days today…

One of the mount points on my server had gotten a little tight for space, so I decided to grow it before it became a problem. Naturally I use LVM so that’s not an issue.. well assuming you have free space on the LVM physical volume that is.. Thankfully this is a server running under virtualisation, so adding an additional physical volume was a simple task and the expansion went as you would expect, flawlessly.

Whilst I was at it, I thought I’d upgrade this box from Debian Squeeze to Wheezy too. Already running Wheezy elsewhere and an upgrade I have done plenty of times to trust (mostly 😉 ). That went well, but there were a few little grumbles around grub complaining about a missing PV that worried me. So I took a snapshot (including VMs memory) before running the magical restart. I am VERY glad I did!

Alas it seems there is a bug in GRUB 1.99 that from my Googling seems to have been around a while! It seems as though it isn’t too happy with an LVM configuration with multiple PVs. Reverting my non-booting box back to it’s running snapshot I was able to attempt ‘update-grub’ and be greeted with a long list of errors regards PV0 not being found.

Thankfully, I think I have found a work around! Although it’s not pretty and a bit time consuming. Essentially present a new PV to the box that is large enough to accommodate all existing PVs data (and probably a little extra growth room), then move your data to this new PV from all the original PVs with pvmove. This will take some time, running pvmove -v in another session/terminal you can at least see progress of the migration.

Once all the data is in your new PV, remove the old PVs from the active VG, then remove them from the system with pvremove. (They can still be connected and show as disks, just not PVs). With that done, run update-grub again, and fingers crossed you should have a bootable system once more.

I would certainly recommend you fire off a new snapshot including memory before rebooting, it’s an excellent safety net to get you back on the box.

Hopefully this will help someone else get out of this situation if they are unlucky to find themselves in it.

]]> 0
Memory alignment bugs, old and new! (fun with Havok) Sat, 20 Sep 2014 14:20:18 +0000 Continue reading Memory alignment bugs, old and new! (fun with Havok) ]]> Writing low level code (assembly) on a system with an .. interesting architecture meant that I soon experienced the joy of memory alignment bugs. These typically present themselves in a completely mysterious manner to the uninitiated. A perfectly functioning piece of code runs happily, then you make a simple non-impacting change somewhere else in the code, possibly even in a section of code that isn’t even being executed, and BOOM! either weird behaviour, or an outright crash!

The first few times I experienced these kinds of bugs it was pretty harrowing, as the changes I was making simply didn’t add up to the output I was seeing. It was almost taking me back to the dark days of computers working on voodoo and black magic! Thankfully, I eventually became able to spot these kinds of errors for what they were, simply alignment errors!

An alignment error in code is where an instruction resides in memory incorrectly. A simple example is for the 16bit processor the Motorola 68000, all instructions must be even aligned. That is, all instructions must start on an even memory address. Addresses of 4, 8, 6, 100, 4096 are all even, and hence fine for an instruction, 5, 9, 7, 101, 4097 however are not. In the example of this CPU you will get a nice helpful address error from the CPU, which helps you realise what is wrong and start working to fix it.

This is quite a well understood bit of low level programming knowledge, so why mention it here? Well, I am currently spending my free time playing with some PC development in C++, using some of the wealth of freely available tech out there to create something, in this somewhat higher level language I have once again fallen foul of the alignment error!

Not something I would expect in a compiled language, I am quite new to using C++ and especially with this level of complexity too, so the seemingly random crashes and exception errors completely caught me off guard. I was feeling quite safe, thinking that the compiler would simply “do the right thing(tm)” and all the woes of low level assembly programming would be behind me, but no! It seems the alignment error persists.

In this case it has occurred whilst working with the rather amazing Havok Physics engine (a free binary only version with limited license is available thanks to Intel here). Naturally processing complex physics maths to the scale that Havok does requires a fair amount of CPU, and as such they have optimised their engine over time. This has lead to their use of their own custom memory management code and lots of clever ways to optimise memory and CPU time, some of which requires specific memory alignment!!!

I am not one for reading manuals.. I like to jump in and learn by playing with tech, unfortunately for me, there is a LOT to learn and I have managed to through what must be pure luck achieve some exciting results quickly. As I have refined this knowledge however my luck buffer has clearly depleted and I have started hitting issues.. so in typical man style.. now that smoke is pouring out, I am consulting the manual 🙂

Frankly, I’d recommend spending a good chunk of time reading through the Havok user manual, there is a wealth of knowledge and examples in it, and it actually (for me at least) makes for interesting reading!

For anyone else out there battling with their compiler, wondering why their code sometimes works and sometimes doesn’t sometimes even running the binary 2-3 times will yield different results and errors.. You may have an alignment issue! I found this article on the Intel forum enlightening, and then a bit of a read of the “Memory” section of the manual.

I have now adjusted my base class for my physics object to inherit from the hkReferencedObject class and so far things seem better. If your class cannot inherit from this then the macro’s HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR and HK_DECLARE_CLASS_ALLOCATOR may be your salvation. These will ensure that the Havok memory allocator and correct alignment are used when a new object is constructed (hopefully 🙂 )

In my case I was seeing errors like “Access violation reading location 0xffffffff”

]]> 0
AHA! Thu, 05 Jun 2014 14:05:30 +0000 Finally spent the 5 minutes to figure out what I had done to break this blog! pesky cache plugin!

That’s one minor job done! 😀

]]> 0
So, cycling Mon, 04 Nov 2013 18:28:21 +0000 Continue reading So, cycling ]]> Yeah, I like cycling now.. quite a bit 🙂

One thing I have noticed a few times on my commutes to and from work is how slow cars actually are. Sure when you are cruising along at 30-40 mph you are going a lot faster than your average cycle commuter.. but.. then comes the traffic…

Tonight for example I noticed a van at a junction heading the same way as myself. It pulled away and disappeared as I merrily peddled away at my usual ~20MPH pace… but then at the next junction/lights I drew parallel to it, this happened several times along probably a 5 mile stretch of road until we finally went our separate ways.

I am a good cyclist, I stop at all red lights (even empty pedestrian crossings) and stay behind the white line at lights (I like not being fined or squished). So it is logical to say that whilst the van could easily hit speeds of 30MPH+ our overall average speed across that distance was the same, but I probably found it less frustrating as I quite enjoy my rides. Also cheaper, less pollution AND (motorists pay attention) I took up a lot less room on the road!

Now if only more people cycled to work, the roads would be a lot more pleasant and we’d probably all be a lot healthier… (and able to eat LOTS of CAKE! 😀 )

]]> 0
Curse you CPAN! (LIBXML2_2.6.0 not defined) Tue, 30 Apr 2013 15:18:51 +0000 Continue reading Curse you CPAN! (LIBXML2_2.6.0 not defined) ]]> If you have seen the following error, possibly starting up Apache2 on your Linux box and you can’t for the life of you figure out why.. it MIGHT just be CPAN as the ultimate culprit. There is a good chance you may have a conflicting version of libxml2 in /usr/local/lib probably with a bunch of other libs too. As I didn’t install these myself, the only tool I can think of that will have done will be CPAN when a package has been installed via it.

Thankfully the fix is simple, remove the libs from /usr/local/lib that are conflicting, and don’t use CPAN 🙂

This may break your Perl module it installed, but hopefully will restore the usability of your system. My recommendation would be to only use packaged versions of your Perl modules to ensure system integrity, save you some headaches later in life.

]]> 0
Hectic! Sun, 26 Aug 2012 18:22:28 +0000 Continue reading Hectic! ]]> Wow, life suddenly got VERY hectic for me!

Crazy busy at work with all mannor of projects, all far too secret for me to divulge here 🙂  But those have to come second to what is really taking up my neural ticks in thought process..  My oh so lovely girlfriend… yeah yeah, I know, soppy blergh etc.. but this is a tad different!

How so? well (as I am sure anyone who has suffered being in my presence for the last few months can attest), she is representing Great Britain at the Paralympics!  So proud of my good lady am I! Hope you will join me in cheering her on, I’ll be there myself in person cheering away, for those who are not, I believe all the coverage is going to be on Channel 4.  Her events are Track cycling, Tandem B/Vi 1KM TT on 31st of August at 9:30 and the 3KM Pursuit on the 2nd of September at 9:30 with the final on the same day at 14:00.

Her athlete profile on Channel 4 is here

So proud, I am a very lucky boy!

]]> 0