the world is open source

Omniscient is a web application that can answer user queries instantly. It consults other web APIs to determine the result accurately for the user query. It answers factual queries directly by computing the answer from structured data obtained from online APIs, rather than providing a list of documents or web pages that might contain the answer as a search engine might.

Omniscient can be accessed at

Omniscient is a web application hosted on google-app-engine written in PHP with the front-end involving standard HTML-CSS combination with some JavaScript support. It takes from user a query, which can be a fact that has an answer unknown to the user (like “when was Nehru  born?”), a domain specific term (like “annelida”), a mathematical equation to solve or simplify (like “factor 2x^5 – 19x^4 + 58x^3 – 67x^2 + 56x – 48” or “solve x^2+4x+4”), an English word whose meaning you’re looking for, or whatever you think that looks relevant as a query.

Obviously, an application cannot take complex inputs from user and magically transform it into accurate results. One has to depend on other web APIs available online in this particular case. This application makes use of one such API called Wolfram|Alpha, a very popular web answer engine which is even used by Siri, another popular application developed by Apple for its iOS devices. The documentation page of Wolfram|Alpha provides a more detailed view of its API services. The Wolfram|Alpha API has a limit of 2000 queries per month, which is more than sufficient for one’s personal use. To start using it, one has to obtain an application identifier (called AppID) by signing up on their website for free. An AppID uniquely identifies you from rest of the users accessing the API. Once you’ve got an AppID, you’re ready to go.

The Back-end

As told already, the back-end is implemented in PHP. One of its advantages is that it can very easily handle communication between the API and the front-end representation. Many thanks to PHP cURL.


Save your AppID in a variable:


Store the user input in another variable ( user input is provided as ):


Meanwhile, get the Wolfram|Alpha API url link ready. Note that user input has to be url-encoded to handle situations where it may contain special characters :

$URL = "".urlencode($INPUT)."&appid=".$APP_ID;

Send a request

You now have the user input and the Wolfram|Aplha API request format ready. PHP uses cURL extension to make http requests. Initialize a curl handle and set the required options to make this request. Send a request to the Wolfram|Alpha API with user query as an argument.


The response obtained from Wolfram|Alpha API is now available in the variable $resp.

Most of the web APIs provide output in XML or JSON format. The Wolfram|Aplha API used here provides output in XML format. In other words, we need to extract data from the API response, so that we can present it to the user. The Wolfram|Alpha API documentation provides a sample XML output to understand the document structure.

Extract data from response

This is pretty straightforward. Analyze the document, and parse it to extract only the pieces which are required. Though convention says not to use regular expressions to parse XML documents, for simplicity I have used regular expressions to extract required data from the response already obtained.

A sample response for user input “PI”  looks like this:

<?xml version='1.0' encoding='UTF-8'?>
<queryresult success='true' error='false' numpods='8'
    datatypes='MathematicalFunctionIdentity'' timedout='' timing='1.736'
    parsetiming='0.054' parsetimedout='false' recalculate='' version='2.0'>
  <pod title='Input' scanner='Identity' id='Input'
       position='100' error='false' numsubpods='1'>
    <subpod title=''>
      <img src=''
          alt='pi' title='pi' width='9' height='20' />

Now frame a regular expression in PHP to match the answer required:

preg_match_all('%\s*<subpod.*?>\s*(.*?)\s*(?:<img alt="" src="\'(.*?)\')?%si'," />

Tabulate the result

The list of all matches are stored in a variable result array $rarr. Now you’ve got the required data as an array and it is sufficient if you present it in the form of a html table. It is necessary to check if the output contains any image references. If images are present, simply create an image tag with source attribute set to original image link.

echo "<table>"
for($i=0; $i<count($rarr[0]); $i++){
	echo "<tr> <td> ".$rarr[1][$i]."</td><td><img src=\"".$rarr[3][$i]."\"/></td></tr>";

		echo "<tr> <td> ".$rarr[1][$i]."</td><td>".$rarr[2][$i]."</td></tr>";
echo "</table>"

If the current code is tested with a sample input data, you may find that the code just works fine, but the user interface is not that appealing.
Wolfram|Alpha response table
Once the back-end is ready, it is not that difficult to come up with a good front-end. I have used a separate page that takes user input and sends it to the PHP file using jQuery.get() which is a shorthand for an ajax http request:

$.get("wolfram.php","q="+encodeURIComponent(inputText), function(returnData) {
  //do stuff to display content here

This makes it possible for the user to submit his query and get a response, without reloading the page or redirecting him to somewhere else.

If you have gone through google-app-engine page, you might notice that it can support only native java applications. But, a 100% java implementation of PHP5 is available, called Quercus. It makes us possible to run PHP applications on google-app-engine, which by default is not supported. The advantages of running PHP using this method includes 100% application up time and a very fast processing speed when compared with conventional PHP applications.

Here are some sample inputs, which you might find interesting:

  • father’s mother’s sister’s son
  • sierpinski gasket
  • derivative of x^4 sin x
  • Oscar for best movie 2013
  • How old was Queen Elizabeth II in 1974?
  • work F=30N, d=100m
  • mass proton / electron
  • 1980 Nobel Prize in Chemistry
  • Which months have 31 days?
  • 32 coin tosses

On a final note, the front-end used here is not supported by Internet Explorer browser, as it does not supports advanced options of jQuery that well. If you are accessing Omniscient from Internet Explorer, please upgrade your browser to Mozilla Firefox (best) or Google Chrome (better).

The existing Omniscient application can be accessed at:

The source code is available on Github, which includes the implemented front-end as well. You can use the source code as you wish for free provided you use it for personal, non-commercial purposes.

Omniscient on Github|

“Save to Google Drive” lets you to save files or images available online easily in Google Drive. You dSave to Google Driveon’t have to actually download the complete file, the file link enough. You can analyze the page you are browsing to extract the links or images, select what you need and save them to Google Drive in a click.

Now you can save files and images found online to your Google Drive account in a click. No need to download the entire file and upload it again to Google Drive. Just provide or select the link and the rest will be done. If you have enabled file synchronization on your computer, added files will automatically appear on your Google Drive directory as well.

Here are some screenshots :

Quick add link :


Link Queue :


Settings :


Context Menu :



  • Save entire files to your Google Drive account just by providing a link or selecting a link from the page you’re browsing.
  • Save Images to your Google Drive account easily. Right click image, Save Image to Google Drive, Done. Since the add-on is based on jetpack project framework, the right context menu will appear only after the image or page has completely loaded.
  • Links are added to a queue and are processed one by one. Queued links are saved persistently, so that you don’t lose any of your links in case of browser restart.
  • Add the link in Clipboard to queue by a single click on the add-on bar.A ‘Clipboard’ is just the text you have recently copied.
  • Analyze all the links/images in the current page, select only those you want to be saved, and all the files in those links will be in your Google Drive account the very next moment.
  • Fully customize the notification settings (Login Failure/Invalid Link/Save Successful) according to your preferences.
  • All files are saved under the root dirctory of your Google Drive account. You can later download all files together as a zip from Google Drive using its options. To do that, in Google Drive select all the files you want to download as a zip, right click and select Download.


  • Google Drive currently supports adding of links of file size up to 25 MB
  • The default file saving directory cannot be assigned to any other directory other than root. The reason is that the Google Drive API used here does not supports this function.

The add-on can be downloaded on Mozilla Firefox (v17 and above) from the official AMO ( website :

Do not forget to rate and review.

The software is distributed for free under GNU General Public License, version 3.0 and the source code can be viewed here :

Source Code for Save to Google Drive 0.2

Problem statement :

Design develop and run a multi-threaded program to generate and print Fibonacci series. One thread has to generate the numbers up to the specified limit and another thread has to print them. Ensure proper synchronization.

Program :

(click “view source” or “copy to clipboard” button on the top right corner of the code section to copy or save the source code)


int fib(int n)
if(n<2) return n;
else return fib(n-1)+fib(n-2);

int main()
int fibnumber[100],i,j,n;
printf("Please Enter the series limit\n");
#pragma omp parallel num_threads(2)
#pragma omp critical
printf("There are %d threads\n", omp_get_num_threads());
printf("Thread %d generating numbers..\n", omp_get_thread_num());
printf("Thread %d Printing numbers..\n", omp_get_thread_num());
printf("%d\t", fibnumber[j]);

 return 0;

In the parallel section of the program, the task of generating numbers is assigned to Thread 0 and the task of printing the numbers is assigned to Thread 1.
We can ensure synchronization by using #pargma omp critical clause that forces only one thread to be active, so that we do not have a race condition where Thread 1 races over Thread 0 by printing numbers that have not been generated yet by Thread 0.

Problem statement :

Design develop and execute a program in C/C++ to simulate the working of Shortest Remaining Time First and Round Robin Scheduling algorithms. Experiment with different quantum sizes for the Round Robin algorithm. In all cases, determine the average turnaround time.

Given below is a brief introduction to the variables used in the program :

  • n                 : Number of Processes
  • bt [ ]            : Burst time for each process
  • at [ ]            : Arrival time for each process
  • tat [ ]           : Turnaround time for each process
  • wt [ ]           : Waiting time for each process
  • rt [ ]             : Remaining time for each process
  • finish [ ]      : Process complete status
  • twt              : Total wait time
  • ttat              : Total Turnaround time
  • total            : Total burst time

Program :

(click “view source” or “copy to clipboard” button on the top right corner of the code section to copy or save the source code)


class sched{
	int n,bt[10],at[10],tat[10],wt[10],rt[10],finish[10],twt,ttat,total;
	void readData();
	void computeSRT();
	void Init();
	void dispTime();
	int getNextProcess(int);
	void computeRR();

void sched::readData()
	cout<<"Enter no. of processes\n";
	cout<<"Enter the burst times in order :\n";
	for(int i=0;i<n;i++)
	cout<<"Enter the arrival times in order:\n";

void sched::Init(){
	for(int i=0; i<n; i++){

void sched::computeSRT(){
	int time,next=0,old,i;
	cout<<"Gantt Chart\n ";
		if(old!=next || time==0) cout<<"("<<time<<")|==P"<<next+1<<"==|";
		if(rt[next]==0) finish[next]=1;
			if(i!=next && finish[i]==0 && at[i]<=time)


		if(!finish[i]) {cout<<"Scheduling failed, cannot continue\n"; return;}



void sched::dispTime()
	for(int i=0;i<n;i++)

		cout<<"Waiting time for P"<<(i+1)<<" = "<<wt[i]<<", Turnaround time = "<<tat[i]<<endl;


	cout<<"Avg Waiting time = "<<(double)twt/n<<" and Avg Turnaround time = "<<(double)ttat/n<<endl;
	cout<<"Scheduling complete\n";

int sched::getNextProcess(int time){

		int i,low;
			if(finish[i]==0){low=i; break; }
				if(rt[i]<rt[low] && at[i]<=time)
		return low;


void sched::computeRR(){

	int time,j,q,i,dec=0;
	cout<<"Enter the time quantum:\n";
	cout<<"Gantt Chart\n ";
			if(at[i]<=time && finish[i]==0)

				if(rt[i]<q)	{
				else {dec=q;}

				if(rt[i]==0) finish[i]=1;
					if(j!=i && finish[j]==0 && at[j]<=time)






void main()
	sched s;
	int ch;

		cout<<"1.Shortest Remaining time\n2.Round Robin\n3.Exit\nEnter choice: ";
			case 1: s.computeSRT(); break;
			case 2: s.computeRR(); break;
			case 3: break;
			default: cout<<"Invalid Option\n";



Free texts over?  Want to send more?  This Google Script powered cloud application enables you to send as much of SMS as you want within India. Additionally, it supports Google Contacts, so you can send SMS without the need to type same numbers again and again.  The application also contains a quick contact adder, in case you want to add a contact quickly without visiting Google Contacts.

  • The only prerequisite is that you must have an account in Way2SMS. If you do not have one, you can always create an account here.
  • Click here to start configuring the application. It requires that you have to be signed in to your Google account. If not, you will be presented a Google login page. After you login, you will be asked whether to grant access or not. You can grant access by clicking Authorize  and on Grant Access buttons. Everytime you need access to this application, you need to click this link. You can bookmark the link for convenient access.
  • You will be asked to enter your Way2SMS credentials, enter the required information. Your information is saved securely in Google servers, and only YOU have access to it (even I don’t). This is an one-time setup.Way2_Contact_4
  • After you enter your credentials, you will be directly taken to application main page, where your contacts are ready in drop-down list (If present in Google Contacts). Select any one contact you wish to send SMS to or if you wish to manually type the number, select Number/Contacts mode to toggle between contact list and manual number input method. Type your message in the message field, and click Send SMS. The delivery status of your SMS is displayed in the top bar of the page.

Contact List mode :

Way2_Contact_1Manual input mode :


  • You can quickly add a contact to your contact list (and also Google Contacts) by selecting  Create contact and submitting the necessary information in the subsequent page. First Name and Phone are required fields. Other fields are optional. By default, contact is added to the Other Contacts group of Google Contacts. You can change it, add another contact or delete existing contacts by visiting Google Contacts. You can even synchronize your existing phone contacts to Google Contacts for easy initial setup, so you don’t end up typing each contact manually. See Google Synchronize for details on how to do this. Common supported devices are Nokia s60/s40, iPad/iPhone, Android.

If you want to use this application again, use the same link as mentioned above . You won’t be asked to authorize again if you have authorized once. The application currently supports sending SMS to only one contact at a time. SMS are delivered even to those numbers which are registered in National DND registry.

The HTML and CSS in the user interface have been designed using HTMLService of Google Apps Script. The javascript usage is minimized and is also supported by all popular mobile browsers like Opera Mini  and Dolphin,  so that you can access this app even from your phone when you are on the go.

Automating VTU result

Who likes to spend hours in front of a slow website waiting for a result? How about getting it directly in your email inbox as soon as it is declared? You can now automate the process of getting your VTU result which will be sent to your email inbox within five minutes of availability.

  • You need to click here to get started. This copies the required script into your google account. If you have not logged into your  google account, you will be presented with a google login form. After logging in, you will get a prompt to make a copy of the script and spreadsheet. Select “Yes, make a copy”.VTU Result screenshot 1
  • You will now have a spreadsheet something like this :

VTU Result screenshot 2

  • Double click on the central white cell and replace 1BI10XXYYY with your USN.
  • After a few seconds, you’ll have a new menu next to Help as Get started!. (If you don’t get this menu, please reload the page by pressing F5 button, or upgrade your browser.)VTU Result screenshot 3
  • Click on Get started! and then on Initialize.
  • Google reports that it is initializing the script, as Running script initializeVTU Result screenshot 4
  • If you are running the script for the first time, you need to authorize the script. Google prompts you to authorize, click OK.VTU Result screenshot 5
  • When you click OK, a new tab opens, which says Now you can run the script. Click Close to close that tab.VTU Result screenshot 6
  • You are now back to the original tab. Click Get started! and then on Run.VTU Result screenshot 7
  • When you click on Run, google executes the script for the first time and reports it as Running script initialize. When the script was run for the first time, you’ll get a confirmation that script is successfully monitoring your USN. You’ll also get a confirmation email that the script was successfully configured. Now you have successfully set up the script to monitor your result. When the result is available, it will email you your result within five minutes.

VTU Result screenshot 8The script stops monitoring, once the result has been successfully found. If you want it to start monitoring again, open the spreadsheet again, and repeat the process of Initialize and Run.

Update: I just got my result. Here is the screeenshot. Mark the date and time.


Any help needed? Feel free to comment here.