Reminder Program

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.

Reminder Program

Postby waqaskhawaja » Tue Aug 07, 2007 7:43 pm

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?
waqaskhawaja
Lance Naik
 
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
WLM: w_kh@hotmail.com
Yahoo Messenger: waqas.khawaja@yahoo.com
Location: Lahore Pakistan

Postby lambda » Wed Aug 08, 2007 12:20 am

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.
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

Postby waqaskhawaja » Wed Aug 08, 2007 3:38 pm

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.
waqaskhawaja
Lance Naik
 
Posts: 44
Joined: Thu Aug 31, 2006 8:52 pm
WLM: w_kh@hotmail.com
Yahoo Messenger: waqas.khawaja@yahoo.com
Location: Lahore Pakistan

Postby lambda » Wed Aug 08, 2007 4:27 pm

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).
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore


Return to “%s” Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron