<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7730225884737531301</id><updated>2012-01-12T23:04:35.388+05:30</updated><category term='linux'/><category term='acpi'/><category term='XMPP'/><category term='pidgin'/><category term='panel'/><category term='grub'/><category term='birthday'/><category term='shell scripting'/><category term='dataone'/><category term='gnome'/><category term='perl'/><title type='text'>Srijith Unplugged</title><subtitle type='html'>The place where I share my experiments on my computer</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-8003632760904538448</id><published>2009-12-17T10:42:00.001+05:30</published><updated>2009-12-23T09:38:51.142+05:30</updated><title type='text'>Moving to New Domain</title><content type='html'>Hi, I have moved to a new domain where I will be posting new posts.&lt;br /&gt;The URL is &lt;a href="http://blog.sriunplugged.com"&gt;http://blog.sriunplugged.com&lt;/a&gt;&lt;br /&gt;Check it Out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-8003632760904538448?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/8003632760904538448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2009/12/moving-to-new-domain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/8003632760904538448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/8003632760904538448'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2009/12/moving-to-new-domain.html' title='Moving to New Domain'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-3163403432339463293</id><published>2009-04-16T12:56:00.002+05:30</published><updated>2009-04-16T12:59:59.630+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='grub'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Restoring the Grub after reinstalling Windows</title><content type='html'>After reinstalling windows or fixing MBR(Master Boot Record) you always loose your grub and you cannot boot to your linux. So this post is about the methods of restoring the grub. There are three methods I use. I will explain all three.&lt;br /&gt;&lt;br /&gt;All three methods need a live cd of a linux. You need to boot from the live cd and take the terminal and do the following:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;First method is using grub command. We initially go into the grub mode interface using the command&lt;br /&gt;&lt;div class="code"&gt;sudo grub&lt;/div&gt;This will get you a "grub&gt;" prompt (i.e. the grub shell). At grub&gt;. enter these commands&lt;br /&gt;&lt;div class="code"&gt;find /boot/grub/stage1&lt;/div&gt;If the find returned (hd0,1) then you would enter&lt;br /&gt;&lt;div class="code"&gt;root (hd0,1)&lt;/div&gt;Now the root drive where the boot folder is mounted.Now we needed to setup the drive to boot to show the grub. We do this by&lt;br /&gt;&lt;div class="code"&gt;setup (hd0)&lt;/div&gt;Finally exit the grub shell&lt;br /&gt;&lt;div class="code"&gt;quit&lt;/div&gt;And then Reboot to and try if you are getting the grub.&lt;br /&gt;If not try the next method.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If couldn't get grub to find the stage1 file or even recognize the drive. Use this method.&lt;br /&gt;&lt;div  class="code"&gt;sudo mkdir /mnt/root&lt;br /&gt;&lt;br /&gt;sudo mount -t ext3 /dev/sda6 /mnt/root&lt;/div&gt;&lt;br /&gt;Then you have to mount the proc subsystem and udev inside /mnt/root also:&lt;br /&gt;&lt;br /&gt;&lt;div  class="code"&gt;sudo mount -t proc none /mnt/root/proc&lt;br /&gt;&lt;br /&gt;sudo mount -o bind /dev /mnt/root/dev&lt;/div&gt;&lt;br /&gt;Doing this allows grub to discover your drives. Next you have to chroot:&lt;br /&gt;&lt;br /&gt;&lt;div  class="code"&gt;sudo chroot /mnt/root /bin/bash&lt;/div&gt;&lt;br /&gt;Now that you're chrooted into your drive as root everything should work.&lt;br /&gt;&lt;br /&gt;&lt;div  class="code"&gt;sudo grub&lt;/div&gt;And then follow the 1st method to install the grub.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;In lastest Linux you can use the command &lt;b&gt;grub-install&lt;/b&gt;.The usage of this command is as&lt;br /&gt;&lt;div class="code"&gt;sudo grub-install /dev/sda&lt;/div&gt;It might be &lt;b&gt;hda&lt;/b&gt; if the hard disk is &lt;b&gt;IDE&lt;/b&gt; and &lt;b&gt;sda&lt;/b&gt; if disk is &lt;b&gt;SATA&lt;/b&gt;.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;So try it out the next time you loose your grub and tell me how it went.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-3163403432339463293?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/3163403432339463293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2009/04/restoring-grub-after-reinstalling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/3163403432339463293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/3163403432339463293'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2009/04/restoring-grub-after-reinstalling.html' title='Restoring the Grub after reinstalling Windows'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-236166792291198870</id><published>2009-03-17T20:20:00.000+05:30</published><updated>2009-03-17T20:20:25.780+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='panel'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='birthday'/><title type='text'>Birthday Reminder For Gnome Panel</title><content type='html'>This program checks the file &lt;b&gt;/home/rsrijith/shell/birthday_reminder.txt&lt;/b&gt; to find the upcoming birthdays in 20 days and writes into the file &lt;b&gt;/home/rsrijith/shell/birthdays&lt;/b&gt;.&lt;br /&gt;There is a file called &lt;b&gt;/home/rsrijith/shell/birthdays1&lt;/b&gt;, the difference between it and birthdays file is that birthdays contains only first name of the person and birthdays1 contains the whole name.&lt;br /&gt;So that's it. Now the code....&lt;br /&gt;&lt;div class="prog"&gt;#!/bin/bash&lt;br /&gt;echo "Birthday Finder "&amp;gt;&amp;gt;/home/rsrijith/logs/bday&lt;br /&gt;date&amp;gt;&amp;gt;/home/rsrijith/logs/bday&lt;br /&gt;tillm=$(date --date="+20 day"  +"%b")&lt;br /&gt;nowm=$(date +"%b")&lt;br /&gt;tilld=$(date --date="+20 day"  +"%2d")&lt;br /&gt;nowd=$(date +"%d")&lt;br /&gt;nowd=$((10#$nowd))&lt;br /&gt;year=$(date +"%Y")&lt;br /&gt;FileName='/home/rsrijith/shell/birthday_reminder.txt'&lt;br /&gt;if [ -e /home/rsrijith/shell/birthdays ]&lt;br /&gt;then&lt;br /&gt;rm /home/rsrijith/shell/birthdays&lt;br /&gt;fi &lt;br /&gt;touch /home/rsrijith/shell/birthdays&lt;br /&gt;if [ -e /home/rsrijith/shell/birthdays1 ]&lt;br /&gt;then&lt;br /&gt;rm /home/rsrijith/shell/birthdays1&lt;br /&gt;fi &lt;br /&gt;touch /home/rsrijith/shell/birthdays1&lt;br /&gt;while read LINE&lt;br /&gt;do&lt;br /&gt;m=$(echo $LINE|cut -f2 -d',')&lt;br /&gt;d=$(echo $LINE|cut -f3 -d',')&lt;br /&gt;name=$(echo $LINE|cut -f1 -d',')&lt;br /&gt;yob=$(echo $LINE|cut -f4 -d',')&lt;br /&gt;if [ $m == $nowm ]&lt;br /&gt;then&lt;br /&gt;d="${d#0}";&lt;br /&gt;if [ $nowd -le $d ]&lt;br /&gt;then&lt;br /&gt;name1=$name;&lt;br /&gt;name=` echo $name|sed 's/\([^ ]*\).*/\1/;s/\([^.]*\).*/\1/'`&lt;br /&gt;dif=$(($d-$nowd))&lt;br /&gt;yrdif=$(($year-$yob))&lt;br /&gt;if [ $dif -le 1 ]&lt;br /&gt;then&lt;br /&gt;if [ $dif -eq 0 ]&lt;br /&gt;then&lt;br /&gt;echo "Happy Birthday to "$name&amp;gt;&amp;gt;/home/rsrijith/shell/birthdays&lt;br /&gt;echo "Happy Birthday to "$name1&amp;gt;&amp;gt;/home/rsrijith/shell/birthdays1 &lt;br /&gt;else&lt;br /&gt;echo "$dif day to "$name"'s Birthday"&amp;gt;&amp;gt;/home/rsrijith/shell/birthdays&lt;br /&gt;echo "$dif day to "$name1"'s Birthday"&amp;gt;&amp;gt;/home/rsrijith/shell/birthdays1&lt;br /&gt;fi&lt;br /&gt;else&lt;br /&gt;echo "$dif days to "$name"'s Birthday"&amp;gt;&amp;gt;/home/rsrijith/shell/birthdays&lt;br /&gt;echo "$dif days to "$name1"'s Birthday"&amp;gt;&amp;gt;/home/rsrijith/shell/birthdays1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;fi&lt;br /&gt;else&lt;br /&gt;if [ $m == $tillm ]&lt;br /&gt;then&lt;br /&gt;if [ $tilld -gt $d ]&lt;br /&gt;then&lt;br /&gt;name1=$name&lt;br /&gt;name=` echo $name|sed 's/\([^ ]*\).*/\1/'`&lt;br /&gt;lastdate=$(date -d "-$(date +%d) days +1 month"|cut -f 3 -d " ")&lt;br /&gt;echo "$d $lastdate $nowd"&lt;br /&gt;&lt;br /&gt;dif=$(($d+$lastdate-$nowd))&lt;br /&gt;yrdif=$(($year-$yob))&lt;br /&gt;echo "$dif days to "$name1"'s Birthday"&amp;gt;&amp;gt;/home/rsrijith/shell/birthdays1&lt;br /&gt;echo "$dif days to "$name"'s Birthday"&amp;gt;&amp;gt;/home/rsrijith/shell/birthdays&lt;br /&gt;fi&lt;br /&gt;fi&lt;br /&gt;fi&lt;br /&gt;done &amp;lt; $FileName&lt;br /&gt;if [ ! -s /home/rsrijith/shell/birthdays ]&lt;br /&gt;then&lt;br /&gt;echo "Nothing to Remind" &amp;gt; /home/rsrijith/shell/birthdays&lt;br /&gt;fi&lt;br /&gt;cat /home/rsrijith/shell/birthdays1|sort -n &amp;gt;/home/rsrijith/temp &amp;amp;&amp;amp; mv /home/rsrijith/temp /home/rsrijith/shell/birthdays1&lt;br /&gt;cat /home/rsrijith/shell/birthdays|sort -n &amp;gt;/home/rsrijith/temp &amp;amp;&amp;amp; mv /home/rsrijith/temp /home/rsrijith/shell/birthdays&lt;/div&gt;&lt;br /&gt;This code is part of the Perl Panel Code. The related codes to this are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/reminder-for-gnome-panel.html"&gt;Reminder for Gnome Panel&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/backend-for-panel-reminder.html"&gt;Backend For Panel Reminder&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/autoreminder-in-pidgin.html"&gt;Auto Away Notifier for Pidgin in Perl&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-236166792291198870?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/236166792291198870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2009/03/birthday-reminder-for-gnome-panel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/236166792291198870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/236166792291198870'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2009/03/birthday-reminder-for-gnome-panel.html' title='Birthday Reminder For Gnome Panel'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-4297184328882661152</id><published>2009-03-17T20:00:00.003+05:30</published><updated>2009-03-17T20:25:23.219+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='panel'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Reminder for Gnome Panel</title><content type='html'>This is the program that lets us to enter the text and time at which it should be reminded me. The command has the following options&lt;br /&gt;&lt;ul&gt;&lt;li&gt;-d: date eg:&amp;nbsp; &lt;b&gt;17/3/2009&lt;/b&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;-t : time [ It's should be entered as 24hr clock] eg:&amp;nbsp;&amp;nbsp; &lt;b&gt;20:00:00&lt;/b&gt;&lt;/li&gt;&lt;li&gt;-r : reminder text [ It should be entered in between a double quotes ] eg: &lt;b&gt;"This is a test"&lt;/b&gt;&lt;/li&gt;&lt;li&gt;-p :priority [ I hav'nt implemented it yet . Kept it for future implementation.] eg : &lt;b&gt;1&lt;/b&gt;&lt;/li&gt;&lt;li&gt;-b :Remind me before [ By using it we can change the default remind before time of 5mins ie it is used to remind from a specific mins before the time we have scheduled to remind. It is specified in mins] eg: &lt;b&gt;5&lt;/b&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="prog"&gt;#!/usr/bin/perl&lt;br /&gt;use Time::Local;&lt;br /&gt;my @date;&lt;br /&gt;my @time;&lt;br /&gt;my $d=0,$t=0,$r=0,$p=0,$b=0;&lt;br /&gt;my @deftime=localtime();&lt;br /&gt;$deftime[5]+=1900;&lt;br /&gt;$deftime[4]++;&lt;br /&gt;my $dv="$deftime[3]/$deftime[4]/$deftime[5]",$tv="$deftime[2]:$deftime[1]:$deftime[0]",$rv="",$pv=1,$bv=0;&lt;br /&gt;foreach $argnum (0 .. $#ARGV) &lt;br /&gt;{&lt;br /&gt;if($ARGV[$argnum] eq "-d")&lt;br /&gt;{&lt;br /&gt;$d=1;&lt;br /&gt;$dv=$ARGV[$argnum+1];&lt;br /&gt;}&lt;br /&gt;elsif($ARGV[$argnum] eq "-t")&lt;br /&gt;{&lt;br /&gt;$t=1;&lt;br /&gt;$tv=$ARGV[$argnum+1];&lt;br /&gt;}&lt;br /&gt;elsif($ARGV[$argnum] eq "-r")&lt;br /&gt;{&lt;br /&gt;$r=1;&lt;br /&gt;$rv=$ARGV[$argnum+1];&lt;br /&gt;print "Remind Text:$rv\n";&lt;br /&gt;}&lt;br /&gt;elsif($ARGV[$argnum] eq "-p")&lt;br /&gt;{&lt;br /&gt;$p=1;&lt;br /&gt;$pv=$ARGV[$argnum+1];&lt;br /&gt;print "Priority:$pv\n";&lt;br /&gt;} &lt;br /&gt;elsif($ARGV[$argnum] eq "-b")&lt;br /&gt;{&lt;br /&gt;$b=1;&lt;br /&gt;$bv=$ARGV[$argnum+1];&lt;br /&gt;print "Remind Before:$bv\n";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;@date=split('/',$dv);&lt;br /&gt;print "Date:$dv\n";&lt;br /&gt;@time={0,0,0};&lt;br /&gt;@time=split(':',$tv);&lt;br /&gt;print "Time:$tv";&lt;br /&gt;$date[1]--;&lt;br /&gt;my $time=timelocal($time[2],$time[1],$time[0],$date[0],$date[1],$date[2],);&lt;br /&gt;my $nowtime=timelocal(localtime());&lt;br /&gt;my $difftime=$time-$nowtime;&lt;br /&gt;print "\nTime Of Alarm:".$time."\nTime Now:".$nowtime."\nDifference in Seconds:".$difftime."\n";&lt;br /&gt;&lt;br /&gt;open (FH,"&amp;gt;&amp;gt;/home/rsrijith/perl/reminder");&lt;br /&gt;print FH "$time:$pv:$bv:$rv\n";&lt;br /&gt;close FH;&lt;/div&gt;This code is part of the Perl Panel Code. The related codes to this are:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/backend-for-panel-reminder.html"&gt;Backend For Panel Reminder&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/autoreminder-in-pidgin.html"&gt;Auto Away Notifier for Pidgin in Perl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://sriunplugged.blogspot.com/2009/03/birthday-reminder-for-gnome-panel.html"&gt;Birthday Reminder For Gnome Panel&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-4297184328882661152?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/4297184328882661152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2009/03/reminder-for-gnome-panel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/4297184328882661152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/4297184328882661152'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2009/03/reminder-for-gnome-panel.html' title='Reminder for Gnome Panel'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-3069365858991393239</id><published>2009-03-17T19:18:00.005+05:30</published><updated>2009-03-17T20:25:10.863+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='panel'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Backend For Panel Reminder</title><content type='html'>I had already posted about creating a &lt;a href="http://sriunplugged.blogspot.com/2009/02/display-reminders-in-gnome-panel.html"&gt;Display Reminders In Gnome Panel&lt;/a&gt;. This post is an addition to that script. This is a backend script that writes what to print into the &lt;b&gt;panel_remind&lt;/b&gt; file. I use this script to print Birthday Reminder and Things to remember of which I will be posting shortly.&lt;br /&gt;So the Code is simple Perl script.&lt;br /&gt;&lt;div class="prog"&gt;#!/usr/bin/perl&lt;br /&gt;our $printl;our $i=0;our $r=0;&lt;br /&gt;$| = 1;&lt;br /&gt;while(TRUE)&lt;br /&gt;{  &lt;br /&gt;open (RB,"/home/rsrijith/perl/reminder");&lt;br /&gt;my @line=&amp;lt;RB&amp;gt;;&lt;br /&gt;close RB;&lt;br /&gt;if($line[0])&lt;br /&gt;{&lt;br /&gt;while($line[$i])&lt;br /&gt;{   &lt;br /&gt;open (WR,"&amp;gt;/home/rsrijith/panel_remind");&lt;br /&gt;my @s=split(":",$line[$i]);&lt;br /&gt;my $nowtime=timelocal(localtime());&lt;br /&gt;my $a=$s[2]+300;&lt;br /&gt;if(($s[0]-$nowtime&amp;lt;=$a)&amp;amp;&amp;amp;($s[0]-$nowtime&amp;gt;=0))&lt;br /&gt;{&lt;br /&gt;my $t=  to_int((($s[0]-$nowtime)/60));&lt;br /&gt;while($t&amp;gt;0)&lt;br /&gt;{&lt;br /&gt;open (WR,"&amp;gt;/home/rsrijith/panel_remind");&lt;br /&gt;print WR "Red:In $t Mins - $s[3]";&lt;br /&gt;close WR;&lt;br /&gt;$r=1;&lt;br /&gt;$t--;&lt;br /&gt;sleep(60);&lt;br /&gt;if( $t == 0)&lt;br /&gt;{      `notify-send "$s[3]" -u critical -t 60000`}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;open (WB,"&amp;gt;/home/rsrijith/perl/reminder");&lt;br /&gt;my $nowtime=timelocal(localtime());&lt;br /&gt;if($s[0]-$nowtime&amp;gt;0)&lt;br /&gt;{&lt;br /&gt;print WB "$line[$i]";&lt;br /&gt;close WB;&lt;br /&gt;}&lt;br /&gt;$i++;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;if($r eq 0)&lt;br /&gt;{&lt;br /&gt;bday();&lt;br /&gt;}&lt;br /&gt;$i=0;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;print "Birthday";&lt;br /&gt;bday();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sub bday&lt;br /&gt;{&lt;br /&gt;open (RB,"/home/rsrijith/shell/birthdays");&lt;br /&gt;my @line=&amp;lt;RB&amp;gt;;&lt;br /&gt;close RB;&lt;br /&gt;&lt;br /&gt;if((!$line[0])&amp;amp;&amp;amp;($r==0))&lt;br /&gt;{&lt;br /&gt;print "nothing to remind";&lt;br /&gt;$printl="Black:Nothing to Remind \n:(";&lt;br /&gt;open (WR,"&amp;gt;/home/rsrijith/panel_remind");&lt;br /&gt;print WR $printl;&lt;br /&gt;close WR;&lt;br /&gt;sleep(100);&lt;br /&gt;}&lt;br /&gt;while($line[$i])&lt;br /&gt;{&lt;br /&gt;$_=$line[$i];&lt;br /&gt;if(m/Happy/)&lt;br /&gt;{&lt;br /&gt;$printl="Blue:$line[$i]";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;$printl="Black:$line[$i]";&lt;br /&gt;}&lt;br /&gt;open (WR,"&amp;gt;/home/rsrijith/panel_remind");&lt;br /&gt;print WR $printl;&lt;br /&gt;close WR;&lt;br /&gt;$i++;&lt;br /&gt;sleep(5);&lt;br /&gt;}&lt;br /&gt;$i=0;&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;This script reads from files&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;/home/rsrijith/shell/birthdays&lt;/b&gt;: The file contains birthdays of my friends that I need to be reminded of. The method to print the upcoming birthdays into this file is posted at &amp;lt;will be posted soon&amp;gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;/home/rsrijith/perl/reminder&lt;/b&gt;:The file contains reminders that I need to&amp;nbsp; be reminded. I used another script to write into that file which is posted at &amp;lt;will be posted soon &amp;gt;.&lt;/li&gt;&lt;/ul&gt;This program needs &lt;b&gt;libnotify&lt;/b&gt;&amp;nbsp; package. The package name is &lt;b&gt;libnotify1&lt;/b&gt; in my computer. It may vary with linux you are in.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/reminder-for-gnome-panel.html"&gt;Reminder for Gnome Panel&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/autoreminder-in-pidgin.html"&gt;Auto Away Notifier for Pidgin in Perl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://sriunplugged.blogspot.com/2009/03/birthday-reminder-for-gnome-panel.html"&gt;Birthday Reminder For Gnome Panel&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;So the ordinary panel reminder can be made of some use using this script.&lt;br /&gt;So try it out and tell me how it went.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-3069365858991393239?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/3069365858991393239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2009/03/backend-for-panel-reminder.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/3069365858991393239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/3069365858991393239'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2009/03/backend-for-panel-reminder.html' title='Backend For Panel Reminder'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-8907724084430025017</id><published>2009-03-14T09:25:00.082+05:30</published><updated>2009-03-17T20:26:51.761+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='acpi'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='pidgin'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Auto Away Notifier for Pidgin in Perl</title><content type='html'>Whenever I am away from laptop my chat buddies leave me lots message and finally lots of "You there???". So  I thought of making a script that would inform my buddies that I am away when someone sends me a message.&lt;br /&gt;This method works with Pigin API.&lt;br /&gt;I have used &lt;b&gt;/proc/acpi/button/lid/C267/state&lt;/b&gt; file to find if the lib of the laptop is closed or not. This file may vary in your laptop. So try to find the find the file in your computer that stores the status of the lid. It should be a file in &lt;b&gt;/proc/acpi/button/lid/&lt;/b&gt; folder and replace the file accordingly in your computer.&lt;br /&gt;The Content of /proc/acpi/button/lid/C267/state is &lt;b&gt;state:      open&lt;/b&gt; and &lt;b&gt;state:     closed&lt;/b&gt; when the lid was closed.&lt;br /&gt;&lt;br /&gt;We save this file as &lt;b&gt;/usr/lib/purple-2/autonotifier.pl&lt;/b&gt; and use &lt;b&gt;chmod +x /usr/lib/purple-2/test.pl&lt;/b&gt; to give the plugin execute permission. Now restart the Pidgin if it is running or open pidgin and go to Tools-&amp;gt;Plugins and you should see a plugin named "Auto Away Plugin". Activate it and that's it.&lt;br /&gt;I have used &lt;b&gt;/sys/class/leds/b43-phy0\:\:radio/brightness&lt;/b&gt; file to notify me if there is any messages while i was away. It uses my Wi-fi light to notify me. When there is a message then the Wi-fi light blinks. This too is computer specific so find the file that controls any of the unused leds and replace that file too.&lt;br /&gt;&lt;div class="prog"&gt;use Purple;&lt;br /&gt;%PLUGIN_INFO = (&lt;br /&gt;perl_api_version =&amp;gt; 2,&lt;br /&gt;name =&amp;gt; "Auto Away Plugin",&lt;br /&gt;version =&amp;gt; "0.1",&lt;br /&gt;summary =&amp;gt; "Auto Away Notifier",&lt;br /&gt;description =&amp;gt; "Auto Away Notifier in Perl",&lt;br /&gt;author =&amp;gt; "R.Srijith &amp;lt;rsrijith007\@gmail.com",&lt;br /&gt;url =&amp;gt; "http://sriunplugged.blogspot.com",&lt;br /&gt;load =&amp;gt; "plugin_load",&lt;br /&gt;unload =&amp;gt; "plugin_unload"&lt;br /&gt;);&lt;br /&gt;sub plugin_init {&lt;br /&gt;return %PLUGIN_INFO;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub im_received {&lt;br /&gt;&lt;br /&gt;my ($account, $sender, $message, $conv, $flags) = @_;&lt;br /&gt;Purple::Debug::info("autonotify", "Message recieved\n");&lt;br /&gt;$conv1 = Purple::Conversation-&amp;gt;new(1, $account, $sender);&lt;br /&gt;open FILE, "&amp;gt;&amp;gt;/home/rsrijith/logs/autonotifier.txt" or die $!;&lt;br /&gt;open LID, "&amp;lt;/proc/acpi/button/lid/C267/state" or die $!;&lt;br /&gt;#$message=~s/&amp;lt;.*&amp;gt;//g;&lt;br /&gt;while(&amp;lt;LID&amp;gt;)&lt;br /&gt;{&lt;br /&gt;if($_ =~ m/closed/)&lt;br /&gt;{&lt;br /&gt;print FILE "$sender:$message\n";&lt;br /&gt;$im = $conv1-&amp;gt;get_im_data();&lt;br /&gt;if ($im) { print "ok.\n"; } else { print "fail.\n"; }&lt;br /&gt;system('(if [ ! -e /var/lock/autoremind ];  then   while grep -m 1 -q closed /proc/acpi/button/lid/C267/state;   do    touch /var/lock/autoremind;    sleep 1;    echo -n 0 &amp;gt;/sys/class/leds/b43-phy0\:\:radio/brightness;    sleep 1;echo -n 1 &amp;gt;/sys/class/leds/b43-phy0\:\:radio/brightness;   done;  if [ -e /var/lock/autoremind ];  then   rm /var/lock/autoremind;  fi; fi)&amp;amp;');&lt;br /&gt;$im-&amp;gt;send("This is an automated response system: R Srijith is not at the desk rite now.");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;close FILE;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub plugin_load {&lt;br /&gt;$plugin = shift;&lt;br /&gt;$conversation_handle = Purple::Conversations::get_handle();&lt;br /&gt;Purple::Signal::connect($conversation_handle, "received-im-msg", $plugin, \&amp;amp;im_received, $data);&lt;br /&gt;Purple::Debug::info("autonotify", "Auto Notify Loaded\n");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub plugin_unload {&lt;br /&gt;Purple::Debug::info("autonotify", "Auto Notify Unloaded\n");&lt;br /&gt;}&lt;/div&gt;&lt;br /&gt;So try it out and comment me on how it went.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-8907724084430025017?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/8907724084430025017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2009/03/autoreminder-in-pidgin.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/8907724084430025017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/8907724084430025017'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2009/03/autoreminder-in-pidgin.html' title='Auto Away Notifier for Pidgin in Perl'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-5869272857033606639</id><published>2009-02-07T21:19:00.009+05:30</published><updated>2009-03-17T20:27:13.684+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='panel'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='gnome'/><title type='text'>Display Reminders In Gnome Panel</title><content type='html'>&amp;nbsp;It was a long standing requirement of mine to create a reminder software or something which can keep me reminding of things as I always keep forgetting things. So I made a reminder that displays my reminders on the Gnome Panel.&lt;br /&gt;It looks something like this:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_t8oKYxpOl3M/Sa6s20NlMkI/AAAAAAAAAF4/7E0OvpkeeUc/s1600-h/Screenshot-2%282%29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_t8oKYxpOl3M/Sa6s20NlMkI/AAAAAAAAAF4/7E0OvpkeeUc/s320/Screenshot-2%282%29.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;So how do we do it?&lt;br /&gt;&lt;br /&gt;1st of all we need to display the program we need in the&lt;b&gt; Add to Panel&lt;/b&gt;.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_t8oKYxpOl3M/Sa6PyoAgm4I/AAAAAAAAAFw/gXlGCnnG0P8/s1600-h/Screenshot-Add+to+Panel.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_t8oKYxpOl3M/Sa6PyoAgm4I/AAAAAAAAAFw/gXlGCnnG0P8/s320/Screenshot-Add+to+Panel.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;For that we add to the bonobo server list. We do this by adding the following code in the folder&amp;nbsp; &lt;b&gt;/usr/lib/bonobo/servers/. &lt;/b&gt;Let us name the file as &lt;b&gt;GNOME_PerlApplet.server&lt;/b&gt;&lt;br /&gt;The content of this file should be :&lt;br /&gt;&lt;div class="prog"&gt;&amp;lt;oaf_info&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;oaf_server iid="OAFIID:PerlSampleApplet_Factory" type="exe" location="/home/rsrijith/perl/panel-applet"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oaf_attribute name="repo_ids" type="stringv"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item value="IDL:Bonobo/GenericFactory:1.0"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item value="IDL:Bonobo/Unknown:1.0"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/oaf_attribute&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oaf_attribute name="name" type="string" value="Panel Reminder"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oaf_attribute name="description" type="string" value="Perl Program working in Panel"/&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/oaf_server&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;lt;oaf_server iid="OAFIID:PerlSampleApplet" type="factory" location="OAFIID:PerlSampleApplet_Factory"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oaf_attribute name="repo_ids" type="stringv"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item value="IDL:Bonobo/Control:1.0"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item value="IDL:Bonobo/Unknown:1.0"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/oaf_attribute&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oaf_attribute name="name" type="string" value="Panel Reminder"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oaf_attribute name="description" type="string" value="Perl Program working in Panel:R Srijith"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oaf_attribute name="panel:category" type="string" value="Amusements"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;oaf_attribute name="panel:icon" type="string" value="bug-buddy.png"/&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/oaf_server&amp;gt;&lt;br /&gt;&amp;lt;/oaf_info&amp;gt;&lt;/div&gt;So this specifies the location of the perl file to run on adding this applet. So here it is &lt;b&gt;/home/rsrijith/perl/panel-applet&lt;/b&gt; . This file should print the reminders to be printed on the panel.&lt;br /&gt;The program need the Following packages:&lt;br /&gt;&lt;br /&gt;Perl packages: &lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;ExtUtils::Depends&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;ExtUtils::PkgConfig&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Gnome2::GConf &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Gnome2::PanelApplet&lt;/li&gt;&lt;/ul&gt;You install this using &lt;br /&gt;&lt;div class="code"&gt;sudo perl -MCPAN -e 'install &amp;lt;package-name&amp;gt;'&lt;/div&gt;&lt;br /&gt;Linux Package:&lt;br /&gt;&lt;ol start="2"&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt; libpanelappletmm-2.6-1c2&lt;/li&gt;&lt;li&gt;libpanelappletmm-2.6-dev&lt;/li&gt;&lt;/ul&gt;You install this using&lt;br /&gt;&lt;div class="code"&gt;sudo apt-get install &amp;lt;package-name&amp;gt;&lt;/div&gt;&lt;br /&gt;&lt;ol start="2"&gt;&lt;/ol&gt;Thus the perl file content is :&lt;br /&gt;&lt;div class="prog"&gt;#!/usr/bin/perl -w&lt;br /&gt;&lt;br /&gt;use warnings;&lt;br /&gt;use utf8;&lt;br /&gt;use Gnome2::PanelApplet;&lt;br /&gt;Gnome2::Program-&amp;gt;init ('A Stupid Applet Written in Perl', '0.01', 'libgnomeui',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sm_connect =&amp;gt; FALSE);&lt;br /&gt;&lt;br /&gt;Gnome2::PanelApplet::Factory-&amp;gt;main ('OAFIID:PerlSampleApplet_Factory',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Gnome2::PanelApplet',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; \&amp;amp;fill);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sub fill {&lt;br /&gt;&amp;nbsp; my ($applet, $iid, $data) = @_;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; if ($iid ne 'OAFIID:PerlSampleApplet') {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return FALSE;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; my $menu_xml = &amp;lt;&amp;lt;EOX;&lt;br /&gt;&amp;lt;popup name="button3"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;menuitem name="Properties Item"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; verb="Birthdays"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _label="Birthdays"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixtype="stock"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixname="gtk-properties"/&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;menuitem name="DesktopSwitcher Item"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; verb="DesktopSwitcher"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _label="Wallpaper Switcher"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixtype="stock"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixname="gtk-stock"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;menuitem name="Walldelete Item"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; verb="Walldelete"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _label="Wallpaper Delete"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixtype="stock"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixname="gtk-stock"/&amp;gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;lt;menuitem name="About Item"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; verb="About"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _label="About"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixtype="stock"&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pixname="gnome-stock-about"/&amp;gt;&lt;br /&gt;&amp;lt;/popup&amp;gt;&lt;br /&gt;EOX&lt;br /&gt;&lt;br /&gt;&amp;nbsp; my $cb_mapping = {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Birthdays =&amp;gt; [\&amp;amp;properties_callback, 'default!'],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DesktopSwitcher =&amp;gt; \&amp;amp;deskswitcher_callback,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Walldelete =&amp;gt; \&amp;amp;walldelete_callback,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; About =&amp;gt; \&amp;amp;about_callback,&lt;br /&gt;&amp;nbsp; };&lt;br /&gt;&lt;br /&gt;&amp;nbsp; $applet-&amp;gt;setup_menu($menu_xml, $cb_mapping, 'default?');&lt;br /&gt;&amp;nbsp; our $i=0;our @line;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; our $label = Gtk2::Label-&amp;gt;new;&lt;br /&gt;&amp;nbsp; $label-&amp;gt;set_justify("left");&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$label-&amp;gt;set_line_wrap(TRUE);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$label-&amp;gt;modify_font(Gtk2::Pango::FontDescription-&amp;gt;from_string("Monospace 10"));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$label-&amp;gt;modify_fg("normal", Gtk2::Gdk::Color-&amp;gt;parse("Black"));&lt;br /&gt;&amp;nbsp; $applet-&amp;gt;add ($label);&lt;br /&gt;&amp;nbsp; $applet-&amp;gt;show_all;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp;Glib::Timeout-&amp;gt;add (5000, \&amp;amp;update_value);&lt;br /&gt;&amp;nbsp;#Glib::Timeout-&amp;gt;add (500, \&amp;amp;update_list);&lt;br /&gt;&amp;nbsp;sub update_list{&lt;br /&gt;&amp;nbsp;open FILE,"/home/rsrijith/panel_remind";&lt;br /&gt;&amp;nbsp; @line=&amp;lt;FILE&amp;gt;;&lt;br /&gt;&amp;nbsp; close FILE;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;sub update_value&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; my @string=split(':',$line[0]);&lt;br /&gt;&amp;nbsp; $label-&amp;gt;modify_fg("normal", Gtk2::Gdk::Color-&amp;gt;parse($string[0]));&lt;br /&gt;&amp;nbsp; $label-&amp;gt;set_markup("\n".$string[1]);&lt;br /&gt;&amp;nbsp; update_list();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub deskswitcher_callback&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;system('/home/rsrijith/shell/deskback 2&amp;gt;&amp;gt;/home/rsrijith/logs/desktopbackground');&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub walldelete_callback&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;system('/home/rsrijith/shell/deletewall 2&amp;gt;&amp;gt;/home/rsrijith/logs/desktopbackground');&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub properties_callback {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;my $b="";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;open BDAY,"/home/rsrijith/shell/birthdays1";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;while(&amp;lt;BDAY&amp;gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ $b.=$_."\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; my $dialog = Gtk2::MessageDialog-&amp;gt;new (undef, [],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'info', 'ok',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $b);&lt;br /&gt;&amp;nbsp; $dialog-&amp;gt;run;&lt;br /&gt;&amp;nbsp; $dialog-&amp;gt;destroy;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sub about_callback {&lt;br /&gt;&amp;nbsp; my $about = Gnome2::About-&amp;gt;new ('Panel Reminder', '0.1',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Perl Program working in Panel',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '© 2009 R.Srijith',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'R.Srijith &amp;lt;rsrijith007@gmail.com');&lt;br /&gt;&amp;nbsp; $about-&amp;gt;show;&lt;br /&gt;}&lt;br /&gt;&lt;eox;&gt;&lt;br /&gt;&lt;/eox;&gt;&lt;/div&gt;This program prints the contents of &lt;b&gt;/home/rsrijith/panel_remind&lt;/b&gt;&lt;br /&gt;An Example of the content of that file should be as&lt;br /&gt;&lt;br /&gt;&lt;div class="prog"&gt;Blue:Happy Birthday to Mahima&lt;/div&gt;So that's it!! And &lt;b&gt;Happy Birthday Mahima&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/reminder-for-gnome-panel.html"&gt;Reminder for Gnome Panel&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://sriunplugged.blogspot.com/2009/03/backend-for-panel-reminder.html"&gt;Backend For Panel Reminder&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://sriunplugged.blogspot.com/2009/03/birthday-reminder-for-gnome-panel.html"&gt;Birthday Reminder For Gnome Panel&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Comment me if you have any doubts or if it's not working.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-5869272857033606639?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/5869272857033606639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2009/02/display-reminders-in-gnome-panel.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/5869272857033606639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/5869272857033606639'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2009/02/display-reminders-in-gnome-panel.html' title='Display Reminders In Gnome Panel'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_t8oKYxpOl3M/Sa6s20NlMkI/AAAAAAAAAF4/7E0OvpkeeUc/s72-c/Screenshot-2%282%29.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-994890113346949126</id><published>2009-02-01T14:33:00.146+05:30</published><updated>2009-02-09T21:58:46.592+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='acpi'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='dataone'/><title type='text'>BSNL Dataone Auto Downloader</title><content type='html'>Bsnl(India) provides an account that has 2am to 8am unlimited download. It was not easy to wake up at 2am and switch on the computer and sleep again. So I tried to find a method to switch on the computer automatically at 2am and download and shutdown at 8am. Although the I thought the idea was foolish, I found out that there actually is a method for doing it. "ACPI Alarm" was introduced in 1999 or so (Even my old PC had it).&lt;br /&gt;&lt;br /&gt;So what does this alarm do? The ACPI alarm wakes up the computer from shutdown or hibernate. You need to keep the UPS or Power Plug to the CPU on after scheduling the time in ACPI or it gets reseted.&lt;br /&gt;&lt;br /&gt;This function needs Bios Support and I feel most bios supports this feature.&lt;br /&gt;The method to do this depends on your kernel version.&lt;br /&gt;So check the Kernel Version first using the command.&lt;br /&gt;&lt;br /&gt;&lt;div class="prog"&gt;uname -r&lt;/div&gt;&lt;br /&gt;If Kernel &amp;gt; 2.6.22 and higher use /sys/class/rtc/rtc0/wakealarm&lt;br /&gt;&lt;br /&gt;Kernel &amp;lt; 2.6.21 and lower use /proc/acpi/alarm  &lt;br /&gt;&lt;br /&gt;&lt;b&gt;  Disable hwclock updates&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;On most machines it's required to make a small change to the Linux shutdown procedure. When your machine goes down, most linux distributions write the system time/data back to the bios. On MANY machines the machines never wakes-up after a time/data update. It's recommended to make this change before you start. See below for more details (distro specific),&lt;br /&gt;&lt;br /&gt;The reason for the recommendation above is that most linux distributions write the current system time back to the bios when shutting down the machine, and with some BIOSes, the machine will not wake up if the hardware clock is modified after the alarm timer has been set. To avoid that, it is necessary to disable the writing of the current system time to the hardware clock in the system shutdown scripts. This is distribution specific, so here are some examples:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;dl&gt;&lt;dt&gt;&lt;a class="image" href="http://www.mythtv.org/wiki/Image:Debianlogo.png" title="Debianlogo.png"&gt;&lt;img alt="" border="0" height="22" src="http://www.mythtv.org/w/images/thumb/a/ae/Debianlogo.png/18px-Debianlogo.png" width="18" /&gt;&lt;/a&gt; Debian (and Ubuntu) &lt;/dt&gt;&lt;/dl&gt;modifying &lt;div class="prog"&gt;/etc/default/rcS&lt;/div&gt;with the following will fix this problem: &lt;br /&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: rgb(239, 239, 239) none repeat scroll 0% 0%; border: 1px dashed black; padding: 5px;"&gt;&lt;a class="image" href="http://www.mythtv.org/wiki/Image:Script.png" title="Image:Script.png"&gt;&lt;img alt="Image:Script.png" border="0" height="22" src="http://www.mythtv.org/w/images/c/cb/Script.png" width="22" /&gt;&lt;/a&gt; &lt;b&gt;/etc/default/rcS&lt;/b&gt; &lt;br /&gt;&lt;pre&gt;#&lt;br /&gt;# /etc/default/rcS&lt;br /&gt;#&lt;br /&gt;# Default settings for the scripts in /etc/rcS.d/&lt;br /&gt;#&lt;br /&gt;# For information about these variables see the rcS(5) manual page.&lt;br /&gt;#&lt;br /&gt;# This file belongs to the "initscripts" package.&lt;br /&gt;&lt;br /&gt;TMPTIME=0&lt;br /&gt;SULOGIN=no&lt;br /&gt;DELAYLOGIN=no&lt;br /&gt;UTC=no&lt;br /&gt;VERBOSE=no&lt;br /&gt;FSCKFIX=no&lt;br /&gt;==&amp;gt; HWCLOCKACCESS=no&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;a class="image" href="http://www.mythtv.org/wiki/Image:Gentoo.png" title="Gentoo.png"&gt;&lt;img alt="" border="0" height="33" src="http://www.mythtv.org/w/images/thumb/0/0e/Gentoo.png/25px-Gentoo.png" width="25" /&gt;&lt;/a&gt; Gentoo Set clock_systohc to "NO" in &lt;div class="prog"&gt;/etc/conf.d/clock&lt;/div&gt;: &lt;br /&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: rgb(239, 239, 239) none repeat scroll 0% 0%; border: 1px dashed black; padding: 5px;"&gt;&lt;a class="image" href="http://www.mythtv.org/wiki/Image:Script.png" title="Image:Script.png"&gt;&lt;img alt="Image:Script.png" border="0" height="22" src="http://www.mythtv.org/w/images/c/cb/Script.png" width="22" /&gt;&lt;/a&gt; &lt;b&gt;/etc/conf.d/clock&lt;/b&gt; &lt;br /&gt;&lt;pre&gt;# Set CLOCK to "UTC" if your system clock is set to UTC (also known as&lt;br /&gt;# Greenwich Mean Time).  If your clock is set to the local time, then&lt;br /&gt;# set CLOCK to "local".  Note that if you dual boot with Windows, then&lt;br /&gt;# you should set it to "local".&lt;br /&gt;clock="UTC"&lt;br /&gt;&lt;br /&gt;# If you want to set the Hardware Clock to the current System Time&lt;br /&gt;# during shutdown, then say "YES" here.&lt;br /&gt;# You normally don't need to do this if you run a ntp daemon.&lt;br /&gt;clock_systohc="NO"&lt;br /&gt;&lt;br /&gt;# If you wish to pass any other arguments to hwclock during bootup,&lt;br /&gt;# you may do so here. Alpha users may wish to use --arc or --srm here.&lt;br /&gt;clock_args=""&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;dl&gt;&lt;dt&gt;&lt;a class="image" href="http://www.mythtv.org/wiki/Image:Geeko_head48.png" title="Geeko head48.png"&gt;&lt;img alt="" border="0" height="25" src="http://www.mythtv.org/w/images/thumb/0/09/Geeko_head48.png/25px-Geeko_head48.png" width="25" /&gt;&lt;/a&gt; openSUSE &lt;/dt&gt;&lt;/dl&gt;modifying &lt;div class="prog"&gt;/etc/sysconfig/clock&lt;/div&gt;holds a switch to write back system time to the hardware clock &lt;br /&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: rgb(239, 239, 239) none repeat scroll 0% 0%; border: 1px dashed black; padding: 5px;"&gt;&lt;a class="image" href="http://www.mythtv.org/wiki/Image:Script.png" title="Image:Script.png"&gt;&lt;img alt="Image:Script.png" border="0" height="22" src="http://www.mythtv.org/w/images/c/cb/Script.png" width="22" /&gt;&lt;/a&gt; &lt;b&gt;/etc/sysconfig/clock&lt;/b&gt; &lt;br /&gt;&lt;pre&gt;# Set to "-u" if your system clock is set to UTC, and to "--localtime"&lt;br /&gt;# if your clock runs that way.&lt;br /&gt;#&lt;br /&gt;HWCLOCK="-u"&lt;br /&gt;&lt;br /&gt;SYSTOHC="no"&lt;br /&gt;# Is set to "yes" write back the system time to the hardware&lt;br /&gt;# clock at reboot or shutdown. Usefull if hardware clock is&lt;br /&gt;# much more inaccurate than system clock.  Set to "no" if&lt;br /&gt;# system time does it wrong due e.g. missed timer interrupts.&lt;br /&gt;# If set to "no" the hardware clock adjust feature is also&lt;br /&gt;# skipped because it is rather useless without writing back&lt;br /&gt;# the system time to the hardware clock.&lt;br /&gt;               &lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;dl&gt;&lt;dt&gt;&lt;a class="image" href="http://www.mythtv.org/wiki/Image:Fedora.png" title="Fedora.png"&gt;&lt;img alt="" border="0" height="25" src="http://www.mythtv.org/w/images/thumb/5/5e/Fedora.png/25px-Fedora.png" width="25" /&gt;&lt;/a&gt; Fedora Core 6 &lt;/dt&gt;&lt;/dl&gt;modifying &lt;div class="prog"&gt;/etc/init.d/halt&lt;/div&gt;with the following will fix this problem: &lt;br /&gt;&lt;br /&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: rgb(239, 239, 239) none repeat scroll 0% 0%; border: 1px dashed black; padding: 5px;"&gt;&lt;a class="image" href="http://www.mythtv.org/wiki/Image:Script.png" title="Image:Script.png"&gt;&lt;img alt="Image:Script.png" border="0" height="22" src="http://www.mythtv.org/w/images/c/cb/Script.png" width="22" /&gt;&lt;/a&gt; &lt;b&gt;/etc/init.d/halt&lt;/b&gt; &lt;br /&gt;&lt;pre&gt;==&amp;gt;  ACPITIME=`cat /proc/acpi/alarm`&lt;br /&gt;&lt;br /&gt;     [ -x /sbin/hwclock ] &amp;amp;&amp;amp; action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS&lt;br /&gt;                &lt;br /&gt;==&amp;gt;  echo "$ACPITIME" &amp;gt; /proc/acpi/alarm&amp;nbsp; &lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Using /proc/acpi/alarm for Kernel 2.6.21 and lower&lt;/h4&gt;&lt;br /&gt;Check that you can write a new time to the RTC Clock Alarm (you will need to be Root) Format is YYYY-MM-DD HH:MM:SS&lt;br /&gt;&lt;div class="prog"&gt;echo "2009-02-1 02:00:00" &gt; /proc/acpi/alarm &lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Using /sys/class/rtc/rtc0/wakealarm&lt;/h4&gt;&lt;br /&gt;Beginning with kernel 2.6.22 /proc/acpi/alarm has been removed and replaced with /sys/class/rtc/rtc0/wakealarm. The key differences with the wakealarm interface are:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Instead of accepting a formatted time, wakealarm accepts the number of seconds since Jan 1, 1970.&lt;/li&gt;&lt;li&gt;If you want to change the wakealarm time, you first need to reset the time.&lt;/li&gt;&lt;li&gt;You have to make sure that your bios clock is set to UTC time not localtime otherwise it will wakeup at the wrong time. None the less it is still possible if the bios clock is set to localtime (likely if you also run windows), see the section below for how to set the alarm correctly when the bios clock is in localtime.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;An example of setting alarm is as follows&lt;br /&gt;&lt;div class="prog"&gt;echo 0 &gt; /sys/class/rtc/rtc0/wakealarm&lt;br /&gt;date -u --date "Jul 1, 2008 10:32:00" +%s &gt; /sys/class/rtc/rtc0/wakealarm&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Then we can confirm that the alarm is set with the following. &lt;br /&gt;&lt;div class="prog"&gt;cat /proc/driver/rtc&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;If the alarm is set then you should see something like this. If so then shutdown and see if it wakes up at the alarm date/time.&lt;br /&gt;&lt;div class="prog"&gt;rtc_time : 13:40:26&lt;br /&gt;rtc_date : 2008-12-21&lt;br /&gt;alrm_time : 10:45:00&lt;br /&gt;alrm_date : 2008-12-22&lt;br /&gt;alarm_IRQ : yes&lt;br /&gt;alrm_pending : no&lt;br /&gt;24hr  : yes&lt;br /&gt;periodic_IRQ : no&lt;br /&gt;update_IRQ : no&lt;br /&gt;HPET_emulated : no&lt;br /&gt;DST_enable : no&lt;br /&gt;periodic_freq : 1024&lt;br /&gt;batt_status : okay&lt;br /&gt;&lt;/div&gt;If you see the alarm date similar to ****-12-21 then the alarm is set to a time in the past and it won't wake up.&lt;br /&gt;&lt;div class="prog"&gt;rtc_time : 13:42:01&lt;br /&gt;rtc_date : 2008-12-21&lt;br /&gt;alrm_time : 13:46:59&lt;br /&gt;alrm_date : ****-12-21&lt;br /&gt;alarm_IRQ : no&lt;br /&gt;alrm_pending : no&lt;br /&gt;24hr  : yes&lt;br /&gt;periodic_IRQ : no&lt;br /&gt;update_IRQ : no&lt;br /&gt;HPET_emulated : no&lt;br /&gt;DST_enable : no&lt;br /&gt;periodic_freq : 1024&lt;br /&gt;batt_status : okay&lt;br /&gt;&lt;/div&gt;In most systems this method should work. But in some Bios called as Fussy Bios using this function is tough. Lets see the different problems it might have and it's solution&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt; Disable/Enable RTC in BIOS&lt;br /&gt;&lt;br /&gt;In some cases you need to disable the RTC alarm function is the bios to make things work.&lt;br /&gt;&lt;br /&gt;* Another possible glitch is, that the option 'Resume By Alarm' (or whatever it is called) is set to Enabled but wake up using /proc/acpi/alarm only works if the option is set to Disabled. Sounds weird but works with some boards.&lt;br /&gt;* On many boards, when the RTC setting is enabled in the BIOS, it will wake only from a time set and saved from BIOS setup, and not from a time set outside of the BIOS setup environment - as we want. All of the boards the original author of this document needed this setting disabled to correctly wake with ACPI. This is the recommended starting point. &lt;/li&gt;&lt;li&gt;Time/Date not visible in BIOS&lt;br /&gt;&lt;br /&gt;After you have set the RTC alarm from Linux, it could be that you not see changes in the BIOS but it still works.&lt;/li&gt;&lt;li&gt;Required to write time/date two times&lt;br /&gt;&lt;br /&gt;Some users reported that their BIOS is only updated after writing 2 times to the alarm file. (reported with proc/acpi/alarm)&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Ok, so the Basic of ACPI is done.Now lets see how we switch on the computer at 2am.&lt;br /&gt;We use the command as,&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If it's to be set on the next day 2pm :&lt;br /&gt;&lt;div class="prog"&gt;date +'%a %b %d 02:00:00 GMT %Y' -d '+1 day'|xargs -i date '+%s' -d''{}'' &gt; /sys/class/rtc/rtc0/wakealarm &lt;/div&gt;&lt;/li&gt;&lt;li&gt;If it's to be set on the same day 2pm :&lt;br /&gt;&lt;div class="prog"&gt;date +'%a %b %d 02:00:00 GMT %Y' |xargs -i date '+%s' -d''{}'' &gt; /sys/class/rtc/rtc0/wakealarm &lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;So, the computer boots up at 2am. Now we need to reboot the modem.&lt;br /&gt;Rebooting modem is required as Dataone calculates session from On time to Off time. If the modem is up from 1am to 5am and we download 4gb, what the dataone does is, it takes the total time modem was on ie 4 hours. 2am to 5am is free so the non free time is 1hr so we will be charged for 1gb (4gb/4 hours). So it's essential to reboot the modem at 2am.&lt;br /&gt;The code to reboot is ,&lt;br /&gt;&lt;div class="prog"&gt;#!/bin/bash&lt;br /&gt;now=$(date +"%H")&lt;br /&gt;now=${now#0};&lt;br /&gt;if (( $now &lt; 8 )) &amp;&amp; (( $now &gt; 1 ))&lt;br /&gt;then&lt;br /&gt;(echo "admin";&lt;br /&gt;sleep 1;&lt;br /&gt;echo "admin";&lt;br /&gt;sleep 1;&lt;br /&gt;echo "13";&lt;br /&gt;sleep 1;&lt;br /&gt;echo "1";&lt;br /&gt;sleep 40;&lt;br /&gt;)|telnet 192.168.1.1&lt;br /&gt;deluge &amp;&lt;br /&gt;fi&lt;br /&gt;&lt;/div&gt;&lt;b&gt;deluge&lt;/b&gt; is torrent client I use.&lt;br /&gt;We should run this command in sessions so that it runs at each boot.&lt;br /&gt;We do this by Adding in&lt;br /&gt;&lt;b&gt;System -&gt; Preferences -&gt; Sessions -&gt; Add&lt;/b&gt;&lt;br /&gt;Give the path of the File that contains the above script. That's it!! Done!!. The script starts at 2am. Now we need to stop the script at 8am.&lt;br /&gt;We use following code for that,&lt;br /&gt;&lt;div class="prog"&gt;#!/bin/bash&lt;br /&gt;now=$(date +"%H")&lt;br /&gt;date +'%a %b %d 02:00:00 GMT %Y' -d '+1 day'|xargs -i date '+%s' -d''{}'' &gt; /sys/class/rtc/rtc0/wakealarm&lt;br /&gt;sudo killall deluge&lt;br /&gt;sleep 5;&lt;br /&gt;(echo "admin";&lt;br /&gt;sleep 1;&lt;br /&gt;echo "admin";&lt;br /&gt;sleep 1;&lt;br /&gt;echo "13";&lt;br /&gt;sleep 1;&lt;br /&gt;echo "1";&lt;br /&gt;sleep 40;&lt;br /&gt;)|telnet 192.168.1.1&lt;br /&gt;sudo shutdown -h now&lt;br /&gt;&lt;/div&gt;We use the crontab to schedule and run it at 7 59am. If you are not sure how to write a crontab entry see the posts before.&lt;br /&gt;Well Happy Downloading!! Keep me Posted on how it went.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-994890113346949126?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/994890113346949126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2009/02/bsnl-dataone-auto-downloaded.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/994890113346949126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/994890113346949126'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2009/02/bsnl-dataone-auto-downloaded.html' title='BSNL Dataone Auto Downloader'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-7124997344444593095</id><published>2008-11-16T14:03:00.002+05:30</published><updated>2009-03-14T09:06:20.776+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='XMPP'/><title type='text'>Online Version of Perl Invisible FInder</title><content type='html'>Here is the online version invisible finder for gmail.&lt;br /&gt;&lt;div class="code"&gt;&lt;a href="http://www.ormakal.net/cgi-bin/invi.pl"&gt; http://www.ormakal.net/cgi-bin/invi.pl&lt;/a&gt;&lt;/div&gt;Felt a lot of people needs this.&lt;br /&gt;Hope it is helpful&lt;br /&gt;And please dont believe it's something foolish to get password. I need to login to get the invisible user List.&lt;br /&gt;And login 2 times atleast and see only the common users in both time. This is because it sometimes gives some false results ie only less than 10%&lt;br /&gt;Happy Picking Hiding People.&lt;br /&gt;Now you can Run but cant hide :P&lt;br /&gt;&lt;b&gt;There is a Problem with the server I had been using the script does'nt work now as the server blocks opening of the 5222 port, which is needed for the script's working.I am trying to find an alternative server.In the mean time you can try running the script on your computer.The script I have used is &lt;i&gt;&lt;a href="http://sriunplugged.blogspot.com/2008/09/find-invisible-users-in-gmail.html"&gt;Find Invisible Users In Gmail&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-7124997344444593095?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/7124997344444593095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2008/11/online-version-of-perl-invisible-finder.html#comment-form' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/7124997344444593095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/7124997344444593095'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2008/11/online-version-of-perl-invisible-finder.html' title='Online Version of Perl Invisible FInder'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-6953460771609326955</id><published>2008-11-16T12:05:00.003+05:30</published><updated>2008-11-24T13:11:55.323+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='gnome'/><title type='text'>Automatic Desktop Wallpaper Changer</title><content type='html'>I have a lot of wallpaper that I wanted to switch automatically. After a lot of search i found that there a command way to control all the gnome settings. So I the command I used is "&lt;b&gt;gconftool-2&lt;/b&gt;".&lt;br /&gt;So code is like:&lt;br /&gt;&lt;div class="prog" style="height:300px"&gt;#!/bin/bash&lt;br /&gt;folder="/home/rsrijith/Pics" #folder where the pics lie in &lt;br /&gt;find $folder -iregex ".*.jp.?g" &gt;$folder/temp_back #list all images in the folder&lt;br /&gt;no=$(cat $folder/temp_back|wc -l)&lt;br /&gt;rand=$(echo `expr $RANDOM % $no`)&lt;br /&gt;while ( grep -q $rand $folder/.last50 )&lt;br /&gt;do&lt;br /&gt;rand=$(echo `expr $RANDOM % $no`)&lt;br /&gt;done&lt;br /&gt;echo $rand &gt;&gt; $folder/.last50&lt;br /&gt;tail -50 $folder/.last50 &gt;$folder/temp&lt;br /&gt;cat $folder/temp &gt;$folder/.last50&lt;br /&gt;rm $folder/temp&lt;br /&gt;file=$(sed -n $rand'p' $folder/temp_back)&lt;br /&gt;ON_USER=rsrijith #your username here&lt;br /&gt;&lt;br /&gt;export DBUS_SESSION=$(grep -v "^#" /home/$ON_USER/.dbus/session-bus/`cat /var/lib/dbus/machine-id`-0)&lt;br /&gt;&lt;br /&gt;sudo -u $ON_USER $DBUS_SESSION /usr/bin/gconftool-2 -t string -s /desktop/gnome/background/picture_filename "$file" &amp;&amp; echo "Worked On:"$(date) &gt;&gt;/home/$ON_USER/logs/desktopbackground&lt;br /&gt;echo "Set Wallpaper as:"$file &gt;&gt;/home/$ON_USER/logs/desktopbackground&lt;br /&gt;rm $folder/temp_back&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;I have used the DBUS_SESSION variable to make it compatible with Ubuntu 8.10. The Dbus session is a bit bit different from earlier versions. The change is that it does'nt accept the change until the gnome is restarted. It's due to the new session that is made each time you update that value.&lt;br /&gt;&lt;br /&gt;So the folder variable should the folder where the wallpapers should lie. You can put pictures in folders inside that folder. All of it will be taken. But I have specified to take only jpg and jpeg only.Now a random image is picked from that using the environment variable $RANDOM. Next we update the gnome settings using gconftool-2 if that image was'nt used in the last 50 changes.&lt;br /&gt;&lt;br /&gt;Thus this file picks an image and puts it as wallpaper. So the next part is making this change automatically. For this we use cron (linux scheduler).&lt;br /&gt;Use the command below to enter the crontab&lt;br /&gt;&lt;div class="code"&gt;sudo crontab -e &lt;/div&gt;Enter the crontab entry as&lt;br /&gt;&lt;div class="prog"&gt;*/15 * * * * /home/rsrijith/shell/deskback 2&gt;&gt;/home/rsrijith/logs/deskbackground&lt;br /&gt;&lt;/div&gt;Check the entry using&lt;br /&gt;&lt;div class="code"&gt;sudo crontab -l &lt;/div&gt;That's all!!!&lt;br /&gt;Anyone tried? Worked? Comment me !!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-6953460771609326955?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/6953460771609326955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2008/11/automatic-desktop-wallpaper-changer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/6953460771609326955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/6953460771609326955'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2008/11/automatic-desktop-wallpaper-changer.html' title='Automatic Desktop Wallpaper Changer'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-8061655974686054851</id><published>2008-09-21T10:12:00.016+05:30</published><updated>2008-11-24T13:17:06.312+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='XMPP'/><title type='text'>Find Invisible Users In Gmail</title><content type='html'>Finding who is invisible is something that I always wanted to do.It's always fun to ping a person who feels none can see him/her online. While studying XMPP protocol I found out that even when the person is offline the chat client knows that person is online.&lt;br /&gt;The Chat Client should know who all are really online at any given time.This is because even when the person is invisible he/she should have a buddy list showing online users.&lt;br /&gt;&lt;br /&gt;Ah!! Guess you did'nt understand a word till now.Let me try making it simpler.&lt;br /&gt;&lt;br /&gt;Let's assume two users A and B are online now.Both A and B are Available (ie the chat client shows them online).Both A and B has a list of online users in his chat client(eg:google talk,gmail inbox chat,pidgin). Now this online users need to be kept constantly updated. This is done by the XMPP protocol(this is the protocol used by google for it's chat).Now even if B is invisible still it needs to keep it's online users list updated as it needs to show B the online users.&lt;br /&gt;So whenever B logs into his account it initially sends a &lt;span style="font-weight: bold;"&gt;presence notification&lt;/span&gt; to all the users in it's contacts list saying that B is online as "&lt;span style="font-weight: bold;"&gt;Please show me online in our online user lis&lt;/span&gt;t".&lt;br /&gt;All online users respond back with their online status and status message.&lt;br /&gt;This is where the invisible people shows up.The chat server replies back with their status. The only difference in them is that they respond with their status as "&lt;span style="font-weight: bold;"&gt;Unavailable&lt;/span&gt;".&lt;br /&gt;So my aim was to find out all users that respond back to me with Unavailable status and display them.&lt;br /&gt;Ok enough of explanation of how it works let's see the code&lt;br /&gt;&lt;div class="prog" style="height: 300px;"&gt;&lt;br /&gt;#!/bin/perl&lt;br /&gt;&lt;br /&gt;use strict;&lt;br /&gt;use Net::XMPP;&lt;br /&gt;&lt;br /&gt;my $sttime=time;&lt;br /&gt;print "Username:$ARGV[0]\n";&lt;br /&gt;my $username = "$ARGV[0]";&lt;br /&gt;my $password = "$ARGV[1]";&lt;br /&gt;&lt;br /&gt;my $resource = "SNIFFER";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;my $hostname = 'talk.google.com';&lt;br /&gt;my $port = 5222;&lt;br /&gt;my $componentname = 'gmail.com';&lt;br /&gt;my $Contype = 'tcpip';&lt;br /&gt;my $tls = 1;&lt;br /&gt;&lt;br /&gt;my %online;&lt;br /&gt;my $Con = new Net::XMPP::Client();&lt;br /&gt;$Con-&gt;SetCallBacks(presence=&gt;\&amp;presence_ch);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;my $status = $Con-&gt;Connect(&lt;br /&gt;hostname =&gt; $hostname, port =&gt; $port,&lt;br /&gt;componentname =&gt; $componentname,&lt;br /&gt;connectiontype =&gt; $Contype, tls =&gt; $tls);&lt;br /&gt;&lt;br /&gt;if (!(defined($status))) { &lt;br /&gt;print "ERROR:  XMPP connection failed.\n";&lt;br /&gt;print "        ($!)\n";&lt;br /&gt;exit(0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# Change hostname&lt;br /&gt;my $sid = $Con-&gt;{SESSION}-&gt;{id};&lt;br /&gt;$Con-&gt;{STREAM}-&gt;{SIDS}-&gt;{$sid}-&gt;{hostname} = $componentname;&lt;br /&gt;&lt;br /&gt;# Authenticate&lt;br /&gt;my @result = $Con-&gt;AuthSend(&lt;br /&gt;username =&gt; $username, password =&gt; $password,&lt;br /&gt;resource =&gt; $resource);&lt;br /&gt;&lt;br /&gt;if ($result[0] ne "ok") {&lt;br /&gt;print "ERROR: Authorization failed: $result[0] - $result[1]\n";&lt;br /&gt;exit(0);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;print "Logged in Sucessfull!\nInvisible Users:\n";&lt;br /&gt;}&lt;br /&gt;$Con-&gt;PresenceSend(show=&gt;"Available");&lt;br /&gt;sub presence_ch&lt;br /&gt;{&lt;br /&gt;my $p=0;&lt;br /&gt;my $x;&lt;br /&gt;my $presence = pop;&lt;br /&gt;my $from = $presence-&gt;GetFrom();&lt;br /&gt;$from =~ s/([a-zA-Z@.]*)\/(.*)/$1/;&lt;br /&gt;if($presence-&gt;GetType() eq "unavailable")&lt;br /&gt;{&lt;br /&gt;if (exists $online{$from}) &lt;br /&gt;{&lt;br /&gt;delete($online{$from});  &lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;$online{$from}=$presence-&gt;GetType()."!!" .$presence-&gt;GetStatus();&lt;br /&gt;print $from."\n";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;$online{$from}=$presence-&gt;GetType()."!!" .$presence-&gt;GetStatus();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;my $currtime;&lt;br /&gt;while(1)&lt;br /&gt;{&lt;br /&gt;$currtime=time;&lt;br /&gt;if($currtime-$sttime&gt;10)&lt;br /&gt;{last;}&lt;br /&gt;my $res=$Con-&gt;Process(1);&lt;br /&gt;if(!(defined($res))){ last;}}&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;XMPP protocol needs SSL encryption.So you need to install the perl modules for it.So before trying out the code make sure u have the following modules:&lt;br /&gt;&lt;ul&gt;&lt;li class="spip"&gt; IO ::Socket ::SSL (&gt;=0.81)&lt;/li&gt;&lt;li class="spip"&gt; XML ::Stream&lt;/li&gt;&lt;li class="spip"&gt; Net ::XMPP&lt;/li&gt;&lt;li class="spip"&gt; Authen ::SASL&lt;/li&gt;&lt;/ul&gt;To install the packages open the CPAN shell using the command&lt;br /&gt;&lt;div class="code"&gt;sudo perl -MCPAN -e 'shell'&lt;/div&gt;&lt;br /&gt;Followed by&lt;br /&gt;&lt;div class="code"&gt;install &amp;lt;module name&amp;gt;&lt;/div&gt;&lt;br /&gt;for each of the module listed above&lt;br /&gt;Also you need to install the package send-xmpp and it's dependecies&lt;br /&gt;&lt;div class="code"&gt;sudo apt-get install send-xmpp&lt;/div&gt;&lt;br /&gt;Run the program by running it as &lt;br /&gt;&lt;div class="code"&gt;perl invi.pl &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;/div&gt;I have also made a online version of this script you can use to find invisible users the link is &lt;br /&gt;&lt;div class="code"&gt;http://sriunplugged.blogspot.com/2008/11/online-version-of-perl-invisible-finder.html&lt;/div&gt;Worked?? Did'nt work?? Comment me&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-8061655974686054851?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/8061655974686054851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2008/09/find-invisible-users-in-gmail.html#comment-form' title='31 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/8061655974686054851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/8061655974686054851'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2008/09/find-invisible-users-in-gmail.html' title='Find Invisible Users In Gmail'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>31</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-2819390956133205258</id><published>2008-09-07T12:25:00.012+05:30</published><updated>2008-11-16T12:01:50.868+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Automatic Command Archive</title><content type='html'>The default command storing size of ubuntu is 500 commands. It stores the commands in home folder in the file "&lt;span style="font-weight: bold;"&gt;.bash_history&lt;/span&gt;" .&lt;br /&gt;The problem is 500 commands is too short of a size.&lt;br /&gt;One method is to increase the command size to a large value by changing the $HISTFILESIZE variable using the following command&lt;br /&gt;&lt;div class="code"&gt;export HISTFILESIZE=1000 &lt;/div&gt;&lt;br /&gt;But this will last only till that terminal is closed.&lt;br /&gt;&lt;br /&gt;Do make tat permanent or rather make that command execute every time u open a terminal we can put that command in&lt;span style="font-weight: bold;"&gt; .bashrc &lt;/span&gt;file in the home folder itself&lt;br /&gt;The commands in this folder will be executed each time you open a terminal. So adding that command is one way to solve tat problem.&lt;br /&gt;&lt;br /&gt;Or there is another way. Make a script tat will automatically archive the old commands to a file and compress it and save if it bigger than a specified size. That's a better method i feel.&lt;br /&gt;Also i try to remove the repeated commands and store only unique ones there by not wasting space storing copies. This is a better method i feel than making it accumulate in the &lt;span style="font-weight: bold;"&gt;.bashrc.&lt;br /&gt;&lt;/span&gt;So let's see how to do it.&lt;br /&gt;File name:logarchive&lt;br /&gt;&lt;div class="prog" style="height: 300px;"&gt;&lt;br /&gt;echo "Ran at:"$(date) &gt;&gt;/home/$1/logs/commandrotate&lt;br /&gt;echo "Size of History: "$(cat /home/$1/.bash_history|wc -l) &gt;&gt;/home/rsrijith/logs/commandrotate&lt;br /&gt;if [ $(cat /home/$1/.bash_history|wc -l) -gt  400 ]&lt;br /&gt;then&lt;br /&gt;echo "Archived" &gt;&gt;/home/rsrijith/logs/commandrotate&lt;br /&gt;cat -n /home/$1/.bash_history|sort -ru -k2|sort -n -k1|sed 's/[ ]*[0-9]*\t//' &gt; /home/$1/.bash_history&lt;br /&gt;cat /home/$1/.bash_history &gt;&gt;/home/$1/history/cmd_history&lt;br /&gt;touch /home/$1/history/temp&lt;br /&gt;cat -n /home/$1/history/cmd_history|sort -ru -k2|sort -n -k1|sed 's/[ ]*[0-9]*\t//' &gt;/home/$1/history/cmd_history&lt;br /&gt;tail -100 /home/$1/.bash_history &gt;/home/$1/history/temp&lt;br /&gt;cat /home/$1/history/temp &gt;/home/$1/.bash_history&lt;br /&gt;rm /home/$1/history/temp&lt;br /&gt;fi&lt;br /&gt;logrotate /home/$1/history/logrot.conf&lt;br /&gt;if [ -e /home/$1/history/cmd_history.1 ]&lt;br /&gt;then&lt;br /&gt;gunzip "/home/$1/history/cmd_archive.gz"&lt;br /&gt;cat /home/$1/history/cmd_history.1 &gt;&gt;/home/$1/history/cmd_archive&lt;br /&gt;gzip -f "/home/$1/history/cmd_archive"&lt;br /&gt;rm /home/$1/history/cmd_history.1&lt;br /&gt;rm /home/$1/history/cmd_archive&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;This script also reduces the current .bashrc file to only unique entry.Although there is a command (or rather environment variable) to store only unique values. But that only keeps the first entry in the file.So only the initial entry stays. I usually use the recently used commands using the up arrow in bash. So I need to maintain the order in which I have typed the command too. That's why I have used &lt;span style="font-weight: bold;"&gt;cat -n&lt;/span&gt; to get the order and have used it to order it in the end.&lt;br /&gt;I have made the script run when the commands exceeds 400.&lt;br /&gt;&lt;br /&gt;Once the cmd_history file goes over 1MB ,I try to compress it and store in as an archive. This is why i have used logrotate file&lt;br /&gt;&lt;br /&gt;File name:logrot.conf&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;/home/rsrijith/history/cmd_history {&lt;br /&gt;missingok&lt;br /&gt;size 1M&lt;br /&gt;rotate 1&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Now we need to run it every 30mins or 1hr according to how much you use the commands.I have used 30mins just in case.So we use crontab (A scheduler in Linux).The crontab file is &lt;span style="font-weight:bold;"&gt;/etc/crontab&lt;/span&gt;.We can edit it using the command.&lt;br /&gt;&lt;div class="code"&gt;crontab -e &lt;/div&gt;&lt;br /&gt;As we need to run it as root.Run the command as root.&lt;br /&gt;So the crontab entry is as&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;*/30 *  * * *   root     /home/rsrijith/history/logarchive rsrijith 2&gt;&gt;/home/rsrijith/logs/commandrotate&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-2819390956133205258?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/2819390956133205258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2008/09/automatic-command-archive.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/2819390956133205258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/2819390956133205258'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2008/09/automatic-command-archive.html' title='Automatic Command Archive'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7730225884737531301.post-7690860318650565818</id><published>2008-09-06T22:25:00.005+05:30</published><updated>2008-11-16T12:03:19.385+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>"Send To" in Linux</title><content type='html'>It's been a common practice among the windows users to right click and search for "Send To" option when a file needs to copied to the USB or any other Drive.&lt;br /&gt;Why spare me, even i used to do this while using windows, when to my astonishment i found that there exists no such option in the default window ("Nautilus") in Ubuntu. So i thought of making one for my convenience.&lt;br /&gt;Nautilus supports user scripts inside it. This can be easily embedded into the manager by inserting it into the folder ~/.gnome2/nautilus-scripts/ folder where ~ stands for the shortcut for home folder.&lt;br /&gt;I used zenity ( a in build gnome dialog box) to get the radio box for selecting the drive to copy to.&lt;br /&gt;The Send to function looks like this&lt;br /&gt;&lt;br /&gt;&lt;div style="TEXT-ALIGN: left"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_t8oKYxpOl3M/SMNtYTqFDbI/AAAAAAAAADQ/WNTJ83ZkE5Y/s1600-h/Screenshot.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5243154655550442930" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_t8oKYxpOl3M/SMNtYTqFDbI/AAAAAAAAADQ/WNTJ83ZkE5Y/s320/Screenshot.png" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_t8oKYxpOl3M/SMNuhow5ouI/AAAAAAAAADY/E8jGLke17Go/s1600-h/Screenshot-1.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5243155915346649826" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 263px; CURSOR: pointer; HEIGHT: 190px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_t8oKYxpOl3M/SMNuhow5ouI/AAAAAAAAADY/E8jGLke17Go/s320/Screenshot-1.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_t8oKYxpOl3M/SMNu0UXSPDI/AAAAAAAAADg/N7-xluv8BuY/s1600-h/Screenshot-2.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5243156236288015410" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_t8oKYxpOl3M/SMNu0UXSPDI/AAAAAAAAADg/N7-xluv8BuY/s320/Screenshot-2.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The Code :&lt;br /&gt;&lt;div class="prog" style="height: 300px;"&gt;#!/bin/bash&lt;br /&gt;destination='Choose Destination'&lt;br /&gt;title_destination='Send files to:'&lt;br /&gt;&lt;br /&gt;copy='Copying'&lt;br /&gt;title_copy='Please wait...'&lt;br /&gt;&lt;br /&gt;success='Files successfully copied'&lt;br /&gt;title_success='Success'&lt;br /&gt;&lt;br /&gt;errors='Something went wrong'&lt;br /&gt;title_errors='Error'&lt;br /&gt;&lt;br /&gt;no_writable='Destination is either not existant or writable'&lt;br /&gt;title_no_writable='Error'&lt;br /&gt;vd=$(ls -tm /media/sed 's/cdrom[0-9]\?[,]\?[ ]\?//g')&lt;br /&gt;#options=${vd//, / FALSE /media/}&lt;br /&gt;IFS=$'\t\n'&lt;br /&gt;options=$(echo $vdsed 's_[ ]\?\([^,]*\),_\/media\/\1\tFALSE\t_g'sed 's_\(.*\)\tFALSE\t_\1_g');&lt;br /&gt;destinazione=$(zenity --list --title "$title_destination" --text "$destination" --radiolist --column " " --column "Device" TRUE $options);&lt;br /&gt;&lt;br /&gt;if [[ "$destinazione" = "" ]]; then&lt;br /&gt;exit&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [[ -w $destinazione ]]; then&lt;br /&gt;NAUTILUS_SCRIPT_SELECTED_FILE_PATHS=$(echo $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS)&lt;br /&gt;destinazione=$(echo $destinazione)&lt;br /&gt;cp -R "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" "$destinazione"  zenity --progress --pulsate --auto-close --title="$title_copy" --text="$copy"&lt;br /&gt;if (( $? == 0 )); then&lt;br /&gt;zenity --info --text="$success" --title "$title_success";&lt;br /&gt;else zenity --info --text="$errors" --title "$title_errors";&lt;br /&gt;fi&lt;br /&gt;else zenity --info --text="$no_writable" --title "$title_no_writable";&lt;br /&gt;fi&lt;/div&gt;&lt;br /&gt;&lt;div style="TEXT-ALIGN: left"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7730225884737531301-7690860318650565818?l=sriunplugged.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sriunplugged.blogspot.com/feeds/7690860318650565818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sriunplugged.blogspot.com/2008/09/send-to-in-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/7690860318650565818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7730225884737531301/posts/default/7690860318650565818'/><link rel='alternate' type='text/html' href='http://sriunplugged.blogspot.com/2008/09/send-to-in-linux.html' title='&quot;Send To&quot; in Linux'/><author><name>R Srijith</name><uri>http://www.blogger.com/profile/10769733060226884283</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/-rOFYblCm3Jo/Tw8ZoEQWBPI/AAAAAAAAATQ/2K3ZI--xeeU/s220/profile%2Bpic.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_t8oKYxpOl3M/SMNtYTqFDbI/AAAAAAAAADQ/WNTJ83ZkE5Y/s72-c/Screenshot.png' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
