GC> I want to get news from some sites.
> This is a good start; nice and abstract.
;-)
GC> In the first phase I want to fill an array which will contain
GC> objects with data like: news_site news_tittle getnews_method
GC> getnewsinfo1_method
> Let's forget about arrays and objects for a moment. How is the data
> structured, what are the relationships, how is it loaded? e.g.
The software will accept a list of sites, from 1 to n.
I'll build a common access method called "read news" whose code is different
from the site we are reading the news from.
The following data will be retrieved and stored on memory and disk.
NEWS ORIGIN ; NEWSID ; NEWSLINK ; NEWS TITTLE ; NEWSDATE ; NEWS DATE ADDED;
FILE ID
The program will stop at the first news duplicated and will work in
"transaction mode". If the connection is lost, the whole "read news" for the
site will be dropped.
<FILE ID> is the file name used to save the news on the HD. Actually we will
save one file per news for commodity reason: <FILE ID>.HTML
Probably the first line of <FILE ID>.HTML will be a a copy of the NEWS
index.
When news are loaded in memory or retrieved from internet some methods will
be attached to the news list like "read, delete, refresh, GETLINKS (site
dependent), getpictures, REFRESH NEWS (site dependent)".
Thinking old programming code (C above all) it would be a simple addition of
a pointer addressing the proper library of code containing the required
functions.
> It sounds like you have two lists: a list of ~10'000 news sites, and
> a list of ~10 methods that are used to read those sites. Is that
> correct? And you need to know which method to use for each site.
10-20 news sites with 10-20 codes used to retrieve 10.000 news.
> types
> method-1
> method-2
> ...
> news-sites ; ~10'000
10-20
> title ; is this dynamic or static?
(Static)
> url ; the target data source
> type ; tells us how to read it, ~10 types (origins)
> news-site
> read ; method to read data from the site
> data: [
> site-1 http://blah-1 method-1
> site-2 http://blah-2 method-2
> ]
...
GC> I know I could do this using a "switch" statement and
GC> getnews_method will point to the code associated with that site
GC> value but I want to use a more compact version of the function.
> Something like this:
> read-site: func [site] [
> do get newsarray/:site/type newsarray/:site/url
> ]
A little difference:
read-site: func [site] [
do get sitearray/:site/type newsarray/:site/url
]
GC> (I want to understand more complicated things)
> Don't confuse complexity with power. :) REBOL's power does not come
> from complexity.
REBOL needs some more docs.
Giuseppe Chillemi
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.