kenya trip - day 5

Lo and behold it’s kenya trip - day 5 already.

We went to visit Jamiibora in Nairobi, a big MFI with hundreds of thousands of customers.

This was hands down the best reception I’ve ever had. We got there fairly early and some Jamiibora employees were just getting in the office. The amazing thing was that most of them would just join in the welcome dance.

You can’t see me dance with the others, because well someone needs to record the event!

After a good 15 minute welcome (really), where we marched and danced toward the meeting room, we finally got to talk to some of the upper management.

Most of them where customers of Jamiibora (meaning ultra-poor) before they eventually joined JB. It felt kinda good to see that if nothing else, microfinance is sustainable enough to give people real jobs.

We discussed microfinance in general, the MicroPlace mission (they applauded here) and how little Americans knew about microfinance (they lol’d here).

We then visited one of the slums in Nairobi. It’s everything you would imagine. Little kids playing naked in the open sewage and families of 6 living in houses as big as my walk-in closet.

It’s a fairly dangerous place to visit, given that your watch can probably feed a family for a week. Good thing I don’t wear one anymore. Anyway, we had our 3 armed bodyguards to help us meet the micro-borrowers.

Very nice and inspiring people these borrowers were. We talked to several and I really enjoyed talking to Richard (he looks 15 but is older) and his wife. They have 2 kids and live in this tiny little place.

His first loan was enough to buy a refrigerator, so he could sell cold sodas in his neighborhood, for a small profit. He was now considering going for another (bigger) loan and even buy land near his native village. woot!

We also had lunch at a restaurant owned by one of the borrowers. Seeing people go from begging to owning a (busy) restaurant makes you feel all nice and warm inside.

Overall a very busy and inspiring day. No matter how much I read about it, seeing it work is something else.

Comments (2)

Leopard + Juniper Network Connect + Subversion + VMWare Fusion -> how to

So you upgraded to Leopard (10.5) and now you cannot connect to subversion repository at work because Juniper Network Connect is fooked. Fear now, here’s the workaround, though it requires some pre-requisites:

- Leopard
- VMWare Fusion (or similar I suppose) running a Windows VM
- That’s it

1) Run the Windows VM
2) Install SVN Tortoise if you don’t have it already (http://tortoisesvn.net/downloads)
3) From the windows vm, open your vpn connection to work
4) Still on windows, browse to the mac file system (Z:/…) and then to your work directory
5) In file explorer, right-click your work directory and “SVN update”. If this works, you’re done

Back to the mac, do your changes there, then cmd-tab to the windows vm to svn update.

Not as easy as when the VPN client wasn’t broken, but it’s something.

Comments (1)

ActiveRecord#update_attribute saves the entire record

Let’s say that you need to update one attribute in an activerecord:

my_record.update_attribute("some_column", "some_value")

you might expect that only “some_column” will change, but that’s not what happens. When you call update_attribute the entire row (object) is saved, and validations are bypassed!

This might surprise you (it surprised me), especially the no-validation part. This means that it’s possible to corrupt a record in the database, by setting a column to an invalid value (for which there’s a validation). Then call update_attribute on a different attribute, and bam, the invalid field is saved along with the attribute being updated.

The proper way to update attributes while still invoking the record validation is to call update_attributes (notice the “s”) and pass it a hash of attributes to update:

my_record.update_attributes("some_column" => "some_value")

This will still save the entire record, but at least validations will run.

(more about ActiveRecord here)

Comments

pvp and leopard “spaces”

WOW PVP + Leopard Spaces = bad combo

ctrl-2 is supposed to be my “get the hell out” key when pvping in wow, but it’s also the switch to space 2 in leopard.

Luckily if I play in fullscreen mode (command-M) then wow wins over leopard. Whew…

Comments

leopard - more headaches - admin account no more

I like to have just one admin account per box, which is also an account that is used just for admin stuff. All the normal accounts are just standard. Nothing weird there I don’t think.

Well, I just noticed that after last night install marathon, something else happened and now my (only) admin account is fooked. He’s just a standard account like everybody else. That makes it hard to do anything of course.

After some research, this is how you trick 10.5 into creating a new admin account:

- Reboot while holding Command-S to boot in single user/root mode
- type: mount -uw /
- type: rm /var/db/.AppleSetupDone (actually I renamed it, just in case, but didn’t need to use the backup version)
- type: reboot
- 10.5 will think this is the first time you’re running the system, will ask you a couple of questions (registration, etc) and for an admin account. Create a temporary one now.
- Should be about it

I got to say though, I have to thank Apple for making it easier on us Windows refugees to upgrade the OS. I feel right at home with the blue screens and other snafus.

Comments (2)

leopard - stuck at the log in screen

I installed Leopard on 3 systems and the first two were mostly flawless. Only mostly though:

- You can no longer start mysql from the preferences pane. If like me you had to start mysql after rebooting (I like to control what resources my system uses…got that from Matt) start the preferences pane, change to “automatically run on startup” (or something) and reboot. MySQL should be running after that.

- The other slightly bigger issue is that I can no longer VPN into the office. Juniper Network Connect is broken on Leopard. Apparently Apple forgot to publish certain Intel binds. I tried going back to an older version of the Network Connect client and encrypting libraries, but it didn’t work. For now I can’t work from home. Sucks.

- Finally, the biggest scare was last night when I upgraded our brand new iMac to Leopard. I chose “upgrade” (instead of new install) just like for the 2 other systems. Big mistake. When 10.5 was finally installed and it rebooted for first log in, was when the pain started. I have four users on that box, and none of them could log in. After entering the password, it would show a blue screen for a second or two, then back to the log in screen. Frigging annoying.

I was really looking forward to sleeping an extra hour last night, instead I slept 4 hours less. That’s how long it took to fix the problem as I reinstalled 3 more times. Apparently there’s a known issue that makes Leopard fail in similar ways, but it’s related to “long passwords created in 10.2″. That wasn’t my problem but I tried the alleged fix anyway. Sure enough, it didn’t help.

Ultimately what fixed the problem was to do a “full install” instead of an “upgrade”. I was worried about full installs at first as I was under the wrong impression that it would take much longer or that it would lose my settings or whatever. None of that happened.

If you’re stuck on the log in screen after installing Leopard (upgrade) do this:

- Put the DVD in the drive
- Reboot while holding the C key (not Command-C, just C). This will make your system boot from the CD
- After the installer starts and you’re choosing how it should run, at some point you can bypass the default options. Do that and instead of upgrade choose full install. In addition to a clean install, you will have a new directory with the relevant files of your old/current OS.
- Install
- Wait an hour (remember to skip the disc verification thing, if you already know the DVD is fine)
- Enjoy

Comments

MicroPlace monk

It’s Halloween and the theme is “wear something blue on your head”.

Thank you Aaron for the inspiration.

Comments (3)

MicroPlace is live!

Check it out: http://microplace.com

Comments (2)

Interviewing programmers

One of the very first interview questions I was asked, right after college was:

- Write a function, C or Pascal or whatever language you like, for counting set bits in a an integer.

I’m no fricken genius and thought this was pretty much a softball question. I was asked another simple technical question and eventually I wound up working there for 2 years.

I did think the interview was way too easy, and when I’d grow up and get to interview people, I would start with an easy question like that, but then go from there.

Well, big mistake. Apparently this is a very difficult question for a lot of people. Some of those people are very smart and I want to have them on my team, they can’t see things that small, that’s all. So I had to come up with other starting questions.

Eventually I moved on to “reverse a string”, or “explain hashtables”, or even “code a linked list”.

Recently I interviewed a fellow with some impressive experience. I didn’t want to offend him and start by counting bits so I asked him to code a linked list and write a function for detecting circular linked lists. “In fact” - I said - “don’t even code it, just tell me how you would approach the problem”.

After staring at the white board for 5 minutes, and refusing my help, he finally said “well, there’s no solution to this problem”

I lawled inside of course, and suggested a couple of solutions. His response was “well sure, if you do it that way”.

No, he didn’t make it.

So anyway, some very smart people can’t count bits, others can’t but don’t know what linked lists are. Others can do but their code makes me want to cook (spaghetti, get it?), so what the hell am I supposed to ask as the first question, to at least get us off the ground.

I finally decided on a new approach. I write a bunch of starting questions on the board, and ask them to pick whatever they like best.

If you’re going to interview with me, here are my questions (be ready to pair program with me on the coding questions)

- count 1s in a int. Use this function to figure out if the number is power of two.
- tell me about hash tables. Why they’re needed, how to use them, how to write your own.
- explain linked lists, and write a function for detecting circularity.
- reverse a string
- write an extremely simple calculator class (add/sub/mul/div) but do it test first.
- tell me about your experience with agile (xp, scrum, whatever)
- tell me about object oriented programming. what it is, why I need it, how it works, etc.
- write a function that traverses a tree (breadth first or depth first) and prints the node values

That’s it. Most programmers should be able to pick one and get started. Well, should but don’t. Most programmers I’ve interviewed get stuck at this point.

I’m also considering asking them to come prepared with some source code they think is well written. Not even their code (though that would be better). Just code they read once and found awesome.

I haven’t tried this approach yet though. I do think there’s value there, if you believe that good designers/programmers have taste.

Comments (2)

sand makers

”To eat Hershey, for me, is like eating sand,” said Jan Goddaert, the corporate marketing director for Cote d’Or. ”but to Americans, it’s good chocolate”.

(from here)

Here we are, almost a quarter century later and nothing has changed. Well, that’s not true actually. Philip Morris owns Cote d’Or (through Kraft) and edible sand is finally coming to Europe!

But to be honest (for once), someone must be doing something right because Cote d’Or still rocks the hell out of that piece of crap they have the guts to call chocolate at Hershey’s. Go here for more.

Comments

updating your rails app database from the command line

I needed some way of bootstrapping the app with initial data. The quick and dirty trick we had was to have the ActiveRecord commands in some text file, then copy/paste them in the rails console and voila, a database with stuff in it.

Having to manually copy a bunch of ruby code in the console and then run it there was kind of boring and error prone though. However, since we only have to do it once (or so we thought), it was acceptable.

As it turned out we had to do it more than once, so it got old very quickly. And not only it was boring and error prone, the rails console (I think) was dropping characters left and right while pasting our ruby instructions.

So now it was boring, error prone and destructive.

We needed to automate this. We already had the code in some text file, so how hard could it be to simply rename the file something.rb and run it?

Ruby has no idea what ActiveRecord is for example, so the script needs to know that. Simply adding

require File.expand_path(File.dirname(__FILE__) + "/config/environment")

at the top of the file does it. Yay! (the script is at the project root)

Great, now I can run any rails code in my script, like bootstrap the database, and it will just work.

Well, almost. By default rails will use the “development” environment. I’m bootstrapping things in production, not development.

Super easy, before loading the project environment, I need to tell rails that I really want to be in production mode. Add this line before the line that loads the environment.

ENV['RAILS_ENV'] = ‘production’

That’s it, two lines of code and your command line script will be updating the database!

Comments (3)

you know what i did last summer

we’re really really close to going full blown live…I can smell it (smells great).

(stole this picture from here)

Comments

Randy Pausch’s last lecture

Carnegie Mellon Professor Randy Pausch, who is dying from pancreatic cancer, gave his last lecture at the university Sept. 18…

and what a wonderful lecture that was.

Comments

back

I wish I could say that I’ve been so busy with work and other important stuff, that I didn’t even have the time to write a couple of lines. I wish I could say even though people who don’t even have the time to write a couple of lines are pretty sad.

The fact is that I’m just lazy and was also wondering who the hell I’m writing this for anyway? As it turns out, *I* like to read what I was doing or thinking 6 months. And so it seems I’m really writing this for me. So Julio in the future, hi there, hope you’ve grown up a little and hope those drums that I don’t have but you must are keeping you happy.

Alright, what the hell happened in the past 2 months?

- We launched our fine website! It’s still in internal beta, and it’s working like a charm. Thanks to XP, a fine group of developers and a great product manager who understands “stories”, the whole thing worked like a charm. I probably should blog about how we did it, since this was the best xp/agile project I’ve been involved with. I also know myself quite well, and the chances of me writing about are rather slim. So here’s the short version of how it was done: smart product manager, short iterations (1 week) with real content at the end of each one, team in the same room, test-first or at least “test before you check-in”, smart folks (some superstars even), lots of test coverage (95-100% depending on the day), mutual respect and last but not least: a decent language and framework. Ruby and Ruby on Rails were a big part of the success. That’s it, easy, anyone could have done it.

Here’s a conversation Fabienne and I had the other day:

Fabienne - “You guys have launched!? I haven’t seen you work past 6 o’clock or on weekends for months!”
Me - Yep, that’s the power of XP baby.
Fabienne - But, but, you’ve been doing XP for years!
Me - Nah, that was “XP-but”. I’ll blog about it…or not.

So anyway, we’re live (even if only to a small subset of the world) and should go live to everyone in less than a month.

This is us (the whole company) celebrating:

- What else happened? Oh yeah, I was given (for free!) a level 65 rogue in world of warcraft, on some PvP server that was not “my usual pvp server”. I couldn’t resist pwning noobs with a rogue, so I played him “a little”, brought him to level 70, transferred him to the proper pvp server, and now I’m camped on top of the roof in Southshore (alliance town) stealth and waiting for noobs to pwn.

- Fabienne and Morgane went to Belgium for a week. Morgane fractured her skull over there, could not fly until the bones were all properly glued together so they stayed 3 weeks. It was all very upsetting. Even the rogue miss me, as I didn’t play him at all then. My buddy Scott practically had me live at his place the whole time, and I’m grateful to him and his family. They made it almost easy. Morgane is fine now and now she can see through walls and bend spoons with her mind.

- Morgane went back to school and she’s doing great. She took some tough classes and so far she seems to be doing fine (I never thought that seeing through walls could help, but apparently that is the case)

- I gave up exercising but didn’t like to see what the scale was telling me day after day. That if you don’t exercise, you gain weight. So I don’t go on the scale anymore. Fixed.

That’s all, Julio in the future. See you then.

Comments (5)

comments section is finally fixed

I’ve been lame about my comments section. It’s been broken forever and I wasn’t doing anything about it. It’s fixed now.

Comments (3)

new (almost) favorite band

For the past month or so I’ve been obsessed with Gogol Bordello. If you don’t know who they are, you’re missing out. If you don’t think they’re the best band of the past 15 years, you’re wrong.

Comments (4)

my accent

according to this site, I have a neutral accent when I speak murcan. According to me the quiz needs work.

Comments (1)

kenya trip - day 4

This has got to be it! Today is the day we are going to see micro-borrowers. These are people that don’t need much to get started, maybe $50 would be enough. Of course no traditional bank would lend them (or you) $50, so thank goodness for the microfinance institutions.

After talking to the Jitegemea Credit Scheme CEO, we finally had the chance to go see what wonders $50 can do.

Catherine managed to go from nothing to a 30-people operation

Though I was truly impressed with her success, and to what a micro-loan can do, I remember promising to myself that I would never complain about my work environment ever again. I kept that promise for at least a week.

In the afternoon we went to see another mfi and their borrowers, this time in Machakos. 50 kms or outside town. Also very impressive.

This lady, a teacher, managed to make enough money (starting from a tiny amount) and eventually build a house twice as big as mine, and what a view! Makes me very happy.

Back to Nairobi for dinner, where we ate at a “authentic Ethiopian restaurant”. Though it was as good as it looked, I’m afraid I’ll need some sort of man-made tool for eating. There’s no way I’m going to eat using my fingers, especially if I’m sharing. I know, I suck, but I really need some sort of spoon or fork. Thank you very much.

Great day altogether. Things are starting to shape up. Tomorrow we’re supposed to go see urban borrowers, which means visit the Nairobi slums.

Comments

white people can’t dance - but they sure are entertaining to watch

Fabienne and I went to see a friend and his band play at a local pub. We had a good laugh observing people dance. We didn’t dance of course, as it’s no fun to be made fun of by jerks with cameras.

My wimpy camera couldn’t handle the distortion. Apologies to Ted and his Mo-Fos for improving their music.

Comments

kenya trip - day 3

We met with the Faulu folks, one of the top five MFIs in Kenya. Once again we learned lots of stuff, but still not talking to borrowers.

At this point we’re slightly depressed. Learning from the MFIs is fine, but we would really like to see micro-finance in action. We want to see how it’s helping the poorest of the poor.

It looks like we’re going to play the tourists again. This time we’re going to see the Safari Walk in Nairobi. It’s not really a park (at least not a big one), and it’s not a zoo. Something in between.

We got to pet a cheetah, that was pretty cool.

She got to pet us too

Comments

« Previous entries · Next entries »