Saturday, April 30, 2011

Does drinking cold water cause soar throat?

People got this wrong idea. Soar throat is an infection, and is not caused by a physical insult (that too just bit cold water). There are few references available. see the link below:

Read these references



Published with Blogger-droid v1.6.8

Friday, April 22, 2011

New member in our family

Veena had her second cesarean yesterday (May 22nd.) Dr Jayakrishnan was the anesthetist. Dr Vinod was Pediatrician. Everything went on smooth, baby cried immediately, Veena was fine afterwards. (Though she was quite apprehensive in the begining)


Wednesday, April 20, 2011

An Introductory guide to Android phones

I was quite skeptical about smartphones, and believed mobile phones are best used as only phones. In the past I had tried windows mobile phones (about which I was quite impressed) and moto rokr linux phone, but still, I thought they will never take over the functions of a computer.

Then iPhone (by Apple computers)  came along, which was quite expensive, and then Google Inc- the company that does everything right- ventured into making smartphone operating system, Android, about two years ago. The company started with its search engine, Google, which became synonymous with data search on the internet, for which computers are primarily used by most of the people. Android phones too, were quite expensive, but recently many mid and lower end androids have come to market, and become quite affordable, which offer almost the same functionalities of an expensive phone.
Samsung Galaxy Android phone

Android or iPhone:
Both phones are quite impressive, and fans argue vehemently on either side. A comment on Youtube best summed up the comparison of two phones as: iPhone is sturdy, impressive in style, and  easy to use, but limited in customisation and the user is confined to what Steve Jobs (Apple founder and CEO. Please see his great speech here) gives him. Android is endless power to end user, runs on sturdy lnux platform, but not so user friendly and easy as iPhone. So, if you want to have a nice cute easy phone, go for iPhone, but if you want endless power of a mini unix computer in your hand, go for Android.


Android Operating system:
Android runs on the famous Linux operating system, which is a Unix derivative. Unix operating system long preceded any other operating system known today, including windows, and still a major operating system, that's amazingly scalable, used from small embedded systems to super computers and satellites. It's underlying idea is so simple and beautiful, that, unix enthusiasts refer to it as Unix Philosophy. Google created a layer on Linux operating system, to make it easy for programmers to write programs in Java, a popular programming language.


Endless Options:
When you install a third party application in android phone, it gets the same privileges of the stock programs (if you grant it). That means, you can replace the dialer interphase, sms application, everything. You can make the phone look and behave like a windows 7 phone or iPhone! Android applications are created as diffferent components, which can be invoked by a particular message (Intent). If you write a particular application to send sms, and you want to use it's second screen (activity, in android lingo) in some other application, it's possible. Android is true multi-tasking environment (which, surprisingly, is not the case with iPhone), and user simply switches the apps. The apps remain open in memory, and android closes them, when memory is to be recovered, user doesn't have to close a program. In iPhone, if you switch apps the first app is immediately closed; and if the first app is to be opened again, it has to be loaded again to memory.

More than a Computer:
Beyond the normal use to browse, email, chat and social networking, androids can be used to make phone calls! LOL.
And beyond these normal functions, the phone has sensors, which sense orientation, acceleration, temperature, pressure, proximity etc. The Google sky is an application that uses sensors in a great way, and when you turn the phone to any direction, the apps shows you the stars in the sky in that direction. Layar is an application that superimposes the location details (such as coffeshops, ATM machines) on the phone camera view. If you just point your phone to a building, you can know what it is, what all interesting places it contains etc! Sensors are used in gaming too, like in car races, where steering done by tilting the phone to either side.

to conclude, I love my Android.

Monday, February 28, 2011

javascript image slideshow

php used to open a directory, select image files in it (even if it contains only images, this check is necessary, otherwise, we'll get '.' and '..' files too. php 'echos' a script which initialises an array of images of these images. the browser just gets the script text from the server, which makes it set the array. 

<?php
if (!$dir=opendir("activities")) echo "could not open dir" ;
$javastr = "<script language=\"javascript\">";
$javastr .= "var d = new Array();";
$num=0;
while ( ($file = readdir($dir)) != false )
{
  if (preg_match ("/.jpg$/i",$file)) {
    $name = preg_replace("/.jpg$/","",$file);
    $javastr .= "d[$num] = new Image();";
    $javastr .= "d[$num].src = 'activities/$file';";
    $javastr .= "d[$num].name = \"$name\"; ";
    $num++;
  }
}
$javastr .= "</script>";
echo $javastr;
?>

a placeholder 'div' defined.

<div id="para">
<div id="activity_div" >
 <div id="slide_caption" ></div>
 <div id="slider"><img name="slide"   /></div>
</div>


In the javascript, a function is iterated to change the slides, passing it the serial number of the slide to be put up. It calls another function which calls itself, till it has finished fading out the current slide, change the image source of the slide, then fading in the slide.   The loop is within the nested function. In javascript, nested function cannot be called within a loop, so, it can't be in the first function.

<script language="javascript" >
 var num=0;
 document.images.slide.src=d[num].src;
 document.getElementById("slide_caption").innerHTML = d[num].name;
 function slideit() {
  var alfa = 0;
  num++;
  if (num==d.length) num=0;
  setalpha(num,alfa);
  setTimeout("slideit()",2500);
 }
 function setalpha(numm, alpha) {
   if (alpha>2) return;
   if (alpha<1) {
     document.getElementById("slider").style.opacity = 0.9-alpha;
   }
   else if (alpha>1.1) {
     document.getElementById("slider").style.opacity = alpha-1;
   }
   else  {
    document.images.slide.src=d[numm].src;
    document.getElementById("slide_caption").innerHTML = d[numm].name;
   }
   alpha += 0.1;
   setTimeout(function() {setalpha(numm,alpha);},50);
 }
 slideit();
</script>

the sample site:
http://midtownpayyanur.orgfree.com/activities.php

Saturday, February 26, 2011

Javascript multiple image fadein

I just got multiple images to fade-in on page load using javascript. I thought, i 'll put down how to do it, since all online helps were bit confusing, at the least.

at first, there's an onLoad event handler for img tag. All tutorials just teach you body tags onLoad event handler.

Then, since we are handling multiple images, you have to pass in the image reference to repeat calls of function to change the alpha of the image. here
setTimeout("function_to_change_alpha("+img+")",interval); 
doesnt work. (for reasons beyond my comprehension about javascript quirks.)
the rightway to do it is, by using closure:
setTimeout(function() {function_to_change_alpha(img);}, interval);

For unknown reasons, i couldn't read the opacity property of the object (image) thus passed.
mOpacity = obj.style.opacity; didn't work.
I had to pass in the current opacity value also, to the function and increment it in the function.

Thus, the final version of the function was:

fadeimage = function (obj, opc) {
 if (opc==undefined) opc=0;
 opc += 0.1;
 obj.style.opacity = opc ;
 if (opc<1){
  setTimeout(function() {fadeimage(obj,opc);},300);
 }
}

I used a php script to dynamically load images in a directory, and assign it's filenames as captions to the images, and assign the above fade-in function to images' onload event.

if (!$dir=opendir("photos")) echo "could not open dir" ;
while ( ($file = readdir($dir)) != false ) {
  if (preg_match ("/.jpg$/i",$file)) {
    $name = $file;
    $name = preg_replace("/.jpg/","",$name);
    $name = preg_replace('/\b(\w)/e', 'strtoupper("$1")', $name);
    
    if ($row ==0) echo "<tr>";
    echo '<td> <img src="photos/'.$file.'" class="fadinimage" onLoad="fadeimage(this);"><br><center>'.$name.'</center></td>';
    $row ++;
    if ($row==2 ) {
      echo "</tr>";
      $row =0;
    }
  }
}

and finally set the alpha of the .fadeimage class to 0 in the css file.

here's the final site:


http://midtownpayyanur.orgfree.com/photos.php

Thursday, February 24, 2011

Paithalmala trip


we had a marvelous trip to Paithalmala, along with Taliparamba Lions club on Feb 19,20. our stay was arranged at Vaithalmala resorts. had a camp fire there on 19th eve.
on 20th we set out to the peak. It was not as tedious, and all members made it easily. we had tapioka biriyani (arranged by the resort) at the pea...k. we were back at resort for lunch, which was a sumptuous kerala meal.
 



Tuesday, February 8, 2011

How to print an online marriage/death/birth certificate in KERALA

The govt of Kerala has made it easy to register the birth/death/marriage events (it takes only few minutes !!) and then obtain a hard copy of the certificate at the convenience, sitting at your home. Its 'information Kerala Mission' makes this possible.


to obtain the cirtificate:

1. visit www.cr.lsgkerala.gov.in
2. click on 'registration search'
3. select the municipality
4. select Birth/Death/Marriage from left side Menu
5. Fill the right side form with details
6. click on 'Search'
7. click on 'View' button
8. click on 'Print'