Sunday, February 23, 2014

Install ElasticSearch on Ubuntu ... the easy way

ElasticSearch had been on my 'bucket list' for quite a while now, so I decided to fire up my trusty DL-380 and install ElasticSearch on my Ubuntu server.

That turned out to be a breeze thanks to this Gist: https://gist.github.com/wingdspur/2026107



Just copy/paste the area I selected and it'll work like a charm.

Go to port 9200 on you machine in order to get the 'Hello World' response:


Thursday, February 6, 2014

C# discussions had last week

At the project I'm currently working on, we often use TFS code review - here's how:


This week we had some interesting discussions on:

It's not all amazing important stuff, but it was interesting nevertheless.

Monday, February 3, 2014

NDC London 2013 videos are online

This link http://vimeo.com/ndcoslo/videos will take you to the NDC London 2013 vimeo site that contains a bunch of videos from the last event. I'll be sure to watch the Scott Guthrie videos on Azure!



Did a presentation on SOLID

This week I did a presentation on the SOLID principles with my colleague Ivar. For all that don't know the SOLID principles: it's 5 basic principles for Object Oriented Programming that make code more maintainable. Every letter within SOLID stands for a principle, so we have:

S for Single Responsibility
O for the open-closed principle
L for the Liskov Substitution principle
I for the Interface Segregation principle
D for Dependency Inversion principle

Go read up on this if you haven't done so: http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)

My idea of the demo was to take a piece of code - this piece of code - taken from CodeCrap.com and refactor it according to SOLID.



I wanted to do live coding on stage, but I was affraid that that might be a bit too ambitious since then I would have to talk, and code, and keep things interesting at the same time. So what I did was create a GitHub repo and separate branches for each of the stages of the refactoring.

Github for windows allows me to switch branches very quickly so what I did was do the whole refactoring, making sure everything worked at every step. Branched off whenever I had reached one of the principles and during my presentation, just switch between branches.


So I could DEMO live code, work with it a little, but then moving on without having to worry about weather the next step would build or not.

My lessons on the other hand for next time are: think even better about what you want to demo and come up with clearer and better examples.

Here's a link to the repo - and like I said, it's all in the branches: https://github.com/jochenvanwylick/201401_solid_demo

Sunday, February 2, 2014

Angular JS controller inheritance

Something I didn't know in AngularJS is that controllers can inherit from one another. My team member Pieter pointed this out to me and I think it's going to be very useful for us.

We're building a bunch of screens that have quite similar functionality ( start with a GET, POST on save etc ). In normal JavaScript, one can use prototypical inheritance of course, but that's not as evident with the Angular dependency injection.

However, since controllers can inherit from each other, it is! Check out this question on StackOverflow: http://stackoverflow.com/questions/18461263/can-an-angularjs-controller-inherit-from-another-contoller-in-the-same-module



Next week we'll be doing some refactoring!

Saturday, February 1, 2014

Zone.js

At the recent Angular Conference ng-conf, zone.js was presented. What I get from the video is that it's an execution context that lets you hook into ALL the function calls (including async ones) that are executed within the 'zone'.

This allows you to both instrument them properly ( get execution times ) but also possibly add some behavior before and after. Check it out at https://github.com/btford/zone.js/