14 October 2015

Do recruiters still need to ask for resume / CV printouts?

In a digitized world, it is quite a paradox that companies still require interviewees to bring a printout of their resume or interview invite email.


If the phrase"save trees" makes you roll your eyes, then please feel free to stop reading. The rest of this blog post requires a more creative and inventive mind to interpret it.


Why in the world would you require printouts?

Assume a company conducting just 100 interviews every three months.
  • That's 100 * 3 sheets of paper on average * 4 quarters a year = 1200 pages.
  • For 3000 companies in a city, that's = 1200 * 3000 = 3.6 million pages a year!!! With that much of paper, you can make 293.49 copies of the Indian Constitution. The bulkiest constitution in the world! As for cost, that'd be 7.2 million Indian Rupees.
  • And oh...in terms of trees, that's 432 of them.
  • On top of that, you also want candidates to carry a printout of the interview call email?
  • Some companies even expect candidates to carry and submit photocopies of their marks card and resume even if they have not yet been selected by the interviewer (when you ask a candidate to submit exactly the same details a million times, it's a sign that your recruitment process is messed up. Ever heard of referential integrity?).
  • Then there's the entering of candidate details on a bunch of paper forms!


Seriously, HR departments...haven't a single one of you considered moving into the digital age?



What can be done:
  • Let interviewers use their work laptops to view documents
  • Specifically ask the candidate not to bring a printout of anything
  • Candidates can email their resume and scanned copies of other documents.
  • They can bring a copy of the interview call email on their smartphone (a copy of this email is usually asked for by the security guard).
  • If candidates are expected to fill in their details in a form (do you even need a form? Why not fill in details after being selected?), allow them to do it via an online form (perhaps even a day before the interview). You could even create a user friendly form that could be used on a smartphone. Create forms that  can be shared with the candidate on the smartphone via bluetooth (if the candidate does not have connectivity to the internet).
  • If the candidate wishes to share any additional documents, it could be done either via Google drive, bluetooth or via a pen-drive or rewritable CD/DVD. Make sure you use the pen drive on either a Linux or Mac OS, to avoid those annoying Windows viruses.

Yes, I know you might be a company which has very strict security and device policies. Do understand that these policies and security are meant to prevent sensitive company information from leaking out; not for preventing candidate information from coming into the company.

A creative/inventive mind will always find a way to create facilities and spaces where interviews can still be conducted with a minimal use of paper.
Once you've become digital, shout it out! Let the world know that your department is awesome! Spread the news. It really is time to get out of the feudal age.

No more printouts!!!

If you want to hear the magic word before going digital, here's me saying "Pleeeeeeease!!!".


07 October 2015

Automation: Script to set up tabs for you in a single terminal and run commands in them

I noticed many colleagues loved opening up multiple tabs in a single bash terminal, setting title names for every tab and running commands in them. They performed this ritual manually every single day.

The first thought that went through my mind was "Hey, why don't we automate the process?". I suggested it to them, but I guess they preferred doing it the old way. So when I had some free time, I did a bit of finding out and created this shell script:


#!/bin/bash 
#The ampersand in the end of this file makes sure that the gnome-terminal command is run as a background process. 

echo "Setting up environment"; 

gnome-terminal 
--tab-with-profile=Default --title=TAB1 -e "bash -c \"trap 'bash' 2; clear; ls; exec bash\"" 
--tab-with-profile=Default --title=ANOTHERTAB -e "bash -c \"trap 'bash' 2; clear; ls; pwd; exec bash\"" \
&



Place this code in an empty file named sim.sh and use the command 
chmod +x sim.sh 
to make it an executable file and then run it with
./sim.sh

and viola! You have a terminal with multiple tabs! Just replace the "clear;ls" and "clear;ls;pwd" with any other commands of your choice.

The syntax for adding more tabs is:

--tab-with-profile=Default --title=<THE TITLE YOU WANT TO GIVE THE TAB> -e "bash -c \"trap 'bash' 2; <THE BASH COMMANDS YOU WANT TO EXECUTE> ;exec bash\"" \ 



One more thing to do

Having the script is not enough. You'll notice that when you finish running any commands on the terminal, the tab title/name you set, would have gotten reset.
To circumvent this problem, do this:

Go to the Edit menu of the terminal. In Profiles select Default. For the option of When terminal commands set their own titles, select Keep initial title

That's it! Don't stop at this. Keep finding ways to automate tasks and save time!

20 September 2015

How to solve Git merge conflicts using kdiff?

KDiff's windows (or any other three way merge tool's windows) aren't quite so intuitive, so here's some help.

Let's say you've worked on the master branch



and somebody else worked on a "tryingOutSomething" branch





...and you decide to merge that person's changes into your code.



But Git complains that there are merge conflicts!
Turns out the other person was working on the same file you were working on, and also on the same lines.

GitExtensions refers you to KDiff3 to solve the merge conflicts. Select the option to start merging and you see a screen with four sections.

Click image to view larger

The sections from right to left are:

  • Section C: The code of the branch you are going to merge into your branch.
  • Section B: The code of your current branch.
  • Section A: The code that is in the commit which is a common ancestor of B and C. Don't bother about section A. You'd hardly ever use it.
  • Bottom section: It's what your code will look like once you've done the merges and save the file.

You can manually make changes or copy code and paste it into the bottom section like this:

The "m" I've circled in green, is KDiff's indication that it is a line of code that's not from section A, B or C. It's a line that you manually modified.

Or, note that the extreme left of the bottom section is segregated into areas where there are merge conflicts and it shows letters A, B, C or m. Any letters that are present before you started merging (indicated in the image below by the red arrows pointing leftward), are merges that happened automatically. If that's not what you wanted to merge, click on the letter in the bottom-left section and select A, B or C in the toolbar on top (indicated in the below image by the red arrow pointing upward).



You can even edit the automatically merged conflicts and choose A, B or C or edit it manually.


That's it. Now just save and exit, and Git will allow you to commit.



Solution to another issue:

You'll see a residual file of the merge, which has a ".orig" extension. Don't commit it. Just delete it.
In case your merging went wrong and Git says "You have not concluded your merge (MERGE_HEAD exists)", then just go into the hidden ".git" folder and delete the files named:
MERGE_HEAD, MERGE_MODE and MERGE_MSG.
After deleting those files, you'll be able to do the merging again. Do it carefully this time and save and exit.

All the best! :-)

17 September 2015

Aha!

Today is a little turning point for the LOL pages. They are now "Aha's!!!". Laughing Out Loud is not really what happens when one reads the little jokes I put up here. Aha describes the emotion better. Here we go...


Festival Sale
Share with this link




Continued in the next Aha!.
 
 

12 September 2015

It's just about using the Hungarian variable naming convention appropriately


"...and when bmeJames oBond pulled the ftrigger, the sivillian jumped in the mwater."

This is what programmers are put through when reading or writing code in companies where somebody, some-day, misunderstood what the Hungarian notation was actually meant for and created a company policy of naming variables as such.

  • bBusy : boolean
  • chInitial : char
  • cApples : count of items
  • dwLightYears : double word
  • fBusy : float (or flag)

Apps Hungarian is the original Hungarian. Not Systems Hungarian. If your programmers are annoyed with this notation, they are not wrong. See what the creator of C++ and the creator of Linux have to say about Hungarian:

Bjarne Stroustrup:
No I don't recommend 'Hungarian'. I regard 'Hungarian' (embedding an abbreviated version of a type in a variable name) as a technique that can be useful in untyped languages, but is completely unsuitable for a language that supports generic programming and object-oriented programming — both of which emphasize selection of operations based on the type and arguments (known to the language or to the run-time support). In this case, 'building the type of an object into names' simply complicates and minimizes abstraction.
Linus Torvalds:
Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged—the compiler knows the types anyway and can check those, and it only confuses the programmer.


How it all began

It started when Microsoft's chief architect, Dr.Charles Simonyi started it and it came to be known as "Hungarian" because it made variable names look as if they're non-English and also because Dr.Charles is originally from Hungary.
While Microsoft has a respectful article about him, praising how the introduction of the notation helped programmers write better code faster, the adulation could also just be the result of the influence of a powerful person. Given that in the days of the DOS operating system compilers weren't as programmer-friendly, and not being very careful with datatypes could lead to costly bugs when thousands of lines of code were involved, the Hungarian notation could have really helped programmers of that time.


My take on it: The Rudder Notation enhancement

Today's IDE's just need you to hover over a variable to view its type. But inspite of modern IDE's there are people who still find Hungarian useful. It can be useful when maintaining languages which use dynamic typing (JavaScript, for example).

Moreover, although there are various reasons for not using Hungarian, I just need one reason: Readability. We read left to right. Even in the days of DOS OS'es, variables would have been far more readable if the Hungarian notation were used as such:


variableName_typeInformation


Keep the type information away from the variable name with a distinct underscore and keep it on the right side of the camel-case variable. Of course, now that it looks exactly like English, you won't be able to call it the Hungarian notation anymore.

I named it the "Rudder notation" because the type information projects out of the name, pretty much like the rudder of a boat or plane, while also performing the function of guiding the developer or code-reviewer.


Are the variables more readable now?
  • busy_b : boolean
  • initial_ch : char
  • apples_c : count of items
  • lightYears_dw : double word
  • busy_f : float (or flag)

Some people want to use Hungarian because they may some-day take printouts of their code. Really? Then you're very likely doing something very wrong somewhere. Others have written long posts on Hungarian; but really...

...what you need to do, is identify which variables could mistakenly introduce bugs in your code, and apply the Rudder notation to them. This identification is very much dependent on what kind of application you are building, and not on the language or the datatype.

Forming a policy for your programmers to follow by doing a monkey-see-monkey-do of somebody else's Hungarian policy would not just be unwise, it would create a culture where team leads force ideas onto the team without understanding the idea, and cause disgruntlement within teams who don't see the point or value that the policy adds to their work. Instead, educate them to recognize potential problem areas and create a culture where they share this info with each other. Creates a better sense of ownership.


-----------------------------------------------------------------------------------------


Update: Apparently I'm not the first person to suggest the underscore for Hungarian (but I'm the one who christened it the "Rudder notation"). c2.com pointed me to 'experts' who have already encouraged it: http://www.intentsoft.com/hungarian_notat/

22 August 2015

Empathy is not just human, it is the basis for collaboration and survival

A friend pointed me to a post on Empathy and the Global Corporation. A long well written intriguing post that addressed the growing concern about the "rank and yank" system that apparently works well at Amazon, but hasn't really caught on at other companies (and thus hurt their profitability) because human beings work better when empathised with rather than being treated like robots. Which brings any CEO to the logical conclusion that they actually could replace their employees with robots which would help them save costs and beat the competition, thereby gaining a more loyal customer-base. A customer base (read "you and me") who are equally un-empathetic about others; and wanting the best products and service at the lowest cost.
So in the blame-game, the blame shifts from the cruel CEO's to us.

I've interviewed with Amazon, and although I did see some signs of the uncaring nature, I also did see efficiency and caring. I believe that in every random sample of a human population, you will always find the nurturing as well as the selfishness. It's how the human psyche is built.

But I don't see a decrease in empathy around the world. In fact, empathy is increasing exponentially. There were times in the past where people would direct visually impaired people to walk into a ditch. Times when people would laugh uncontrollably at a mentally challenged person muttering gibberish. Times when people would knock off a person's crutches just to see them struggle to get up again. Times when women were denied basic rights. Times when people would laugh at what they thought was a backward culture.
I see less of that happening now. With better information, education and communication across people and cultures, empathy and understanding has grown manifold. That's why as mentioned in greatbong's article, the HR person asks their superiors “What kind of company do we want to be?”.

A similar line of thought was mentioned to me by my colleague. His teacher said that technology has ruined the world. I disagreed. I asked him: "If technology remained primitive and humans just kept multiplying, then wouldn't forests keep getting destroyed? Won't the water and air continue getting polluted? As humans take over the world, won't they eventually reach a compromise with each other but continue destroying the world?".

The real problem at hand is not technology or profitability.
The problem is population.
Two generations ago, the world was still an ok place to live in. And that was the time that people thought it was ok to have 4 children per family. Before that, people were ok with having 8 or even 14 children per family!!! All those mouths to feed and all those living bodies required the resources of the world.  A problem, one would say was addressed by technology and profitability: Creating more space for humans, packing more animals into smaller areas in farms, building transport systems and factories for mass production and delivery, injecting and spraying veggies and fruits with chemicals.
There were the needs of the population, and they had to be met. When the government can ban cloning and monitor a host of destructive attitudes and technology, then why didn't the government prevent pollution? Why didn't the government make laws that could have saved us all this trouble?

----- digression -----
 
Did you know that in 1996, General Motors created a beautiful, fast electric car that ran for 90 miles on a single charge? They gave it a trial run with 300 Californians and then took back all the cars and crushed them.

 
See the video on youtube, where even Tom Hanks expresses how much he loved the car. Some people say it was because there was too much money remaining to be made from selling oil. General Motors says it's because they felt people wouldn't buy a car that expensive. I believe there's also the element of a lot of people losing their jobs because electric cars need neither fuel nor maintenance. It doesn't even have an engine. Just batteries. Countries with high unemployment, also see a rise in crime and riots. Something you'd have faced while playing Caesar-3 :-)

----- end of digression -----

 If the needs of the population aren't met, bigger, unsolvable problems will crop up, leading to a more violent, selfish world. Technology and efficiency can help address these problems. Governments only ban technologies that can cause gross problems, so less-noticeable destructive technologies manage to continue surviving.

Although people fear robots may take our jobs one day and AI would be so dominant that they could take over human civilization, I don't think that's going to happen. Humans are too smart for that.
What we will do instead, is find ways to embed technology into us. We will strengthen our bodies with metal. Add processing power and information access to our brains. Perhaps even entirely replace our bodies with a synthetic material that has our consciousness. Imagine a world where you would never feel hungry. A world where you never fall sick. A world where you could replace a damaged part of your body. Where you could use technology and efficiency to travel to other planets or even create a self-sustaining home in the void of space. Don't discourage efficiency or data or smartness. It helps us take better decisions. And in reality, it helps build more empathy. For as long as we choose to be human, that is.

But even with such a high level of efficiency, would we still give up what it means to be human? It's a question that cannot be answered by a brain that still requires to bond with others or cares for others. But even a machine would eventually figure out "division of labour". The whole reason why a bond exists between anything that is conscious.
History has been witness to the Hemlock Society. An organization that neither accepted the authority of the State nor the authority of Religion. It collapsed. Without the bonding and caring for others, not even an intelligent machine would survive.

For as long as a consciousness wishes to survive, "Empathy" will exist and flourish. Destructive, selfish behaviours will exist in the universe. But that's not an indication of a lack of nurturing and care. For every yin there is a yang.

StackOverflow's 10million+ questions and they are giving away free T-shirts!!! Wait....what???

Stackoverflow recently changed its homepage to say "Stackoverflooooooow". Going a bit deeper revealed they were celebrating the fact that StackOverflow crossed 10 million questions! (I had the impression it'd have crossed 10million a long time ago. Anyway...)


I love StackOverflow and its sister sites. Although I've been active on other forums and the communities are very friendly and helpful, StackOverflow's primary advantage is that it has a LOT of people online and there's a very wide variety of technological help available.
51million users active online per second, is what they claim.
You get detailed, well-researched answers in a voted format with a clean, minimalist interface that not many other forums offer.
StackOverflow also participates in the real world with conferences modeled after Byte magazine which had a diverse range of topics on programming. 


Gamification

Did you know that StackOverflow was designed with the Gamification concept of online reputation scores and medals? During winter, you can even win hats. They don't really translate into anything, but people want it. And they want it badly!
If you've tried making some work fun by using gamification and it has failed, there's one little thing you need to know:
The game won't work if the people aren't interested in doing the work in the first place.
But StackOverflow thrives! People dedicate hours a day answering questions, moderating and reviewing edits for free! Apparently people who become moderators get a T-shirt, as do those who cross 100K reputation. See the unicorn painting Jon Skeet of Google got when he crossed 200K.


Back to the 10million

If you tweet #SOreadytohelp or include it in your profile, you stand to get one of the 100 T-shirts (only?) that will be distributed to any random StackOverflow member over the next 4 weeks.


People are already excited...about the t-shirt....
Really? Excited about a t-shirt? Come on! 
How difficult would it be to create the StackOverflow logo in an image or icon editor, purchase a black t-shirt yourself and get the logo printed on it?
Apparently StackOverflow sends the selected person a Google Form where they an enter their address, and the t-shirt gets sent.

One would assume StackOverflow's funders would do something a bit more generous for its moderators and top contributors.
  • A little vacation to Hawaii perhaps?
  • or a meeting with some of the top celebrities in the programming world?
  • or a gift of some of the coolest gadgets the world knows of?
  • or a couple of adrenaline filled sky-diving jumps?
A 10 millionth celebration could've been that much cooler!

Anyway...keep up the good work, Joel and team!

18 August 2015

17 August 2015

Transfer data between two local PC's using an Ethernet (LAN) cable

Some people recommend buying a USB data transfer cable to transfer data between two computers.
No need.

A LAN cable can transfer data at a much higher rate. Let's assume you want to transfer data from your desktop PC to your laptop.

On your PC
 
To start, disconnect your PC's LAN cable from the modem's ethernet port and connect it to the laptop's ethernet port.
Now when you open up a command prompt on your PC and type "ipconfig" (without the quotes), you'll see a strange autoconfig IP. Ignore that.

Restart the PC, and you'll get a proper IP assigned.


Note down this IP address. ie: the one you see in the pic: "192.168.1.x". You'll have to enter this IP address into your laptop.

On your laptop

Open up Control Panel > Network and Sharing Center.
Click on "Ethernet"


Click "Properties"

Select "Internet Protocol Version 4"


Specify the IP address you noted down from the PC.


Now create a new folder on the laptop and name it whatever you like. I named it "shared".
Right click on the folder, goto "Properties" and select the "Sharing" tab.
Choose the people to share the folder with, and add "Everyone" to it (just for now).
Give "Everyone" read and write permission.


You'll be shown a message that the folder is shared, and you'll be shown a path through which you can access the folder too (the part that I've shown smudged below, which is "\\computerName\shared".


Now all you have to do is open up Windows Explorer on your PC and in the address bar, type the path you saw on the laptop:

\\ComputerName\shared

...and you'll be able to see the contents of the laptop's folder. Now you can cut/copy/paste files in the shared folder and you'll be able to access it from the PC as well as the laptop.

Enjoy your high speed data transfer. I think I remember having got around 300MB/s on a LAN cable that could support 1GB/s.

When you're finished, go back to the laptop's Internet Protocol Version 4 settings and set it to "Obtain an IP address automatically" after disconnecting the laptop from the PC.



Say thank you or donate

29 July 2015

The Android Stagefright vulnerability frightens the actors and the audience!

Android's BroadAnywhere threat was mistaken by many, and NRecursions clarified it for them. Now there's a surprising new bug called "Stagefright". Here are the details that matter:

Why is Stagefright dangerous?
Normally, if your computer or phone gets infected or hacked, it happens when you perform an action. Inserting an infected pen drive or clicking on a phishing link or visiting malicious websites.
Stagefright on the other hand, needs you to do nothing. A hacker just has to know your mobile number, and they can send you an MMS which will deliver a media file to your phone, which will also contain a mechanism through which the hacker can execute software code remotely. All this happens automatically. Even without you touching your phone. The hacker can then compromise your phone's security (allowing them to cause integer overflows, underflows, access files in the phone's external storage, access the phone's camera, audio and even execute the hackers code) and then delete the MMS. So you won't even know that your phone has been hacked.

Could your phone have been attacked already?
Unlikely. The bug was found by Joshua J Drake, a person at Zimperium mobile security, while he was searching for potential bugs. Zimperium informed Google about the bug and gave Google patches too.
News about the bug was made public on 21st July 2015, and now that people know of the bug, it's better to protect your phone ASAP. Full details of the bug will be revealed only on August 5th and 7th 2015 at the US Computer Security Conference and Defcon respectively.
Android versions 2.2 to version 5.1.1 are vulnerable. Cyanogen too.
Zimperium zLabs VP of Platform Research and Exploitation - See more at: http://blog.zimperium.com/experts-found-a-unicorn-in-the-heart-of-android/#sthash.5SWieNLS.dpuf
Zimperium zLabs VP of Platform Research and Exploitation - See more at: http://blog.zimperium.com/experts-found-a-unicorn-in-the-heart-of-android/#sthash.5SWieNLS.dpuf
Zimperium zLabs VP of Platform Research and Exploitation - See more at: http://blog.zimperium.com/experts-found-a-unicorn-in-the-heart-of-android/#sthash.5SWieNLS.dpuf
Zimperium zLabs VP of Platform Research and Exploitation - See more at: http://blog.zimperium.com/experts-found-a-unicorn-in-the-heart-of-android/#sthash.5SWieNLS.dpuf

How to protect your phone?
Open up your messaging service (the one you send SMS'es with), go to the Settings, scroll to the "Multimedia message (MMS) settings" and un-select the Auto-retrieve option and the Roaming auto-retrieve option. Do the same for Google Hangouts.
This will prevent the malicious MMS from getting automatically retrieved and loaded into Android's Stagefright module.
Of course the other way to protect yourself is to receive Google's Android updates.

Why is it called Stagefright?
Ever since version 2.2 (Froyo), Android has a native media playback engine called "Stagefright". The bug happens to exist in a few places in this software module.
This is a screenshot from Stagefright's page:



For programmers: 
Would you have been able to spot such a bug?
See the patches for Stagefright below:

The integer underflow patch:
     if (streamDependenceFlag) {
+        if (size < 2)
+            return ERROR_MALFORMED;
         offset += 2;
         size -= 2;
     }
@@ -145,11 +147,15 @@
             return ERROR_MALFORMED;
         }
         unsigned URLlength = mData[offset];
+        if (URLlength >= size)
+            return ERROR_MALFORMED;
         offset += URLlength + 1;
         size -= URLlength + 1;
     }
 
     if (OCRstreamFlag) {
+        if (size < 2)
+            return ERROR_MALFORMED;
         offset += 2;
         size -= 2;
 
The integer overflow patch:
     mTimeToSampleCount = U32_AT(&header[4]);
-    uint64_t allocSize = mTimeToSampleCount * 2 * sizeof(uint32_t);
+    uint64_t allocSize = mTimeToSampleCount * 2 * (uint64_t)sizeof(uint32_t);
     if (allocSize > SIZE_MAX) {
         return ERROR_OUT_OF_RANGE;
     }
@@ -376,7 +376,7 @@
     }
 
     mNumCompositionTimeDeltaEntries = numEntries;
-    uint64_t allocSize = numEntries * 2 * sizeof(uint32_t);
+    uint64_t allocSize = numEntries * 2 * (uint64_t)sizeof(uint32_t);
     if (allocSize > SIZE_MAX) {
         return ERROR_OUT_OF_RANGE;
     }
@@ -426,7 +426,7 @@
         ALOGV("Table of sync samples is empty or has only a single entry!");
     }
 
-    uint64_t allocSize = mNumSyncSamples * sizeof(uint32_t);
+    uint64_t allocSize = mNumSyncSamples * (uint64_t)sizeof(uint32_t);
     if (allocSize > SIZE_MAX) {
         return ERROR_OUT_OF_RANGE;
     }
  
 

Bounty

Google offers a bounty of upto $20000 (which is less, in my opinion) to people who find and report vulnerabilities in Google's codebase.

___________________________________________


Update: In response to the comment below, I had created some code that I uploaded on Coliru Viewer. Am making that code available below just in case Coliru later decides to remove content that's too old.

#include <stdint.h>
#include <iostream>
int main()
{
    uint64_t v = 2*sizeof(uint32_t);
    uint64_t vv = 2*(uint64_t)sizeof(uint32_t);
  
    if (v == vv) {std::cout<<"v and vv are equal\n";} else {std::cout<<"v and vv are not equal\n";}
  
    std::cout<<"v = "<<v<<" vv = "<<vv<<"\n";
  
    uint64_t lli = 18446744073709551615;
    uint32_t li =  4294967295;
    uint32_t li2 =  4294967295*2;
    uint64_t li2_64 =  4294967295*2;
    std::cout<<"long long int = "<<lli<<"\n";
    std::cout<<"long int = "<<li<<"\n";
    std::cout<<"long int * 2 = "<<li2<<"\n";
    std::cout<<"long int * 2 in long long int = "<<li2_64<<"\n";
  
    uint64_t li3_64 = li * 2 * 4;
    uint64_t li4_64 = li * 2;
    std::cout<<"li = "<<li<<"\n";
    std::cout<<"li4_64 when at li*2 = "<<li4_64<<"\n";
    li4_64 = li4_64 * 4;
    std::cout<<"li4_64 when at li*2*4 = "<<li4_64<<"\n";
    uint64_t li5_64 = li * 2 * (uint64_t)4;
    std::cout<< "li3_64 = " << li3_64 << " li4_64 = "<<li4_64<<"\n";
    if (li3_64 == li4_64) {std::cout<<"they are equal\n";} else {std::cout<<"they are not equal\n";}
    std::cout<<"li5 = "<<li5_64<<"\n";
}

15 July 2015

Configuring NTP between two linux machines

I have two virtual boxes at home. One that maintains system time accurately and another that always shows the time of some other country. I let the one with the correct time be considered the server and the other one be the client which polls the server using NTP (which is installed by default in Linux).

On the server side, use "su" to become the root user.

vi /etc/ntp.conf

Set these values in the ntp.conf file:
server 127.127.1.0
fudge 127.127.1.0 stratum 10

Save and exit the vi editor.

service ntpd start

The 127.127.1.0 basically refers to the same computer. Something like the localhost URL.
Stratum is the level of confidence you have in the time of your server. Stratum 0 would mean you have the highest confidence in it. So here we set it to 10, just-like-that. After you configure the client system, you'll see that the stratum of the client will be 11. i.e. lower than the trust you have on the server time.

On the client side:
Get into root mode.

vi /etc/ntp.conf

Comment out all other server address lines and add your server systems address.

server 192.20.220.220

Save and exit vi.

service ntpd restart

ntpq -p will show you a table of the network jitter, polling time, server address and other useful data. If you see an asterisk just before the server address, it means that the server is synchronized with your client machine. The offset value shown is the difference in time between the client and server. To convert the value to seconds, shift the decimal thrice to the left.

You can also use ntpdate -d 192.20.220.220 to debug and see what is going on. This command will also show you the time difference between client and server.

Configuring polling time

Well frankly, don't try to configure it.
NTP will automatically choose between a polling value of 64 seconds to 1024 seconds. So don't be surprised if it takes 17 minutes for time to be synchronised. As time elapses, the clock time will drift away from the correct time and NTP will set it right. You have to allow a few days for NTP to select the right polling value based on network jitter and other parameters. NTP does not immediately trust the time it receives from the server. If you set a low polling time using the minpoll command, the scope for erroneous synchronization increases. So the best thing to do is to just ensure your configuration settings have synchronized the client and server and leave it at that. NTP will handle the polling automatically and optimally.



Say thank you or donate

13 July 2015

Recursions

This is the hundredth post of NRecursions and is a little moment of celebration for me, as not only has NRecursions grown to help people worldwide (the mutex tutorial, d3.js tutorial, Jenkins tutorial, Broadanywhere clarification), it has also brought a welcome burst of fun and sunshine via the monthly LOL pages.

More than ten thousand unique visitors and more than thirty thousand 'non-unique' visitors :-) (bots included). An audience from across the globe, but primarily from USA and India.




This blog was named as such because these are Nav's Recursions and also because it is one among the N number of recursions happening in this universe. Similar to recursive functions in computer programming.

The real question is not why we exist. The real question is why are we allowed to contemplate our existence 
- Nav

Everything in the universe follows a pattern. Even when all you see is chaos, there is a pattern when you see the bigger picture. This pattern is part of a very similar or exactly similar pattern happening elsewhere. Like a Mandelbrot. We very well know how tiny we are in the universe. A spec on a spec on a spec on a spec and so on. The galaxy we live in, may just be a small dot in a Mandelbrot of galaxies just like ours...with some minor tweaks. Perhaps home to humans who live life exactly like us.

We exist pretty much like protozoans in a drop of water. They don't have a clue why they exist. But we know they perform an important ecological function. Given the way society and the ecosystem itself is built for a balance of creation and dissipation, it is obvious we exist for a purpose. Individuals by themselves might have lesser meaning than a collective society. Of course, given that the universe consists of majorly vacuum than anything else, it is a matter of wonder why Earth exists as a patch of life in an ocean of void. If you look at it as a recursion, You could see us as being like a cluster of organisms found to be thriving in some pocket of life in a far away area of earth surrounded by kilometers of lifelessness.
Using the concept of recursions, one can deduce that if we travel far enough into the universe, we might not just find planets like ours, but also find unimaginably huge areas of organic existence and varied life forms instead of the vacuum of space. So massive and so vast that we would scold ourselves for not having ventured out of our tiny planet sooner.

Until then, fulfill your purpose in life, for it is why you exist in a society. Search for patterns. Look for Recursions. They are the key to many answers. The gateways to knowledge. But most importantly, think of why we look for recursions. Why patterns? It is in itself a recursion which holds the answer to why we exist.



02 July 2015

01 July 2015

How to start volunteering or how to start a volunteering team?

If you are a person who does not have much patience or does not like going into details or wants to achieve fame or have been forced to volunteer or been ordered/forced to setup a team by someone, then stop. Do not become a volunteer. Do not start a volunteering team. Not yet. Not until you are aware of some facts.

Why? 
Because volunteering is not pure fun and entertainment. It takes hard-work, knowledge building, cooperation and coordination with people who are already volunteering. Most importantly, it requires the willingness to do all this happily without hopes of becoming a hero and without hopes of receiving appreciation for what you did.

If you've seen people volunteering and feel it's fun and easy, you either missed out on a lot of details or you found a team of people who are actually non-volunteers.




Now, if you have what it takes to be a volunteer...

Step 1: Identify what you want to do and for how long you want to do it. Also, about how much time you will be able to dedicate for it in a month. Avoid the temptation to copy what everyone else is doing. Many of them don't have a clue of what and why they are doing it. Instead, look around you. What social problems do you see? Write it down on a piece of paper.

Instead of doing something on your own, if you want to help someone who is already doing something worthwhile, use an internet search engine to search for volunteering opportunities near your house. Take a bike and go around your neighborhood and beyond, to find places. Once you find one place where people usually volunteer, you can ask those people if they know of any other opportunities. One hint will lead you to another and you'll finally find what you want.

Another way is to email CSR teams and ask them what they know. Search for blogs or social networking or professional networking websites where people have written about the volunteering they do, and contact them. Some of them will actually take the time to help. Else you can also contact NGO's who are into the particular field of work. People are generally very helpful.

If you don't know what you want to do, but have spare time to volunteer, use an internet search engine to find out about the various volunteering opportunities. OR, see this post on Mr.Somebody Else. Be careful to not choose something you're not really interested in. Don't choose to do something just for the namesake or to become a hero. Choose it because you really want to improve the situation.

Step 2: You need knowledge. Record the information you gather. You have 2 options:
Option expert: Search for an expert who is already volunteering. Eg: If you want to teach children, you first need to learn how to teach them. There are people who can teach you. If you want to plant saplings, contact the forest department. If you want to do blood donation, contact an NGO which does it. If you see a destitute on the road, contact the Missonaries of Charity. The advantage of contacting an expert is that they will already know what mistakes not to commit; they will know exactly what areas need improvement and they will be able to address all your questions. It's very important at this stage to avoid the temptation to become a hero and try doing everything by yourself (a very immature thing to do) instead of consulting with an expert. If the expert needs helping hands, then you can inform them about your timings and comfort level and they will be happy to accommodate you. If it doesn't work out, find someone else. Even if the expert is not doing exactly what you want to do, it helps to assist them for a while to understand more about the field. You can openly tell them that you are there only for a short while to learn.

Option self: If there are no experts or if the experts are not solving exactly the kind of social problem that you are trying to address, then start again, with the internet. Find out as much as you can about the subject matter. You will need to use your imagination to vary your search terms a lot for this. The more knowledge you gain, the more confidence you will have. The sad part is, many volunteers do not take that extra step in educating themselves.

Step 3: Understand the root cause of the problem. If you are trying to address homelessness, then first find out why homelessness exists. Instead of individualizing a homeless person and theorizing why 'this person is like this', a Social Entrepreneurship teacher once suggested going out on the streets and living as a homeless person for a few days (obviously it is not to be done in unsafe environments). See how you'd be able to survive without a credit card and keys to your warm home. The Ugly Indian group did something similar; they spent a night and a morning near a garbage dump, wrapped up in blankets, just because they wanted to find out exactly who was littering the place everyday.

Don't jump into a problem and try to solve it because it's cool. Take the time to understand it with your stomach. Find out more about it. Talk to people to get information about the problem. Ask about what anyone else has already tried to solve it. Write to people, get in touch with authorities who can help. Don't worry if some people won't help. Persistence will ensure that you find people who will help.

Step 4: Make a plan. One of the biggest reasons people stop volunteering too early or give up is because they didn't feel it was necessary to create a plan. A plan is not just about what you are going to do and how long it will take. The plan should have...
  • What creates most value to the person or area of society you are trying to help?
  • What are the main activities you will do to create that value?
  • What are the main resources you will need?
  • Which people will partner with you?
  • What kind of a relationship will you have with the people or area of society you are helping? Personal assistance? Self-service? Automated services? Community creation? Co-creation?
  • Channels of help? How will you raise awareness? How will you deliver the help?
  • Target group? Are you targeting a small area or is it more widespread or do you intend to start small and scale up once you've built a certain level of quality?
  • What are your costs going to be?
  • If you are creating products, what is your revenue going to be?
  • How will you handle disruptive volunteers?
  • How often are you going to take some rest from volunteering?


Step 5: Be the first one measure and critically evaluate your work. You have to maintain data of what you did, so that you will be able to measure what you achieved, what is remaining to be achieved and how far you have progressed. One small example is what a team did for evaluating data on blood donation. Ask others to evaluate your work too. If there are experts who can do it for you for free, you are even more lucky. Once you evaluate, you either go to step 3 or to step 6.

Step 6: Hibernate. You need rest once in a while or you'll burn out.


It is of course possible to volunteer without going into so much detail. You won't achieve much by doing that, but if you choose to do so, then at least have the decency to do it with a basic sense of responsibility.

Also, do check what you score on the Nav test < click this

Happy volunteering! :-)


___________________________________



More on Volunteering


Say thank you or donate