Browsed by
Author: admin

Girl who saved 100 lives

Girl who saved 100 lives

Meet Tilly Smith. At age 10, she saved nearly a hundred foreign tourists at Maikhao Beach in Thailand by warning beach goers minutes before the arrival of the tsunami caused by the 2004 Indian Ocean earthquake.

tilly_smith

Smith learned about tsunamis in a geography lesson two weeks before the tsunami from her teacher. She recognized the warning signs of receding water from the shoreline and frothing bubbles on the surface of the sea. She alerted her parents, who warned others on the beach near hotel Phuket. The beach was evacuated before the tsunami reached shore. This was one of the few beaches on the island that reported no casualties.

Smith’s family were very humble and declined to be interviewed by commercial and national broadcasters.  Later Smith went to United nations meet in November 2005, where she met the U.N. Special Envoy for Tsunami Relief as part of a campaign to highlight the importance of education.

Funny love story

Funny love story

Son: “Daddy, I fell in love & want to date this awesome girl!”

Father: “That’s great son. Who is she?”

Son: “It’s Sandra, the neighbor’s daughter”.

Father: “Oh hoo, I wish you hadn’t said that. I have to tell you something son, but you must promise not to tell your mother. Sandra is actually your sister.”
broken_heart_by_fastreflex-1
The boy is naturally bummed out, but a couple of months later

Son: “Daddy, I fell in love again and she is even hotter!”

Father: “That’s great son. Who is she?”

Son: “It’s Angela, the other neighbor’s daughter.”

Father: “Oh ho, I wish you hadn’t said that. Angela is also your sister.”

This went on couple of times and the son was so mad, he went straight to his mother crying.

Son: “Mum I am so mad at dad! I fell in love with six girls but I can’t date any of them because daddy is their father!”

The mother hugs him affectionately and says:
“My love, you can date whoever you want. Don’t listen to him. He is not your Father.”!!!
The Son  Fainted…

How to check timestamp of a file using Perl

How to check timestamp of a file using Perl

You can use the built-in module File::stat (included as of Perl 5.004).

Say the file handle is $fh. Calling stat($fh) returns an array with the following information about the file handle passed in (from the perlfunc man page for stat):


perl

  0 dev device number of filesystem
  1 ino inode number
  2 mode file mode (type and permissions)
  3 nlink number of (hard) links to the file
  4 uid numeric user ID of file's owner
  5 gid numeric group ID of file's owner
  6 rdev the device identifier (special files only)
  7 size total size of file, in bytes
  8 atime last access time since the epoch
  9 mtime last modify time since the epoch
  10 ctime inode change time (NOT creation time!) since the epoch
  11 blksize preferred block size for file system I/O
  12 blocks actual number of blocks allocated

The 9th element in this array will give you the last modified time since the epoch (00:00 January 1, 1970 GMT). From that you can compute the local time:

 my $epoch_timestamp = (stat($fh))[9];
 my $timestamp = localtime($epoch_timestamp);

If you use Time::localtime module, the code willl look better:

 use File::stat;
 use Time::localtime;
 my $timestamp = ctime(stat($fh)->mtime);

 

How the new 500, 2000 notes will travel to common man in India

How the new 500, 2000 notes will travel to common man in India

The new rupee notes are being printed at four mints. Together, they can print about three billion notes per month.

The mints have to replace about 14 trillion taken out of circulation. If half that value is printed in 500 rupee notes and the other half is printed in 2,000 rupee notes, the mints will have to print around 17.5 billion total notes to replace the value of the notes taken out of circulation.

To replace all of the money taken out of circulation, the mints will have to print about 17.5 billion notes, which would take about 175 days.

rupees

To replace 10 trillion, an amount the government says it expects to be returned by the people, the mints will have to print 12.5 billion pieces of banknotes, which would take about 125 days.

Printing 17.5 billion notes at a rate of three billion notes per month will take almost six months. Even if the mints began printing the replacement notes three months ago, they would still need around three more months to complete the printing.

But printing the notes is only half the battle. Once the notes are printed, they need to be distributed to banks and ATMs so they can find their way into your wallet.

Step 1: Printing presses

  • One of the two printing presses responsible for churning out new 2,000 notes is located in Mysuru, Karnataka. The other is in Salboni, West Bengal.
  • Two more presses — one in Dewas, Madhya Pradesh, and one in Nashik, Maharashtra — are printing 500 rupees notes to replace the old ones.

Step 2: RBI issue offices

  • Once printed, the notes are transported to the 19 Reserve Bank of India issue offices in major cities across the country.

Step 3: Currency chests

  • From the issue offices, the money is transported in high-security vans to more than four thousand currency chests across the country. Currency chests are operated by various banks.

Step 4: Bank branches

  • Once a bank has the money in its currency chest, it can restock its bank branches in the surrounding area.

Step 5: ATMs

  • From the bank branches, money is taken to nearby ATMs. Most of the country’s ATMs are not built to accommodate the new 2,000 notes. Thousands of engineers are working as fast as possible to retrofit the country’s 2.18 lakh ATMs. This enormous undertaking is expected to take a few more weeks.
How to get cash from ATM

How to get cash from ATM

After demonetization of 500  and 1000 rupees notes by the government, every one is running short of cash. Many ATMs are without cash. The ATMs that have cash have long queue. How to get cash ??

sbi_queue_niharonline

 

People are suffering as they now have no money to transact. Moreover, many have stormed the banks to exchange their money but that’s not an easy task. The banks have been overcrowded with a huge number of people further making the task even more difficult.

 

rupees

How to find ATMs in your locality that have cash ??

Some apps and websites claim to inform on which ATMs have cash in a particular locality. But As it turns out these are fake. Believe us, there is no such app or website that gives correct information. Because the banks have not given any portal for gathering such info.

However, you can follow some simple tips to get cash.

  1. Visit the bank where you have an account. Bank employees will be willing to provide their own customers with notes of their choice of denomination. Average waiting time would be an hour. You can get maximu
  2. Ask the bank employees, what is their ATM cash filling schedule. ATM machines are getting empty within 2/3 hours of  cash refill. You should visit the ATM just after their cash refill schedule.
  3. Visit the ATMs of private banks. The centralized banks usually have more customers and hence the long queues. Whereas private banks have equal cash but lesser customers. Hence less rush.

Happy banking!!

How to prepare for Programming Interviews . . .

How to prepare for Programming Interviews . . .

Mostly 3 things interviewers expect from a candidate

  1. Can you visualize a large system and build its components.
  2. Can you logically optimize the system or its modules.
  3. Can you implement your logic within small time.

Most companies will hire you if you do well in 1 and 2, but do average in 3.

screen-shot-2014-12-04-at-12-04-42-am

 

If you are a C++ programmer, learn the language fundamentals and how to effectively use the standard template library.

Language Fundamentals:

Learn in detail about pointers, classes, structs and object oriented programming concepts. Know how to create nodes that will be crucial for most problems. You should be able to create and traverse a linked list in about 5 minutes. learn how to approach expanding the data structure considering the inheritance properties.

Data Structures:

Learn what the following are and how the related functions work. Understand and derive their time complexity.

  • stacks/queues/deques/lists
  • maps and sets (red-black Trees, AVL Trees)
  • unordered_maps and unordered_sets (hash tables)
  • vectors (dynamic arrays)
  • priority_queues
  • Iterators (how to use them with the above data structures)
  • Know how to represent a real world problem in the form of graphs.
  • Tries

Algorithms:

The algorithm library is extremely important. Try to know all the functions, how they are internally implemented and their time/space complexity. They help save quite some of your interview time.

  • In memory sort
  • External sort
  • reverse a statement, string
  • Find nth_element
  • lower_bound,upper_bound
  • next_permutation/prev_permutation
  • rotate
  • optimize space usage
  • mathematical functions

How to use the above knowledge:

A typical interview is about 45 minutes. You have to write a complete program and answer few logical programming questions within that time. Interviewers look for the robustness of your implementation and your design capabilities. Most interviewees fail to implement their logic within the required time, even though they know the logical design.

  • Almost all the questions depend on your ability to use these data structures/algorithms directly, without implementing them – especially sort, vectors, maps.
  • You may often need a data structure like hash table or heap to achieve a appreciable time complexity.
  • First get the design in your mind and them start coding. Changing the design after coding half way is recipe for failure.
  • Ask the interviewer for hint, if you are out of ideas. Interviewers appreciate if you pick up the hints and solve the problem faster.