18 mars 2008

Using remind to always be on time with birthdays

I'm sure a lot of people are like me, always forgetting the birthdays, because it's coming faster than expected (March already?? No way! it was January just yesterday!)

Step One: get remind
Anyway, if you are using Unix or Linux, you can install remind, a small software that we'll help you stay on track with your friends and their ages. To get it, with Mandriva, pretty easy:

urpmi remind

Step Two: create the reminding file
To use remind, you must create a file with the list of all your friends' birthdays. That's probably the longest part of this how-to, but you only do it once, and then it's good to go for all your life !! You can call this file file_remind for example. The file doesn't need any extension.

The file is just a plain text file. You can use vi, the simplest editor. I personally use gvim, its graphical version (with colors). Now, ready to start? Here we go !

The first line of the file is going to be the most difficult one: we are going to create an age calculating function, considering that you know in which year your friends are born. Mine looks like this:

FSET depuis(x)(year(trigdate())-x)

FSET means (c'mon you're not morons!) Function SET.
depuis is the actual name of my function ('cause I'm French)
x is the variable (you can call it toto, fcuk or yr if you like, it doesn't matter)
year is a remind function which gets the year from a date
trigdate() result is the exact date where you launched the remind command

So if we analyse quickly, depuis is going to get the year from the actual date (the year we are in right now), and substract x from it.

You'll understand better when I show you the second line of my file:

REM 9 Nov +7 MSG Anniversaire POIPOI: [depuis(1982)] ans %b


REM tells remind that this line is a reminder. If you're looking for the others, here is Remind man page. You can also access it by typing man remind in your console.
9 Nov is the date of the birthday I want to remember (and you should remember it too, that's mine! ;))
+7 tells remind to give me this information for 7 days before the birthday date. If you want to be reminded only the day before, just put +1.

MSG and what is following is the actual message that remind will show upon using remind.
[depuis(1982)] is the function we created in the first step, where x is 1982 here, my birth year. So dpeuis is going to substract 1982 to whatever year we are in today. (2007-1982 = 25)
%b shows, when you run remind, the number of days remaining until the actual date of the reminder.

Step Three: Result
To run remind, you just have to launch the command remind, followed by your file's name. And here is the result I get (on Nov 3rd 2007):

remind file_remind

Anniversaire POIPOI: 25 ans dans 6 jours

Everything that was behind MSG is showed. Anniversaire POIPOI just appears normally, then the depuis function calculates my age (you must put "ans" to actually get a French sentence, because depuis only gives you the number). And thanks to %b we know that it's "dans 6 jours" i.e. in 6 days.

Now you just have to copy and paste this line as many time as friends' birthdays you want to remember, change the dates and years, and you are good to go. If you don't want to deal with this (basic though) programming, there is a graphical version of remind, that you can find on the official site. And here is the Wiki, if you want to know more!

P.S: now the next step is to get remind to be launched when your computer start, because is you forget to run remind, you'll miss so birthdays for sure !

Aucun commentaire: