Saturday, March 29, 2014
Tanflora -- Our own Keukenhof around Bangalore
Tuesday, March 18, 2014
A Weekend - supposed to be perfect
Today, I feel bad not for his broken hand but for hiding this incident because of the fear of being scolded . Looks like I failed completely and still trying to find an answer what triggered him to behave like that as on the same evening I have spent a good time on the play ground with him before leaving for home to prepare his favorite dinner.
Monday, February 17, 2014
Pinkathon
But the biggest block I think is they themselves as to take initiative of starting an active lifestyle and being committed to it which is not an easy commitment . Though I am not expecting them to run Full-Marathon in sub 3 hours but even if they can do atleast 30 minutes of speed walk or other cardiac activities on daily basis that would be great.
Tuesday, January 28, 2014
Planning a summer escape - 2014
View Driving directions to Chandigarh, Chandigarh, India in a larger map
Friday, January 17, 2014
Goa ... beach and x-mas
Wednesday, December 18, 2013
PHP iptcembed Gallery3 to Flickr
Here is how I did it
1. Copy Gallery's items table to temp table so we do not mess with live data
2. Add a new column to the temp table
ALTER TABLE `Yours_G3_items-new` ADD `album_name` TEXT NOT NULL3. Find out the parent album id of each items and add that data in the new column.
UPDATE Yours_G3_items-new,Yours_G3_items SET Yours_G3_items-new.album_name = Yours_G3_items.title WHERE Yours_G3_items-new.parent_id = Yours_G3_items.id4. Export the new table with "|" as separator and "" as enclosed.
Now the PHP script
<?I Wish there was API where I could import the image from my old hosting company to Flickr directly instead of uploading them via their PC up-loader.
//File to be opened
$file="/tmp/csv.txt";
$gallery_album_base = ..../gallery3/var/albums";
$new_gallery_album_base = <new location>/albums" ;
//
$handle = fopen($file, 'r') or die ("Fail to open input file \n\r") ;
$ln= 0 ;
// Some Functions Start
function csv_explode($delim='|', $str, $enclose='"', $preserve=false){
$resArr = array();
$n = 0;
$expEncArr = explode($enclose, $str);
foreach($expEncArr as $EncItem){
if($n++%2){
array_push($resArr, array_pop($resArr) . ($preserve?$enclose:'') . $EncItem.($preserve?$enclose:''));
}else{
$expDelArr = explode($delim, $EncItem);
array_push($resArr, array_pop($resArr) . array_shift($expDelArr));
$resArr = array_merge($resArr, $expDelArr);
}
}
return $resArr;
}
// iptc_make_tag() function by Thies C. Arntzen
function iptc_make_tag($rec, $data, $value)
{
$length = strlen($value);
$retval = chr(0x1C) . chr($rec) . chr($data);
if($length < 0x8000)
{
$retval .= chr($length >> 8) . chr($length & 0xFF);
}
else
{
$retval .= chr(0x80) .
chr(0x04) .
chr(($length >> 24) & 0xFF) .
chr(($length >> 16) & 0xFF) .
chr(($length >> 8) & 0xFF) .
chr($length & 0xFF);
}
return $retval . $value;
}
// Some Functions End
while ($line = fgets ($handle)){
$line = str_ireplace("\x0D", "", $line);
$line = urldecode ($line);
++$ln;
print ("just line : $ln \n");
if ($line===FALSE) print ("FALSE\n");
else {
//print ("I am $ln \n");
//print ($line) ;
$variables = csv_explode ("|", $line);
//print_r ($variables);
//26(album or photo) 25(title), 13(image_path), 4(details),33(album_name/tag)
if ( $variables[26] == photo ){
//Path new and old path
$old_path = $gallery_album_base . '/' . $variables[13];
$image_name_new = $new_gallery_album_base . '/' . $variables[13];
$path_parts = pathinfo ($image_name_new);
if (!file_exists($path_parts['dirname'])) {
print ("makeing directory {$path_parts['dirname']} \n") ;
mkdir ($path_parts['dirname'], 0777,true);
}
// Set the IPTC tags
$iptc = array(
'2#120' => "$variables[4]",
'2#105' => "$variables[25]",
'2#005' => "$variables[25]",
'2#015' => "$variables[33]",
'2#116' => 'Copyright, www santm com'
);
// Convert the IPTC tags into binary code
$data = '';
foreach($iptc as $tag => $string)
{
$tag = substr($tag, 2);
$data .= iptc_make_tag(2, $tag, $string);
}
// Embed the IPTC data
$content = iptcembed($data, $old_path);
// Write the new image data out to the file.
$fp = fopen($image_name_new, "wb");
fwrite($fp, $content);
fclose($fp);
print ("working on $image_name_new \n");
//$size = getimagesize($image_name_new, $info);
//if(isset($info['APP13']))
//{
// $iptc = iptcparse($info['APP13']);
// var_dump($iptc);
//}
} //end of if photo loop
} // end of else loop
} // end of while loop
# Close the File.
fclose($handle);
?>
More here on major phpfunction
http://www.php.net/function.iptcembed
http://www.php.net/function.pathinfo
http://php.net/manual/fr/function.explode.php
Saturday, December 14, 2013
Moving away from self hosting
Friday, October 25, 2013
Kurseong

Monday, September 30, 2013
Mysore Half Marathon 2013
Thursday, September 19, 2013
West Sikkim - Hee Bermiok
Day-1
Day-2
Thursday, September 05, 2013
Indian Babus(Govt Official)
The guy told without looking at me "Come Monday"
Me - "Sir Monday is Off due to Ganesha Festival"
Him - swallows his words and says "OK come Tuesday"
Me - "Sir I need it today"
Him - Now he looks up and says "come afternoon"
Me -"Sir it is already afternoon as it is 12:20 PM"
Him - "OK get the bank statement" to prove the money is credited as you paid by Cheque"
Me - little annoyed -"It is three months and I am telling you it is debited from my account"
Him - takes the acknowledgement slip and goes to a room and comes back in 5 seconds.
Me - Goes to the same room after 30 Sec; ask the lady with computer for the receipt.
She hands me over the print outs.(surprise surprise so this is the time it really takes 1 minutes max)
Me asked for Official Seal
She points back to the first guy
Me come back with the printouts he signs and puts the round seal.
Thanked him very politely. And got out of there.
The whole thing took only 10/15 minutes a max and my good luck that my work was done. Best part he spoke in Kanada and I kept on replying in English. Whatever we do as Indian with watching MTV and eating McDonald a visit to Government Office still remains nightmare which I postpone and procrastinate for ever. As those Officer or a Clark does not change their attitude.






