Re: Please speculate: "saved articles" functionality on www.news.com

From: Manohar Kamath [MVP] (mkamath_at_TAKETHISOUTkamath.com)
Date: 02/13/04


Date: Fri, 13 Feb 2004 17:46:48 -0600

Ken,

I had implemented this a while ago, for a site which is now defunct. I took
an approach similar to what you have described -- save an ID on client
machine and store all the articles on a database. The only caveat was, the
user had to be a registered member, and that way you don't clog up your
database with "orphaned" articles.

For a small list of articles, I would recommend using XML to save your IDs.
Why XML? Cos then you can expand the list to contain maybe the article
headers, etc. Save this entire XML as a cookie on the client, and as long as
this is <4K, you should not have any problem.

<root>
    <articles>
        <article id="123" title="This is the first article" />
        <article id="345" title="This is the second article" />
    </articles>
</root>

XML is also easier to manipulate using the MSXML component. Otherwise, you
are relying on some delimiters in your final string, and it can be a mess to
expand upon.

Also, saving this info on client avoids unnecessary database trips as well.
Finally, the design depends on what the user-scenario is like.

-- 
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Ken Fine" <kenfine@u.washington.edu> wrote in message
news:c0j6fl$qcu$1@nntp6.u.washington.edu...
> Can folks take a look at the "saved articles" functionality on
www.news.com
> and speculate how they're working the magic? Also, can we have a
discussion
> as to the pros and cons of various design approaches for this kind of
"saved
> articles" functionality? I'm going to speculate how this works, and
> hopefully some  of you can tell me where I'm way off.
>
> The interesting thing about www.news.com's approach is that it's done in
> javascript without page reloads. The articleIDs are probably being written
> to dynamically named (i.e. incremented) hidden form elements. You're
limited
> to 10 articles. I presume that when you switch to a different page, the
> values in the hidden form elements are written to cookies on the user's
> local machine.
>
> I'm wondering why the limit of 10. I'm also wondering about the best
> approach for storing this kind of information as cookies in terms of
naming.
> I would think that it's probably doing something like (assuming ASP):
>
> response.cookies('newscomcarticleids")("1401") ...
> response.cookies('newscomcarticleids")("1280") ...
>
> Would this be a reasonable approach, or are there better ways? What is the
> limit on the number of articles that could be stored?
>
> I presume that when the visitor asks for the list of saved articles, the
> machine translates the cookies into an array, and pulls out the titles
> corresponding to the saved article IDs with an explict query, e.g.: SELECT
> articletitles... FROM tblarticles WHERE articleid=1401 OR articleid=1280
> OR...Although in news.com's case, they might be saving the title
information
> as well in some manner of cookie.
>
> Another way that "saved articles" functionality could be enabled is by
> writing a unique cookie to each unique visitor's machine, and storing the
> "saved articles" as values in a database using the cookie as a key. I'm
> wondering if anyone has any perspectives regarding how this would scale;
> seems like you would need some automatic DB maintenace to regularly clear
> out inactive users' keys.
>
> An advantage to a DB approach is that "logged in users" could retrieve
their
> saved articles from anywhere, versus having their settings confined to a
> single machine. Maybe you mix approaches (client-side cookies and
> server-stored DB values) to provide maximum ease-of-use for the end user.
>
> Wrapping up a ramble-ly message, anyone with experience implementing this
> sort of system will probably have some useful design perspectives. I think
I
> have the basic ideas down, but I'd love to hear from someone who have
> actually done this.
>
> Thanks,
> -KF
>
>
>


Relevant Pages

  • Re: After Diagnosing Prostate C Then The Decision-Making
    ... The NY TIMES is one of the best newspapers in the World. ... avoiding the annoying cookie crape. ... They are nevertheless a fine, unusual, great independent publication ... at least I can't recall any health -medical articles at ...
    (sci.med.diseases.cancer)
  • Re: Question
    ... Our site is a newspaper site. ... Only subscribed users can view the top 10 ... These top ten articles are shown on the index page with a little ... cookie if a cookie is set then it redirects to the story page. ...
    (microsoft.public.dotnet.general)
  • Re: Question
    ... These top ten articles are shown on the index page with a little ... > cookie if a cookie is set then it redirects to the story page ... > redirect, i don't know what server variable to use. ... Next enable Forms authentication (see <authentication ...
    (microsoft.public.dotnet.general)
  • Re: Question
    ... "Steven Spits" wrote: ... These top ten articles are shown on the index page with a little ... >> cookie if a cookie is set then it redirects to the story page ... >> redirect, i don't know what server variable to use. ...
    (microsoft.public.dotnet.general)
  • please help-xml system
    ... i am trying to learn how xhtml, rss, and xml work (a very basic ... master xml file. ... mywebsite would have articles available for download in small xml files ...
    (comp.lang.java.programmer)