Author Archives: Pradeep

Google Authenticator: Moving To A New Phone


Getting a new HTC One left me wondering how will I move Google Authenticator from my HTC Legend, I didn’t want to do everything all over. To my amazement I found Google has come up with a solution for a situation like this, it’s the “Move to a different phone” option in 2-step authentication setting page. It was a breeze switching to a new phone. Install Google Authenticator on your new phone and follow the “Move to a different phone” link.


Monitor Files & Directory For Modifications With PHP

One can monitor for changes to files & directories, including events like open, close, new file, delete, rename & all other file/directory operations.

The following code snippet should be self-explanatory:

$data_file = '/var/data/my_data_file.txt';

$inotify_fd = inotify_init();

$watch_descriptor = inotify_add_watch($inotify_fd, $data_file, IN_OPEN);

while (1)
$events = inotify_read($inotify_fd);
$filepath = $events['name'];

print "File opened";

inotify_rm_watch($inotify_fd, $watch_descriptor);


List Modified Filenames In Git

I was working on a few enhancement features of an existing project, after a few weeks work I was required to make some completed features live, so I was wondering what all files have been modified. So the Git versioning came to help, and by specifying two commit SHA1s I was able to retrive the list of files modified between the commits. Here’s how to do it,

$ git diff --name-only afd98 a3d55

Monitor Directory For New Files With WSH

Sajal wanted to monitor a directory, detect new file(s) and open them in their associated applications, I remember monitoring directory for changes in Linux in a Perl script. Doing something similar on Windows it seemed tough, but a after a little pondering I remembered about Windows Script Host (WSH), and after a bit of googling, coding, trial and errors, I came up with a script which does all that is required, it’s written in VBScript.

strDrive = "D:"
strFolder = "\\dropbox\\downloads\\"
strComputer = "."
intInterval = "5"

' Connect WMI service
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")

' build query
strQuery =  "Select * From __InstanceCreationEvent" _
& " Within " & intInterval _
& " Where Targetinstance Isa 'CIM_DataFile'" _
& " And TargetInstance.Drive='" & strDrive & "'"_
& " And TargetInstance.Path='" & strFolder & "'"

' Execute notification query
Set colMonitoredEvents = objWMIService.ExecNotificationQuery(strQuery)

' get a shell application object
Set WshShell = WScript.CreateObject("Shell.Application")

Set objLatestEvent = colMonitoredEvents.NextEvent
' strip out the real path
Response = Split(objLatestEvent.TargetInstance.PartComponent, "=")
' remove slash & quotes
FileName = Replace(Response(1), """", "")
FileName = Replace(FileName, "\\", "\")
' open the file in it's associated program
WshShell.ShellExecute FileName, "", "", "open", 1
Wscript.Echo FileName

Force Download Specific Files with Apache & Htaccess

At time we want visitors to download instead of viewing the file instead of viewing inside their browser. As a visitor I have faced problems with PDF files at many sites where I wanted to download the PDF file and view it separately because viewing the PDF inside the browser slows down the browser and sometimes causes the browser to crash.

So, If you want to force people to download a file or all files in a specific directory and so on, if is very easy to do so with the help an Apache directive which sets the response header ‘Content-Disposition’ to ‘attachment’, see the examples below:

<Files *.pdf>
Header set Content-Disposition attachment

<Directory /var/www/html/images>
Header set Content-Disposition attachment

Your own, “no software”, data shredder

Junk file creation

By data shredder I mean deleting data on a re-writable storage medium beyond recovery by normal methods. You might have heard of recovery of deleted files using special software, similarly, there are software available to delete data/files rendering them unrecoverable.

Read more »

Browsing privacy at public places & work


Many times we run into situations where we are required to use a public or a friend’s computer for work or personal work, like paying bills, buying stuff online etc, with this comes a privacy problem of privacy where you might accidentally leaving browsing/download history, login cookies (i.e. remember me/stay signed in etc) or chances of browsers saving form data & passwords. Private browsing or Incognito mode as some browsers feature it is the answer to the problem.

Read more »

Taking screenshots on your Android phone

ShootMe - Screen Capture app for Android

There are quite a few apps which let you take screenshots on your Android phone, the apps can be divided into two categories, one which required the phone to be rooted to work and the other where the app will work on an unrooted phone too. Here is a list of screenshot taking apps with their virtues & vices so that you can decide which one to use.

Read more »

Setup Gmail & Contacts your iPhone/iPod


Setting up GMail, Google Contacts & Calendar sync is not just a matter for few clicks, so here we are with a step-by-step guide to configuring Google Sync on your iPad/iPod/iPhone. This is only supported on iOS version 3 & above, you can check your current version by going to Settings > General > About > Version and upgrade if required.

Read more »

SMS Backup Apps for Android

SMS Backup Restore by Ritesh Sahu

With unlimited SMS storage we seldom delete SMS messages and gradually they pile up, navigating the SMS inbox becomes tough and you feel like deleting all messages, but then there are some you don’t want to delete. Also, rarely though, you might flash your Android phone or would like to factory reset it, and you might want to backup your precious SMS messages.

SMS backup & restore apps, backup & restore your SMS messages, on-demand or automatically, in common XML or in a binary format. We’ll look into the features of a few such apps.

Read more »

search engine optimization