Category Archives: Computer Science

Mostly programming and coding work related to PHP, HTML, Java, C#, Python and any other that I come across. May also include consumer level articles.

Searching Multiple Documents

At work, at school or even at home, often we have to read though multiple files to find specific texts or objects. When there are more than one file to search, most users would open and search each file one at a time. But time is invaluable and most of us rather do anything but searching for information all night. Likely, there are simple solutions you can use to prevent repetitive search. The following article will briefly explain how to search large number of individual files on a Windows based computer.

Searching multiple PDF files

1) Open the Adobe PDF program (with or without a document file).

2) Now press CTRL + Shift + F to open the “advanced search” window shown here:

Text search in multiple PDF files
Text search in multiple PDF files

3) Select “All PDF Documents in” radio option under “Where would you like to search?” dialog.

4) If you prefer to search only a single folder containing multiple PDF files, choose from the folder tree under the drop down or choose “Browse for Locations…” from the list. It will give you a pop up for locations in your computer/network.

Locations options for PDF files search.
Locations options for PDF files search.

5) There are few other options including Case-Sensitive, entire phrase search, etc.

The following is an example of search results for all PDF-based lectures for Hydrology 401 class for the term “hydraulic gradient”. During final exams of Winter 2013, I have literary saved hundreds of hours searching for information in PDF materials using this method.

How the results will appear. By hovering over a result will provide page number.
How the results will appear. By hovering over a result will provide page number.

Searching Microsoft/OpenOffice

This is not an ideal solution. The results are often scattered across the computer and the data presentation is not as good ad the Adobe PDF search. But still this is better than looking for specific concepts using good-old flipping pages.

1) In Windows 8, go to the Start Screen and then simply type away… Files with your word phase should come up as soon as you type.

2) Click on search word/similar words list, which appears below if the items you are looking for does not appear under immediate files list.

3) Can search all types of documents. However, locked PDF and document files may not always get searched.

You may go to search settings on your computer to limit the type of files and the locations for the search.

Windows 8 computer-wide all file search results.
Windows 8 computer-wide all file search results. Click for larger image.

As you can see from the example above in which I searched “Phacopida”, the new Windows 8 redeisgned results page can be very informative. For some people like me, this is great since it also searches Wikipedia and images with that file name or meta tag. But for others this can be confusing. Microsoft have placed the results in panes (A to E on the image above) so that each search location is separated. Ideally, this is the best way to search multiple format (PDF, image, Office, etc) on Windows 8 computers.

The same function is available on all Windows computers from Windows 95 and upwards. The only difference is the results in older generation Windows units will display in the Folder format.

General Search in Windows 7
General Search in Windows 7

Problems with images and diagrams

Unless the images are saved as a PSD file, CorelDraw file, Excel/Word text-graphic file or image files with meta data, it will be harder for the computer to detect what you need. I would recommend encouraging your instructors to use modern tools when creating images/diagrams so that the texts included in them can be search by Windows and other Operating Systems. There are tools for image search, but these software will cost you an arm and a leg!

Google Custom Search Refinements

Google is a very popular search engine. One of the driving forces behind the popularity is the Google Inc’s generous offers such as free site based search. The Google Custom Search Engine (CSE) is a such free Webmaster tool. It allows the site owners to integrate the powerful Google search system into their website. I already discussed how to replace the default WordPress site search with your CSE. In this article, I will introduce you to creating content filters.

Filtering the web

As time progress, the amount of pages and media also increase with it. This is not just true for large scale cooperate websites, but also true for personal websites like SANUJA.COM. Someone who publish articles and other web items regularity would at least have one or two articles/items per week. If you multiply them by the number of weeks per year, that’s a lot of information. The problem with general web search on your site is that the visitor may move out of the site as a result of it. The solution is to use an integrated site search that only search your site. All Content Management System (CMS) comes with some form of built-in or modular site search. For average web owners, that’s all they need. But what if you would like to have more control over how the site content is search? The CSE will allow you to restrict your search to specific area of your site. This is how you configure your Google CSE to refine your search results.


If you have a section of your website that is more important than the rest, then refining is a good way to help the visitors narrow down their search. For example, on my site I empathize the academic exam bank. I want my visitors to filter out all the materials under Exams and Resources during a search (if desired). Here are the steps to creating a refining filter:

1. Log-in to Google Custom Search Engine (GCS) and select the search engine you would like to edit.

Selecting your Google CSE
Selecting your Google CSE

2. Choose “Search features” from the right hand menu and select the second tab “Refinements”. Now press “Add” button from the Refinements pane.

Adding a refinements.
Adding a refinements.

3. A pop-up window will appear with form for new Refinement addition. Save the item.

Add new refinement popup.
Add new refinement popup.

4. Choose “Setup” from the right hand menu and select the “Basics” tab. Under “Sites to search” you can add a limitation.

Refinement directory/link limitation.
Refinement directory/link limitation.

In this particular example I provided my visitors an option to limit their search to my exams area. Since all my exams bank questions are followed by the common URL, “*”. Which is like a prefix. It will allow the Google CSE to limit all the returned search results to Exams pages.

5. Choose the Refinement option created in step 3.

Limiting the site directory and adding the Refinement
Limiting the site directory and adding the Refinement

Here is an example of a refined search…

Refined search results using the tab style.
Refined search results using the tab style.

Excluding content

You can prevent the Google Custom Search from indexing certain pages or URL (link) patterns. To do that, you can:

1. Navigate to exclude section by clicking the “Advanced” link at the bottom of “Sites to search” section.

Advanced link.
Advanced link.

2. Once in the Advanced sections, you should see “Sites to exclude”. Add either one URL at a time or use the prefix method just like in the refinement configuration.

Restricting (excluding) a prefix URL pattern.
Restricting (excluding) a prefix URL pattern.

There are few reasons to why you may exclude URLs, pages, images or other data. Pages from access restricted or membership based areas can be hidden from search results to prevent unwanted traffic to such areas. Sometimes images have copyright agreements that specifically restrict your users from searching images. You may have “junk” or temporary URLs such as http://domain.xxxx/P?7299 which often generated by some Content Management Systems or plugins/scripts.

Rooting an Android

Some of you may have heard about the term “root” or “rooting” with regards to Android mobile Operating System. This term is not something new to computer and software geeks. Root is the most fundamental level in a UNIX or Linux based operating system. In order to install some apps and to tweak the behavior of a OS, you need the root access.

Due to various variables, every option listed here may not work for your particular phone.

Skip Jargon

Introduction to Android

I am not going to give long history on Android. From a technical perspective, you should know that it is an open sourced mobile Operating System currently supported and developed by Google. More than hand full of manufactures use this OS to streamline their devices. Android can be installed on mobile phones, tables, televisions, GPS units and any other electronic devices that support such architecture.


Rooting is granting access to most fundamental operations which otherwise will be blocked by system default. While not all applications of rooting may harm the device, due to the wide openness of what you can do with root access could brick your device (f*&^ked up beyond repair). This is why rooting an Android device will void your manufacture’s warranty. If you are not technically inclined, I would stay away from rooting. This article is written for tech guys who have limited experience in Android environment.

This also place a lot of responsibilities on the end user. After rooting a device, you will not have the “safety net” from malicious apps which otherwise will be in placed by default. It will be your sole responsibility to manage your root access permissions wisely.

How to Root an Android

Installing the Recovery

1) Download and install the drivers for your device from the manufactures. You may find them on their support website and/or the media that was provided to you by in the original packaging.

2) Download ODIN software. It will make it easier in flashing recovery and the rooted firmware. Please note that the ODIN will only works on Windows based computers.

3) Download the Odin flashable recovery (.TAR file) for your device then copy it to the same folder as Odin. There is an another option if you have a .img file. Please read further down for instructions.

4) Open ODIN by right click on Odin.exe –> “Run as administrator”. You should come up with a window similar to the following.

Ordin Program on Windows
Ordin Program on Windows

5) Turn off your phone and reboot into Download Mode. In order to go into the Download Mode, hold Volume Down + Home + Power while it shuts down. Continue to hold until the device is powered up and a text message appears on the top corner (very small sized texts). Once inside the Download Mode, press Volume Up to enter.

6) Connect the device to computer via USB/charger cable. It is recommended to use the original manufacture provided cable. If your phone do not support USB 3.0, please do not use USB 3.0 port on your system even if it is backward compatible. This is just to be safe.

7) The ODIN window should have a COM** port highlighted as shown here.

Comm USB port highlighted in ODIN.
Comm USB port highlighted in ODIN.

If ODIN is not highlighting the port, go back and make sure you have properly installed the right device drivers from your hardware manufactures.

8) Click on the PDA button on the right right pane of the ODIN. Refer to above image.

9) When prompted (once the PDA button is selected) go to the firmware location and select the firmware file (TAR file).

10) Warning! Make sure Auto-Reboot and F. Reset Time are the only options checked and that PDA is the only other thing checked on ODIN before starting the flash. CHECK again and again your settings and that you have selected the correct firmware for your model phone and are using the correct options. If you are using a laptop, make absolutely sure you are plugged in, or if on battery, that it is charged enough and will not go into sleep mode during flash.

11) Click Start to begin the flash. This will take a while, so be patient. Do not unplug or remove the battery during the installation. I highly recommend placing the device on a solid stable surface with the USB cable attached during this process. I would not move the device since some computers and devices have lose USB connections which could potentially disconnect your device. If the device gets disconnected, this may result in bricking your phone.

Flashing the ClockworkMod Recovery.
Flashing the ClockworkMod Recovery.

12) Once the installation is successfully completed, the ODIN will report PASS on the top left hand corner. The phone should have automatically rebooted at this time.

ODIN report back "PASS" in a green box after a successful install.
ODIN report back “PASS” in a green box after a successful install.
You may unplug the phone and close Odin if you wish.

13) Wait at least 5-10 minutes (or even as long as 30 min) for the system to boot the first time and then build its cache. Do not remove the battery or disconnect power during this time.

You may now flash a ROM file using the PDA button on the ODIN. You can also flash a ROM using either a custom recovery or the default system.

Another option for ROM Flash

1) Download the appropriate ROM zip file and save it on your phone (just like saving any other file).

2) To get into the recovery mode, hold Volume Up + Home + Power while it shuts down. Continue to hold until the device is powered up. An example of a recovery screen is shown below (CWM).

ClockworkMod Recovery screen.
ClockworkMod Recovery screen.

3) Choose “install zip” (or “install from zip”, “install ROM”, etc) and select the zip file you saved.

4) After few minutes you should get a success message. Now go back and reboot your phone.

Third option for ROM Flash

You may flash a ROM that comes in the image (.img) format. Do not feel overwhelmed by the coding. Just follow the instructions and it will be installed on your device in few seconds.

1) Download a recovery image of your choice. For example; ClockworkMod Recovery Images. Save the .img file in your device’s memory.

2) Rename the image file to recovery.img or anything of your choice. Note: If you decided to rename the file other than recovery.img, then please change the second line of code appropriately to reflect the file name (dd if=/sdcard/YOUR_FILE_NAME.img of=/dev/block/mmcblk0p18).

3) Download a terminal app, which will allow you to enter commands into your Android system.

4) Open the terminal app and follow these instructions.
– type and enter

$ su

– type and enter

# dd if=/sdcard/recovery.img of=/dev/block/mmcblk0p18

– type and enter

# reboot recovery
Example of a terminal with recovery image named as "re.img".
Example of a terminal with recovery image named as “re.img”.

There are significant risks associated with this method. If you flash an incompatible ROM or if you enter the codes wrong, you could end up bricking your phone.

Common Errors

During the rooting and installation process of a custom ROM, you may come across errors. Do not panic because most of these errors are common and can be fixed.

Status 7 Error – installation aborted

Be warned that editing the code impropriety may result in bricking your device. Before edit the code in the ROM zip folder, make sure that you have the right ROM for your phone. By removing the code, we essentially removes the safety mechanism in which recoveries like ClockworkMod uses to block invalid zips from being installed.

Clear codes in updater-script file up to (NOT including) show_progress(0.500000, 0);. You should be able to locate this file at, META-INF –> com –> google –> android. The number of lines that should be deleted varies with each custom ROM. For example, the CynogenMod 10.2 will have the following check code at the very binging.

assert(getprop("ro.product.device") == "d2att" || getprop("") == "d2att");
assert(getprop("ro.bootloader") == "I747UCDLK3" ||
       getprop("ro.bootloader") == "I747MVLDLK4" ||
       getprop("ro.bootloader") == "I747MUMBLK3" ||
       getprop("ro.bootloader") == "I747MUMBLL1");
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
package_extract_file("system/bin/", "/tmp/");
package_extract_file("system/bin/backuptool.functions", "/tmp/backuptool.functions");
set_perm(0, 0, 0777, "/tmp/");
set_perm(0, 0, 0644, "/tmp/backuptool.functions");
run_program("/tmp/", "backup");

Initial boot stuck in a loop

Go back to recovery and clear (wipe) user data, System, Cache and Dalvik. Instructions for will soon be posted here. These options are in the recovery section under “advanced” menu.

GooglePlay Store is not installed

Most custom ROMs do not include GooglePlay files. You need them not only to download apps, but also for basic functions such as the Google Keyboard. You can flash this file into your device using the any compatible ZIP file available online with the GooglePlay Store.

1) After downloading the ZIP to your computer/phone, relocate the ZIP file to the root of your device storage main memory. This will make it easier to find during flashing.

2) Go to the Recovery Mode and select “install zip”.

ZIP folder installation choice.
ZIP folder installation choice.

3) Select the option for device storage memory.

Go to device storage memory.
Go to device storage memory.
If you have saved the ZIP file in the root of the device, it will probably be under a folder titled “0”.

4)Go back and clear memory before rebooting. Once the reboot is complete, you should see your GooglePlay app. If you end up with a connection error even when you have a wifi or mobile network connection, try the following for troubleshoot:
– Check if you have installed the latest compatible version of gapps for your mod.
– Check if the hosts configuration is correct using a file explorer app. Go to device root -> etc -> hosts (open as a text file).
– If both of the above failed, delete the GooglePlay app (from the settings), then re-download the ZIP and start this process over. Sometimes during download process, the file gets corrupted.

Too many choices; help me out

To a novice Androider, choosing what recovery and ROM to flash along could discourage rooting. I am all for choices, but sometimes even I need some guidance. You may choose any recovery and ROM that is compatible with your device. You may even use the stock ROM with the root access. It all depends on your choices. However, in case you need my opinion (personal choice), this is what I would recommended:

  • Compatible version of ClockworkMod Recovery (Touch or non-Touch)
  • Compatible version of CyanogenMod stable release
  • SuperuserSU app for controls
  • Compatible signed version of Google Apps zip

Happy rooting 🙂

Ordinary tech heroes

The dictionary definition for the term hero reads; a person who, in the opinions of others, has heroic qualities or has performed heroic acts and is regarded as a ideal or model for the rest of the community. The classical definition implies that you know the person well enough to identify the hero. If you research any civilization, almost all heroes are popular characters with very unique social statuses. In this Information Age, not all leaders have the desire to be famous. But all great heroes from the history to the present have similar stories to tell. is hypocritical for organizations like FoxNews, CNN and even BBC to criticize the lack of education and/or high moral backgrounds of people like Edward Joseph Snowden, while at the same time the workers in these media giants use iPhones made by a college dropout, Mr. Steve Jobs and Microsoft Windows OS made by Mr. Bill Gates who never passed a programming course.

They haven’t changed

In modern Information (technological) Age, often we disregard our history because we think the history is irrelevant. From my opinion, it is the opposite.

In 2013, most of the news in Canada has been dominated by privacy issues. Our increasing dependencies on technology has lead to redefining the term privacy. The key players in this privacy wars have both supporters and opposers. Just like in World War I or the French Revolution, a hero to some may be a villain to the others. Bradley Edward Manning and Julian Paul Assange are examples of modern day heroes or villains. Regardless if this is the 1800s or the 21-century, there is always a conflict between what is considered good and what is considered evil. The history has repeated itself and nothing much has changed. The only difference between the war lords like the Alexander the Great or the King Asoka and the modern tech world lords is the medium in which they fight. Unlike in the old days, it is not always clear what we are fighting for because the causes are often complex and dynamic. I think this is why most people are unaware of the growing problems in the modern world.

Birth of the IT heroes

Today in 2013 a Computer Engineer or a student with access to a network can cause more damage to a country than a nuclear weapon. From stock markets, educational systems, banking system all the way to the private family databases have been digitized. While it provides faster access to information, it has also significantly altered the way we fight. The same network and database that provide information on your family history like can also be used to track you down by your enemies. The same fail proof DNA evidence is used in trials have been linked to wrongfully convicting innocent people.

You could be a 10 year old or a 90 year old with access to a high speed Internet connection. You could have no friends or lots of friends outside of the “networked world”. You could have Facebook and Twitter accounts or you may never had one at all. You could be formally educated as a network and computer specialist or you could be someone who never passed a single high school course. It does not matter who you are, we all can be tech heroes. I came across stories in which 90 year old using a mobile phone took pictures of a bank robbery in progress and called the police at the same time. The group of unorganized individuals known as the “Anonymous hackers” includes people as young as 10 years old.

Side note on the background of people. I found it is hypocritical for organizations like FoxNews, CNN and even BBC to criticize the lack of education and/or high moral backgrounds of people like Edward Joseph Snowden, while at the same time the workers in these media giants use iPhones made by a college dropout, Mr. Steve Jobs and Microsoft Windows OS made by Mr. Bill Gates who never passed a programming course.

To some this is a great opportunity to be a hero while to others this is a great time to be a criminal. It all depends on how you use the technology, for what purpose and what is defined as “good” and “evil”.

What is good for the society?

Who should decide what is good for our civilization? The Governments run by handful of people? The tech heroes which include people with hidden evil intentions? The large data mining companies like Google or Amazon? These are valid philosophical and logical questions we should ask ourselves. Even if we answered them who will keep these in checked and balanced? In my opinion, this will be a never ending war. Unlike the French Revolution or the World War I and II, this tech war will have much larger impact on our civilization. While you could argue that this is not as fast and violent as “traditional wars”, I can counter argue with the increased dependency on technology, we would only need a single mad person to push that button to explode a nuclear missile.

Introduction to Modern Warfare

Israel use of banned chemical weapons
Israel use of banned chemical weapons

I do not think that I have to explain to my readers who are Bradley Edward Manning and Julian Paul Assange. They became famous for WikiLeaks which released large databases containing US Government’s criminal activities around the world. They have been viewed as enemies in some politicians (who probably couldn’t even connect a computer to a projector), while others have hailed them as heroes. Either way they are only two out millions of tech heroes.

Edward Joseph Snowden is another leader in the tech war. He exposed the NSA (National criminal Security Agency) operations involving spying on multimillion droller trade deals for American companies like Microsoft and Google and spying on US citizens. Too bad the modern media controlled by the few Zionist elites do not want to publish the US spying on trade deals eh?

The group of highly unorganized tech experts known by their umbrella name “Anonymous hackers” have been exposing corruptions in Governments and Private Companies. They have also forced powerful people (similar to A. Hitler) in modern companies to step down. They have also fought for the rights of civilian victims, which otherwise have no voice to promote justice. I am not going to say if they are good or bad, but if you would like to read their projects like Occupy Wall Street, Child Pornography crack down or Rehtaeh Parsons operation, ironically Google Search is your friend.

There are other small cases such as murders like Derek Medina of Miami posting messages on Facebook admitting to killing his wife or police officers being questioned (and often not changed) after digital video evidence recorded by civilians (and even their own other officers) indicate abuse of power. The best example of this in Canada is the Robert Dziekański Taser incident which created a ripple effect in the RCMP (Royal Canadian Male-only Police). How about those RCMP male officers groping female officers or even raping them by forcing them to have sex while on duty?

Aftermath Boston Marathon explosions
Aftermath of Boston Marathon explosions

Yes there are good examples from conventional type wars. The video and photographic evidence of modern wars such as the ones in Middle East have disputed the official accounts. The use of banned chemical weapons by Israel Army OR the use of lynching of Black men by Nazis are great example of conventional hate spilling over to the tech world. Let’s not forget about the the role of technological age in Abu Ghraib prison scandal photos. I did not know US Army had sluts until I came across those images. The Boston Marathon bombings civilian video surveillance is another example of bad guys being tracked using technologies.

Bangalore : Karnataka Cooperation Minister Lakshman Savadi seen watching porn.
Bangalore : Karnataka Cooperation Minister Lakshman Savadi seen watching porn.

With mobile devices ethics of using it also can be come in to question. The Women and Child Welfare Minister CC Patil and the Co-operative Minister Laxman Savadi (BJP) of India have been cought watching pornography during the Assebly in Benglauru. While this is nothing illegal in India or even in Canada, it brings the spotlight to ethics of technology and how we use it. The irony in this particular case is the abuse of technology is proven by another technology; the TV broadcast of political proceedings in India.

Back to the basics

May be the solution for those who would like to secure data is to going back to the old technologies. The reason Sub.-Lt. Jeffrey Paul Delisle of the Canadian military was able to copy data from secure servers in Canada to a USB drive and hand information over to Russia, is because our data on military intelligence have been digitized in recent years. After the incident, I was researching on the history of spying and realized may be physically writing down non-time critical data is not a bad idea. Think about it, if you only keep the essential data and services on digital format, it would be at least bit difficult for someone to copy the data. While it is still not fail-proof, at least it would be better than the current system of digital encryption. In old days spies are trained to memorize information not copy information on a PDA (Personal Digital Assistant, now known as Smartphones or Mobile Computing Devices). This will completely eliminate the need for secure networks all together.

In my opinion, separating data networks from one another is another way to combat security issues. If you have a NAS (Network Attached Storage) with family pictures, why not simply separate the entire Internet LAN (Local Area Network) connections from the NAS connections? This will still give you the access to data on your home network while blocking all access from outside. It may not be an ideal solution for some, since you cannot access your data from outside the house, but still provide much better security than an encrypted password.

Democrazy to democracy

The point is the complications of tech world goes on and on…and in this technological age, it is difficult for anyone to keep secrets from everyone. After all, when even the authorities commit crimes, I do not see a problem in civilians taking actions to protect their community form crime and abuse. However the accountability knife should be able to cut on both ends. Both the criminals and the heroes should be held accountable for their actions. It is scary to say that it is difficult for us to keep track on who is watching whom. With billions of people with access to technology, the power has truly shifted from “democrazy” to true “democracy”.

Enable the Num Lock at startup

This is a very common question I get from my friends. I have no idea why Microsoft didn’t make this easier since they can just add a button to the toolbar. I am aware of the fact that this is probably on several different websites. Having too many well explained documents on this never going to hurt anyone.

There are no security issues of having Num Lock on at startup (at least not that I am aware of). You can do this on computers running any edition of Windows NT, 2000, XP, Vista, 7 and 8. In addition, you can also do this on Windows servers running NT and up. If you are going to do this on your work or school computer, please make sure that you are not breaking any laws. You do need administrative privileges to perform this change.

Using Registry Editor

The easiest way to do this is using what computer geeks called, “regedit” method.

1. Open regedit: I usually type “regedit” in Windows general search (on the start menu) of the computers running Windows Vista and up. This is the easiest way to open Windows Registry Editor.

General Search in Windows 7
General Search in Windows 7

General Search in Windows 8
General Search in Windows 8

If you have a older OS, then open Run, and type regedit.exe.
Regedit using Run
Regedit using Run

2. Open Keyboard folder: Go to HKEY_USERS\.Default\Control Panel\Keyboard.
Keyboard Folder
Keyboard Folder

3. Edit: Right click on the InitialKeyboardIndicators and choose Edit. It will open the String Edit window.
Editing of InitialKeyboardIndicators
Editing of InitialKeyboardIndicators

4. Click OK: and you may be asked to restart your computer. Now you are done!

Using BIOS

The second way of doing this is using BOIS settings. Today there are so many different BOIS software. Therefore it may take few more or less steps to change it from BOIS. What you need to find in your BOIS is the “Keyboard Features” (or sometimes “Keyboard and Mice Features”) and switch the NumLock to ON. I do not recommend using BOIS because it is much safer to do it through regedit. Only if the regedit cannot be accessed for some reason should you be using BOIS to modify the NumLock.

I do not know why the software developers have set this feature to disabled at start up. As far as I know, it will not have adverse effect on your computer.