Comment your Rust Code


This post explains how to properly comment you Rust code.

Add Documentation to your Public APIs

/// This is a documentation comment

Documentation comments can be used to generate public HTML documentation. So these are ideal to document your public Structs, Methods and Functions. Also Documentation support markdown formats. Explain Panics, Errors, Examples of your code and whether your code is Safe or Unsafe.

Cargo runs your Doc Examples

To ensure your code is up to date, Cargo test will run examples in your documentation. This is really awesome.

Use Regular Comments for Code Internals

// This is a regular comment

Use regular comments to describe your code’s internals. These would not be included in the generated HTML file.


Machine Learning – a 10 minutes overview

What is Machine Learning

Vast number of programming problems can be solved by writing a set of well defined rules. Some problems are very complex it’s either we can’t define a clear set of rules or there are huge number of rules that it is impossible to manually codify those rules. A very good example is Speech recognition.

Machine Learning provides us technology so we can teach computers these rules provided a set of labeled data (training set) and extend them to a general set of data that were not seen in the training set.

Categories of Machine Learning

Supervised Learning

Goal of Supervised Learning is to predict the output variable from a given input variable. So for supervised learning, we need a data set with labeled output variables to train our machine learning function. If output variable is a category, it is Classification Problems. The functions we learn to solve these problems are called Classifiers. If output is a real value, it is a Regression Problem. Function we learn is called Regression Function.

Unsupervised Learning

Main goal here is to find some structure in a input data set. This involves,

  • Find clusters of similar data
  • Outlier detection

Machine Learning Workflow

Machine learning workflow mainly consists of three components.


This involves representing your problem in such a way that a computer can deal with it. So you have to extract a set of features from your input objects. Extraction most relevant set of features from your input objects is called Feature Extraction or Feature Engineering. Next part of the problem is choosing an appropriate machine learning methodology for the problem.


You need to have a framework to evaluate the accuracy of your ML algorithm. We usually set aside a set of test data for this.


After evaluation step, you may find some improvements you could do. Such as choosing a more appropriate algorithm or extracting more relevant features.


Usually you have to iterate through above described steps before you can find an optimal solution for you problem.

How to make a Blog Searchable in Google

How to make my WordPress blog searchable via Google? That was one of the first questions when I started my blog.  Here is a very easy way to get it done without meta tags.

Step 1 – Go to Google Search Console

Follow this link

Step 2 – Add Property – add the Link of your web page

Click “Add Property” and add the link to your web page.

Screen Shot 2018-08-19 at 8.34.42 AM

Step 3 – Verify the Ownership of your Webpage

Google asks you to verify the ownership of your page, this is where most of us run into problems.

Screen Shot 2018-08-19 at 8.38.43 AM

Step 4 – Get DNS Verification Record

Click “Alternative Method” then select “Domain Name Provider”. You should see the following page.

Screen Shot 2018-08-19 at 8.57.51 AM

You should add this record to your DNS.

Step 5 – Open WordPress Domains Page

Go to your WordPress Admin page. Go to Domain tab.

Screen Shot 2018-08-19 at 10.30.01 AM

Step 6 – Then Select “Name Servers and DNS”

Screen Shot 2018-08-19 at 10.30.33 AM

Step 7 – Then Click on “DNS Records”

Screen Shot 2018-08-19 at 10.31.39 AM

Step 8 – Add Google Site Verification Code as a Record

Screen Shot 2018-08-19 at 10.32.45 AM

Step 9 – Verify it on Google

DNS record instantly takes into effect. Go back to Google Search Console and click on Verify.

Screen Shot 2018-08-19 at 8.38.43 AM

We are very responsive. Feel free to ask question/leave suggestions.




IELTS is a quite easy exam to pass, provided that you have prepared your self well for it. In this blog I am explaining what I did to ace the IELTS exam with less effort.

Step 1 – Find an Institution

There are several well-known institutions. Choose one which is conveniently located for you. It’s really a personal choice.

Watch out!!!

When you reserve the test, do not mention your real purpose of taking the test. They typically to set higher standards for people who take it for immigration reasons. There is no reason for IELTS institution to know why you are taking the exam. Just specify that you are taking the exam for a personal reason. If they compel you to give a reason, it’s best to go with a different institute.

Step 2 – Schedule a Test

Seriously, book your test, at the very beginning. Here are the reasons why should you do it.

  • There will be a long wait list. Typically 3 – 6 weeks
  • It will give the motivation to get committed to studying. It’s harder than you think to find time to study when there is no deadline

Know Your Exam

Check whether to take an Academic or a General exam. If you are doing this for a PR application, you should take the General module. For university applications, take the Academic exam.

Know How Much You Have to Score

Know how many points you need. This will help with time management.

Step 2 – Study

Personally, I spent 3-4 weeks preparing for the exam. IELTS exam comprises of 4 parts.


The exam takes about 50 minutes. You have to read a few articles and has to answer some questions. Cambridge University has a book with IELTS pass papers. Get a copy and do practice past papers. One trick I learned is to read the question once before you start reading the paragraphs. This really helps to save time.

It is very easy to waste lots of time here trying to perfecting your score. If all you need is a 7, why study for a 9. Save your effort/time for other areas.


During the exam, you will listen to some dialogs and answer some questions. Similar to Reading taking some pass papers should suffice. Don’t waste time perfecting your score.


During the exam, you will be asked to write one letter/memo and an essay. Do a few Cambridge pass papers. Find “IELTS Training modules by Adam Smith” for writing. Follow this module do some of its exercises.


You will have to talk with an interviewer during the exam for about 15 minutes. First, you will have to speak a few minutes on a given topic, following a few minutes of general conversation on the same topic. Again follow IELTS module of Adam Smith provide which some great tips to get a high score for this exam.

Step 3 – Know How to Spend your Efforts

Here is how I spent my efforts during my IELTS preparation.

Reading – 15%

Listening – 15%

Writing – 45%

Speaking – 25%

Step 4 – Go for the Exam

Be there on time, bring your ID – the usuals.

We are very responsive. Feel free to ask question/leave suggestions.

How to Pass Amazon Onsite Interview


Before you can sit for the onsite exam, you must pass the amazon coding interview. Please check this blog on how to pass the amazon coding test.

I was able to successfully pass the Amazon exam in my second attempt. It was a very challenging and refreshing experience. In this blog, I am sharing what I did to prepare for the exam.

Interview Structure

The on-site interview has four separate interview sessions, done by four individual interviewers. Each interview should take about 55 minutes.

Out of four interviews, three will be algorithmic questions. One will be a system design question.

Algorithmic Questions

For Algorithmic questions, you will have to write your code on a paper or on a whiteboard. You can use any programming language. You will have to provide the runtime and/or memory complexity of your program. You will have about 40 minutes to finish your question. If you complete it early, the interviewer may ask you a second question.

Design Question

Same goes for the design question. You have to draw the design diagram on the paper/whiteboard and explain your question to the interviewer. Similarly, you will have about 40 minutes to complete the question.

Leadership Questions

Amazon is very serious about its leadership principles. At the end of each interview, you will be asked some questions about Amazon Leadership Principles. This will take about 10 – 15mins.



Basically, follow the same set of preparations that I described here for the coding exam.

Since you won’t have IDE support during the interview, you will have to prepare for it as well. Trust me this is important. When you do practice questions do them on paper. Don’t worry about small mistakes on language syntax. But try to output the best industrial code you can.

Same principals as online coding interview applies. Use meaningful variable names, try to come up the with best code structure you can.

Design Question

Design question can be very challenging because of the ambiguous nature of it.

These questions can be of two flavors. Either it can be a very high-level question like “Design Netflix”. Or it can be quite a low-level question like “Give me a class diagram for a Table”. So either you are designing a complex system with high granular modules. Or you are designing a very simple system with very modules with low granularity.

To prepare for this exam again you have to practice a lot. Do sample amazon design questions available online. Try to glance through SOLID Design principles. Key to pass this interview is to be able to justify your design trade-offs to the interviewer. You don’t have to present your solution with AWS, or any cloud solutions for that matter. Use whatever technologies you are familiar with.

Leadership Principles

You can read about the leadership principles here. Read each one of them and try to absorb the essence of every principle. Then try to think about your past experiences where you had to apply these principles. I recommend you to prepare two examples for each of the leadership principles from past experiences.

Preparation Resources / Books

Like I have recommended in my other post, I highly recommend you to invest on Amazon best seller Cracking the Coding Interview: 189 Programming Questions and Solutions book.

This book covers all the algorithms, data structures that needed for your interview with complexities and it has 189 practice questions. Book is not cheap. But a sound investment considering that it will help to get to Amazon.

Looking for a free book??

If above book is too expensive, an alternative book is Coding Interview Questions. This is not as good the first book, but gets the job done. You can read this book for free for 30 days if you register for Amazon’s Kindle Unlimited Membership Plan’s free trial period.

During the Interview

Think Out Loud

Always maintain good communication with the interviewer. Ask questions regularly. Also, try to think out loud. Explain your thought process to the interviewer. For a particular question if you can think of two or three solutions, explain all the solutions to the interviewer. And tell him what you think the best solution and why.

Make Assumptions

Questions can be ambiguous – sometime on purpose. Clarify ambiguities with the interviewer. You may be able to make some assumptions to simplify the problem. If you are going to make any assumptions, clearly state them.

Use Language Provided APIs

You can use any language-provided library for the algorithmic questions. This is highly encouraging because it saves your valuable time. But if you are going to use any API / Data structure, you should be able to explain the inter-workings and complexity of them to the interviewer.

Leadership Questions

For leadership questions, you will be asked about one of your past experience. And you will be asked lots of questions from different angles of the situation. It will be very hard to maintain a lie; so be honest and truthful.

One Screw up Doesn’t Count

Also, all interviewers have a vote on you. So if you screw up one interview, don’t give up. Give your best shot to remaining interviews.

Other Recommended Readings


Automate Reboot and Git push with Linux Crontab



I am going to explain how you can set up daily git pushes with crontab command.

Step 1 – Disable git username/password prompt during check-in

Follow the steps on this StackOverflow post.

Step 2 – Add git commands to a sh file

Add following sh file to the repository root directory.


#Pull remote repository
git pull

#Git commit and push
git add -A

git commit -a -m "Daily Update"
git push

Step 3 – Open Crontab

sudo crontab -e

Step 4 – Setup Daily Executions

Add following line to the crontab file. This will run the script every 8am in the morning.


For example, the command I used was this.

0 8 * * * /home/myhome/project/

Step 5 – Setup Daily Reboot

Refer to this askUbuntu post to set this up.


Set up Ubuntu Mate on Raspberry PI for Python Developers



This blog explains how to set up a freshly installed Ubuntu mate on a Raspberry PI for Python and Django development. If you want to know how to install Ubuntu Mate on Raspberry PI please refer to this post.

Step 1 – Enable SSH

Not really needed for this task. But handy to have it. Run the following two commands to activate it.

sudo systemctl enable ssh
sudo systemctl start ssh

Step 2 – Update Ubuntu

Run following two commands. These two will take 1-2 hours to finish.

sudo apt-get update
sudo apt-get upgrade

Step 3 – Install Importent Packages

sudo apt-get install git
sudo apt install vim

Step 4 – Install Python/Django

sudo apt install python-pip -y
pip install --upgrade pip 
sudo python -m pip install django

Best Machine Learning / Data Science Reads

Here are the most interesting research papers / articles that I came across.

  1. A Few Useful Things to Know about Machine Learning. This papers discusses twelve important topics that every machine learning practitioner should pay his attention to.
  2. This article describes foundations of algorithmic bias.
  3. How machine learning algorithms are evaluated in real world uses in web and other online applications.