vinayras's blog

MySarkariNuakri - First Android App from VinayRas

VinayRas is proud to announce their first Android application -"MySarkariNaukri"

MySarkariNaukri is an application that displays government jobs from http://www.mysarkarinaukri.com/. Mysarkarinaukri.com is one of the most visited website for government jobs in India.

The syncs jobs from website, and stores locally. This in return offer search facility.

In the second version we will be coming up with more features.

Google Store

Delete Orphaned terms from vocabulary (Drupal)

We have been managing several websites powered by Drupal. Over the years we have found that we have several terms that do not have any nodes associated with them, thus rendering empty pages for those keyword.

Here is a small piece code to delete those terms. This can be added to cron to make sure terms are cleaned regularly.


$vid = 3; // Vocabulary ID
$terms = taxonomy_get_children($tid = 0, $vid);
foreach ($terms as $term) {
if (taxonomy_term_count_nodes($term->tid) == 0) {
// See if any nodes use the terms. If none, delete the terms.

Geolocation information from Browsers

HTML 5 has introduced a new feature - Browser Geolocation API. Now using a simple java-script code, you can extract the location information of visitors. This helps specially if you are providing location based information such as movie details, business listing, travel advisories and other such information.


if (navigator.geolocation) { // check if browse supports
navigator.geolocation.getCurrentPosition(function(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;

How to list all cron entries on a WHM/cPanel based servers

Ever wondered how to list all the cron entries of all users on WHM/cPanel based servers

I have been trying to find a way to list all cron entries of my clients just to make sure things are in proper place.

Here is the small piece of code that helps


for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done

crontab -l helps in listing root cron entries only. It does not list cron entries of users created through WHM interface.

Facebook comments & SEO

Facebook comments has recently emerged as replaced for comment boxes on regular websites. There are many advantages - such as spam control, posting comments as yahoo, Facebook or other users, ability to post on Facebook profile's wall etc.

We started using the Facebook comments on most of our community based websites. But we always wanted to find a way to get the SEO benefits from comments posted on website.

Preventing cross-site-scripting (XSS) vulnerability

Recently i came across a report at xssed.com, about ebharatjobs.com being vulnerable to cross site scripting (XSS). That report was filed way back in 2009, and we have already fixed that when we upgraded www.ebharatjobs.com in 2010.

I wanted to share the code we used to check the input from users to possibly prevent XSS vulnerability.


// cross-site-scripting (XSS) vulnerability
$q = $_GET["q"];
//remove the script tag and its contents

Drupal 7: Bulk update taxonomy url aliases

Yesterday, we showed how to Bulk update node url aliases. Now we faced similar problems while generating bulk url aliases for taxonomy terms. For some reason the admin interface was not able to generate them. The screen just struct up.


define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// menu_execute_active_handler();
set_time_limit(0);
error_reporting(E_ALL);
$tid = (int) variable_get("url_alias_last_tid",0);

Drupal 7: Bulk update node url aliases

eBharatBase.com has more than 2, 60,000 nodes. We changed the pattern of url aliases to be generated for each node. We tried to generate from admin interface of pathauto module, the system hangs everytime.

The reason - query to fetch node was taking much longer to execute, and php/drupal used to show error message since they were not receiving any response.

To tackle this problem, i started writing small but effect piece of code to generate the url alises of all 2,60,000+ nodes.

1) Created script named "generate_url_alias.php" in drupal root folder

SearchPropertyIndia.com - Find Real Estate Properties with ease

SearchPropertyIndia Screenshot

SearchPropertyIndia.com is a vertical search engine targeted to the people looking for properties such as Flat / Apartment, Bungalows, Villas or Land, plots. Visitors can also search for properties available for rent only.

Searching property online can be a tiresome process, and at times you will not be able to find the right kind of property you might be looking for. To make this process easier we have come up with this vertical search engine.

SearchPropertyIndia.com crawls real estate websites, and indexes them. And then people can search them based on city, type, etc.

ebharatjobs Mobile Job Search

We are very happy to announce the mobile version of eBharatJobs.com - India's most used job search engine.

The mobile version is located at http://www.ebharatjobs.com/m

Redirection from main page is handled through a php script that detects if the referring agent is Desktop or a mobile/handheld device. The mobile devices are shown this new mobile version of ebharatjobs.

The website is live and we are now waiting for feedback from our users.

Thank you
Vinay Yadav
Web Developer