Fear of Git

The intention of this article is not to explain how Git works. It is just to explain how Git should be approached.

The beginning

In 2010, I got introduced to Git. Git was a buzz word then. Just skimmed through its features and thought how could there be any other source control not having all these.

I was saying to myself, Git is the most obvious way any source control should work.
But that was a pretty immature thought, because I did not know what is actually happening inside Git.

Later, was working in Git with the so called basic ...

View comments.

more ...

Blog story

In this article, I wanted to share about various people and factors motivating me to start this blog and the tools I used to make it live.

Fizer, who runs www.chennainerd.in insisted me to start writing and was ready to publish my articles in it. He emphasised on creating a brand on the internet, which can in-a-way be achieved through blogging. He was patient enough to do the proof reading and educated me about hacker news for taking it to larger audience. It is only because of his influence this blog is live.

Software Engineer's Life Manual ...

View comments.

more ...

2's complement - you beauty

This is a short write-up two's complement, which, in my humble opinion is one of the great idea to which entire computer industry should be thankful to.

I remember, in my school days when computer science subject was taught without computer, there used to be problems to find binary equivalent of a number.

Binary equivalent of 5 is 0101. (Considering bit length of 4).

On top of this, there used to be problems to find the one's complement of it and two's complement of it.

One's complement of 0101 is 1010 (Simply inverting 1 to 0 ...

View comments.

more ...

Proxy and port forwarding

This article is more like a case study on when to use proxies and when to just stick to simple port forwarder. Also discusses in detail on what each of those is, and the tools falling under each category.

At office, we have our solution - basically a bunch of HTTP services, deployed on openstack which is not directly accessible from external network. We were asked to use a jump server (a.k.a jump box/jump host) - a server in the middle which has access to both, private network of the solution and the external network.

For using the services ...

View comments.

more ...

Dockerfile CMD vs ENTRYPOINT

I had difficulty in understanding the difference between CMD and ENTRYPOINT in Dockerfile before I did the below experiment. Hope this will help someone like me who cannot understand the difference from the documentation or stackoverflow.

Consider the below docker file

[[email protected] 01.BusyboxWithCMD]$ cat Dockerfile
FROM busybox:latest
CMD ["cat", "/etc/passwd"]

Let's build an image and call it busy_cmd_image

[[email protected] 01.BusyboxWithCMD]$ docker build -t busy_cmd_image .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM busybox:latest
 ---> 2b8fd9751c4c
Step 2 : CMD cat /etc/passwd
 ---> Using cache
 ---> e4df0d0c0d67
Successfully built e4df0d0c0d67

Now, we ...

View comments.

more ...

Random Rationalized

I had a requirement to have random numbers generated in a C application.

#include <stdlib.h>
#include <stdio.h>
int main()
  int i = 0;
  for (i = 0; i < 5; i++) {
    printf("Random number %d  =  %ld\n", i, random());
  return 0;

I ran the code once and saw that random numbers were getting generated.

But to my surprise when I ran the code second time, I saw the same numbers getting printed.

What??? Does it mean random numbers are predictable? If so, why is it called random? Random and Predictable words literally contradicting each other.

But I remember using random.random ...

View comments.

more ...

GCOV - C/C++ Code coverage testing tool

What is GCOV

  • GCC provides GCOV, code coverage testing tool for C/C++ programs.
  • GCOV identifies the lines of code that got executed while running the program.
  • It also gives additional information like how many times particular line got executed.
  • Also provides information about how many possible branches are there in the code and which branch path got executed more.

Use cases


GCOV identifies the sections in the code that are heavy executed, using which we'll be able to focus on optimizing the parts of the code which are executed often.

Identifying dead code

Any code that got ...

View comments.

more ...

Generators in Python

One of the few obscure feature of python (for the beginners) is Generators. In this post I would like to share few naive questions I had about generators and the answers I got after understanding them.

Question 1: Are generators something like static variables in C? Say, generateFibonacciNumber() is a generator. First time I call generateFibonacciNumber() and iterate upto value 5, the next time I call generateFibonacciNumber() will it start returning from value 8 when iterated?

This could sound like most dumb question on earth, but honestly I had this question having come from C background.

Answer: No. Generators should ...

View comments.

more ...

I am a C programmer. Why I love AngularJS?

The intended audience for this blog are not the people who have profound knowledge in HTML and Javascript. This is only for those who are in inertia to experiment with web development. Also, please be aware that this is not beginner's tutorial for AngularJS.

I have this habit of trying some web related stuff rarely once in a year. Couple of years back on a fine morning started to play with jQuery and was impressed by its power. But at the end of the day thought there is so much to APIs to remember or at least be aware ...

View comments.

more ...