Wednesday, November 22, 2017

Nature, most benign, most benevolent!

We have this habit of blaming nature for all our ills.

Obviously, because man is the most intelligent creature on Earth and cannot go wrong.

Just imagine, what doesn't nature give us? Nature gives us light, energy, peace of mind, food, water and everything that is needed for our survival.

And, what do we do in return?

Do not let any chance to damage her physically and spiritually.


The better our knowledge of nature becomes, the worse becomes our treatment of her, making her angry.

What does nature do when she becomes angry?

She reacts in ways we cannot fathom.

Just let this sink in. The world has seen 2053 nuclear explosions since 1945. 

What Nature teaches us?

So, what are the lessons that we have to learn from nature.

We should all know that the benign, benevolent character of nature cannot be taken for granted. Because, our actions can change the quality of nature.

Nature or the cosmos cannot be overpowered, but it can be won over by our responsible actions which take nature into account, in all our actions.

It is not for nothing that our ancestors worshiped nature, which the modern religions rejected outright. It only shows our depredation and fall from grace.

Friday, November 17, 2017

Compressing jpg files; Which online tool is better?

Compress jpg files; Which is better?

We needed to place a few banner images on one of our web sites. The high resolution images were of the size of over 2MB. This is not ideal for a home page of a website. So, we decided to try a few image compression tools online.

The Image Compressing Challenge Contenders

We tried three image compression tools, such as, and

The first mentioned compressjpeg gave me a reduction of 72% from the original. To the untrained eye, there is no difference in the quality of the images.

The process was also pretty fast.

On the other hand, tinyjpg failed to upload my 2.5MB file twice and gave me a compressed file the third time.

Guess what, the online image compression tool shaved off 78% from the original image size.

Compressjpg, the third online tool that we tried, took a longer time to process the source image. The first attempt seemed to be a fail.

When trying the second time. File upload happens and there is a message which says the file was converted. But, the download link seemed like a Google adsense link.

So, of the two successful ones, the choice would be for speed and for better compression.

But, wait. There are other online tools like and Of these, seems to be good choice, compressing the original image of size 2.4MB to a size of about 375K. That is cool 85% reduction in size., meanwhile gave a compression of about 71%.

The Image Compressing Champion

Finally, from our analysis of jpeg image compression tools, we found out that the following tools gave us image compression without apparent loss of quality. In order of compression efficiency, they would be,, and

The winner of the compression challenge would be jpeg-optimizer

Wednesday, November 08, 2017

jQuery is updating a different tab different div, Why?

jQuery is not updating the right tab, updating a different one

Sometimes, we find that our jQuery code is behaving not as we expect it to. Like, for example, we expect it to show a certain content in a certain div, but it updated the content in a different div, instead.

The first time we encountered such a situation, it was frustrating. The key to finding a solution is to persist and split the problem into different small pieces.

There is no specific error that is shown or seen in the debugger or developer tools window. So, it becomes difficult to home in on the error. What we need is a cool mind and a certain experience to troubleshoot in such a situation.

Taking time off from the task, addressing a different task and coming back at a later time helps, almost in all situations.

The most probable reason is that the div that is getting updated is not closed. Some of the closing tags are missing.

So, the div that you are updating is actually part of the previous named div and so the previous div is getting updated and not the one that you intended.

Solution: Close the previous div properly to create the differentiation. Check and compare the opening tags with the closing tags.

$( "#home" ).removeClass("active");
$( "#one" ).removeClass("active");
$( "#menu1" ).html( text );
$( "#menu1" ).addClass("fade in active");
$( "#two" ).addClass("active");

In the above jQuery script, dive menu1 is updated with some html content.

Then the div with id menu1 is made active. Then #two is made active. #two here is a tab visualization. Two different tabs are created in this example to provide the visitor a feel of viewing two different screens.

In normal situations, this should provide the impression that a different tab is being viewed.

But, in our case, it did not happen.

Because, our code looked something like this

<div id="home">
      <div id="menu1">

In this case above, "menu1" becomes a subset of "home" and thus any update of the menu1 is reflected in "home".

The right code would have been

<div class="container">
     <div id="home">

<div class="container">
     <div id="menu1">

Proper closing of the tags, is very important.

A simple solution for jQuery is not updating the right tab, but updating a different one.

It is frustrating till we understand and identify it; then it becomes easier to make the update of the right div or tab using jQuery.

Tuesday, October 10, 2017

How to not print columns on display while printing on paper

Many of you may or may not be aware of a javascript code that is capable of printing page content.

We had created a report which looked something similar to the one shown below.

Notice that there are two columns that display "No" in orange colour. We want to print the report, but we do not want the "NO" columns to be printed on paper.

Hiding columns from a table using jQuery

jQuery has a simple command which can hide any number of cells based on their class names. That command to hide a class is given below.


This command was given in the jQuery code, to be called when the print command was called.

Let us assume that we gave the classname "noprint" to all those cells in those two columns, which we do not want to print.

In the code loop, we added an additional classname called "noprint" to the content, like so.

 If you see, the  class "noprint" has been added. Now, when I give the command 

All cells that need to be hidden, have to be given the classname "noprint".


All those cells that have noprint class in them are hidden from view.

We are using "class" and not "id" because of obvious reasons, the reasons being the "id" can appear only once in an entire page.

Printing using the system dialogue from web application

Now, the Print command may be used to call the system's print dialogue and get our page printed. See below for the code.


Friday, October 06, 2017

mdbootstrap css and the invisible uncolored button

mdbootstrap css not working as expected

This document can otherwise be called btn-success vs btn_success Bootstrap css. This is because, a simple oversight resulted in a confusion that left our imagination flying at the speed of a mythical spaceship.

Recently, we were working on a page, where certain page elements were to be painted dynamically in the course of the program.

CSS not updating cell as expected

When the program was run, the color of the cell did not change. On analysis, we found the  css class to be present in the code.

After many rounds of analysis, we found out the problem to be an innocuous "_" symbol.

btn-success explained

To put it simply, the class that we called was btn_success,  whereas what we should have called or referred to would have been "btn-success".

Notice that the character "_" in place of "-". Though they seem similar, it is easy to overlook them when they are part of a larger group of words, in this case, a program.

We are recording it here so it may be useful to another set of desperate souls who want color in their mdbootstrap css.

btn-success In a nutshell

btn-success is a bootstrap class, which highlights the cell green. If you use btn_success instead of btn-success, your cell will not be highlighted in green.

Usage of btn-success


In the above example, a ? is displayed with in a button, which has the background color green.

Wednesday, October 04, 2017

Learning HTML Online, Fast and FREE

A FREE Online Course for Web Development

Yes! It is true. Though, it was a serendipitous discovery. There aren't many sites that offer you the best quality training on the web. And that too, for no cost.

A run through of the syllabus and the course structure has not failed to amaze us. Such is the smooth and easy flow of the lessons, which will take the student through all the aspects of the course.

FreeCodeCamp is my first choice if you want to learn a new subject, such as web development.

According to their website, they are a community that helps you learn to code, then get experience by contributing to open source projects used by nonprofits.

Established in 2014, freeCodeCamp has helped over 14,000 people get jobs or get better offers. They have helped over 30 non-profit organizations with their web sites too.

For the student, in addition to the course content, they also have a Youtube channel, which contains classroom sessions, which can be utilized by the student to improve their techniques.

You can follow them on twitter, facebook, Subreddit and 

Their LinkedIn University page is here

So, if you are looking to learn JavaScript, jQuery, HTML5 and web development online for FREE, freecodecamp is where you need to go.

Monday, September 11, 2017

Knee Jerk Governance ?!

A Country of RULES, RULES and more RULES

I do not know how many of you have noticed. We are a country of RULES, RULES & more RULES.

Probably the only country in the world with the most RULES (LAWS) for anything and everything.

Somebody alleged that it is because laying down rules are the easiest of tasks; doesn't involve any responsibility. 

Make a rule that helmet is mandatory. But, don't make a rule that safe roads are mandatory. Because, making safe roads involves effort. Whereas, forcing the biker to wear a helmet is simple. And, if he fails, more money to the government kitty.

I have been wanting to write this for a long time now. See, the idea is not to find fault with anybody. The idea is to highlight the problem in the system.

School tragedies

The trigger for this article is the sad loss of the innocent child in a Gurgaon school on account of alleged murder.

Similar incidents have happened in many parts of the country. It is alleged that in every case, there was always a reaction from the authorities and an assurance that steps have been taken to prevent the occurrence of such incidents in the future.

One such incident that comes into our mind in this context is the Kumbakonam school fire accident tragedy. 

There was another such incident in Bengaluru, following which schools in Chennai were asked to install CCTV cameras in their premises.

The schools were also asked to verify the credentials of the employees.


take action based on advisories

What would be the ideal course of action? Now, it is up to the local authorities, the police and civic administration, to verify periodically, if the advisories are being followed.

Regular visits to the schools by the police and the corporation authorities and frequent meetings with the principals of the schools would keep them on their toes at all times.

Getting updates on the status of security and safety protocols from the schools on a regular basis will give the schools a sense of fear and responsibility that they are being monitored. This will definitely ensure that the schools take extra care and do not let their guard down.

School infrastructure and layout of the schools, with entry and exit details, whether MCBs are installed, the ratio of students vs teachers vs maintenance and security staff and all such things need to be shared with the authorities.
Actions need accountability. Someone needs to assume the responsibility.
The authorities can then formulate a plan or ideal scenario, which can be recommended to the school to follow up and implement. A timeline may be given to the school for the implementation of the ideal security protocol system.

We do not know if such an exercise was taken up by the corporation and the police with the schools in Chennai.

Status of safety and security

The Blue book on school safety has to be drafted NOW.

In the context of safety and security of the children, what will be the present status of safety and security in our schools across the country? Is there a blue book available on such safety and security aspects of all schools in the country with the authorities? It would be a sweet surprise if such information is available with them. We, as citizens would be most proud.

That would have been wonderful. But, given the track record of our authorities, we are just waiting for another mishap to happen.

Then there will be another knee jerk action from the government, authorities and the schools, which everybody will forget over a period of time.

A Blue Book on School safety is the immediate need of the hour.

Knee jerk governance

As we all know, all our governments have always been reactive, not pro active. Our governance have been reactive and not proactive. The focus is always on rectifying the problem after it has happened and not taking steps to prevent the occurrence of a problem.

We have never been in a situation where we were on top of a situation all through our 70 years of governance of independent India. Let us take for example, the 2015 and 2016 floods of Chennai and the 2004 tsunami in the coastal areas of Tamilnadu.

Do you think the government is now prepared to tackle such an incident if it were to happen again? Think about it.

We are a reactive and relief offering system. We are never an anticipating and well prepared system. The problem is systemic.

It is not because we do not want to be prepared. It is because, there is no system in place. There are no long term plans that are prepared and put into place.

Is there a Solution for our ills?

Most definitely. But, we need to have long term plans for nation development along with the short term plans. We need to have at least a basic set of rules [as we all know, our governments are experts in laying down rules] for each department of the government, going down to the grass roots.

Presently, we have 5 year plans. We have governments that run for 5 years. And, if there is a change of guard after 5 years, there is a tendency to put the plans of the previous government in the back burner, or put them in the cold storage.

Hence forth, all our government decisions should be based on the merits of the plans. We need to take all the intelligentsia of the population into confidence and all decisions will have to put the interest of the nation paramount.

We need not all those 5 year plans or 10 year plans. 

We need to have 20 year plans. How do we envisage our city 20 years from now? 
How do we see our state 20 years from now? How do we want our country to be 20 years ahead?

This takes time, but it would be well worth the effort that is put into this.

Mould the young minds

We need to mould the young minds of today; they are going to be the rulers of tomorrow. There is a dire need to create a healthy future generation that is fit in body and mind, which is capable of leading the nation into its bright future.

We need to introduce compulsory physical exercises, yoga and meditation, to keep the mid and body focused and keep them from harm's way.

Follow the Japanese way

I recently saw a Japanese video, which emphasized the attitude of the Japanese people, which is respect and caring for the others. Every Japanese is known to be respectful of the others. That is a quality, which we need to inculcate in our future citizens. We need a country full of citizens who are concerned about other citizens.

We should tell our future generation about the glorious past of our country, which was the fount of civilization in its heyday, till greed and selfishness brought us down.

This is sure to bring down all the ills of corruption and greed, which are pulling the nation down from all sides.

There is HOPE for the future

We hope that at least from this incident onward, the government takes serious cognizance of its responsibilities as the ruler of this great nation.

Link: School buses in chennai to be equipped with cctv cameras

Nature, most benign, most benevolent!

We have this habit of blaming nature for all our ills. Obviously, because man is the most intelligent creature on Earth and cannot go wro... Registered & Protected DWYE-NHTO-NBNH-7FFM