Monday, January 7, 2013

Oh Windows...

After switching to Linux a couple of years ago (thanks to the every-so-friendly encouragement of the co-authors of this blog), I had more and more difficulty with Windows.  It is as if Windows' hardware auto-detect is so advanced it detects the Linux presence in your wetware processor and enables the  pain-generator-module to bring some joy to your day.

Having moved to a new employer, the first thing I did at my new job was to install Linux.  During the installation process I notice that I do not have any Internet access. "No problem", I thought, "it's only the proxy..." (this being semi-corporate, after-all).  So after the install I booted Windows, went to Internet Explorer to get the proxy details.  This is how it looks:



That was painless! So I booted back into Linux and set my global proxy... and then... nothing.  I then continued to spend a full two and a half days trying to get my Linux box to log onto the Windows domain (my assumption being that that is a requirement to gain Internet access around here).  I first tried Samba... but had no joy. I suspected it had to be a setting somewhere that a missed.  I then tried 'likewise' (https://help.ubuntu.com/8.04/serverguide/likewise-open.html) after being recommended by a couple of websites.  No luck... I ran diagnostics tools, pulled and sacrificed some hair to the Windows gods, fiddled some more with Samba, cried a little, searched the Interwebs, cried a lot, sacrificed some more hair, no luck...

Finally I mailed the one other person that I knew ran Linux.  "You only need the proxy... no need to log onto the domain." was his reply.  I started to get that metal-taste in my mouth and felt the hair in my neck rise... back into Windows... and yip, to my horror, the textfield was too small to accommodate the IP.  Logged back into Linux, set the correct IP and viola! Internet is working...


I hate Windows... (and the number 9 a little bit too)

Wednesday, September 5, 2012

Gamification of day to day development work

I've been thinking a lot today about how to help developers write solid code, and write good tests, and perhaps even have some fun in the process. So what about achievements for your day to day work?

I know Visual Studio has done something like this in the past, but it's been for C++ (or C#), and as far as I understand, it's been developer centric, not project centric.

The problem with the developer centric approach is that it inherently leaves out people, and in my opinion doesn't promote the health of the project as a whole. I think a combination of the two seems to be in order, so there should be developer-specific achievements, but also project-specific achievements.

I'm really keen to develop something like this. I was recently bitten by the fact that I stopped writing unit tests (Because of time pressure, the usual BS excuse) and now of course my mind has been racing on how to stop this trend. Now I'm not that naive that I'll think something like this will solve all the worlds shitty software problems, but, if it helps even a little bit and people have fun in the process then why not?

Here's some achievements I've come up with, please feel free to add some or comment on them:

Project Achievements

  • Have to start somewhere: 5% test coverage
  • It’s improving: 10% test coverage
  • Getting better still: 30% test coverage
  • Works on my machine: 50% test coverage
  • Getting pretty solid: 75% test coverage
  • Should work: 80% test coverage
  • Will work: 90% test coverage
  • Specs may be wrong, but it works: 95% test coverage
  • The first cut is (not always) the deepest: First unit test gets added.
  • Single celled organism: Project has been active for one month
  • Fetus: Project has been active for two months
  • Baby: Project has been active for three months
  • Toddler: Project has been active for 5 months
  • Child: Project has been active for 1 year
  • Teenager: Project has been active for 1.5 years
  • Adult: Project has been active for 2 years
  • Middle Aged: Project has been active for 3 years
  • Twilight Years: Project has been active for 4 years
  • It’s not all about the code: Project gets its first “resource” file (ie. src/main/resources for Java)
  • Blink and you’ll miss it: Project takes less than 5 seconds to build
  • Watching paint dry: project takes longer than 1 minute to build
  • Don’t tell Han Solo: More than 1 developer has worked on the project
  • Three’s a crowd: More than 3 developers has worked on the project
  • It’s more fun this way: More than 5 developers has worked on the project
  • Polygamy : More than 10 developers has worked on the project
  • This is serious: Project gets its first tag
  • We can like to be doing configuration management: More than 5 tags
  • We know what’s out there: More than 20 tags
  • We’ve got a release coming up: More than 5 tags in a week
  • We’re trying to fix it (or it’s growing quickly) [this could depend on age of project]: More than 10 commits in a single day
  • It’s not working: Same as above, but for 5 commits

Developer Achievements

  • Adding functionality by removing code: LOC get less, but test coverage increases.
  • Removing a dependency: A dependency is removed from the project.
  • Getting it Back on track: Added a first test after a long period of no tests being added
  • Likes it pretty: Made a commit with only whitespace changes
  • Leave is in the bank: 15 continous days of commits
  • The Creator: First commit for a new project
  • Dabbling: Developer worked on more than 1 project
  • Branching out: Developer worked on more than 3 projects
  • Part of the furniture: Developer worked on more than 10 projects
  • Letting go of the shackles: Developer worked in more than 1 language
  • Versatile: Developer worked in more than 3 languages
  • It’s all the same: Developer worked in more than 5 languages
  • Burning the midnight oil: Developer pushed a commit between 12:00 and 05:00 am
  • Who needs to eat? Developer pushed a commit between 12:00 am and 13:00 pm
  • No Youtube: Developer pushed more than 10 commits in one day
  • Hard worker: Developer pushed more than 20 commits in one day
  • Must be a bot! Developer pushed more than 50 commits in one day
  • Diligent: 2 commits in a row where a test is added
  • Knows what he’s doing: 3 commits in a row where a test is added
  • Consistent: 2 commits in a row with a good commit message
  • Taking it to heart: 5 commits in a row with a good commit message
  • Shakespeare: 10 commits in a row with a good commit message
  • Give him the documentation work! 20 commits in a row with a good commit message
  • I’m focused: More than one month commiting to the same project

Wednesday, July 25, 2012

Steam on Linux

Steam is coming to Linux!!!. If you don't believe me check out this link: http://blogs.valvesoftware.com/linux. Valve will start off by releasing Left 4 Dead 2, with more of their games to follow.

Thursday, July 12, 2012

Regarding the Whaleventures-pact of 10/11/12 July 2012

Wow, this is quite strange, it feels like a lifetime ago when I last read the comments on Jaco's original post regarding time travel and the "whaleventures-pact" as he put it.

Firstly, I have seen the future. Heck, I just came from it. (I just realised that talking about it is more difficult than I thought it would be, because for me everything is past tense, but for you guys everything will be future tense. So forgive me if I get the tenses wrong.)

Secondly, for fear of causing a butterfly effect I have decided not to tell you guys about all the stuff that has happened (is going to happen) through the years, except that time travel is (has become) a reality as you may have deducted by now. So, let it be known that the Whaleventures-pact is a strong bond that ties us together.

Anyways, gotta run, the time travel police is closing in. Yeah, I know right!? Such a cliché.

Tuesday, July 10, 2012

Monday, July 9, 2012

Thrift TThreadedPoolServer thread pool

Don't know how many of you are still using Thrift - it's still going strong here because it works so much better than RMI.

Just a small tip, I recently came across a TThreadedPoolServer. The idea is that a thread pool gets used to serve requests from the clients - so each client has its own thread. In my opinion, this is not ideal, but this is how it's working at the moment.

There is a danger though: make sure you set the maximum number of threads in the pool! Otherwise it just keeps on adding threads to the pool - returning them I don't know when. The app was sitting at 400+ threads just now.

It's easy to do:

You can of course set a minimum etc. as well. I'm not sure when the threads are "freed" and returned to the pool - I'll investigate this later today.

Thursday, July 5, 2012

On progress of thought and not just jumping in

We all know it's hard to think. One of my previous employers always famously said "Thinking is hard work. If it wasn't, everyone would be doing it.". So I just want to share something that happened to me this morning, to illustrate this point. And also how you shouldn't just always write down the first thing that comes to mind.

So, I had a list: [a,b,c,d,e]. I wanted to get the "pairs" in this list. So basically, I wanted a function f(l), that given [a,b,c,d,e] would give me [[a,b],[b,c],[c,d],[d,e],[e,a]]. I wanted to use this to draw lines, connecting a bunch of points. (Note: it is important that the last element in the list connects to the first, otherwise I'll have a gap in my line drawing)

So, the classical way to do this, would be to go ahead and code up something like:

This works. But it's not particularly elegant, and it has a special case for the last entry, which I don't like, and would like to avoid. Also, it's very specific - I can't easily change it to pair n and n+2, or n,n+1,n+2 for example (Not that I need it at the moment, but still, its a very *specific* implementation.

So then I thought, what about taking the list, and zipping f(x) = x, with f(x) = x + 1, over the length of the array. That would give me the indexes of the pairs. So, I would end up with a list like: [[0,1],[1,2],[2,3],...] etc. and then I could just use that list, and map over it to get the appropriate elements in the original list. I could even then zip additional lists as well, for eg. f(x) = x + 2, f(x) = x + 3 which will give me 4-element pairs. Nice.

Problem solved right? On further inspection - not really. There is still a MASSIVE edge case there at the end. In fact, with this solution, the edge case is probably even more difficult to manage then in the purely imperative form. So I decided, I'm not even gonna code up the solution like this, cos I haven't yet had enough caffeine to deal with this edge case mess.

So then I realised, that basically what I want to do, is "rotate" the original list, and zip the original one, with the rotated one. Yes, good old ROT-n. So I take my input list, rot-1 it, and then map the input list with this rotated list. This gives me _exactly_ what I want, and also solves the edge case problem for me very elegantly! I now also have the ability to pair an arbitrary number of elements from the list, by just rot-1'ing, then rot-2'ing, then rot-3'ing, and then zipping all these lists together. Very nice.

But now, I need a rot-n function. Javascript (or underscore) doesn't have one, so I'm gonna have to implement my own. Dammit, right? Remember those varsity excercises where we did rot-13 in like first year? Not really lus to implement this right now! And then, what will I gain, really? Then I could just my original implementation!

Then, I had a quick chat with Gary, and we came to the conclusion, that a rot-n list, is simply the concatenation of the tail of the list, from (n,length), with the head of the list from (0,n). This makes my job much, much easier. Turns out, rot-n in Javascript looks as follows:

So, armed with that, my original solution simply becomes:

Much nicer hey? And also, more general. And I sommer got a rot-n function out of the deal as well!

This was just my latest example of how it helped me to think things throught a bit before I start to write the solution. I'm very much a Just Do It guy, but it's good to sit back and think, you tend to get much more out of it then what you just intended to write.