Stay Healthy, Stay Fit

We are all in that phase of life where work and travel take up most of the day. We wake up early in the morning and sleep late into the night. Commute to office, navigating through unpredictable traffic and put in our labor through the day, only to return home totally exhausted. At work, we are constantly staring into computer screens sitting in uncomfortable chairs for hours. The work never seems to end. All this takes up a lot of our energy and we feel tired very often and early. Fatigue tends to threaten our routine. We eagerly look forward to the weekends to rejuvenate.

Ancient scriptures tell us that a person is at his best only when Mind, Body and Soul are in sync. Each of the three need to be exercised often to kept in good shape. Mind can be exercised through mental aptitude (work, decision making, solving puzzles, thinking, reading etc.). Soul can be exercised through spiritual ways (reading scriptures, following one’s religion). Body needs to be fed and exercised to be kept in good shape (Eating healthy, physical exercise).

Most of us take care of Mind and Soul, but ignore the equally essential of the trio – the Body. Rarely do we find time to physically exercise as we spend most of the time either working or travelling. As we lack time, most of us end up having junk foods which can quickly satiate our hunger, providing instant food and energy only to cause long term health effects. Biologically, the body can fend of most of the diseases up to the age of 40 (Men) and around 45 (Women) as the immune system is strong. Once we cross that age barrier, the immune system weakens up opening doors for all kinds of health issues. Hence, it is very important to make an early start and make being healthy our top priority.

Few steps towards health which working professionals themselves can take up very easily in their day to day activities and most of which I personally follow everyday are listed below:

  • Take the stairs in office. Avoid escalators and elevators. Not only can you have a longer conversation with that colleague of yours, you can also get a decent cardio workout.
  • Take smaller water bottles to office so that you are frequently getting up and going to the cafe to get it filled. You add few more steps that way. Needless to say, drink plenty of water to keep your body hydrated through the day.
  • Take a break or a nap (if your workplace allows you to) – A power nap can work wonders. Try to give yourself a break in between work. Maybe you can walk across to the other side and have a talk with a colleague.
  • Try getting down a stop ahead or earlier – I personally do this just so because I can get some walk on the way back home.
  • Eat healthy and nutritious – Avoid junk and oily foods.
  • Stand whenever, wherever you can and stand straight – Avoid taking that seat in Metro or public transport. Standing can be very beneficial and and an exercise in itself.
  • Watch out for the way you sit while at work. Make sure you are sitting upright and have a good back support.
  • Spend some time doing nothing – Just do nothing. Your mind needs some rest too. You can practice Meditation, Mindfulness etc.

All the above tips can be practiced daily without having to schedule some exclusive time for it. Make it part of the your routine and incorporate health your day to day activities. Let us make being healthy a top priority for ourselves.

 

 

 

Careful about using wrapper types in JavaScript

We are aware that JavaScript provides 5 Primitive Types, namely string,  boolean, number, undefined and  null. These types except null and undefined have their own wrappers that create an object version  of  these types.

I will use String type to illustrate my point above.

We create a primitive string…

    var strPrimitive = "Hello World"   // Primitive string

and its object equivalent..

    var strObj = new String("Hello World"); // Object hash of the string

So, we might assume it is fine to use any of the Primitive or its Wrapper type in our code. But, be aware of the following pitfalls,

  • Observe that, the primitive and its wrapper types aren’t the same for obvious reasons (Primitives => string literal; Wrapper => string object)

     strPrimitive == strObj // false
     strPrimitive === strObj // false.

  • Also, JavaScript auto converts primitive to object as and when necessary and vice-versa. This perhaps explains why all the methods on the String prototype are available to the primitives.
  • Using the primitive types also saves some memory on Heap, which otherwise have to be allocated for the objects.

Using wrapper types is also discouraged for the following scenarios, particularly with Boolean type.

A simple boolean primitive would look like:

   var bool = false;

This works good in our code while doing something like this:

   if(bool){ // Do something if true...}

But consider what would happen if you were to use the wrapper instead of the primitive.

   var bool = new Boolean(false);

Now, doing so would prove to be fatal!, as the below code would evaluate to be true since objects are truthy.

   if(bool){ // Do something if true...}

So, the correct way to check would be using valueOf;

   if(bool.valueOf()){ // Do something if true...}

In all, it is best to avoid using wrappers when we can accomplish the same using the simple primitives.

Day 2 : First official jQuery conference in India – Bangalore

Stage set for the jQuery Conference
Stage set for the jQuery Conference

Do read about the Day 1 of the conference, if you haven’t already.

If Day 1 of the conference saw some exciting talks, Day 2 could only get much better. As with Day 1, the second and final day of the conference saw some amazing discussions centered around ReactJS, Functional Programming with JavaScript, Virtual DOM, Visualisations with D3, ES6 and ending with a great talk on WebRTC.

The day began with a keynote on ‘Common jQuery Mistakes’ by Dave Methvin – President of the jQuery foundation, who spoke at length about the common pitfalls all developers tend to find themselves in quite often. Dave also spoke on the coding do’s and don’ts that would have a bearing on the page performance. The session also detailed on managing the various jQuery versions out there, being aware of the features that are either supported or deprecated, how jquery-migrate would help mitigate issues in migrating our applications from one version of jQuery to the other. The essence of the talk was that the latest version of jQuery may not be always well suited for our applications and that care needs to be taken in choosing the right version often going through the documentation and which seldom developers do these days. The keynote ended with several code snippets demonstrating the mistakes committed therein and a way out of all those mistakes. The session met with a thunderous applause from the eager audience.

Keynote on 'Common jQuery Mistakes'
Keynote on ‘Common jQuery Mistakes’

Continue reading

Day 1 : First Official jQuery Conference in India – Bangalore

jQuery Conference, Bangalore
Bangalore, India

         jQuery Foundation in conjunction with AgileFAQs, hosted the first ever official jQuery Conference in Bangalore, India. The event, spread over two days (24th and 25th July) was well attended with over 300 Developers, Testers, Freelancers, CEO’s of Start-ups, Open Source contributors, JavaScript & jQuery enthusiasts from 5 countries. The conference saw presentations and talks on host of JavaScript technologies and tools from the management of the jQuery Foundation as well as some amazing JavaScript enthusiasts. Apart from Kris Borchers – Executive Director, the jQuery Foundation was represented by Dave Methvin – President, and Scott Gonsalez – the jQuery UI Lead.

Dave Methvin
Dave Methvin
Kris
Kris Borchers
Scott
Scott Gonzalez
Other than HCL Tech, the event saw participation of employees from several multinational companies such as Adobe Systems, Cognizant Technology Solutions,  IBM, Informatica, SAP Labs, Time Inc., TCS, Yahoo! Inc.to name a few.

Continue reading

Understanding JSON (JavaScript Object Notation)

JSON or the JavaScript Object Notation, as we know, is one of the highly popular data-interchange format along with XML, YAML, RDF etc. Its popularity is mainly due to its syntactical similarities with the JavaScript and it being human readable. Often, we find it difficult to clearly distinguish between JSON and its JavaScript counterpart – A simple JavaScript Object. In this article, I will try to distinguish the fundamental differences between the two.

Firstly, let me define a simple literal object in JavaScript. It looks like this, in its simplest form:-

var jsObj =

   {  
       "firstName" : "John" ,
       "lastName" : "Michael"
   };

Continue reading

Most useful tools for a web developer

“Give me six hours to chop down a tree and I will spend the first four sharpening the axe” – Abraham Lincoln

Likewise, any web developer needs to be aware of the tools which aids in faster and better web development. In this article, I wish to introduce few tools which I found to be immensely helpful for any budding web developer to have it in their arsenal.

  • Editors :- To start with, a developer needs an editor, a tool in which development happens and where the developer spends most part of the time. So, it is only wise that developers choose the right editor. Although, it takes time to get comfortable using any editor, it is worth the effort to try out different editors and choose one which is helpful the most. The choices vary from developers to developers and it is best left to the individual to make a choice.

I started with Notepad++ but eventually found Sublime Text to be the one suitable for me. These two seems to be the most popular choices, but I have seen my friends use other alternatives such as Eclipse and Aptana, which are popular too.

Continue reading

JavaScript – Simple, Intuitive & Promising

Web development is an area of immense interest to me. Having been in this field for over 3 years now, I look back at the time I ventured into this field for the first time during my college days for some academic project. As with any newbie, I started with HTML and CSS with an intention to design a simple login page. Designing a “Login Page” is akin to writing a “Hello World” program.

It started off pretty well and I was able to get the login page designed in no time. Once I got the hold on HTML & CSS, my curiosity increased manifold and now I wanted to add a “Home Page” which is to be shown once the login details are successfully authenticated. I was hence introduced to JavaScript and backend programming with PHP.

Continue reading