Moving to GitHub



Despite usually being a commited (no pun intended) svn user I have decided to make the switch to Git & GitHub.

There were two main reasons, one was just a curiousity to see what Git was all about and see how it worked, and the other was that I just really wanted to start using GitHub.

My GitHub profile is here: https://github.com/robhinds

As a starting point, I have moved all my demo source code over to GitHub, so that can all be accessed directly from there (although the old links will still all work).

If you head to my profile you will also see a few repositories associated to a RoR tutorial that I am currently working on - so there will be a post coming out of that shortly..

0 comments:

Hands On NoSQL - Integrating MongoDB & Spring MVC


Over the weekend, I took some time out of my side project to have a play with MongoDB. I was interested in looking at NoSQL and getting my head around some of the implementation details and had heard document oriented NoSQL DBs would be a good place to start.

So I stripped out the guts of a web app I have built, and dropped in a very simple domain model (the app just allows creation of resumes - I chose it as I wanted a model that made sense to use a document oriented DB rather than trying to crowbar in a model that is still relational) - then using Spring I looked at wiring all the MongoDB stuff. I was pleasantly suprised with how easy it was to drop it all in.

This also gave me a chance to finally play with CloudFoundry - I've had my beta account for a while now, but seeing as CF supports MongoDB and Spring/Java apps I figured this would be a perfect chance to test it out. Again, it was relatively easy to configure the app and CF to get the app up and running using the Clouds mongo DB service.

The other bit of experimentation I have done is rather than writing this up in a massive blog post, I have signed up for slideshare and uploaded a presentation with the details - you can check out the presentation embedded above - would love to hear feedback as to whether you prefer slideshows or traditional blog posts - for me its harder to get a lot of details in slides without over-crowding them, but then if its a very detailed walkthrough it can make for an over-long blog post.

As always, the complete source code for the app (Spring MVC web app with full mongoDB configuration, including config for both localhost and CloudFoundry deployment) is available here!

2 comments:

Free Stanford Courses

As I have mentioned before, I am a big fan of Stanfords online efforts of putting lectures/courses in places like iTunes for free.

They have now announced that they will be offering several of the courses fully online, for free - this includes lectures (in real time) and all the coursework, which will be marked and graded, and all students will be informed on how they rank (in terms of percentiles i guess). The course doesn't get any official Stanford credit, but will get a "Statement of Accomplishment" (whatever that is).

The list of courses currently about to be offered this coming academic year is here

Having a degree in Artificial Intelligence, I would love to sign up for the AI courses to refresh (its been several years since uni and AI has changed a lot), but not sure I could find the time to keep up with further weekly commitments and coursework, but will investigate further.


0 comments:

API Design Manual

Came across quite a useful document via HN a week or two back covering good API design that is worth a read if you are involved in software development.

Check it out here

0 comments:

Software Engineering Interview Questions Part 2

There was also recently an article that was doing the rounds with the 20 most craziest interview questions, quoting allegedly real questions from interviews at places like Google, Facebook, Goldmans etc. Here are a few, along with my attempts to answer them..

Facebook: Twenty five racehorses, no stopwatch, five tracks.  Figure out the top three fastest horses in the fewest number of races.
This needs a few assumptions before we begin: 1) each track only races 5 horses, and races cant be started at the exact same time - preventing effectively just running all the horses at once; 2) horses run the lap in a consistent time (e.g. if horse A beats horse B in one race, and horse B then beats horse C, then A will also beat horse C)
  1. Race 5 races, each with 5 horses in it (so all horses have raced) (5 races)
  2.  Race 1 race with the winners of the first 5 races (6 races)
  3. Find the winner of race 6 and from that horse's original race take the horses that came second and third (2 horses); take the second place horse of race 6 plus the horse that came second in his original group (2 horses); take the third place horse of race 6 (1 horse) - Race these 5 horses, this will give the second and third fastest horses (we already know the number 1 fastest horse is the winner of race 6)
Total races: 7

Goldman Sachs: Suppose you had eight identical balls. One of them is slightly heavier and you are given a balance scale. What’s the fewest number of times you have to use the scale to find the heavier ball?
Answer: 2
  1. Arbitrarily split the balls in to three piles, 3-3-2
  2. weigh the two sets of 3 balls (first weighing)
  3. If the two sets of three balance (weigh the same) then we know the heavier ball is one of the balls in the set of 2, so weigh those two (second weighing), and you will see immediately which is heavier
  4. If the two sets of three do not balance, then take the heavier set and weigh any two of those balls - if the first two balls you weigh are the same then you know the third ball in the set of 3 is the heaviest. If they do not weigh the same then you will immediately see the heaviest ball


Google: You are climbing a staircase. Each time you can either take one step or two. The staircase has n steps. In how many distinct ways can you climb the staircase?
The trick to this question, as with a lot of complex sounding questions(things that start with "there are 100 prisoners.." or "there is a village with 1,000 married couples") is to break "n" (or the number provided" to a much lower number.

In this case, lets start off with n=2 (we will skip n=1) - in this instance its easy to do the mental arithmetic to work out the number of permutations: it can be 1,1 or 2. So therefore there are 2 different permutations. Obviously, in this case, whilst n=2, permutations(lets call it x)=2, but its safe to assume n=x will not be consistent as n increases.

So let's increase n, this time, n=3. Again, simple mental arithmetic and we can work out possible permutations: 1,1,1;  1,2 and 2,1. So again there are 3 permutations (x=3).
We will continue our approach to see if we can see a pattern emerging.

n=4: possible permutations: 1,1,1,1;  2,2;  2,1,1;  1,2,1;  1,1,2, so x=5
n=5: possible permutations: 1,1,1,1,1;  2,2,1;  2,1,2;  1,2,2;  1,1,1,2;  1,1,2,1;  1,2,1,1;  2,1,1,1;  So x=8

We could continue this process untill we could see a pattern emerging, although as n increases, the number of permutations increases so might need a pencil and paper if you wanted to carry on. Fortunately, it seems to be heading in the direction of the Fibonnaci sequence! So to find the number of permutations for n steps we just need to find the nth position in the fibonnaci sequence (still not that simple!)



I have not validated that these answers are correct, but this is what I came up with! Leave a comment if you think I have done something wrong somewhere along the way.

0 comments: