Wednesday, August 26, 2009

Uniquify an array of hashes

Almost at the close of one of the cohort tasks I am working on and I need to uniquify an array of hashes. Many suggestions point to redefining #hash and #eql? for the hash instances before I put them in the array. And voila! there was anoitulos
and I qoute:
"Assuming your hashes are always single key-value pairs, this will work:

a.map {|h| h.to_a[0]}.uniq.map {|k,v| {k => v}}

Hash.to_a creates an array of key-value arrays, so the first map gets you:

[[:a, 1], [:a, 2], [:a, 1]]

uniq on Arrays does what you want, giving you:

[[:a, 1], [:a, 2]]

and then the second map puts them back together as hashes again.
"

Tuesday, August 04, 2009

Denzel

He's 21 months old now. He wants to do whatever grownups do. If I buy him a toy cellphone, he's gonna only use it for 1 day and he's back to crying for my cell.

Monday, July 27, 2009

ACEDN.org

Just launched my first proffessional website http://acedn.org. It has been a great learning experience for me and it has reaffirmed my passion for the field. The client and founder of the website's organisation Tony Ayuninjam has been a great client and he's a man with a helluva idea. Just checkout what he has in store for Malawi and Africa in general!

Tuesday, March 31, 2009

Monitor this. Monitor that!

This is Baobab Health Trust's 44th Day in the new offices at Community Health Sciences Unit and still this developer hasn't finalized BASM. Well, he has an explanation to that!
  • The link to remote site hasn't been persistent
  • He was committed to development of reports for Mateme sites and
  • He has been busy with feature development and bug fixes for BART 9.2
What on the www is BART, Mateme and BASM?

Baobab Health Trust(organisation this developer works for), a Malawi-based non governmental organization, addresses the health crisis in Malawi by innovating appropriate technology that tackles developing country health care problems. The core of Baobab's approach is the use of easy-to-use touchscreen clinical workstations at the point of patient care. This system efficiently and accurately guides low-skilled health care workers through the diagnosis and treatment of patients according to national protocols. The system also captures timely and accurate data that is used by health care workers during patient visits to supplement decision making.

One of the system Baobab Health developed and supports is BART . This is a Ruby on Rails application running on a low cost touch screen work station which aides in the treatment and care of HIV / AIDS patients.

One other system is Mateme which developed using the same technology as BART but is used in rural health centres for outpatient registration and diagnoses.

Baobab Health uses low-cost information appliances and servers that are significantly more robust in harsh environments than traditional computers and these are powered by generic 12v batteries producing a combined voltage of 48 volts.

One challenge was monitoring of these batteries remotely to identify faulty batteries before power supply reaches critically low levels. Then comes in BASM - Baobab Server Monitoring system. This software was primary looking at addressing early warning mechanism for power supply but I will be looking froward to extending this to include other server critical resources.