Monday 30 April 2012

Mini Rolls

On a lighter note, I've just had a Cadbury's Mini Roll... Not had one of those in years... and I can fit a whole one into my mouth in one go... LOVELY.


Laptop From Ebay - Maternal Strife

Aside from running all over the shop this weekend, I had a laptop zonked on me by my father, to have a look at sorting it out for him, this laptop cost £60 off of ebay, and it was as old as the hills... A single core (core 1) with 2gb of RAM and an ATI graphics card.... Its dirt slow.

Best thing I could do was not bother to open windows, in fact, I opened windows on it and noted six different pieces of user monitoring software running in the open; clearly the seller wanted to phish for personal information from this machine.

So, I wiped the machine with a blank copy of windows XP (its licensed OS) and low and behold I booted up and the malware was back...

So I got out my trusty Linux boot CD and fired up into a version of Linux Mint to take a look around.  Dead sneakily whomever had sold this laptop had a hidden partition on the hard drive, it was booting into that to restore whatever malware onto the disk on the main partition and then letting the OS Boot.  It did this with a custom copy of Grub, with the text turned black and a zero time out... Very very sneaky.

I cleaned this all off, installed Mint onto the machine and it was a decent little box, I could imagine a developer (who doesn't mind the slow clock speed) enjoying the machine, it has a very tall screen (over twice the height of the screen on which I now write this mail to you guys in fact)... Crispy tall screen, I was almost tempted to have the machine off of him for my Pascal efforts, but I resisted...

But what a palava... what a lot of work that laptop seller must have gone to in order to set up that machine as a honey trap.

The machine is now sorted, however, all this is immaterial, what really bugged me was how much I had to say "No you can't play games on this machine"... to my mother... She had this plan that they'd get me to fix this laptop up and she'd sell it onto a member of the family so they could "browse the net, do homework and play some games".

Well, they can do all those things on it, but not play the games I think they thought they were going to play... First of all, the machine was very very low spec... I tried to explain this to my mother... "My gaming machine has eight processor cores and £470 worth of graphics cards inside... this laptop is ten years old and cost £60, its not going to run games".... But she insisted it would do...

No, it won't....

Yes, it will.....

Now, I'm no expert on my mothers education, but since it ended in the early 70's I'm going to pretty much assure you all right now that it contains absolutely no IT or computer related knowledge.  In fact, apart from her typing a few letters on our Atari ST as kids, and her briefly using e-mail in the modern era, I don't remember my mother using computers all that much; she's an SMS expert but a computer numpty.

I however, have been gaming longer than I care to recall, have a degree in Software Engineering, am lucky enough to be a computer programmer for a living and I live and breath this industry as it is my life blood...  Yet, sat in my own room, on my own turf, she was willing to argue with me about this, to basically try to play off the "I'm your mother, I know best" card on a topic about which she knows nothing.

Now, some of you out there may know my Mum, so when I say "She ended up pulling a face like she thinks you can't see her" you'll know what I mean.  But, for the rest of you, she pulled a face like a turtle straining to take a shit and not blow itself out its own shell.

And, this made me very angry, not least because this is my area of expertise, don't put me down.  My brother and sister-in-law are hairdressers, would I argue with them about dandruff?... No... Would my mother?... No... So why does my Mother and pretty much every fucker who's ever typed an e-mail (and little else) on a PC think they can argue with me on the topic?...

I've blogged about this before, but not from direct close family, that was extended family; whom may not beware I did a degree in this stuff... And not aware I've ALWAYS - for thirteen years - worked in this industry; and not aware I live and breath this both mentally and physically.  My mother however should be more than well aware of my experience and bow to my judgement, not argue with me.

If I had cancer, and my son was a doctor, I'd defer to his knowledge and experience on the old diagnosis front.  So why can't people back down and accept someone might know more than them about the IT trade and the piece of shit laptop they just bought off of ebay?

Maybe they have to defend what they just bought?... Maybe they're embarrassed this heap of shit ain't going to play Crysis...?  Whatever the reason, they have to suck it down, because I'm getting right fucking tired of being back chatted to on the topic.

The other angst which came up was also related computers, you see, every weekend I had to do an online shop for my Nan.  Its not a big deal, but lately I've been getting back chat to about what I've ordered; I have only ordered what Nan asked for; but my Mother thinks she can talk to me like I'm a fucking idiot that forgot to order disinfectant... if the old gal don't ask, she don't get, if I just bought things there'd be hell to pay.  If the old gal has forgot to ask, fair enough, but don't talk to me like shit because of it.

But anyway, this old saga of doing this order has gone on for YEARS, I have hundreds - no shit - of receipts for all the orders I've done, and we have the pattern of what to order down easy, but this weekend I've had family visits, I've had to travel to Leeds, I've been pretty fucking busy - even before I mention my wife being extremely ill last night and this morning... Above that we have a weekend away planned soon, so in anticipation of problems I printed out a dead easy to follow cheat sheet for my Dad to follow to do the shop.

I gave him this, and said "we're going away, so you'll need to do the shop that weekend"... nothing more, nothing less... The action in the sheets involve typing in the web page, a username and a password and then basically using the mouse to click the list of favourites that site holds for my Nan... its about 21 key strokes total.... Remember this list of instructions has just been handed to a man you've witnessed is happily using ebay, is using paypal and whom plays computer games all the time...

And you should see the comedy text reply my mother has sent me... here's the first:

From Me:  "How's Dad got on with the shopping list?"
Reply:  "Do u mean the How 2do an online order?  If so he's lookf n gonna try.  Friday he helped me with a brief e-mail as i can no longer see letters n numbers.  It took 3hrs.  He's limited when using his fingers as he has 2keep them in creans n cover them with plastic dressings.  There4 it'l b hard using his fingers n hands as their so sore.  We've been 2nan, collected her order n explained the change.  She got very upset as she was happy with u.  Was really hard telling her."

Now, lets parse this over folks... My Dad has a hard time with cream on his fingers... yes he does... but he manages on ebay and paypal - activities which take more typing than this online shop for Nan... And comparing ebay, paypal or the online shop to typing an actual e-mail is just retarded... Not least because my Dad ain't the most literate bloke on the planet, indeed he only seems to know where the ASWD keys are because of playing shooters all the time... So, stupid comparison from a stupid woman as far as I can tell...

As for his fingers hurting him, I've counted 21 characters need to be typed to do this shop... all the rest is clicking pre-existing items on a list...

I might suggest he get one of these though, since he's on ebay, I'm sure he'll find one...


Next thing to parse out of this mail... She's been to Nan, a vulnerable, confused old woman and told her god knows what story about my not wanting to help any more... Scaring her, upsetting her... When... These instructions were only for a rainy day (and its rained this weekend) or for the weekend we go away (soon) and possibly for covering whilst we go on our delayed honeymoon... Never was it mentioned I'd not do it any more...

But my mother is an over dramatic theocratic obtuse pain in the rear end, so she's decided to make a drama out of this.

This has me incensed to actually stop doing the shop altogether, firstly because I consider my mothers actions ridiculous and I think my father should have shown some back bone and gone "whoowhooowhoaaa there, stop and think about this, these instructions are only to cover, or in case he gets hit by a bus"... instead... off they trot to rain on Nan's parade...

But also to receive these stupid messages as text... It incenses me to be angry, to "FIT RAGE QUIT" because they've been... well they've been fucking arseholes...

AND THEN....


To really annoy me, more lies are crawling out the wood work... I have the text saying they've just got the shopping list right... its timed 19:13...

I have an e-mail timed 20:32 saying the shop has been done... 

So it took about 1 hour 30 minutes to drive home from Nan's, settle in, get the machine on, digest my instructions and type in the whole shopping list... right... That's an hour and thirty minutes.... When I'm on the phone with Nan trying to get sense out of her, that's about the same amount of time I waste... Not doing bad is he, for a guy unable to use his hands...

But then... at 21:13... So, two hours after the first text... (TWO HOURS)..... I have this text arrive....

"Dad just done nan's shop - Took him 3hrs from list. x"

No, no it did not, it took him at most an hour and a half, and you took only two hours to reply... Where does she get three hours from?... I have irrefutable proof of 1 hour 30 minutes, assuming she sent the text about getting the shop in the car (which I admit I assume I do - but its the most likely scenario).

1. Go Nans & scare her, take written list.
2. Drive home - whilst driving send guilt riddled text to fuck with mind and set my resolve NOT to shop again.
3. Get home - fuck about - get on machine do shop
4. Confirmation of Shop being done arrives at my inbox.

My mother in unaware I had a live mail tell me about the confirmation, she has no idea that I know this discrepancy exists... But she's quite willing to lie to me about the time taken...

Its not the first lie she's been caught out with... There's a few others out there in the ether that she'd rather gloss over... But, I'm getting tired of this attitude from her.

Tired of this, I'm holier than thou, I know more, I am bending over backwards for you... She has this air...

I spoke to my wife about this earlier, my wife lived at home with her parents well into her 20's... I was gone out the family home at 19... to Uni... My younger brother left at 16 to live with his girlfriend... My parents have had years together as a couple to live their own lives before they were married and now long after, they've had more time living their own lives as a married couple doing their own thing, than having kids at home... But they go on like they've been tied down to us kids for ever... They've not...

They've travelled, they've been all over and have a rich social life... And if they (specifically my mother) wants to come to my home and argue with me about my specialist topic, and argue with me about life and then weave this web of guilt and bullshit about this whole shopping insignificance, to be frank I can do without visits from her, until she can buck her ideas up and stop arguing...

Other arguments with my Mother in the last 30 days:

> "You've never lived in St Anns"...
< "We lived on St Anns Wells Road for two years odd, and I lived on Abbortsford Drive, St Anns, for a year whilst at University"...
> "You never lived in St Anns"...

Even my Dad looked at her sideways on this one, because we've always said we lived in St Anns, its always been a fact and a simple, proud one...

> "You written your game yet?"
< "What?"
>"You were writing a game on the computer?"
< "You mean my project at work, the system software I was writing?... yes I checked it in last week after months of work".
> "But its a game?"
< "No, is a software system"
> "But you play games on the computer"
< "Not at work"

This was about my work... Nice to know my professional conduct is considered playing.


Saturday 28 April 2012

Blogger New Look

I'm busy sorting out the big post I have for the world, it details the virtualization, installation and usage of subversion on Windows and Linux; a very useful post.

However, I'm having difficulty with the new Blogger back end, first things first, the button for "new post" is just a pencil... I don't use pencils, I'm not an artist, and I'm not practising my handwriting (a common thing here in the UK for children to use a pencil for)...

I also hate the white on near white on orange look, it reminds me of a portal for the Orange phone company, not Blogger...

And then the next problem, I draft blogs, especially large ones in notepad, pasting directly into the Blogger interface from notepad results in lots of the text being broken up over lines... If I paste the text from say "textpad" instead... the text is fine going into blogger, it all rather poor.

And jarring... and I don't like it... I really don't like it...

Tuesday 24 April 2012

J-H-ON


Okay, I'm going to give you all a revelation... My name... Is Jonathan... I prefer "Jon".  People who use my full name are either interviewing me, or telling me off, so don't so it... well don't do it, if you're not interviewing me.

But, I've noticed a strange problem... People read "Jon" or hear others call me "Jon"... and they think my name is "J-H-on"... literally that, not Jon, not John... J-H-on with a hard H in there...

I mean, we've had a King John, we've Little John, we've John the Baptist and John, Paul, George and Ringo, and they're just John... where does this hard H come from???!!??!?

Friday 20 April 2012

New Generation of Programmers


Tomorrow, I'm going to be looking at posting my mamoth post covering a complete set of instructions to install a virtualized copy of Ubuntu into VMWare player and setting up, as well as actually using Subversion, on that as a server... It a huge post which has taken several evenings of my time to create over the last week and a half, it contains over 90 individual images stepping you through the process... So watch out for that Tomorrow...

Today though I want to talk to you about Coding in Schools, there is much hype about the Raspberry Pi, about it showing kids how to code again, like on the BBC Micro all those years ago.  I actually came to my junior school in 1985 slightly after the bust period in that computer boom.  By the time I had left in 1989 I had played on the BBC Micro a few games, learned to roughly program the turtle to draw a shape on the floor and to see the first Archemedies model computer be bought by the school.

At home I always had slightly better technology, I had a Commodore with its brand of Basic, which I did knock up a few programs on and did spend time learning to type with.  Also, I always had a fascination with my Mum's type writer, and being quite young had no real creativity, or rather I didn't know I was allowed to just make stuff up, so I would type out passages from books we had around me, Thomas the Tank engine being a favourite.

All this lead to my pretty much ignoring IT as a GCSE topic, I took one look at the syllabus and also had heard a lot about the teacher being prosecuted for touching a lass up in another class, and pretty much passed on that and went onto fail French in spectacular style.

When I went to look for my A-Levels though in 1994 there was a whole new generation of machines in full swing, 16bit computing was slowly giving way to 32bit, Intel had released the 80486 and the dancing men in clean room suits of many colours were on the tele... So, along with Chemistry and Biology I opted to take Computing...

Now, in 1994, I walked into a class to learn computing and I immediately fell in love with the idea that I could type a few commands into this computer and get it to do what I wanted.  The interface (Microsoft DOS) was well behind what I had at home (GEM on TOS).  But this more primitive low level view of the machine let me fall in love with programming it... Raspberry Pi might very well do the same, its main purpose is to be cheap, the software its presenting could be virtualised as a copy of Linux on any Desktop PC, so no matter how many PC's a school has invested in now all the pupils could be taught on a common virtual platform to use the same virtual software and then as they perhaps get Pi's they can switch to them and have a head start... All well and good...

But, often, pupils coming to programming now are far too used to the GUI, far too used to pretty interfaces and they're not interested in algorithms.  I've fallen foul of this myself, I spend more time making a program look the part than actually be the part.

Spin back a couple of days to my post about programming Pascal on the Atari ST.  At first I saw it as a real pain in the bum to get that system up and running and programming and it was slow to compile and impossible to effectively debug... But... I had the raw power over the machine, I was in charge, my program was all it had to contend with, there was no worry about Windows kicking in, or timing problems with my program being removed from the CPU, or the virus scanner taking over and ruining performance... It was very raw, very basic... very simple...

I'm yet to have a proper good look at the pi, but if it can nail this back to basics in the hardware as well as the price it may well be onto a winner to produce a new genertion of good programmers... Better than me and all my lazy, lax, short cut taking ways I hope...

Wednesday 18 April 2012

Aluminium Foil on my Sandwiches Please....

I've come to the conclusion that to get the perfect, home made, sandwich to stay perfect at my work (with its downdy used & reused air, poor temperature control and slight odour du used training shoe) that I need to wrap it in two layers of aluminium foil...

Not the soundest ecological proposal I admit, I may even start trying to save the foil to use it day after day, but after using sandwich bags, clingfilm, paper bags, a plastic box and buying one from the local shop I think that the home made sarnie is king if wrapped right.

The plastics all left the food with an after taste, the paper bag was too fragile in my bag with alsorts in it, and the clingfilm.... well, not only did it leave a taste on the food, but I've noticed that clingfilm today smells horrible - as a kid it used to be pretty inert stuff but modern clingfilm stinks really badly.

The aluminium foil however keeps the sandwhich in shape, supports it structurally and chills the sandwhich more effectively than plastics... That's my two penneth for the day.

Tuesday 17 April 2012

Pascal Programming on the Atari ST

Here's a strange feeling... I have the feeling that I've just done something unique for the day today... I think no-one else on this planet was coding Pascal on an Atari ST today... But I was...

I watched a video where by one of the tenants to meet in order to consider yourself a programmer was to know five languages fluently (that's computer programming languages folks, not GCSE French or German).

My considerations for my five languages are C++ (and therefore C), C#, Java, Pascal and Perl.  The latter I'm fairly rusty on, I only did one major task on it and that was a while back, so I'm going to have a look back later.  The C family and Java I use all the time... So this left Pascal.

I always put Pascal down, its on my CV, its one of the first languages I ever learned, its certainly the first language I actually coded and put through a compiler and linker (rather than just interpreting), I learned it in Turbo Pascal for DOS and my first job after leaving university was to work in Delphi (a derivative of Pascal) coaxing some legacy systems of my employer from Delphi to Borland C++ Builder standard code.

But that was a LONG time ago.  Over a decade.  So I took a step back and looked around for a copy of Turbo Pascal (I own one so it was around somewhere) but all I found was a broken zip file and a few 16bit applications I could not run on any of my current machines.  My old Laptop (the one my brother had stolen in a house burglary about eight years ago) had it all on it, so its gone... What Pascal/emulator/virtual machine do I have which I can work and reference and remember?  And you'll never believe where I ended up.

I ended up with an Atari ST emulator and making an image of the ST Format cover disk with Personal Pascal upon it.

My first task was to extract the Cover Disk LZH file - which took oh sooooo long.

Then I set up my desktop and got used to the interface again.  I love my Atari ST, I have the real machine under my desk and software still hanging around.


So, I'm using Hatari, compiled under gcc running on ubuntu for this work...

The challenge I had then was to pick something to actually do, I chose a simple application I have on the back burner for an item on GetACoder which I've bid on, and started to port the code from C# to Pascal...


The first thing I realized was how little infrastructure, or helpful, code there is in Pascal, you have to declare everything procedurally, my brain is very much object orientated.  So thinking procedurally rewired a whole bunch of connections in my brain... Then I had to remember how to use pointers in Pascal... I remember fighting with this before (when I was 16) but now, with years more experience I breezed through the logic and the allocation and disposal of resources.


The application was back together pretty quickly... except... I had a couple of bugs, the first bug I had was that in the iterator passing down the linked list of integers at each row in the code it was not referencing the correct "next" pointer.  So I had an infinite loop... doh.

But, oh my god, what a ball ache to debug it.  There is no debugger in this free Pascal compiler/linker, so debugging I was reduced to the level of primitives...


Putting in writeln statements looking where the code went wrong, instead of calculating values on the fly I was having to declare variables for them write them out to the screen and check their value visually as I let the program move between readln statements... Utter total ball ache.

But in the end the program was running...

(Don't worry about the negative values, thats just the 16bit integers rolling over a lot earlier than they do in my 32bit implementation).

The code, I'll post another day for you folks to enjoy... But this little foray into ST nostalgia did one of two things... firstly, finding these bugs in the code made me become very intent on the software as it left my fingers, far more intent on making sure its correct than I am with modern systems - where a quick compile helps find what's going wrong where - in the ST to compile this trivial code was a lengthy operation - taking up to a minute to compile and link alone - this changed my approach to the code, I was attentive, nurturing and double checking at each step making sure the logic was perfect that simple typo's and spelling mistakes were not made... I missed code complete terribly, but this lack of functionality pressed me to be a better programmer.  I had to remember what I was doing, where and when, I also have to think about the names of the functions and procedures I was laying down and remember their names, names which I had made meaningful.

All in all, to this point the coding has been a successful exercise.  Helping me refresh my knowledge and count my blessings working as a developer today.  On some levels I miss this kind of coding, closer to the machine, down near the bare metal, but in many more respects I thank progress for the innovations of modern development environments.

The absolute weakest thing about the code I produced on the ST however was that, because editing was such a chore, because there is only limited memory (1 megabyte) and that to have to strip the code down for compilation comments would take extra memory space, I simply ceased commenting my code.  I suddenly understand how frustrating some of the code problems I dealt with as a Millennium Prep manager really must have been for the folks I kept whipping into a frenzy.

Monday 16 April 2012

Irish Stout Bullies

I have an Irish Stout irritation, now I've travelled, I've seen how the Irish, the Welsh, the Scottish and the British bar staff of several hundred different drinking establishments pour an irish stout... I've watched TV adverts, and I've seen posters...

And you know what I've noticed... No matter how, or in front of whom, you have a pint poured if there's a person of Irish origin, descent or ancestry with you at that moment they'll say....

"Oh, god look at the state of your (insert brand name here)"

This is not only irritating, but this pint, will I guarentee, looks exactly like the hundreds of previous pints of said libation which you have enjoyed without this input by your co-drinker.

I don't know if there's some rule, some law, calling down the genome to the Irish blood to make their mouth insist on saying this utter pish statement or what, but they say it...

I've got a standard English reply for them, as they're about to moan about the state of your pint, pick it up and as you are about to touch cold glass to lips whisper "Cock" and carry on to take a big swig.  Settled or not!  That really riles them.

Friday 13 April 2012

Image Processing in C++

This evening, I've been playing about in code, I was looking for some method of rasterizing bitmap data to an off screen surface and saving it to disk, I settled on using CImg in the end, and my first task was to perform some grey scale conversions.

I started with this image, which I got from a google search, and I moved onto implementing averaging grey scale:

This is (r + g + b) / 3, simple....

I also implemented a scaling based on luminosity and another on min-max averaging...  Here are the results...

There are subtle differences when you zoom into these images, the last one the Luminosity one is the clearest when you inspect it carefully, and so I used that to start implementing some Sobel mask edge detection.  Here's the output of my implementation...

Right now I'm going to bed, but I'm tempted to tidy my code and post it here in the Public domain, I'm sure I've seen some degree level image processing modules based on this, any universities out there want to give me coarse credit?

Thursday 12 April 2012

IT Hiring Duds

So, I was reading this, and just nodding along... This is nothing new, for about the last decade I've been seeing Asian origin graduates leaving the UK going home to get jobs, and they clearly may be making up the successful amount of IT hires out there.  I myself shared the very end of my final year digs with four chaps from Malaysia...


But, the whole phenomenon of poor IT hires is nothing new.  I come from a mid-way generation of IT trained persons, I did my A-Level and degree in the shadow of the 8bit and 16bit computer businesses of the 80's, where money was king and getting rich with IT easy.

The intellectual challenge back then was not to excel at the subject, but instead to proove you knew what the heck you were doing with anything... I remember one interview where I walked into a room and was just pointed at a running PC and told to change the CPU for another the chap handed me... Then I remember an interview which was to sit down and do a 4 page (pretty bloody terrible) mathematics paper (which incidentally I refused to do - on principle that they were going to be interviewing a Software Engineer on the topic of Mathematics they may as well check your doctor is okay by handing them a joint of beef to carve - and I walked out)...

But whilst I was training there continued to be this under tow of other hires around me, whom were not IT trained, they might have a computer at home, they might have; at the time; had exposure to a BBS or the infantile internet and so they were considered a good hire, they were a quater the price of me with my six years dedicated academia and years of experience - they're well over a tenth the cost of myself now.

And they still get hired, they still proove to be ineffectual in the roles, they still prove to be useless and they still move on after 2-3 months.

There have been many here where I am working now, one famous case the chap appeared, never spoke to anyone, made accusations about everyone being Christian pigs, copied all the software from the cabinet and spent all day on the phone to "home" which was the other side of the world... He got fired in the end... But just taking one look at him, when he started, I knew he was another of these dead-end hires, it was painted all over his face along with the shit eating grin he had...

They still get hired, they still exist, the UK has suffered them since the 90's and still suffers them right now, they talk the talk, but don't walk the walk, and I'm so happy to see this is a universal problem.

P.S. If my bosses are reading, I'd love to be on the hiring committee for programmers/technical people coming to the company!

Tuesday 10 April 2012

RIP - Jack Tramiel

In my opinion the passing of Jack Tramiel yesterday is more a watershed moment than the passing of Steve Jobs, yet there has been neary a squeek about Jack crashing into the ether of eternity... The father of 8bit computing in the US - with in roads into the UK - where we think of Clive Sinclair and Chris Curry as presenting the UK with affordable 8bit computing, it was Tramiel and his companies (Commodore and Atari) which brought 16bit computing to the UK and world, at affordable prices.

The father, in some ways, of the C64, C16, VIC-20, Atari ST, TT, MegaST, Falcon and all those miriad of Amiga models, the man has a story to rival and even eclipse many other "industry titans", from Auschwitz to California his rise was meteoric, not accidental.

So, I for one say thanks to Jack for his machines, for his life and thanks for all the memories:

Jack Tramiel - 1928 - 2012

New Following Blogs

I think I need to find new blogs I'm following, because... Well I'm not following a single one of the ones listed down there, Darren changed his blog from the venerable "Common Sense Gamer" to the"Catholic Gamer".. Not long after I appeared on his great podcast... and I lost the taste for it... My friend at Wenton changed and has two other blogs, and of the others only Massively I've visited in the last month.

I need new blogs folks, so suggestions please.


Monday 9 April 2012

Breaking it to the Wife...

I'm trying to figure something out, I'm trying to figure out how to tell my wife that 40 minutes is not enough computer time... that to program, you have to be left for like 3 hour stretches, and only contacted if there's going to be some coffee arriving with it.

And that the silence after they call your name is not "ignoring" its holding 7 +/- 2 items in short term memory and so scrabbling around for a pen before replacing some value with "let the dog out" or "empty the dishwasher".

Now, I love my wife, she's doing some great job trying to understand that my sitting at a desk for 9+ hours a day typing code does actually pay the mortgage, and therefore I'm not just full of shit when I say I do something for a living that means "playing on the computer"... But she's not getting the time scales involved.

Her job is nursing related, caring related, so she does a task for a person in 10-15 minutes and moves on.  Her mother before her was a nurse, does 10-15 minutes on a task and moves on, her Father is a builder, he hammers in a bunch of nails, lays a load of bricks, plains a bunch of wood and moves onto a new task, he's quick, he'll not spend more than an hour on one task...

I however... I might have to spend 4 hours on one class, or designing something, or documenting something (yes I'm a programmer - not a coder - because I document my stuff folks - hehe).  All this takes a LOT of time... and I'm trying, slowly, to introduce her to the concept.

My current strategies however are to shout "Yeah, a minute"... "I'm on my way, I'm doing a compile" (compiled - she's witnessed can take from 15minutes up to an hour, so she has seen LARGE projects being built - I am not going to tell her that "normal" projects build in about 10 seconds... Not until she's worked out that 99.98% of the time is cerebral and her yelling form three rooms and one floor away, is annoying the shit out of my concentration.

SVN Dump

So, I've had a few hardware issues over the last few days, I had hoped to sit down and get on with some coding; of a project which is now four months without any love and needing a LOT of input... But, hardware has stepped in the way.

First of all, I had a failing hard drive in my development machine - I had to pull the drive and then start a fresh install of Windows for that machine (its my main Visual Studio machine so I am at pains to virtualize it itself), this may seem no big deal, but I currently only own the abortive step child that is Vista, so my Windows experience on this machine is always... interesting to say the least...

So, fresh install, no problem, set back up, Visual Studio up and running and I even had a peek at the 2012 Beta of Visual Studio - I agree with everyone else, the monochrome feel is very annoying.. But then... I couldn't get to my code server...

This was strange as the code server is approximately 3 inched to the left of the machine trying to get to it, they're connected via a 10 port gigabit hub... And it all always worked before... I checked the code server (Ubuntu Server with Apache & SVN) its fine, its got its external wireless connection to the internet and its static IP on the physical connection to the hub...

I check the Windows machine, its also got its wireless connection and a supposed static IP address on the local connection across the hub... Yet neither machine can see one another... This was holding up code time at 10pm on a night when I was not only dirt tired, but that I had to get up to do some complex coding at work the next day... So it pretty much frustrated the crap out of me.

The next night I never got to take a look at the problem in depth, just to play about with the Linux side and try some ifconfig alterations, all to no avail.

I have tonight however, four days later, in the midst of the Easter weekend, managed to take a good look, and I've figured out, after an annoying amount of reboots, the problem... The problem is fucking windows... Get this... To set the static IP address AND use the Wireless I have to do the following:

1. Disable the wireless connection.
2. Set the wired connection to DHCP.
3. Reboot.
4. Set the static IP into the network interface on the wired card.
5. Reboot.
6. Check (by pinging) the server that we are on the network.
7. Check (by pinging) the Windows machine its on the server.
8. Enable the Windows Wireless connection.
9. Reboot.

Now, I am able to use both the wireless and the live connection to the server... VERY annoying, since the same thing on Linux can be achieved from the command line in two commands without needing to reboot like a moron...

Second on my list of woes, is that the server itself went down, well, not down on purpose but I decided to swap boxes about.  My standard server machine layout has always been a 32bit cut of Ubuntu server, this is what one assumed was on the server... So, I could hot swap the drive, right?... Right?...

Nope, the server had an install of 64bit Kubuntu... I do not know why... Even being 64bit the machine had only 2GB of RAM in it, so it didn't need to be 64bit... And I'm amazed I set up the major code server for this pretty important system as a 64bit cut, when I have no back up 64bit machine...

So, what was I left doing?... Basically, I've put the 32bit server back together, and installed a lovely new cut of Ubuntu on there (I've gone with a Gnome desktop environment, so I can do some build machine testing later with some GUI tools).  I've then set up apache, SVN and some basic tools to get things working and had to manually add my export of the old repository back in there...

No big deal over the now working gigabit local network (don't ever try to rebuild a 2GB repository over wireless - lol).

But still I feel like I've wasted so much of this code time for Easter.

Tuesday 3 April 2012

Coding Standards: Naming Conventions

Started to the C++ 101 coding standards, by Herb Sutter et al, last night... I love reading C++ books as it gives me a real refresher on the topic and spurs my development work, the last books I read were by Scott Meyers, whom I have a little bit of a coding crush on, his texts are so clear and concise they're lovely to read and if, like me, you are interested in the topic you can re-read them all the time.

I was hoping of more of the same from Herb and co... However, this is the first I've come to read from them and I'm finding it a little annoying.  I've not read much, but I want to just pick one one specific item they mention:

Naming Conventions.

In the first piece (which they correct point out is section zero), they moot naming conventions, they rightly say "pick a naming convention and stick to it" but then they say "and if you've not got one, use this" and go a head and give very brief examples of how they would name things...

Now I hope that as the book unfolds they've not used those naming conventions, as not only did I personally not like them, but I believe firmly on a modern IDE they'd actively come to make coding more work than it needs be, let me explain.

With the code completion tools you get the variables, members, parameters and functions all listed out (usually alphabetically) so if you define three variables

class Foo
{
  public:
int C;
int B;
int A;
};

And then from an instance of the class:

Foo f;

You try to code complete:

f.[Right here you get the code completion options]

And you don't get the order they were declared in.  No, you get them, in every IDE I've used, in alphabetical order, so you see a list

f.[A]
  [B]
  [C]
  
To choose from.  You can then select the item you want, or see it shown to you do you can quickly carry on typing it.  If you remember the variable already then, no harm is done, but you may find a typo or spelling mistake in your declaration if the suggested code completion does not show your required item.  A good double check to use.

Selecting the suggested code completion item is also very trivial, so now think about a more structured class, with functions and members and constants... How can you tell one thing from another, do you want your member spreading all over that code completion list?  Or do you want to be able to see all the members together?  See all the constants and tell the locals from the parameters within functions?

I know I want all those things, so my coding standards differentiate between members, locals, parameters and such by pre-fixing them with:

m_ for members
c_ for constants
g_ for globals
p_ for parameters
l_ for locals

even e_ for enums, though I do admit I use c_ for some enums.

This comes from a little bit of experience that "Hungarian" notation as was is pretty unhelpful at times, and that following variable names with such post-fixes still leaves them in a messy order in the code completion suggestions.

Putting m_ infront of all the members acts as an aggregate to put all the members in the 'm' section, likewise all the locals together and so forth.

Some argue that just underscore be used as a pre-fix for member names, this is often used, if I see code using that style I will adhere to it, but I still maintain the strength added by aggregating with 'm_' over just '_'.

I firmly believe my style allows people to read my code and understand the difference in scope and usage of my variables a lot more readily than other approaches.  I have been openly told this is "Shit", in professional environments, but time and again I've proven its worth to myself, and I hope others, when I have been able to pick up code after 6 months, a year, and recently even as old as five years and gotten straight back into the swing using it.

I have seen other arguments for and against pre-fixing names in any fashion, and even witnessed a strong flow of programmers preferring to post-fix names with just '_' for members.  I personally find this abhorrent, it negates my points about aggregating the members together in the code completion (which even the pre-fixing crowd agree with) and post fixing with '_' leads to terrible code to read:

class Foo
{
   private:
      int Age_;

   public:
   
      Foo (int Age)
      {
         if ( Age > Age_ )
         {
            Age_ = Age;
         }
      }
};

This example shows us, how close "Age_ = Age" could be to a typo of "Age-= Age" and a big headache in the code.

So I suggest you steer away from post-fixing in naming conventions, try pre-fixing and perhaps consider trying my idea out, start to read "l_" as local and "m_" as member in your minds eye as you sound out logic it can be very helpful, and in this example given, it lets you determine all the levels of variable in use:

class Foo
{
   private:
      int m_Age;

   public:
   
      Foo (int p_Age)
      {
         if ( p_Age > m_Age )
         {
            m_Age = p_Age;
         }
      }
};

So, I read that function as:


"if parameter age is greater than member age set member age to parameter age"

Much clearer than the previous, which I can't help but read as

"if age is greater than age score set age score to age"

Shorter to sound out, but a lot more confusing to, especially to less experiences programmers (or beginners).

Now, all this said, I can not deride anyone coding, coding is hard work and takes a lot of concentration, however as we gain experience as programmers we need to stop thinking about just splurging the code out, we need to think about maintainability, about poor souls whom may not have 10+ years in the industry and whom have "seen it all"... So we need to police ourselves, to rein in coding habits and let out coding standards.

This is my naming convention standard, its not better or worse for you than whatever you use now, but for me it works, and I hope I've explained why it works well enough that you perhaps think about using it.