Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Programmer > Advice on inter...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 52612 of 53789
Post > Topic >>

Advice on interesting reading and updating num. of views/day for

by edfialk <edfialk@[EMAIL PROTECTED] > May 9, 2008 at 12:03 PM

Hello, I'm hoping someone is intrigued and feels like conquering this.

I need to keep track of number of views per day for a particular
object.  I was thinking of making it a comma separated string
("10,12,0,15,13",etc.).  In addition to this field I keep track of the
last time the string was updated.

So, if the views currently are "10,12,0,15,3", the date is set to 2
days before now, and I need to update, the views would become
"1,0,10,12,0,15,3" and the date would be set to now.

1 view today, 0 yesterday, 10 the day before that, etc.

This very well might not be the best way to do it but it's the best
way I can think of right now.
I'm probably going to need to keep track of the last .... 60 days of
views.

So, time to add a new view.

First, I check how many days are recorded.
   If none, set view to 1, date to now, return.
   If 1, check when it was last updated.
            If today, add a view and return.
            Else
                 *Figure out some good way to count how many days ago
the date was and update accordingly.

   Else if more than 1, check date, etc.

So one tough part is how many days ago was this view_date?  I can get
month/day, but say it's set to 12/25 and today is 3/1.  I need number
of days in each of months in between view_month and now_month (along
with checking year), subtract that from view_day, add that to now_day,
then update accordingly.

I think I can get it to work, but it'll be ugly.

So, just asking if anyone has any helpful ideas or tips that might
save me some any of my numerous if thens along the way.

Any advice would be greatly appreciated!
Thanks!

-Ed
 




 1 Posts in Topic:
Advice on interesting reading and updating num. of views/day for
edfialk <edfialk@[EMAI  2008-05-09 12:03:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 23:33:17 CDT 2008.