Tuesday, September 24, 2013

Birds also use passwords !!!


Recently, many websites were hacked or compromised because of the weak authentication logic used in them. Google/Twitter are now using 2FA to take care of such cases. New iPhone 5S has a fingerprint scanner for authentication purposes. We humans can do this and develop more security and their implementations around such problems.

Now, what about birds - How do they set and use any password? Following article shows you how birds use their password or coded scheme in their chirping to ask for or set a password scheme:

http://blogs.discovermagazine.com/notrocketscience/2012/11/08/fairy-wrens-teach-secret-passwords-to-their-unborn-chicks-to-tell-them-apart-from-cuckoo-impostors/#.UkFKhoYmtfS


Tuesday, September 17, 2013

3D View from 2D Images



Having a 3D View for a given 2D image has always been a long awaiting obsession for many of us. We have always wondered how do we add that extra information to any particular image to get its 3D View. Few days back, I saw a very nice attempt of the same posted as a youtube video here.



If this concept goes through reality; it is simply awesome. Yes, you could argue that this is not valid for all type of objects but valid for only symmetric objects but wherever its applicable and it works; it would be an amazing thing to try. I believe that this paper was also part of SIGGRAPH 2012.

In fact, there are a lot of other attempts to handle this problem but they deal in different sub-problems such as 123D catch by autodesk. Adobe Photoshop also has a workflow to try this situation - see here.

I am actually amazed to see this. I think the day is very near when we will be able to easily feel the objects that we click from our point and shot digicams.





Sunday, September 1, 2013

Obtaining Directory Change Notifications on Windows

This post is useful for developers only....

Sometime back, I was trying to look for a way to get Directory Change Notifications on Windows i.e. the same ones that dropbox or google drive any other file sync app would have used. The code would need to use FindFirstChangeNotification as well as WaitForMultipleObjects APIs:

MSDN Link - http://msdn.microsoft.com/en-us/library/aa365261%28VS.85%29.aspx
-------------------
Sample code
-------------------

#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>

void RefreshDirectory(LPTSTR);
void RefreshTree(LPTSTR);
void WatchDirectory(LPTSTR);

void _tmain(int argc, TCHAR *argv[])
{
if(argc != 2)
{
_tprintf(TEXT("Usage: %s dir\n"), argv[0]);
return;
}

WatchDirectory(argv[1]);
}

void WatchDirectory(LPTSTR lpDir)
{
DWORD dwWaitStatus;
HANDLE dwChangeHandles[2];
TCHAR lpDrive[4];
TCHAR lpFile[_MAX_FNAME];
TCHAR lpExt[_MAX_EXT];

_tsplitpath_s(lpDir, lpDrive, 4, NULL, 0, lpFile, _MAX_FNAME, lpExt, _MAX_EXT);

lpDrive[2] = (TCHAR)'\\';
lpDrive[3] = (TCHAR)'\0';

// Watch the directory for file creation and deletion.

dwChangeHandles[0] = FindFirstChangeNotification(
lpDir, // directory to watch
FALSE, // do not watch subtree
FILE_NOTIFY_CHANGE_FILE_NAME); // watch file name changes

if (dwChangeHandles[0] == INVALID_HANDLE_VALUE)
{
printf("\n ERROR: FindFirstChangeNotification function failed.\n");
ExitProcess(GetLastError());
}

// Watch the subtree for directory creation and deletion.

dwChangeHandles[1] = FindFirstChangeNotification(
lpDrive, // directory to watch
TRUE, // watch the subtree
FILE_NOTIFY_CHANGE_DIR_NAME); // watch dir name changes

if (dwChangeHandles[1] == INVALID_HANDLE_VALUE)
{
printf("\n ERROR: FindFirstChangeNotification function failed.\n");
ExitProcess(GetLastError());
}


// Make a final validation check on our handles.

if ((dwChangeHandles[0] == NULL) (dwChangeHandles[1] == NULL))
{
printf("\n ERROR: Unexpected NULL from FindFirstChangeNotification.\n");
ExitProcess(GetLastError());
}

// Change notification is set. Now wait on both notification
// handles and refresh accordingly.

while (TRUE)
{
// Wait for notification.

printf("\nWaiting for notification...\n");

dwWaitStatus = WaitForMultipleObjects(2, dwChangeHandles,
FALSE, INFINITE);

switch (dwWaitStatus)
{
case WAIT_OBJECT_0:

// A file was created, renamed, or deleted in the directory.
// Refresh this directory and restart the notification.

RefreshDirectory(lpDir);
if ( FindNextChangeNotification(dwChangeHandles[0]) == FALSE )
{
printf("\n ERROR: FindNextChangeNotification function failed.\n");
ExitProcess(GetLastError());
}
break;

case WAIT_OBJECT_0 + 1:

// A directory was created, renamed, or deleted.
// Refresh the tree and restart the notification.

RefreshTree(lpDrive);
if (FindNextChangeNotification(dwChangeHandles[1]) == FALSE )
{
printf("\n ERROR: FindNextChangeNotification function failed.\n");
ExitProcess(GetLastError());
}
break;

case WAIT_TIMEOUT:

// A timeout occurred, this would happen if some value other
// than INFINITE is used in the Wait call and no changes occur.
// In a single-threaded environment you might not want an
// INFINITE wait.

printf("\nNo changes in the timeout period.\n");
break;

default:
printf("\n ERROR: Unhandled dwWaitStatus.\n");
ExitProcess(GetLastError());
break;
}
}
}

void RefreshDirectory(LPTSTR lpDir)
{
// This is where you might place code to refresh your
// directory listing, but not the subtree because it
// would not be necessary.

_tprintf(TEXT("Directory (%s) changed.\n"), lpDir);
}

void RefreshTree(LPTSTR lpDrive)
{
// This is where you might place code to refresh your
// directory listing, including the subtree.

_tprintf(TEXT("Directory tree (%s) changed.\n"), lpDrive);
}

Thanks to my colleague +Abhijeet Singh for helping me with the above info.


Saturday, June 15, 2013

do what you wanna do !!!

Today, I came across a great article here. I liked the spirit of the article - it asks you to follow what your heart says but not at the cost of your daily life commitments. This inspires a  person to do what he likes, be prepared to do what he wants to do and still tells you a way to take care of your regular life.

The points that are mentioned are normal but the spirit is amazing. 10 out of 10, Mr. David  Ferguson.

Sunday, March 31, 2013

My HP Trip in May, 2012

First I would like to talk about a few things that I like. I like travelling, going to newer places, even revisiting places that I like e.g. I have gone to Jaipur 5-6 times to see those same things (Chowki Dhaani, Birla Mandir) again and again. Most importantly, I like to drive to these places rather than using any mode of transport. Till sometime back, I have been driving mostly in plains (with a some minor exceptions). So driving in hills was a missing point for me and secondly, due to my back pain, driving long distances remained a dream . If the question comes to your kind is how long? In the initial days, I had to take a break at-most 100 Kms and 200-250 Kms was the maximum that I could drive before getting exhausted.

In the month of May-2012, we planned a trip to Himachal Pradesh - Parents and wife wanted a spiritual trip (5 devis), I wanted to spend time with all of them especially my daughter and also wanted to visit a few good hill stations. So we planned 9 day covering Anandpur Sahib, Bhakra Dam, 5 devis, Dharamsala & Palampur. Initial 3 days, we satisfied our spiritual hunger - Jwala Devi was the one I liked most. Also, we enjoyed big #bhakra #dam on the way and on 3rd day, we reached Dharamsala. - after 600 Kms of driving, lot of it was in hills. We didn't like it too much (it was really hot there, hotel was not good enough). We also went to Mcleodganj - liked it very much - amazing weather, awesome Dalai Lama temple, Bhagsu Falls and many more things.

After 3 days, we went to Palampur. By the time I reached there; my dreams of driving in hills was fulfilled. Palampur was a dream place - the weather, neugal (river stream), Saurabh Van Vihar, the medicated environment and HPTDC Hotel - The Tea Bud. I was so impressed with the place that I even enquired about buying some property there.

Now only, one wish was left driving long distances. We started early around 07:00 am - weather was really nice for driving & home was 525 Kms away (with more than 150 Kms in hills). First brief 5 mins stop was Una, nearly 150 KMs - at the base of the hills. Then, it was Havelli Restaurant, Karnal (around 370 Kms) for 45 mins and finally Home @ 07:00pm. I had completed 12 hrs journey - a sense of accomplishment.

Friday, March 29, 2013

How much do you know Bhagat Singh?

Do you really know Bhagat Singh - the most influential revolutionaries of the Indian independence movement? Let's see:
  1. The bombs Bhagat Singh and his associates threw in the Central Assembly in Delhi were made from low grade explosives. They were lobbed away from people in the corridors of the building and were meant only to startle and not harm.
  2. He coined the phrase 'Inquilab Zindabad' that became the slogan of the India's armed freedom struggle.
  3. When he was kid, often spoke of "Growing guns in the fields" so that he could fight the British government for freedom.
  4. At the age of 12, right after the Jalianwala Bagh incident, Bhagat Singh bunked school and went straight to the place of the tragedy. He collected a bottle of mud wet with blood of Indians and worship the bottle every day.
  5. He underwent 116-day hunger strike which ended on 'October 5, 1929'
  6. He was fluent in many languages: (1) Could speak and write all these fluently - Hindi, English, Arabic, Punjabi (2) Could speak and write One or Two out of these - Polish, French and Swedish
  7. Bhagat Singh was a brilliant actor and he appeared in various plays in his college as Rana Pratap, Samrat Chandragupta, and Bharata durdesha.
  8. He was 23 years of age when he was hanged.
  9. He was hanged an hour ahead of the official time when the death sentence was to be commuted
  10. He said: "They may kill me, but they cannot kill my ideas. They can crush my body, but they will not be able to crush my spirit." This was to be quoted many times over by revolutionaries after Singh's death.
Source: Various Internet websites which I rad over a period of time such as wikipedia and others.

Lyrics of an inspirational song &quot;रुक जाना नहीं तू कहीं हार के !!&quot;

  • Movie/Album: इम्तिहां (1974)
  • Music By: लक्ष्मीकांत-प्यारेलाल
  • Lyrics By: मजरूह सुल्तानपुरी
  • Performed By: किशोर कुमार

रुक जाना नहीं तू कहीं हार के
काँटों पे चल के मिलेंगे साये बहार के
ओ राही, ओ राही

सूरज देख रुक गया है
तेरे आगे झुक गया है
जब कभी ऐसे कोई मस्ताना
निकले है अपनी धुन में दीवाना
शाम सुहानी बन जाते हैं दिन इंतज़ार के
ओ राही, ओ राही...

साथी न कारवां है
ये तेरा इम्तिहां है
यूँ ही चला चल दिल के सहारे
करती है मंज़िल तुझको इशारे
देख कहीं कोई रोक नहीं ले तुझको पुकार के
ओ राही, ओ राही...

नैन आँसू जो लिये हैं
ये राहों के दीये हैं
लोगों को उनका सब कुछ दे के
तू तो चला था सपने ही ले के
कोई नहीं तो तेरे अपने हैं सपने ये प्यार के
ओ राही, ओ राही...



Saturday, March 23, 2013

Stats say it all !!!

Here are some interesting stats I have gathered over past few days - really interesting:
  1. When Rohit Sharma made his first fifty, #Kohli was playing in U19 #WorldCup Final. On 23rd Jan 2013, Kohli has over 4000 runs & Rohit Sharma completed his 2000 ODI runs - #Cricket
  2. Cost of VVIP choppers could fund free medicines for all: http://timesofindia.indiatimes.com/india/Cost-of-VVIP-choppers-could-fund-free-medicines-for-all/articleshow/18723504.cms