Posts

Setting the right expectations

This is not my typical technical article, just a little restrospective of an experience at work.

I was working with a new member in the team, to provide him the KT on one of our applications. I asked him to pull our source code from git, and he told me that he has never heard of git before. I showed him a few basic git commands and asked him to to set up the code locally. Once he got stuck after a point, he asked for my help. I asked him where he had checked out the source code and he pointed me to his desktop. I found a highly cluttered and unorganized desktop, and the source code of our project was right in the middle of that mess.

That immediately turned me off.
Soon I realized that he had no prior experience with many of the tools and software that we use largely at work. I got pissed some more.
After a while, I went to my supervisor and asked him who had interviewed this candidate for our project. He told me that he had no idea who interviewed him and he was just assigned to our…

Beyond CAPTCHA

If you have ever filled an online form, you are bound to have encountered a CAPTCHA.

CAPTCHA stands for Completely Automated Public Turing test to tell Computers and Humans Apart. I haws been named after the computer scientist Alan Turing.

What is a Turing Test?
Turing test is used by humans to see if a machine can converse like a human. The turing test has evolved to an interesting concept. Today, its a scenario in which a human interrogator uses some sort of interface, often a computer terminal, to communicate with someone else. This some one else could be a another computer program or a human being.If a computer program manages to fool most of the human interrogators into believing that it's a human, the program is said to have the turing test.

The CAPTCHA test is a turing test designed as a short hand for a gateway that allows humans to pass through while keeping machines at the border. The idea of a CAPTCHA is  to build something which is simple for a human being to decipher w…

12-Factor Apps in Layman's terms

Popular platform-as-a-service provider Heroku has published a set of best practices called the Twelve-factor-app for building deployable sowtware-as-a-service apps that are

PortableContinually Deployable andScalable Here are the twelve principles in a more precise and understandable version:
CODEBASE: One codebase tracked by revision control, many deploys
Put all your code in a version control system, the best option for me is the git. You can have multiple branches but never multiple repositories for the same service/ microservice. There can be only one codebase per app, but there can be many deployments.
DEPENDENCIES: Explicitly declare and isolate dependencies

This has been more important ever since configuration tools like Chef and Puppet have been used extensively used by DevOps to automate the configuration and deployment process.

Consider maven as dependency management tool, manifest will be pom.xml, which fetches dependencies as jar (artifacts) from various repositories.

All you…

Logging the right way

Logging is an important aspect of software development, one that is many a time ignored by developers.
it's important to have clean and helpful logs. They can come real handy when you have to debug an issue.

Below are a few important points to keep in mind while writing your logs

1. Using a good API

In my experience,I find the slf4j API better than the others.
Consider this:

in log4j:
logger.debug("Found employee : name: "+name+"designation: "+designation+" department: "+department);
This is difficult to read and has 3 string concatenation.

it can be rewritten with slf4j as
logger.debug("Found employee : name: {} designation:{} department: {}",name, designation, department);
Now, this is more readable, and avoids the string concatenation.

2. Watch what you are logging

Every time you log, watch what you are logging. Sometimes loggers can be the cause of many exceptions

Example 1: logger.debug("User Details :{}", user.getName());
This …

The power of Continuous Integration

What is Continuous Integration?

Continuous Integration is a methodology followed by development teams, where in they submit their codes periodically to a source control management system (SVN, ClearCase, Git etc.). Each time a new submission happens, a set of automated scripts run to build, deploy and test the build. This ensures that the current build is error free and a clean deployment.

There are many tools available for Continous Integration...TeamShip, GitLab, Codeship. The most commonly used one is Jenkins.
I will talk about the most commonly used CI tool, Jenkins.

Advantages

This is just the tip of the iceberg. There are many advantages that CI brings along:

1. Integrations are automated
The integration process can be completely authomated. Configure your Jenkins to poll the repository on a regular interval. Once the tool detects a check-in, it triggers a set of configured scripts to automatically buils and deploy the build to the server. Thsi saves time and also eliminates manu…

GROUP BY MONTH, YEAR AND WEEK IN SQL

Say, You have a table from which you need to get the count of records, sum of amount and average amount on a weekly, monthly and yearly basis.

These are the queries:

Select
COUNT(id) as COUNT, SUM(AMOUNT) as SUM, AVG(AMOUNT) as AVG, DATEPART(WEEK, CREATED_DATE) as WEEKCOUNT
from TABLE
GROUP BY DATEPART(WEEK, CREATED_DATE);

Select
COUNT(id) as COUNT, SUM(AMOUNT) as SUM, AVG(AMOUNT) as AVG, MONTH(CREATED_DATE) as MONTHCOUNT
from TABLE
GROUP BY MONTH(CREATED_DATE);

Select
COUNT(id) as COUNT, SUM(AMOUNT) as SUM, AVG(AMOUNT) as AVG, YEAR(CREATED_DATE) as YEARCOUNT
from TABLE
GROUP BY YEAR(CREATED_DATE);

Conditional coloring of the list rows in Sencha Touch 2

I had a tough time doing this. Finally its up. You need to manipulate on the dom.
Just need to add the following listener on your list item.

listeners:{
                activate:function(list,index,item,record){
                var itemClass =Ext.get('id-of-your-list').dom.getElementsByClassName("x-list-item");
                    for (var i = 0; i < itemClass.length; i++) {                       
                        if(this.getStore().getData().items[i].raw.status ===1){ //condition on the record
                            itemClass[i].style.backgroundColor='#f3f3c7'; //change the color of the row
                        }else if(this.getStore().getData().items[i].raw.status ===2){
                            itemClass[i].style.backgroundColor='#c7f3c7'; //change the color of the row
                        }
                    }
                }
            }