Sunday, May 23, 2010

WareRU Online

Finally! After a weekend full of blood, sweat and tears, I now have an on-demand trial of the WareRU Inventory management system online backed up by the wonderful Amazon Web Services. It has been a real learning experience getting this going and it allows me to showcase a great piece of software that was not available to try due to the prohibitive costs of Java hosting.


Enough said! Give it a go at http://bit.ly/blJxMi

Saturday, May 22, 2010

Amazon Web Services Meetup - Melbourne

I recently attended a cloud computing meetup in Melbourne hosted by an Amazon Web Services evangelist. I'm usually quite sceptical of the content of such meetups - I've met my share of salesmen from big vendors in my career - but the community aspect of such a meeting was too tempting to ignore. There was about 35 developers in attendance, mostly rubyists and sys-admin types. In all it was a productive session which had me thinking, when will I put this to use?

It turns out, one of the systems I've previously built has been languishing in neglect because of expensive and unmanageable Java hosting. I used to host a Virtual Private Server (VPS) for about 90$ (AUD) a month. This hosted a Tomcat Server, MySql, mail server and my website (PHP). I found this to be quite an expense, given the demo was rarely accessed - as it is specialised software. Also I had the hassle of cleaning up the data so that prospective clients found a professional demo ready for their use. This also needed to allow for long term trials so cleaning up the database every hour wasn't feasible.

It is a tribute to the maturity of Amazon's Web Services that it has been able to meet my requirements. I am in the process of chronicling the challenges I faced in creating this on-demand demo service.

Saturday, May 15, 2010

NameError: uninitialized constant GData

I was trying out the GData gem from Google as part of my chex rewrite when I got struck with a bit of an idea how the Ruby console works. This has been one of the things I've loved about programming in Ruby as opposed to Java / NET or the other programming languages I program in. I installed the gem using: "sudo gem install gdata" which worked like a treat. Next thing I did was fire up the console to start playing around with gem - "ruby script/console", only to be greeted by this error.

  1. trevors-macbook-4:chexscheduler trevor$ ruby script/console
  2. Loading development environment (Rails 2.3.5)
  3. /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
  4. >> client = GData::Client::Calendar.new
  5. NameError: uninitialized constant GData
  6. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant'
  7. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
  8. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
  9. from (irb):1
  10. >> client = GData::Client::DocList.new
  11. NameError: uninitialized constant GData
  12. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant'
  13. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
  14. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
  15. from (irb):2
  16. >> client = GData::Client::DocList.new
  17. NameError: uninitialized constant GData
  18. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant'
  19. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
  20. from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
  21. from (irb):3
  22. >> ^Dtrevors-macbook-4:chexscheduler trevor$
  23. trevors-macbook-4:chexscheduler trevor$ clear
This is peculiar as the gem has already been installed globally. However, as it was not added to the environment.rb, it was not picked up during the launch of the console. Only when I added the line " config.gem 'gdata', :lib => 'gdata' " to environment.rb and relaunched the console did it work. Back to playing around with the gem.

Adjusting to the Agile way

As I mentioned in a previous post, I'm rewriting one of my previous applications written in Python in Ruby on Rails. I've decided to spend sometime thinking and journalling the process - not just the technical hurdles of reimplementing in Ruby, but also the changes in project management methodology. I've fully embraced a scrum methodology for this project and I'm writing user stories on a notebook when I'm on the go and inputing them into Ice Scrum for traceability.

One of the challenges I find when I'm developing a new product is to treat myself as a client. I get so many brain waves and at times I'm not always disciplined enough to write them down. I just assume that since I originated the idea, it'll always be there. Sometimes its not necessarily a technical solution, it could be something that inspires the general vybe of the application (To be fair this also applies to when I'm using other methodologies). Having to condense this into a user story is a challenge.

Also, as the sole developer, there is a laziness involved in spending time writing something which your never sure will be read by anyone else. I feel like jumping straight into the actual deliverable. Note to self: Need to find out whether apps like twitter / facebook were built by their original developers using a strict development methodology. Do these methodologies apply at the edge of such innovation? I'd love to write the user stories for Twitter. I'm sure they could fit in 140 characters. Someone should write a tool using twitter for user stories.

Monday, May 10, 2010

Rewriting Chex Scheduler on Ruby on Rails

I was recently taking some speculative phone interviews a few weeks ago and I came across an international consulting company with a strong focus on Ruby on Rails and Agile practices. I remember remarking that I was not 'over-enthusiastic' about RoR (big mistake!). Anyway, I justified my reasons. I recently thought over my reasons for my dislike and decided to do my next major project using RoR. This happened to be my rewrite of Chex Scheduler - an online scheduling application written in Python and ExtJS running on the Google App Engine.

I'm also fully embracing the Agile way - using scrum in this instance - and I'll be cataloguing my experience. I'm pleased to have some tool support for project management in scrum in the form of Ice Scrum. Its great! The application will be deployed to Heroku and I'm hence using the git, version control system. I'm still undecided on what to use for Javascript, perhaps JQuery-UI. I think ExtJS was a bit heavy handed for what I wanted to achieve. So far, those are the design decisions I've made. I'll be updating the blog on how I'm proceeding.

Sunday, May 9, 2010

My experience map

Now, for some shameless self-plugging...

I've been answering some deeply personal questions about my experiences across my employment history for a head-hunting website and below is my experience map. I'm not sure the information is very useful - more than the nice graphic - and it doesn't capture all the technologies that I've worked on. It's interesting though, and cute.

To see my full career page, click here
http://mycareer-headhunter.com.au/people/trevorkimenye


Monday, April 19, 2010

Math for Software Engineers

I've recently gotten into TopCoder (don't ask me where I've been all this time). As a software engineer of about 7+ years, I was quite keen to find out where I stacked up in the programming stakes. I've programmed mostly in Java, so that was the language I chose to use in practice area of the Arena. I should also disclose that I got a tip to attempt some of the division 1 and 2 problems from a Google page about preparing for their interviews. This sparked my curiosity even further.

After starting the Arena (TopCode should have a UI contest to find a more user friendly place to show link to the jnlp. At the footer seems an odd place to have a link that is used frequently) I went into one of the practice rooms and picked a problem related to gambling. TopCoder does not allow unauthorized reproduction of their problems, so I won't violate their copyright. The problem can be found in practice room SRM 144 Div 1.

The crux of the problem is to find out how many combinations of a particular set of items that can be selected from another set of items. For example, if you have to pick 2 numbers from 1-10 inclusive, how many combinations can you include? What if the order is important (i.e. the second number you pick must be greater than the first)? What if the numbers must be unique (i.e. no repititions)? What if both the order and unique rules are necessary?

While I was intrigued with the logical challenge of solving this puzzle, I wondered whether this has a place as a problem for a software engineer. I suspect, depending on how the client has explained this problem (you would have to see the post for the problem from TopCoder) it either becomes a computer science or mathematical problem rather than one about building software. Many computer solutions are replacements for manual processes so sometimes it is necessary to ask the client, "What are you doing currently to solve this?" It could however be a new problem and it is unreasonable for the engineer to tell the client, "Sorry, I can't quite remember my high school math."

The solution to the problem required 4 routines:
  1. A method to calculate exponentials. In java - Math.pow is sufficient.
  2. A method to calculate permutations.
  3. A method to calculate factorials.
  4. A method to calculate binomial_coefficient.

Exponentials
Exponentials can be used to calculate the number of possibilities without any rules regarding order or uniqueness. For the example of 10,2 the number of possibilities is 100.


Permutations
From wikipedia, a permutation of a set of values is an arrangement of those values into a particular order. Going back to the original problem of picking 2 numbers between 1-10, regardless of order and ensuring the numbers are unique (i.e. 1,2 is valid but 2,2 is invalid), calculating the number of permutations of the 10 integers with 2 options for each.

  1. private long permutation(int n, int opts)
  2. {
  3. long result = 1;
  4. for (int idx = 0; idx < opts; idx++)
  5. result *= (n - idx);
  6. return result;
  7. }
Factorials
Factorials are a little more interesting than permutations. The factorial of a positive integer n (n!) is the product of all positive integers less than or equal to n. The factorial of zero is defined as 1. This is useful for calculating binomial coefficients.