20 Mar 2017
Even if you are the most obedient driver, you will one day get stopped in the road, that guy today was my self. This is a list of what you must have when you drive in Sri Lanka.
- Original or the certified copy of the book (registration)
- Original of the revenue license (photocopy not sufficient)
I have had a drivers license for 12 years but have been driving for much longer. I drive great distances and am capable of maintaining discipline in the road. With all that… Today 2 cops stopped me about a 3rd of the distance from Kurunegala to Colombo, for no apparent reason.
I had all but not the original revenue license. I actually keep it in the car, but this morning I took it out to make a photocopy as the one I had pasted in the windshield had fallen. While I stuck the new photocopy in the windshield I had forgot my original on the photocopy machine.
They were like “We are going to write a ticket, because we can”. After appealing to their humane nature I was able to walk away.
Make sure, you keep your originals in the car, to avoid the embarrassment.
16 Mar 2017
I have had my fare share of embarrassing mix-ups in my life. The best one would be the day I applied to a ColdFusion job thinking that it was a CodeIgniter job in my early days at oDesk/UpWork. I went through the interview process and got selected. Unknown language and an urgent fix for a live e-commerce website, how more fun can life get?
I knew I was in trouble the moment I opened the project in the editor. I was just starting been a full time freelancer and a bad rating would have been catastrophic at that stage, so I improvised.
Bugs were resolved and the website was fine again. We also worked on some features.
Surviving an unknown language, which they clearly knew, probably landed me on Ruby with the same client. I worked for the next 2 years with Ruby based technology. Among one of the projects is the transition of the CF e-commerce website I worked on to Ruby on Rails using Spree E Commerce platform.
That website is Buttercup Cake Shop.
14 Mar 2017
I was on the line with a friend who said “I am stuck on the road for hours, this mother f—–s are blocking the road again”. I had to remind him his past, when he told how protests were fun, but it is not so now, he agreed with a heavy sigh!
Violence is the problem
I am in the grounds, every problem should be solved with a gentle fashion. We talk, we compromise, we vote and then we make legislation. I also believe students should not be ragged physically and mentally but rather be involved in our research and development. Carrying these views was what put me in hot waters once and had to join the minority Anti Ragging groups and be Ala (the ignored).
Protests are a bigger problem than SAITM
Students in public universities led by the Anthare (Inter University Students Federation) are hitting the roads very often. I doubt a single day goes by without them showing up in the news. They have no respect for the countries law, nor for the police who keeps the society safe .
The demonstrations make damage to public infrastructure, damage private property, makes congestion so bad, hundreds of thousands of man hours lost every protest .
They are just adrenaline junkies demonstrating the strength and stupidity of the youth. I guess it is a mating ritual which seems to be working .
Right for Education
Students in SAITM have a right for education. They pay money and they get educated. It is not some thing you should worry about. Your parents and my mother didn’t have money to get us private education, but we shouldn’t be jealous of their parents achievements. Your worry should be how your parents can be better, not cause worry for the parents who are!
For the record, I personally don’t like SAITM. But I strongly believe we need good Private Universities. I stand strong we should help them correct them selves and if they fail to absorb the university to the government and maintain it as a paid university.
Substandard? No problem!
Our public universities are well established, recognized internationally, better equipped, has the best of teachers and the sharpest (may not be the finest or smart - - given their collective behavior) students the country has to offer. Why are we worried about them?
I can’t emphasize enough. Every one has a right to learn from who ever they want. Let them learn. But there are points where as responsible professionals we should be involved to defend.
- I believe, for at least some time, they should be bared from training in government hospitals. They have their “teaching hospital”. They can surly use that. Or partner with any private hospital for the task. The helpless poor people should not be the lab rats, in my opinion.
- They should have UGC approval and should meet with SL Medical Council Standards and until then their degrees will not be recognized.
- There should be a common exam for every (government and private) medical student who seeks join SLMC to face.
Even not meeting this facts, I don’t think any one should intervene with their education.
Abolishing SAITM is not at all a solution. We need private universities to be better and we need more of them!
12 Mar 2017
Its Sunday, but I just finished interviewing a Ruby developer to join my team. He will not be joining the team, but not for reasons posted here.
I showed him a piece of code from that was like…
data = JSON.parse(params[:data], symbolize_name: true )
# more stuff wich included N+1 Query
He was quick to point out that the I am creating symbols from a user input. I was curious why he thought it was a problem and he described that Symbols in Ruby don’t get garbage collected. Knowing it was a little higher than what I expected I asked “which interview question website did you pick it from” and I figured out it was Toptal.
That is not entirely true if you are on Ruby 2.2 or higher.
There are two kinds of Symbols in Ruby. Some are mortal while others are immortal. Most symbols you make dynamically get cleared.
A good article on that matter
10 Mar 2017
The days of isolated websites and apps are over. Applications interact with one another through APIs to access each others specialization. You should write a Ruby GEM for the task. But how are you going to mock API calls. Answer is vcr will and you don’t!
A simple example would be as follows. The API is written using HTTParty but should work with any thing…
it "fetches price trends" do
VCR.use_cassette "zumper/san-frasisco-ca/lower-haight" do
price_trends = Zumper::API.get_price_trends(
# do some thing with price_trends
Here, on your first call, the response will be recorded by you VCR in to a file. This file will be used to replay the API call making it fast and deterministic.
If you are wondering why…
- Tests should run fast and HTTP is a notoriously slow protocol
- Tests need to be deterministic - running on http you might come up with internet errors
I was asked what if the API changes…
Firstly and most importantly, APIs shouldn’t implement breaking changes. End points need to be thoroughly tested and changes shouldn’t break tests. Breaking changes can come from a new version ex: v1 -> v2. But it is not under your control.
Secondly, vcr is for you when developing, so the tests run faster. I normally have a VPS that momentarily deletes vcr cassettes and run tests again.
I am out! Happy & snappy testing!