Reminder Program

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.
Post Reply
waqaskhawaja
Lance Naik
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
Location: Lahore Pakistan
Contact:

Reminder Program

Post by waqaskhawaja »

Using MySql and Java, I have to write a program for reminders. A reminder's date and time could be set and then an alert to the user is displayed on the date and time that was set.

How do I know that it is now time to alert the user? I do not want to check the reminders table every five minutes. Most of the search at google returned birthday reminders that work on a specific date. Checking for a date once in a day is alright but how to manage time-based reminders?
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

why don't you want to check once every five minutes?

i guess you could load the next hour's data once an hour, and then fire off threads to deal with the messaging every five minutes.
waqaskhawaja
Lance Naik
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
Location: Lahore Pakistan
Contact:

Post by waqaskhawaja »

lambda wrote:why don't you want to check once every five minutes?
The reminder can be set for any time in hours and minutes. With dozens of users using the reminder option in a web application, querying (probably) hundreds of reminders every minute does not seem to be a good idea.
lambda wrote:i guess you could load the next hour's data once an hour, and then fire off threads to deal with the messaging every five minutes.
It sounds good. I'll look into it. Thanks.
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

waqaskhawaja wrote:The reminder can be set for any time in hours and minutes. With dozens of users using the reminder option in a web application, querying (probably) hundreds of reminders every minute does not seem to be a good idea.
you should profile instead of speculating. with the appropriate index on reminder date/time, it probably won't take very long. for example, it takes me about 2 seconds to select over 42,000 records on a slow celeron-class 1ghz computer (with one ide drive).
Post Reply