Twenty first Century Kids Love

What are you little children doing here? I saw these two kids, a girl and a boy of 5 or 6, holding their trousers and trying to fasten in a hurry as I suddenly opened the door of the toilet. They replied nothing but shyly giggled and ran out of the door. This scene created thousands of thoughts in my head. What were those kids doing inside the toilet putting their pants off? Were they sharing kids’ love? Why were they playing in a private place? What game were they playing inside a 3X3 closed toilet with the doors closed? What made them do such an activity? And many more…Not sure what exactly the two little kids were doing but I want to relate this story with the teenage love of this age. A girl of around 16 was pregnant for 35 weeks. She didn’t even share this information with her parents. Suddenly when their parents came to know about her pregnancy they had no idea what to do except panic. Investigation begun. The girl revealed the truth. According to her, The boy liked the girl. Approached her via her friend. Dated her for a couple of days. Finally, after having sex for the first time the boy disappeared. Became contactless. Leaving everyone suffering after 7 months. This is just one example of 21st-century love. Like this, I have heard and seen a couple of dozen cases in Nepal as well as in India where amateur girls got aborted and carved scars for lifetimes. Well, I have no objection to the kids for making their teenage love. One can make as many as one can but the point is are the kids able to cope with the level of tension created due to the amateur relationship they have created? Do their relationships create peace of mind or complications? What mental and psychological effects are they going through? Are our kids getting proper counseling in their school? Do the guardians give good care to their children? How is sex education taken and given to our children? Being a father of a son I am highly concerned about this matter. I am concerned for the future of today’s kids. Kids nowadays are more concerned about friends and relationships rather than their studies and homework. Very few children are focused on their work and career. Also being a social worker I would like to convey a message to all the teachers, caretakers, guardians, and parents to accept the responsibility of their students and children and give them proper care. Be open. Talk to them. Make a friendly environment. Try to reveal their secrets. In order to make a balanced life for our children, periodic counseling is required. What is happening in the children’s life? Like physical health, we also need to take care of the children’s mental health and psychological status. Physical health problems can be cured easily by medical treatment but psychological issues are often complicated and maybe too expensive. Hence, as a teacher and guardians, it is our responsibility to keep track of our children’s activities. By continuously monitoring their behavior and habits we will be able to help them build a healthy career. And hence a better world.

Good luck. Happy parenting.

थारु को हुन् ?

म सानै छदा कहिले काही हाम्रो घर मा पहाडी केरा को डोको बोकेर  आउनु हुन्थ्यो, एक जना बाजे।  म हजुरबा लाइ सोध्थे को हुन् इनि भनेर।  हजुरबा ले इनि मेरो मित हुन् भन्थे।  हामि केरा खादै रमौंथ्यो र मित बाजे संग गफ गर्थ्योउ। बाजे ले हामि लाइ नेपाली बोल्न सिकाउनु हुन्थ्यो।  बाजे १ हप्ता पछि फर्किनु हुन्थ्यो, १ बोरा चामल त्यहि डोको मा राखेर।     

अहिले म सोचेर दङ्ग पर्छु।  मित बाजे कोसौ टाढा पहाड बाट डोको बोकेर हाम्रो गाउ पैदल आउनु हुन्थ्यो र पैदल नै चामल बोकेर फर्किनु हुन्थ्यो।  मोटर चल्दैनथ्यो त्यति बेला।   हजुरबा ले भन्नु हुन्छ उहा धेरै गरिब हुनुहुन्छ भनेर। पहाड  मा जिउनु गार्हो छ अरे।  

त्यसैले नै होला धेरै पहाडी हरु चामल लिन तराई झर्थे २० साल पहिले।

हजुरबा ले भन्नु हुन्छ, हाम्रो ४० बिघा जमिन थियो।   नवलपरासी का धेरै गाउ हरु मा थारु हरु जमिन्दार थिए। बिस्तारै पहाडी भाग बाट मानिस हरु तराई वोर्लिए।  थारु हरु ले इन्लाई सरह दिए।  

आज एकजाना पहाडी साथि ले को हुन् थारु र के का लागि आन्दोलन गरिरहेका छन् भनेर सोधे। मेरो कुनै जवाब थिएन।  म उसको अनुहार हेरेर मुस्काए मात्र।     

How to implement Heatmap on Websites using PHP, MySQL, jQuery and Ajax?

I was assigned a task when an Interviewer interviewed me and that was a Technical question. I was asked to design a system that can gather click data from a webpage and show it later in form of a Heatmap.

[dfads params=’groups=-1′]

This system can be integrated into any website which records visitor clicks on the page. The goal of of this will be to track visitor’s mouse clicks on various elements of the page and later show them accurately in form a Heatmap. The owner should be able to see aggregated click data in form of an overlay on top of his webpage. The areas in the heatmap that are red more clicks compared to the areas that are white.

After googling through the internet I found some resources which were very interesting. I devoted some time and tried to implement a demo. Please follow the following Steps:

1. Client Code : Create a file index.php and include the following code below. This is the page where users make clicks.

[code]
<script type=’text/javascript’ src="js/jquery-lib.js"></script> <!– jQuery library –>
<script type=’text/javascript’ src="js/hm-dev.js"></script> <!– Log JS –>

<title>99-Websites.com Labs</title>
<body>
<div style="text-align:center">
<img src="99-ws-labs.jpg" />
</div>
</body>

[/code]

2. The Ajax Call : Create a JS file named as hm-dev.js. This file is included in the above index.php page. Add the snippet below:

[code]
/*
Author : Dev
Date : 12/06/2015
*/

jQuery(document).ready(function() {
jQuery(document).click(function(e){
//alert(window.location.href.toString().split(window.location.host)[1]+" — "+e.pageX+" — "+e.pageY);
log_click(window.location.href.toString(), e.pageX, e.pageY);
});
var canvas = document.getElementsByTagName(‘canvas’)[0];
canvas.style.display = "none";
});

function log_click(page, x, y){ // log clicks for heatmap
jQuery.ajax({
type: ‘POST’,
url: ‘log_click.php’,
crossDomain: true,
data: "x_coord="+x+"&y_coord="+y+"&page="+page,
dataType: ‘json’,
success: function(responseData, textStatus, jqXHR)
{
if (responseData== 1){
console.log("Click logged: " + x + ", " + y);

}
else{
console.log("Error – click not logged " + x + ", " + y);
}
},
error: function (responseData, textStatus, errorThrown)
{
console.warn(responseData, textStatus, errorThrown);
alert(‘CORS failed – ‘ + textStatus);
}
});
}
[/code]

3. Log the Clicks : Create a PHP file named with log_click.php and add the following snippet.

[code]

<?php
header(‘Access-Control-Allow-Origin: *’);
header(‘Access-Control-Allow-Methods: POST, GET, OPTIONS’);
header(‘Access-Control-Max-Age: 1000’);
header(‘Access-Control-Allow-Headers: Content-Type’);

//echo json_encode(array("your_request_was" => $_POST[‘page’].$_POST[‘x_coord’].$_POST[‘y_coord’]));

include(‘config.php’); //Create config.php file and define $dbuser, $dbpass & $dbname

if(isset($_POST[‘x_coord’])){
$page = htmlentities($_POST[‘page’]);
if($page == "/"){ $page = "/index.php"; }
$xcoord = htmlentities($_POST[‘x_coord’]);
$ycoord = htmlentities($_POST[‘y_coord’]);
$time = date( ‘Y-m-d H:i:s’);

$conn = mysql_connect(‘localhost’, $dbuser, $dbpass);
mysql_select_db($dbname, $conn);
$page = mysql_real_escape_string($page);
$xcoord = mysql_real_escape_string($xcoord);
$ycoord = mysql_real_escape_string($ycoord);

mysql_query("INSERT INTO clicks (timestamp, page, x, y) VALUES (‘$time’, ‘$page’, $xcoord, $ycoord)");
mysql_close($conn);
echo "1";
}
else
{
echo ‘0’;
}

?>

[/code]

4. Create MySQL Table : Create table with following fields:

[code]

CREATE TABLE IF NOT EXISTS `clicks` (
`timestamp` datetime NOT NULL,
`page` varchar(200) NOT NULL,
`x` int(255) NOT NULL,
`y` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

[/code]

That’s it, the first part is over. After implementing the above steps you will be able to log clicks on the MySQL Table. The next and the main part is viewing the heat maps.

5. Create the Admin Page : Create PHP page named with admin.php. This page will lists out all the domains on which the client side code is added. When the links are clicked, their respective heatmaps will be displayed below the same page.  Admin Code is listed below:

[code]

<?php
/*
Author : Dev
Date : 12/06/2015
*/
include("config.php");
$con2 = mysql_connect(‘localhost’, $dbuser, $dbpass);
mysql_select_db($dbname, $con2);
$query = "SELECT distinct page FROM `clicks` WHERE 1";
$result = mysql_query($query);
?>
<html>
<head>
<title>Heatmap Admin</title>
<script type=’text/javascript’ src="js/jquery-lib.js"></script>

<script type=’text/javascript’ src="js/heatmap.js"></script>
<script>
jQuery(document).ready(function(){
var heatmapInstance = h337.create({
container: document.querySelector(‘.display’),
radius: 25
});

jQuery(".showcanvas").click(function(){
//location.reload();
//alert(jQuery(this).attr(‘value’));
var timescale = "day";
var page = jQuery(this).attr(‘value’);
//alert(page);
var postData = "timescale="+timescale+"&page="+page;
jQuery.ajax({
type:"POST",
dataType: "json",
data: postData,
beforeSend: function(x) {
if(x && x.overrideMimeType) {
x.overrideMimeType("application/json;charset=UTF-8");
}
}, url: ‘heatmap.php’,
success: function(data) {

if (data.amount > 0){
for (i=0; i<data.amount; i++){
heatmapInstance.addData({
x: data[i].x,
y: data[i].y,
value: 2
});
}
}
}
});

});
});
</script>
</head>
<body >
<div style="width:100%; border:1px solid; black;">
[Click on the Websites below to View their respective HeatMaps]<br>
<ul style="font-size:12px;">
<?php
while($row = mysql_fetch_assoc($result)){
?>
<li><a href="#" class="showcanvas" value="<?=$row["page"]?>"> <?=$row["page"]?></a></li> <br/>

<?php

}
?>
</ul>
</div>
<div class="display" style="width:100%;height:100%;border:1px solid; black;float:right;">
</div>

</body>
</html>

[/code]

The main logic behind the code is the heatmap.js library. In order to understand in detail you can explore the following references:

1. http://www.patrick-wied.at/static/heatmapjs/example-click-heatmap.html

2. http://rossmarks.co.uk/blog/?p=683

3. http://www.d-mueller.de/blog/cross-domain-ajax-guide/

You can view the Demo here: 

1. Client / Users Page : http://99labs.net where you can make some clicks on the webpage.

2. Admin Page : http://dewendra.com.np/labs/hm/admin.php where you can view the Heatmap.

Also, You can download the whole code from here : Download

[dfads params=’groups=-1′]

PS : The client code can be installed into any website and their logs can be maintained on the remote server. If you go through the client side code you can see the ajax code implemented with CORS (Cross Origing Resource Sharing) using jQuery.

VMware Player unrecoverable error: (vmx)

When I opened my VMware today, following error was displayed:

VMware Player unrecoverable error: (vmx)

Exception 0xc0000006 (disk error while paging) has occurred.

A log file is available in "C:UsersacerDocumentsVirtual MachinesRed Hat Enterprise Linux 6 64-bitvmware.log".

You can request support.

To collect data to submit to VMware technical support, run "vm-support".

We will respond on the basis of your support entitlement.

[dfads params=’groups=-1′]

Solution: Remove the following two files from the VMware installed directory. You can check the installed directory from Player -> Manage -> Virtual Machine Settings -> Options

  1. Red Hat Enterprise Linux 6 64-bit-93cd0331.vmem
  2. Red Hat Enterprise Linux 6 64-bit-93cd0331.vmss

[Source: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002347]

Alphabets Kids will Learn in Future

Alphabets kids will learn in Future.

A: Amazon.com
A shopping Website.

B: Blogspot.com
A free blog website from google.com.
Bing.com
A search engine from Microsoft.

C: Cnn.com
CNN News Website

D: Dropbox.com
Share Files on the Cloud

E: Ebay.com
A shopping Website.

F: Flipkart.com
A shopping Website.
Facebook.com
A social networking website.

G: Google.com
A Search Engine

H: Hostgator.com
A Website Hosting Website

I: Instagram.com
Share Pictures online.

J: Jabong.com
A shopping Website.

K: Kakaku.com
A Chinese Website

L: Live.com
Email Website from Microsoft

M: Msn.com
A Search Engine from Microsoft.

N: Naukri.com
A Job Search Website.

O: Olx.in
Sell your old products online

P: Photobucket.com
Share images online

Q: Quikr.com
Sell your old products online

R: Rediffmail.com
An Email Website

S: SurveyMonkey.com
Create Surveys and Get Answers online.

T: Twitter.com
A microblog Website

U: Upload.com
Upload and Share Files

V: Vimeo.com
Upload and Share Videos

W: Wikipedia.org
The Free Encyclopedia

X: Xe.com
Live Exchange Rates.

Y: Youtube.com
Upload and Share Videos

Z: Zomato.com
Search Restaurants Nearby.

Information Compiled from alexa.com (Top 500 Websites on the Web)