30 Jun

Hadoop yarn distributed shell example on MAC

I have installed hadoop via HomeBrew.

Command:

hadoop org.apache.hadoop.yarn.applications.distributedshell.Client -jar /usr/local/Cellar/hadoop/2.7.0/libexec/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.7.0.jar -num_containers 1 -shell_command ls

check output from:

less /usr/local/Cellar/hadoop/2.7.0/libexec/logs/userlogs/application_<jobid>/container_<jobid>_01_000002/stdout

 

 

12 Jul

Why is programming so…

Here is the first part of many blog posts to come explaining some of the “Frequently thought but not asked questions”. If you have some questions, please feel free to leave them in the comments of this post. Would love to answer them. :)

Why is programming so :

 

Cryptic

Any new language (french, german, italian) you hear/read will at first will look cryptic. As you get accustomed to it, it will feel natural. Once you understand why a piece of code is written using a particular “syntax” (more on this later) it will be easy for you to relate to it.

 

Rigid or Strict

Each spoken/written language has a grammar. Similarly each programming language has a syntax. The only difference here is Human’s can understand the hidden meaning in the dialect despite incorrect grammar, by considering other factors like the environment, the gestures etc. Unfortunately the computers are not yet this advanced, if we use the wrong syntax, the computer does not take the other factors in the scenario. Only your imagination and requirement are restricting you from creating a software. Programming is not rigid or strict, it’s not stopping you to create something.

 

Diverse

Over the years, with interests of more companies, developers, scientists and customer requirements; computer programming had to evolve and with this evolution many diverse but necessary languages were created. Again here we can see an analogy to just any other spoken/written language. Latin for example has been evolved into french, english, german, italian. Sanskrit is evolved into hindi, kannada, tamil and bengali. Similarly over the years, one programming language was evolved into more simpler programming languages. The programming language C is used as the base for most of the other languages like Python, PHP, Ruby (don’t get scared here, these are just the names of some the programming languages).

16 Jan

A year ago!

A year ago I had you.
A year ago I could hear you.
Your words of wisdom and care
are more important than air
I wish I could hear you
I know you can hear me

A year ago I had you.
A year ago I could see you.
Your smile levitating souls
Your tears drilling holes
I wish I could see you
I know you can see me

A year ago I had you.
A year ago I hugged you.
Your warmth was the world
now everyone’s cold
I wish I could reach you
I know you can reach me

A year ago I had you.
A year ago I had the most precious person…

27 Nov

PHP Gotcha – foreach with pass by reference

We can pass by reference the values in an array to modify the array. But in the following code snippet, the output will be somewhat erratic.  

$someArray = array(1,2,3);
foreach($someArray as &$value) {
   $value++;
}

$value++;
print_r($value);

The output is

array(2,3,5)

As you noticed the last value is incremented twice, because the reference is not lost after the loop ends. The increment $value++ outside the loop will update the last reference viz the last element. To avoid this one must unset your last used reference

$someArray = array(1,2,3);
foreach($someArray as &$value) {
   $value++;
}

unset($value);
$value++;
print_r($value);

Now the output will be

array(2,3,4)

 

31 Mar

Twitter Bug :)

Its always interesting when companies like twitter, facebook and others release half cooked code .. and show us their naked self  :P

 

q

twitter bug while updating profile

27 Feb

Life does not let you fly that easy!

No one wants to fall and just stand, we want to “fly”.

Each step you take on the runway, time will keep on throwing stones in your bag making each step difficult than the previous and all of a sudden you will find yourself in a huge trench with bag already weighing tons.

One needs to find a source, a light to bring the will to continue the attempt to fly … and if time really wants to test you it will take the light away from you and keep you in an abyss.

At this point, you are left with your thoughts, experience and determination. One needs to align all of these and put best foot forward.

Once out of the abyss, task is not over … the target was to fly … you have just reached level zero again but this time with more load, tiredness and shock. But you have also gained the experience on how the world moves when you are in that trench, who stands with you, who threw you a rope, who was your light, who can be your light …

With the strength gained and lessons learned each step on runway will seem lighter than the abyss …