I think I'm posting way too much :-(

Rebol [
        Title: "Newsgroup posters"
        Date: [ 8-May-2001 ]
        Author: "Graham Chiu"
        File: %newstats.r
        Notes: { find who has been posting to the Rebol newsgroups
}
]

; First some supporting code of Jeff's
do load-thru http://www.codeconscious.com/rebol-library/scroll-face.r

targeturl: http://www.escribe.com/internet/rebol/index.html?by=Date&n=
names: copy []
rule: [ some [ thru "[REBOL]" to <B> thru <B> copy author to
</B> ( append names author ) ] ]

; see how many pages there are
; it's in this format : "Date Index page 1 of 86. ["

parse read join targeturl 1 [ thru "Date Index page 1 of "
copy NoOfPages to "." ]
NoOfPages: to-integer NoOfPages
data: copy []

; NoOfPages: 30
cnt: 0
loop NoOfPages [
        cnt: cnt + 1
        parse read join targeturl cnt rule
]

UniqueAuthors: unique names

; to return the minimum pair possible from 2 pairs
minpair: func [ p1 [pair!] p2 [pair!]
        /local xy ] [
        xy: make pair! 0x0 
        xy/x: min p1/x p2/x 
        xy/y: min p1/y p2/y 
        return xy 
]

Occurences: func [ name [string!] 
        /local counter
        ][
        counter: 0      
        foreach poster names [
                if equal? poster name [
                        counter: counter + 1
                ]
        ]
        return counter
]

; now to build up a block of statistics - [ name1 posts1
name2 posts2 name3 posts3 ]

foreach author UniqueAuthors [
        ; count each occurrence of author in names
        append data reduce [ Occurences author author ]
]

data: sort/reverse/skip data 2

lo: copy { banner "Rebol Newsgroup Stats - top 100" space
4x0 }
boxsize: 10x10

across: "across box blue "
txt: " txt ^""
ret: "^" return "

; only want the top 100
data: copy/part data 200

foreach [ cnt name ] data [
        boxsize/x: cnt 
        append lo reduce [ across boxsize txt name "(" cnt ")" ret
]
]

lom: layout load lo
view center-face scroll-face lom minpair lom/size (
system/view/screen-face/size - 50x50 )

--
Graham Chiu
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to