Monday, 14 April 2014

Avalanche Sharks!

"Avalanche Sharks". Oh lord it is so bad. I need to wash my eyeballs with bleach. A pineapple enema would be better. Is this Ebola? Or am I just bleeding from my eyes in shock? Demon sharks in snow? Wait. What? And what's with that dog? They've tasted human flesh! Oh why, oh why do I watch these movies? Because they are soooooo bad. That music? Dum Dum Dum! That's actually Dumb Dumb Dumb! Teenagers. Spring break. Guns. Avalanches. Sharks. Ancient Indian Burial Ground Sharks. That haven't eaten for 25 years! What could possibly go wrong? "They love people meat" Apparently. And leap into spas full of spring break teenagers. And burst out of the ground to eat guys proclaiming love. What's next? Tree sharks! Swinging from tree to tree! Great sharks! In british columbia! With their girl by their side! And they'll sing! Sing! "I'm a lumber shark and I'm ok! I sleep all night and I eat teenagers all day!" I swear some of these lumber sharks are Canadian! I would swear i heard one lumber shark say"sorry" as it ate some one. Spoiler alert! Some random Japenese tourist straightens some bent sticks! And. And. Lumber sharks vanish! Next in this gripping shark fest: "They thought they were safe on the space station..." Monkey Space Bread Shark! From the people who brought you"Killer Croissants" and "Blood Soaked Baguettes"! Bread Sharks! High gluten terror! "This time... The bread slices you!" You know... Seriously... SciFi would probably make that movie. Er... I'd watch it... And while I'm on a ridiculous point, I've figured out why SciFi produces these appallingly bad movies. To stop an alien invasion. "Wait. What?" I hear you say. Well think about it. Our movie broadcasts are being picked up from civilisations out there. And to be sure their unaminous conclusion has to be: "Land there?! You're joking right? Have you seen the sharks? They're fucking everywhere. They fucking fly for GondFlangle's sake! No fucking way am I exposing my crew to that place.You can't conduct a proper anal probe if you aren't sure there aren't such things as ass-sharks! It'd be be Butts, Blood and Gore all over the medical bay"
What's next? Ben has some ideas... ArachnoShark! Swim into my web of terror! The eight finned freak of nature! Eight mouths! Eight Eyes! Eight stomachs! Eight fins! Eight... Eight... Oh... Whatever

Friday, 7 March 2014

I'm 57. I'm not old.

To anyone who hasn't had a Pythonesque upbringing...
Well...
You missed out.
Sorry.
Better hit the 'back' button because you're unlikely to get any references from here on in.

Now.
Where was I?
Oh yeah.
57.
I'm not fucking old!

Old is when you accrete cats.
One that pisses everywhere and is called Samson not because he's strong but because he has long hair.
And he's a she.
And one that refuses to be petted and shits in your shoes.
"Those" kind of cats.

And you have one of those ride on carts.
With "Go Faster" stripes.
And aerials.
And a stick so you can poke young people and say: "Get a job! Cut you hair! Marry a cousin!"
Maybe not the latter although Pat Robertson may disagree.

Wait.
What?
Where was I?

Oh!
Yeah.
Being old.
No.
No. Fucking. No. .COM.
Not old.com.
"Experienced"
experienced.com.

"Experienced" My Fucking Phhhbbbttt.

I just survived.

Survived the cold war. Fucking nutters.
Survived hippies. Fucking nutters.
Survived Ayn Rand. Fucking nutters.
Survived fucking tons of crap...
Well..
Get off my lawn!

Served.

Anyway.
Where was I?

Oh Yes.
Minecraft.

Getting a tad annoyed.
Seems like I spend time building spectacular... Wait.. Adequate.. Wait... Shit... Apartments...
For testificates.
They swan around.
They are ignoring the Tom Clark Memorial Mega Tower (Thanks Sips) I spent fucking ages building.
And they... Well... They're "young".
And they expect me.... Me... To provide them with a Mega Tower.
With shopping malls.
And the MC equavalent of FCUK.
Wait.
What?

I'm the geriatric.
They're folding their arms and acting like it's expected.
Screw them.

I'm the geriatric.
So screw minecraft.
I'm following Sips lead and trying "Banished"!

Oh.
Oh Crap.
Banished needs Windoze.
Oh crap.
Bugger.

Bloody young whipper snappers.
What the hell is a snapper anyway and why would it whip?

Wait.
What?
Is it someones birthday?

Tuesday, 11 February 2014

Frickin Chocobos - Tennis elbow generators

Ok. We have a Hexxit server.
So one day my other half suggests I breed chocobos.
"Why yes," I say, "That sounds like a good idea."

WTF was I thinking?

I managed to scrounge up a few yellow choco-bastards and corralled them as best I could.
Grew acres and acres of frickin Gysahl Greens.
Then off to the pens.
Right-Click, Right-Click, frickin-right, frickin-click.

I am so SICK to the back teeth of right clicking.
And the incessant "Wiperoo" sound they make.
Aaaaaaah. Frickin Aaaaaaaah!
I'm going nutso-bong!

So after many, many hours of right clicking I get a few Greens and Blues.
And after many, many hours of chasing the mad, flighty bird-bugger-it-i'll-kill-them-alls around I manage to get 3 whites ones.

And... Wait for it... They're all FUCKING female.

Now I want to share something.
Something dark.
Very dark.
And I *KNOW* dark.
I want to imagine you've been breeding these frickin noisy flighty birds for ages.
And you try once again to breed a white one.
And you get yet another frickin baby Blue or Green.
And you snap.
Snap.
Snap deeply and profoundly.
"Crack goes the mind boys, crack, crack, crack."
And you chase that frickin little choco-kid-bastard around with a steel sword until you get it.
And you retreat from the awful, hateful, awful, incessant "Wiperoo" sounds to the safety of your house.
Burdened down by frickin blocks of frickin feathers.
WHAT THE FRICKIN USE ARE THE FRICKIN FEATHERS?
I HAVE FRICKIN CHESTS FULL OF THE STUPID THINGS.

Anyway, calming down now.
Deep breaths.
Chests with 12 by 64 blocks of choco-drum-sticks.
Cooked.
Cooked child chocobo-drum-sticks.
Nom.
Nom Nom.
Nom-frickin-child-chocobo-drum-sticks.

Oh the choco-bird-ity of it all.

Then!
Then!
Then your spouse announces that he's been to the Nether and managed to coax three PURPLE chochobos back.
And crows over his achievement!
Oh.
And he has equipped them with saddles.
And...
And...
I just remember being up to my arm pits in chocobo-chicks with a steel sword.

I FRICKIN HATE chocobos.

And I have tennis elbow.
In the real world.
Frack it.

I'm off to dig a hole.

Update! My other half took some umbrage at the above. He suggested that his effort to bring back Purple ones from the nether was a Herculean task and he should be lauded. I did that female thing of staring at him in a 'pointed', 'dagger' like manner. He suggested that I open a Kentucky Fried Chocobo Stand. I demurred. Meh.

Ruby: Class loading/unloading example

Recently I had the unfortunate task of writing specs to test a singleton.
Why would that be a chore I hear you ask?
Because the singleton in question had several configuration options.
Most of which were file based.
So out of the ~60 specs, 50 of them were for error conditions.
(File missing, folder not readable, not JSON, JSON but with invalid stanzas etc)

The problem was that each test had to start with a clean slate.
The singleton class must be pristine and new each run.
How the hell do you do that?

Unload the class, then reload it.

I fiddled about quite a bit with this, so I've put together a simple project that illustrates how this is done.

The bottom line is that you have to send :remove_const and the class name to the module or whatever your class is defined in.

For example, say a class is defined in a file skavee_bloopsie.rb thus:

module Skavee
  class Bloopsie
  end
end

Then this is what you run to unload and reload it:

Skavee.send(:remove_const, :Bloopsie)

This works at any depth of modules:

module A
  module B
    module C
      class Z
        def ohai
          'ohai!'
        end
      end
    end
  end
end

A::B::C.send(:remove_const, :Z)

You can test this yourself by copying and pasting this into irb:

module A
  module B
    module C
      class Z
        def ohai
          'ohai!'
        end
      end
    end
  end
end

a = A::B::C::Z.new
 => #<A::B::C::Z:0x007fc78c9b1dc8>

puts a.ohai
 => "ohai!"

A::B::C.send(:remove_const, :Z)
 => A::B::C::Z

b = A::B::C::Z.new
 => NameError: uninitialized constant A::B::C::Z

And here's the Gotcha!

a.ohai
 => "ohai!"

Wha? Well it's obvious. The instance is still being referenced.

So be careful out there people.

An example gem is available via my repo at https://github.com/ZenGirl/ruby-class-unloading

Friday, 11 October 2013

RubyMine GitLab Integration

I setup the community version of GitLab so I can have locally controlled projects.
Since I use RubyMine as my IDE, the integration with both github and gitlab was a bit convoluted.

First I couldn't get ssh to work, so I used http (since it was on my home network) to get the push/pull working.
(There are links to pages explaining how to fix that at the end of this post)

One you have GitLab running, you can create a project.
After doing that, you get to see a page with boxes telling you how to connect using git from the command line.

One thing to note is that there are two commands to set your `user.name` and `user.email`.
The key is that they use `--global` which is problematic.

So. Let's say you have created a project called `test`. Do this:

cd [your projects folder]
mkdir test
cd test
git init
git config --local user.name "YOUR_NAME"
git config --local user.email "YOUR_GITLAB_ACCOUNT_EMAIL"
git remote add origin [HTTP_URL_PROVIDED_BY_GITLAB]
touch README.md
git add README.md
git commit -m 'Initial'
git push -u origin master

You can have 'port' and 'groups' so the url could look like this:

http://gitlab.local:8080/home_projects/testing.git

Ok. What about task management integration?

Fiddly, but doable.

First, you have to use the GitLab API.
And for that you need your private key AND know the project number.

When you issue a curl request you get back JSON:

curl http://gitlab.local:8080/api/v3/projects/3/issues?private_token=YOUR_API_TOKEN
[
    {
        "id": 4,
        "project_id": 3,
        "title": "Some task",
        "description": "Some description",
        "labels": ["Enhancement"],
        "milestone": null,
        "assignee": {
            "id": 4,
            "username": "bill",
            "email": "bill@bill.com.au",
            "name": "Bill Bloggs",
            "state": "active",
            "created_at": "2013-10-10T22:59:26Z"
        },
        "author": {
            "id": 4,
            "username": "bill",
            "email": "bill@bill.com.au",
            "name": "Bill Bloggs",
            "state": "active",
            "created_at": "2013-10-10T22:59:26Z"
        },
        "state": "opened",
        "updated_at": "2013-10-11T01:07:50Z",
        "created_at": "2013-10-11T01:07:19Z"
    }
    ,
    {
        "id": 3,
        "project_id": 3,
        "title": "Another task",
        "description": "Another description",
        "labels": ["Bug"],
        "milestone": null,
        "assignee": {
            "id": 5,
            "username": "bill",
            "email": "bill@bill.com.au",
            "name": "Bill Bloggs",
            "state": "active",
            "created_at": "2013-10-10T23:00:19Z"
        },
        "author": {
            "id": 4,
            "username": "bill",
            "email": "bill@bill.com.au",
            "name": "Bill Bloggs",
            "state": "active",
            "created_at": "2013-10-10T22:59:26Z"
        },
        "state": "opened",
        "updated_at": "2013-10-11T01:07:59Z",
        "created_at": "2013-10-11T01:06:54Z"
    }
]

So how to get RubyMine to use this?

1. Open preferences -> tasks
2. Change 'Changelist name format' to {project}-#{number} {summary}

Under Servers, add a 'generic' server

In the general tab:

1. Change the server URL to http://YOUR_SERVER/YOUR_REPO_WITHOUT_DOT_GIT
2. Insert your username and password
3. Click 'Use HTTP Authentication'

Go to the gitlab server and under your account settings, there is an input box with your private key.

Copy it.

In the additional tab:

1. Add the URL: http://YOUR_SERVER/api/v3/projects/PROJECT_NUMBER/issues?private_token=YOUR_PRIVATE_KEY
2. Check the 'JSON' option
3. In the Task pattern insert: "id":({id}.?+),.+?,"title":"({summary}.+?)"

Hit test.

You should see 'Connection is successful'.

From now on you should be able to use the tasks drop down.

FYI When creating tasks in gitlab, there is an irritating anti-feature for assigning labels.
You have to type them in.
The set I use is:

Enhancement
Bug
New Feature
Quick Fix
Duplicate
Invalid
Question
No Fix
Documentation
Presentation

I still need to figure out how to have GitLab return the project name ala TestProject-#{number} {summary} format.

Off-topic: Go read
https://wiki.archlinux.org/index.php/Gitlab#Backup_and_restore
and https://github.com/gitlabhq/gitlab-recipes
and http://api.gitlab.org/
and https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide
and https://groups.google.com/forum/#!forum/gitlabhq

Friday, 4 October 2013

__rvm_date syntax error: unexpected end of file

When running rspec tests inside RubyMine, you may see something like this:

 sh: __rvm_date: line 1: syntax error: unexpected end of file
 sh: error importing function definition for `__rvm_date'

What worked for me is to shutdown RubyMine and edit the

 /Applications/RubyMine.app/bin/idea.properties

file and add:

 rubymine.console.environment=disabled

To the end of it.

Apparently there is a bug for it at:

 http://youtrack.jetbrains.com/issue/RUBY-14308

Something to do with loading rvm through shell inside RubyMine.

em::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Ok.

One day you'll see this:

$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.rubygems.org/gems/rake-10.1.0.gem)
An error occurred while installing rake (10.1.0), and Bundler cannot continue.
Make sure that `gem install rake -v '10.1.0'` succeeds before bundling.

Wait. What?

Worse is when you do a `gem list --remote` you get NOTHING.

WHAT? PHHBBTT! [Brain melts]

The issue is somewhat arcane and is embedded in rvm using openssl.

Let's have a look at the certificates:

$ rvm osx-ssl-certs status all
Certificates for /usr/lib/ssl/cert.pem: Old.
Certificates for /usr/local/etc/openssl/cert.pem: Up to date.
Certificates for /etc/openssl/cert.pem: Old.

Ah. So what worked for me is:

rvm get stable
rvm reload

If you still get 'Old' on the status, do this:

$ rvm osx-ssl-certs update all
Updating certificates for /usr/lib/ssl/cert.pem: Updating certificates in '/usr/lib/ssl/cert.pem'.
...elided...

and now you'll be able to bundle again.

Saturday, 7 September 2013

Iron Man Zombie Robot Hitler is not happy - and he has a gatling gun

No.
I'm not kidding.
Ben keeps finding these movies.
I don't know how he does it.

He's a node warrior.

In any case 'Nazis at the Centre of the Earth' is worth a look.
If you are into gouging your eyes out with forks that is.

It's appalling.
There are so many 'WTFFF?' moments in this movie I couldn't even begin to do justice to it.
Although in this case justice might be better served by getting every copy on the planet and burning them.
Oh.. And the extra two F's are 100% totally insufficient.

I think the point when I said "Ok. This is very, very bad" was when an Lockheed P-3 Orion survey plane encounters the Nazi saucer rising out of the Antarctic ice and the radio conversation goes something like this:

Pilot: "I'd like to report a UFO!"
Off-Camera Dude: "UFO?"
Pilot: "Yes! It's huge!"
Off-Camera Dude: "You're cleared to engage!"

Wait. What? Engage? With what? Bad language? This is an Orion, not an F-18!

And then the Orion launches 8, yes *eight*, Hellfire missiles at the saucer.

"Calm down Kim... Breathe..."

Two things.

1) It's a frackin' survey plane. I know the Americans go a little gun happy arming things, but an Orion? In Antarctica? Hellfires? Eight of them?

2) As the pilot of the Orion, I would notice that the saucer is size of Nebraska. Oh. And the rivets holding it together were 3 foot across. Eight Hellfires would not be enough. Sixty four wouldn't be enough. I'd be "gone".

Oh.. And Robot Hitler? Cool. In a "WTF?" kinda way. I kept asking myself some things:

1) Why does he need to sit down? He's a frickin' robot.
2) Robot Hitler?
3) Gatling gun?
4) [Head explodes]

But I digress.

Wait. Where was i?
Oh yes.
It's KRAP.
But in a that "Wouldn't Miss It For The World" kinda way.
A kinda "Robot Hitler with a Gatling Gun" kinda way.

Wednesday, 4 September 2013

A Movie, my D&D roots and software development

Hmm.
Just finished watching "Tad - The Lost Explorer".
Worth it btw... So go find it and watch it.

In any case...
There was a scene where the explorers reach a chamber.
With dozens of different coloured ropes hanging down.
They eventually picked the right one of course...
And the door opened and the movie continued.

I was reminded of my D&D roots back in the 70's.
I ran a dungeon.
A bad one.
An evil one.
A 'gotcha' one.
An 'oh... I'm dead.. Frack!' one.

One weekend I had a dozen or so people trying to navigate my dungeon.
They encountered a room.
With coloured ropes hanging down.
And a door on the other side with "нажмите сюда" on a button.

(For those that don't know any Cyrillic it *very* roughly means "press here" - I'm not a Russian speaker so I apologise in advance for any butchering of the language)

So...
Here was a bunch of very smart people debating how to get across the room and open the door...

And did they debate?

Hell yeah.

For four weekends they investigated every rock, every crack, every sand grain at the entrance of the room.

I waited... Impatiently I might add...

On the fourth weekend, they had catalogued every rock, every crack, every sand grain...
They roped themselves together and formed a line across the room.
The one at the front (A guy who nearly had a heart attack doing it) strapped three spears together...
And with the air buzzing with protection spells, pressed the button.

And...

And...

The door opened.
The rest started the most excruciating process of getting each member, their donkeys, their supplies across that room.
They all made it.

Why? Because there was no trap...
They were inculcated with the idea that every move would be a deadly one.
My dungeons were death traps.
The slightest mis-step would end everyone.

That room.
They called it "The Room Of Sorrows."
Not that room.
I just put a simple room.
No traps.
No death.
No hidden issues.

I marvelled at their ingenuity at bypassing traps that weren't there.

They made it and congratulated each other.

And now, I look back and see how often a team of developers often does the same.
Not every issue is a "Room Of Sorrows."
You don't need to spend hours on some issues.

Sometimes you need to have the b***s to just barrel in and TRUST that you are frackin' smart enough and ugly enough to work out the issues as you take the path.

Pick a path.

Commit.

Oh. And Push... Mustn't forget the push.

Monday, 2 September 2013

GalactiCraft! OMG!

Ok. Haven't posted for a while as I've been rather busy.
Yesterday (Sunday) I decided to rebuild our internal network minecraft server up.
Got bukkit and configured it up and allowed external access to it for my family.

In any case, while doing this I stumbled on Galacticraft.
It's a tekkit mod that is just hilarious and looks very cool.

The site is at:

http://micdoodle8.com/mods/galacticraft

And you should *definitely* watch the podcasts by yoglabs.
Hysterically funny.
I cracked up repeatedly.

My favorite parts are.. are...
Oh what the heck...
ALL OF THEM.
Giant three headed creepers, spiders with spacesuits, Shai Hulud, alien eggs, variable gravity, slow motion skeleton arrows...
I just giggle madly if I think of the spider with a helmet and air tanks.

I could go on...
But you need to go and watch the podcasts.
Do it.
Do it now...

Oh... Shai Hulud... If you haven't watched or read Dune, this won't mean anything.
But don't despair! Go get the book, or watch the movies.
My favorite is the De Laurentius "theatrical" version. (We have all the versions)