Monday 28 September 2015

SDL2.0 Complete Installation on Ubuntu

I've just spent sometime, setting up SDL for development on my Ubuntu machine, and found that the Ubuntu library caches lack SDL v2.0, they have the older 1.2, but that wasn't good enough, so here is a little script I've put together, to get me all the dependencies (least what I think the dependencies are), download each part of SDL (SDL, TTF, Mixer & Image), extract them into folders, build and install them, and then delete the folder copy which was extracted.

cd ~
sudo apt-get install build-essential xorg-dev libudev-dev libts-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev libopenal-dev libogg-dev libvorbis-dev libaudiofile-dev libpng12-dev libfreetype6-dev libusb-dev libdbus-1-dev zlib1g-dev libdirectfb-dev
wget https://www.libsdl.org/release/SDL2-2.0.3.tar.gz
tar -xvzf SDL2-2.0.3.tar.gz
cd SDL2*
./configure
make
sudo make install
cd ~
rm -rf SDL2-2*
wget https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.0.tar.gz
tar -xvzf SDL2_image-2.0.0.tar.gz
cd SDL2_image*
./configure
make
sudo make install
cd ~
rm -rf SDL2_image*
wget https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.12.tar.gz
tar -xvzf SDL2_ttf-2.0.12.tar.gz
cd SDL2_ttf*
./configure
make all
sudo make install
cd ~
rm -rf SDL2_ttf*
wget https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.0.tar.gz
tar -xvzf SDL2_mixer-2.0.0.tar.gz
cd SDL2_mixer*
./configure
make all
sudo make install
cd ~
rm -rf SDL2_mixer*
sudo ldconfig

Once this is all done, you need to edit /etc/ld.so.conf adding to it, thus:

sudo nano /etc/ld.so.conf

And add:

include /usr/local/lib

Save the file, I can now create an empty C++ project, or just a main.cpp, and include the following files:

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>

The libraries to link against are:

libSDL2.a
libSDL2_image.a
libSDL2main.a
libSDL2_mixer.a
libSDL2_test.a
libSDL2_ttf.a

(Each .a also has a static .so, alongside, if you prefer)

This, of course the linker options on the command line are:

g++ --std=c++11 main.cpp -llibSDL2.a -llibSDL2_image.a -llibSDL2main.a -llibSDL2_mixer.a -llibSDL2_test.a -llibSDL2_ttf.a

Sunday 27 September 2015

Chess - Waiting

I've continued to play chess online, and again after doing some of the training puzzles I took to another rated game... and this is where I find myself...


The chap has fallen into my trap with the knights and queens, he had the upper hand on the left, but then I had the two knights defence and he fell into this position.

All he can do is move the knight to block the my Queen (blue line) and then I move my Queen (red arrow) and we have check-mate.

However, he's not moving... I don't know if he's left, or quit, or just wants to let the time roll down, but I'll just keep giving him 15 seconds to stop him trying to time the game out.  So this is maybe another toxic player from the community.

Saturday 26 September 2015

Chess - Win

In my prior post I had posted that the en.lichess.org community was a little toxic, well, I'm happy to announce the registered community is actually quite nice... so far...

I decided after doing a bunch of the "openings" training (and being bad at it) I'd try a rated game...


I won, and not only did I win, but I had the opponent "Vecky" chat back to me, and it was a nice game, I enjoyed it.

As I said in the chat there, I celebrated with a nice coffee :)

Friday 25 September 2015

More Chess - Toxic Players

I'm beginning to find the online Chess community a bit more feeble than I remember... I used to play on Yahoo Games Chess, years ago... I even met a lass through it once, seriously, chess got me laid... However, playing on en.lichess.org, I keep having my opponents leave the match!


In this case the chap had the upper hand, my opening went wrong, he moved his bishop aggressively into my centre, but then my knights rescued the situation and he left?!?!?!  Leaving me to just have to wait for his time to end or "claim victory".


Road Rage #1

To the woman driving the Black Audi TT out of the QMC, down Leen Gate, Nottingham at around 9:55 today... You're very lucky I don't have a dash cam, you're very lucky we met in traffic outside my place of employment and there is a decorum mandate for staff, you are very very lucky indeed, because I really felt like driving into you, dragging you out of your car by the roots of your silly greying blond scag wig and smashing your face in.

Lets, analyse why everyone, I turned into Leen gate following an RLMS lorry, as I work here I know RLMS would be pulling up on the left of the road soon enough, so waited behind it, a van passed, a car and then I peeked out, a red car was pulled up on the right of the road, way up level with the Bellfruit factory gates, and the road was then clear, so I pull out around the now parked lorry.

A black Audi TT appears at the hospital end of this row... It passed the Bellfruit factory gates, passed the pulled over red car, and as I'm now level with the rear of the RLMS lorry, this Audio is approaching the lorry itself.  It's no where near the lorry, there's a dozen meters between where the Audi is and where I am by this point,

I am mid manoeuvre around a parked vehicle,  I am already across the median and moving (checks highway code) yes, so the other car did not have right of way, I've already waited for other vehicles, so it is approaching a moving car, and should be aware of me, should give way, I'm already out into the movement, but the Audi is bearing down on me, "here we go" I think, it's a car make and type which seems to empower dick heads to drive like idiots, so I figure this is another... and as it's getting closer and closer I can see it's bonnet is not dipping, the Audi is not braking... and I could see the woman driving by now, see her demographic, and yes, she's a fucking hooray henry, a "I'm driving here" type, and I bet she's the type who can never be wrong, who can never be told, and thinks she's made it in life because she's been so forthright, I can see her now...

I'm now trying to turn left sharply to get back in front of the parked lorry, so I'm over steering to get in and out of her path of potential destruction, without slowing down she comes past me and pulled a face at me!

This stupid, pig eyed, wig clad pig of a woman pulls a face at me!

For her idiotic, in correct, highway code violating drive!

I really, honestly, felt true anger boil, I wanted to chase her down and break her false teeth all over her steering wheel, I wanted to chase around and smash into her, to drag her pathetic limp corpse down the road from my bumper, like some macabre bonnet trophy.

But, of course, this is reality and one can't do that, one can't even joke about it I guess (though I just have), so in stead I wish I had a dash cam, though in this case I'd need 360 degree coverage, and I'd have taken her plate, taken the stupid face she pulled and I'd have blown then up and pasted them all over the internet.

See how her employer, or employees, liked to see that; see how her Insurer would like to know how crap a driver she really is.  For my part, I'm fuming, but I'm done, madam you had the upper hand, driving around today you are anonymous, you can get away with being a dangerous idiot like this, you and your ilk driving like idiots however you've had your day, and once technology in cars to monitor and report such flagrant obtuse abusive and idiotic driving as yours is available, the better!

Thursday 24 September 2015

Chess & Me

I've always been fascinated by board games, Chess was perhaps the first I obsessed over, and I wasn't bad at playing it... When I was around 10 we had a wooden chess set at home, and I'd spend hours looking at positions, but was  never encouraged that this was a worth while thing to do.

When I was in my early twenties, I came back to Chess and had a few books and bits and bobs for it, spent ages analysing positions once.  It's sort of part of me.

Anyway, I recently came across en.lichess.org, and signed up... I had played a few games and got totally thrashed whilst anonymous... But I did a bunch of their training puzzles (some of which I think I saw better options or at least equivalent options for) and then signed up... Ironically when you sign up their capta check is a chess puzzle, and I kept getting it wrong!

But soon sorted and I started my first game, no pressure, so I went for classic 20 minute (plenty of time) game style.  I have this speed chess, I'm not practised enough for it.

Here's my ending board, did I win... I think I did, but the opponent just left :(

(I'm playing white)

Wednesday 23 September 2015

Genius Lash Back

Yesterday's post about the "Genius Programmer" effect has had a ricochet, had a colleague, come over and bemoan me for not appreciating ability, and he had me fire up his new website... lots of PHP, lots of HTML and a smidgen of JavaScript... "There" he declared "proof I'm a decent programmer".

*cough* I interjected

"What?" he asked, puzzled.

"No you really don't want to hear my thoughts" I said, concentrating on the screen "it's a very nice site, very swish, is this javscript drive?"

But he already wouldn't let it go, "tell me what you're thinking?"

"All right, I think this isn't programming, this is scripting, coding at best, it's making a virtual environment do something, lots of the site here is from other libraries you've just brought them in by copying and pasting, that menu is just copied and pasted from one on another site, the art work is generic, and you've more stuck existing blocks and ideas together than created anything new"

For you see, I do see the Software Engineer category to be sub-dividable, you have classic programmers, working on the bare metal, or at least working on an emulation of the bare metal.  Then you have coders, who are essentially working in an interpreted language, so for the most part they're coaxing a virtual environment to do their bidding, and working around it's quirks whilst that environment obfuscates the metal below them, many programmers find themselves stuck being coders when they walk into java or C# roles.  But Python, java, perl, C# even some variants of Basic are all making coders out of people and fair do's to them.  Then there are scriptwriters, these are people writing scripts for other uses, so you have bash shell, DOS batch, JavaScript all manner of scripts, I find scripts to be a little like programming the VCR used to be, they have their nuances, but they're all basically the same and like programming the VCR they are very direct and set to a purpose, you can't make the VCR bake bread, but it will record Emmerdale without a fuss.

You could take this as a disparaging belief, but please don't, I think anyone creating actionable code, be that in a language, a script or via physical direction, all have their place and each technology has it's niche, many of us know and work in multiple languages for this very effect, I for example have been heavily using Python for two months, but I still consider my main role as a programmer to be C++, and then coding as C#.  I know Java enough to get by, but I don't consider myself a java expert.  I like C for certain things, but I compile it with a C++ compiler, so I'm not doing pure C unless it's on my old Atari's, so that's just a hobby language, and the same goes for Pascal.

But knowing I have this depth of experience to draw on, lets me move an algorithm, or a solution to a problem from one realm to the other... Take this all back to my colleague...

He copied blocks, used pre-written libraries, and generated the vast majority of his site through not knowing anything, but my copying.  "Great Artists Steal", and yes he stole this site and it looks great... But does that make him a programmer?  Far from it.

Tuesday 22 September 2015

Meeting the "Genius Programmer" Myth

We've all had it, we've all met them, a few of us have maybe even pretended to be them... But there are very few real, and therefore absolutely swathes of fake, Genius Programmers.

I bring this topic up, as my current role revolves around pampering a system which I had no design input into, which is, frankly, a bit of a mess, and which I would and could and at one time was allocated time to re-write from the ground up myself.  This system was designed by a Genius programmer, in some aspects it wasn't even a very good programmer, or rather not a very good modern programmer.  It was designed by a chap with his roots in 1980's Radio equipment, and whom had google at hand.  So it's coded to a Coding Standard downloaded from India, it's main features, though functional and good don't take full advantage of modern programming practice, like inheritance or even full encapsulating things as classes.  It's a hodge podge.

And then it had a team each work upon it, where each member would do their own thing, but the designer would reel those changes in and uniform them, that was until the first, the perhaps the worst ever, specimen of a "Genius Programmer" was hired.

Hired, some time after me, he soon changed the core programming language being used by the department from being C++ to C#... Yes, you heard that right, from C++ to C#.  Though this was luck as a manager grade member of the group was pushing for us to take up Java, as she'd used it at a previous job.

So, C#... Genius Boy soon had it running tricks, but many of his tricks were to call down into the Operating System, something far easier to do from C++, and it all became a bit of a farse, he'd write unintelligible code, in poor structure, and then the designer was so intimidated by this boy talking the talk he'd not check whether he walked the walk.  And 50% of the time the boys code did what was intended, so long as he didn't get bored between starting to implement it and delivery day, if he got bored, forget it, all bets were off.

And we've all met people like this, presenting themselves as the best thing since sliced bread, but they don't acutally deliver.

So, I'm now coaxing this system into old age, and probably extinction soon.


However, he wasn't the first time I ever met the 'genius programmer' phenomena, the first time was a genuine example Max (if you're out there Max Barr, hello!!!!), was a genuine article, he as kindly spoken, had infinite patience to listen to the problem, would mull things over and then he'd attack (between smoke breaks) the problem.  He even had the same phone as they used in that years hit film "The Matrix".

Max was the genuine article, able and produced working results every time, however, his code often had a world of it's own, as he included such variable names as "Great Green Flesh Devouring Scabs", yes you can imagine you could not maintain his code easily.  But it worked, and you left Max to his projects knowing they were in good stewardship.

At the same time I met this genuine article, I was also introduced to a complete fake... I wasn't involved in hiring this joker, but the boss at the time gave us this speach he was coming in and showing us how to do things... Shaking things up...

At the time I'd just finished porting the company's old product to the internet via CGI, and the new project was in Java, hosted on Jakarta Tomcat and later through IBM WebSphere.  This fellow was to be a Java expert.

He came in, he was a bit odd, immediately one had a feeling of... "He's odd"... I couldn't put my finger on it at first, but he sat in a corner, and the first week there he was off to buy a brand new hard drive for the machine he was working on... So he spent that day out, at a local shop to buy a drive.  I went into the shop later, they served the guy in about 5 minutes, so immediately he'd had the day off doing nothing.

Then he presented his first piece of code, and we were meant to clap in awe that it used a thread, it was very annoying to watch.

He then decided the IBM WebSphere server we'd all got sorted was not good enough, and we needed a Linux machine.  And I agreed, the trouble with this however was it was 1999, so you had two choices for your Linux server Suse and RedHat.  I would have chosen to install both, except back then they cost money to get the support and in a commercial environment the boss wanted it all supported.

It was therefore decided that the genius would be sent to pick, at a Linux conference, I was sent with him... Well, another waste of time later, I left early and headed back to the office "pointless day, he just met his mates and they didn't talk tech", indeed the whole presentation for the whole morning was the Suse guy in a suit telling us to use theirs, followed by the RedHat guy in a t-shirt with a red-hat printed on it, telling us to use theirs... very annoying.. No comparisons, no service information, no detail, no point.

So anyway, back at the office, no more code came from this guy, and I learned working in Warwickshire he was commuting every day 64 miles from Nottingham, so that's 128 miles a day... And oh look, I'm from Nottingham... "Where'd you used to work?"... I asked one day... And by remarkable coincidence, where he used to work, is where I work now... But he made out he'd been senior developer here, and al-sorts... Genius programmer remember, he was telling the boss, and us all, how he'd worked on major projects...

But like I said, no more code came out of his corner, and after only a few weeks he departed that employment.

Spin forward two years and I work where I am now, which happens to be where this Genius claimed to have been a senior programmer.  So I ask about after him... Nope, no-one remembers him... I ask HR, they look at me puzzled... The HR lady at the time did go have a look though, and this genius did indeed work  here... For four weeks... He was never senior.

He seems to be one of those hummingbird programmers, able to talk the talk to get the role, but then unable to walk the walk.

Years later this chap was in the news, on the TV, turned out my feeling of something odd about him might have been right, he turned out to be of some strange religious beliefs...

Friday 18 September 2015

New Project Series for you Guys

I've been trying to record you a new series, my rants on life, the universe and everything, with the phone in the car on the drive in, I've tried to record video, tried audio, tried to just dictate and then write out the rants... None of it has been working for me, I think I need to get a better mic set up to record the audio I want.

Even post processing the captured audio and video files has been to no effect.

Topics I covered this week were Kivy in Python, the on going Immigration Crisis coming out of Syria and the wanker who cut me up in a fully livery clad van, the douché.

So, very diverse.

But until I can get around to solving the technical hiccups you'll just have to know and accept that I'm trying... in both senses of the term, yes I'm trying...

Thursday 17 September 2015

Pet Hate of the Day

I've got a pet hate for the day, when I message anyone, before, during and after I try my utmost to get their name right, on the phone that's hard sometimes you ask them to spell it, or you look them up on the company website, or websites.

E-mail makes this easier, when someone has already contacted you, or there's an internal company address book you have their name right there, right in front of you...

Bob, might very well e-mail you, but you can see they're Robert... Stewy might send you a meeting invite, but you know he's Steven...

So why the fuck is it that my name, Jonathan, gets totally garbled... I mail and talk to people as Jon, I just sent a mail and signed it off "Jon".  That's permission for the other end to engage me as "Jon"... So when I get "Jonathon", "Johnathan", "Johnathon", "John" or even "Jonefan" it winds me the fuck up.

You have my name, you have how I've presented it to you, I'm not so mental that I don't know how to spell my own name, grrrrr

Wednesday 16 September 2015

What Happened to CubeWorld

I've just been sorting out my laptop ready for a stint on the road, so I've made sure some of the tools I need are available, that the dual boot to Windows is still working - because believe it or not I've had a hotel once not let any browser except IE get onto their free WiFi - and I've also made sure I have some games....

The laptop of course has my installation of CubeWorld on it, you may recall back in 2013 I had a main PC PSU failure, so that week I had to find another title and CubeWorld was blowing up all over the place at that time... So I bought into that Alpha..


I play CubeWorld now and then, but I don't connect my laptop to a network very often, so I was amazed today when firing up the game there were no updates... Hmmm... No updates since 23rd July 2013... Hmmm....

That's a long time, so I just had a look around, whether I needed to download a whole new updater/launcher, or some other thing, no idea, can't get on the site, there's no forum, there's no news, no information.

The only place I found any information was on Reddit, and I like Reddit, but not for hard facts, it's more a guide to potential situations regarding projects, lots of opinion and little solid fact at times... You know, like Wikipedia.

So checking that out, what is the status of CubeWorld?... Well, a video touting the "up coming" Quest system was released, but nothing more... Nothing... For over a year... One can't log onto the site (at least I couldn't, even resetting my password) and the shop is closed...


Now, I love this game, I love the look, the feel, the world and the look... I hope nothing bad has happened to it's becoming really really cool (as it's only cool at the moment).

The GM in me is shaking my virtual D20 in the development efforts direction and saying "please give me more".

Tuesday 15 September 2015

GCSE Maths (8300) Foundation - A modern resit

I'm a little disappointed with myself, a friend of mine has just taken, or should I say, retaken his GCSE Maths papers, some twenty two years after this dismal first time around, and he's chuffed he got himself a C.

Now, he worked really hard at this, and good on him, I got a C in GCSE maths the first time around, and I am one of those people who think exams now are easier than back then, so my friend challenged me to open the exam board sample exam paper and do it...

So, I did, now I this was with no rehearsal, the Foundation paper, and unlike my exams, no calculator!... Yes, when I were a lad you always had your scientific calculator, but this exam has three papers, two with and one without, I was challenged to the one without (ironic for a computer programmer).

I set about the paper, and after 2 hours had finished, this was a 1 hour 30 minute paper, so a little worrying already, but we'll let that slide, and I also noted I had difficulty with fractional maths without a calculator, which I myself have always always reached for.

I had significant difficulty too as I've forgotten about simultaneous equations, I was proper scratching my head, the feeling that I knew it once was there, but the practical was gone... So I expected to have lost 6 marks already...

I was stunned therefore when told I'd scored just 50 from 79 marks.

Interestingly though one of the questions my mate did say my answer made more sense than the one in the answer paper, I'd used common sense rather than explain how I picked a median group... so he'd deducted two marks as there were no workings, but I'd gotten 1 of the 3 marks available for just being right... I personally feel I should get all three marks for just being right, lets face it, if you put down a good answer you knock confidence!  And I was right, somewhere in my noggin I crunched the figures and I was hard-wired to be right, why should that be penalised?

I've always thought the right answer should get full marks, and only if it's the wrong answer should the working be looked at, but this marking scheme was "A1" they got the answer, but only is "M1 and M2" in the workings... and I'm like, no... A1, they got it, it was right, they passed, stop pussy fucking footing around, they were right... And then if they were wrong, see how far wrong, and feed that back into your course for next year, if 20% of candidates get such and such wrong, but the workings look right, your course might have a fault, or you might have to clarify the teaching material, not punish the candidate who was right all along!

It beggars belief.

But I was truly surprised how hard the exam was, harder because of no calculator for me, but for a foundation level exam it was pretty comprehensive to me, and it has given me a better respect for those getting A's and A*'s today... They must bloody work hard, or at least have learned the procedures for the questions by rote.

The question I have, which remains is, what does 50/79 mean in terms of a grade?... Hmmm... I recon I'm in the C category again, just like I was first time around... Hey ho.

Friday 11 September 2015

Payday 2

I've been playing with Payday 2, Chaplain the legend that he is introduced me to the title, and I'm quite happy to play it solo stealth, trying to figure everything out...

One thing to work out is how to hide bodies...


No-one's going to spot him are they?... Noooo, we're good...

Wednesday 9 September 2015

Remember Remember to Blog in September

Sorry I've been away so long, but I've been very very busy, in the office I've had a paradigm shift in my projects, away from coaxing old C# systems and writing little C++ items to developing for Android.

I've therefore had to set up, and document, a whole manner of working with a new set of devices on an OS most of the folks in my office don't want to acknowledge, no not Android... Linux... They line Android... But detest and hate seeing Linux.

Yes, yes I know Android is Linux, and I know you know... But you tell some of the folks in my office, and the ones who don't have an opinion generally have an iPhone stuck to their ear.

So, developing for Android... I must have been doing Java eh?... Nope... Remember I said I was into Python, well I've been developing Python for Android, I've learned the languages, got to grips with Kivy and used buildozer to create my APK's for distribution to the devices.

I've dabbled with PyJNIus as well as other Android API libraries.

I will be bringing some tutorials to these pages about all this, once I've gotten the project itself completed.

My current challenge is animation of the active pages within the Application with Kivy.