Automatic Birthday Remainder Program
Hi , This Program runs works as Birthday Remainder in our local system . Just try this !
It will display our friends name and photo in desktop like notifier whenever u switch on ur system on.
It will remaind u on,
1) Today’s B Day
2) Tomorrow’s B Day
Installation :
—————
To Notify :
$ sudo apt-get install libnotify-bin
To Ruby :
$ sudo apt-get install ruby
$ sudo apt-get install rubygems
$ sudo gem install activesupport
Datebase :
———-
In this “database” file which having friends name, dob , image_path.
You can edit and add new line in order of name , dob , image_path with separated by comma.
database file:
Arulalan,01-01,~/birthday_remainder/Arulalan.jpg
Dhastha,31-12,default
Conditions:
1) first field must have name
2) second filed have dob. It is date and month order only. date ( from 01 to 31 ) & month ( from 01 to 12 ).
The date and month are separeted by minus symbol(-).
eg: 09-05 ( 9th day , May month )
3) third field have the image location path. This image will be displayed on monitor ( notify )
create ond directory “ birthday_remainder” in ur home folder.
U can set path like this. eg : ~/birthday_remainder/Arulalan.jpg ( If u stored the image in this folder ) or u can set any image path
If u dont have image then set the third field as “default” eg: Dhastha,31-12,default
This “default” option will invoke inbuild image path. this inbuild image is stored in “birthday_remainder” folder itself. path is : ~/birthday_remainder/cake.jpeg
you may add any no of lines in this database file.
bday.rb:
#!/usr/bin/env ruby
require “rubygems”
require “active_support”
sleep(10)
file=File.open(“database”,”r”)
file.each do |bday|
bday=bday.chomp!
bday=bday.split(/,/)
name=bday[0].to_s
dob=bday[1].to_s
image_path=bday[2].to_s
if image_path==”default” then
image_path=”~/birthday_remainder/cake.jpeg”
end
dob=dob.split(/-/)
current_time=Time.now
month=current_time.month.to_s
day=current_time.day.to_s
if month.to_i <10 then
month=”0″+month
end
tomorrow=1.day.from_now.to_s
tomorrow=tomorrow.split(/ /)
p tomorrow
if dob[1]==month then
if dob[0]==day then
system(“notify-send ‘BirthDay Remainder’ ‘Today #{name} Birthday’ -i #{image_path} -t 3000″)
sleep(10)
system(“notify-send ‘BirthDay Remainder’ ‘Did U wished #{name} Birthday ?’ -t 0″)
end
if dob[0]==(tomorrow[2]) then
system(“notify-send ‘BirthDay Remainder’ ‘Tomorrow #{name} Birthday’ -i #{image_path} -t 3000″)
sleep(10)
system(“notify-send ‘BirthDay Remainder’ ‘Did U Purchased Gift For #{name} Birthday ?’ -t 0″)
end
end
mon=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
today=Time.now.to_s
today=today.split(/ /)
today[1].to_s
x=mon.index(today[1]).to_i
y=mon.index(tomorrow[1]).to_i
if (x+1==y or tomorrow[1]==”Jan” ) and dob[0]==”01″ then
system(“notify-send ‘BirthDay Remainder’ ‘Tomorrow #{name} Birthday’ -i #{image_path} -t 3000″)
sleep(10)
system(“notify-send ‘BirthDay Remainder’ ‘Did U Purchased Gift For #{name} Birthday ?’ -t 0″)
end
end
Change Permission :
——————-
here , you must make “birthday_remainder” folder in ur home folder and paste this bday.rb and database file and corresponding images .
$ sudo chmod -R 777 ~/ birthday_remainder/
Adding into Start Up Application :
———————————-
In ubuntu 9.10 version :
1) Go to “System” -> “Preferences” -> “Startup Applications”
2) Click “Add” button
3) Now click “Browse” button and comes to home folder-> birthday_remainder folder-> bday.rb ( select bday.rb )
4) In Name field , type as ” Birthday Remainder”
5) Then click “Add” button
* u can enable (check box )or edit or remove whatever u add in startup application
Logout or Restart :
——————-
Now u can see the bday remainder in ur desktop.
How to check :
————–
If u wanna to check this program , then u change the dob of database file into curent date.
this prog will remaind u today’s and tomorrow’s b day….
* It will remaind u in all calender days like 28,29,30,31 & leap year.
u can get this program and guide lines as document from here :
Link : http://www.slideshare.net/arulalan/automatic-b-day-remainder-program
Have a fun !
அருளாளன் . த




Posted by Raji on November 20, 2009 at 8:08 am
Good Job Arul
Keep rocking
Posted by A Simple Birthday Remainder Application Using Ruby | Ramachandran's Blog on August 21, 2011 at 7:50 pm
[...] http://tuxworld.wordpress.com/2009/11/19/automatic-birthday-remainder-using-ruby-notify-bin/ [...]