Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.advocacy > #355270
| From | Melzzzzz <mel@zzzzz.com> |
|---|---|
| Newsgroups | comp.os.linux.advocacy |
| Subject | Re: Melzzzzz, where's your stats source code? |
| Date | 2016-05-14 15:00 +0200 |
| Organization | albasani.net |
| Message-ID | <20160514150026.71228635@maxa-pc> (permalink) |
| References | <nh5uo7$gca$1@dont-email.me> <20160514041144.59c3bfaa@maxa-pc> <nh64ll$tib$1@dont-email.me> <fhgvm.fkf0iz@rooftop.invalid> <nh67q5$4pu$2@dont-email.me> |
On Sat, 14 May 2016 00:02:32 -0400
DFS <nospam@dfs.com> wrote:
> On 5/13/2016 11:16 PM, owl wrote:
> > DFS <nospam@dfs.com> wrote:
> >> On 5/13/2016 10:11 PM, Melzzzzz wrote:
> >>> On Fri, 13 May 2016 21:27:53 -0400
> >>> DFS <nospam@dfs.com> wrote:
> >>>
> >>>> It's time for you to post it.
> >>>
> >>> Sure...
> >>
> >> ?
> >>
> >
> > That code is Melzzzzz'zz. Make your own.
>
>
> That code belongs to the community!
>
>
I won't post all but here is relevant part (golang):
ids,_ := conn.NewNews(grp,tm)
out := fmt.Sprintln("articles",len(ids),"since",tm)
rt := fmt.Sprintln(n,l,h)
var stat = make(map[string]int)
var subjects = make(map[string]int)
type Posters struct {
reader,poster string
}
var readers = make(map[Posters]int)
var repl = make(map[string]int)
for _,v := range ids {
v := strings.Replace(v,"%","%%",-1)
article,err := conn.Head(v)
if err == nil {
poster := RFC2047.Decode(article.Header["From"][0])
stat[poster]++
if rdr,ok := article.Header["X-Newsreader"];ok {
readers[Posters{rdr[0],poster}]++
} else if rdr,ok = article.Header["X-Mailer"];ok {
readers[Posters{rdr[0],poster}]++
} else if rdr,ok = article.Header["User-Agent"];ok{
readers[Posters{rdr[0],poster}]++
} else {
readers[Posters{"unknown",poster}]++
}
if s,ok:=article.Header["References"];ok {
ss := s[0]
strs := strings.Split(ss," ")
fmt.Sscan(ss,&ss);
subjects[strings.Replace(ss,"%","%%",-1)]++
parent,err := conn.Head(strings.Replace(strs[len(strs)-1],"%","%%",-1))
if err == nil {
repl[RFC2047.Decode(parent.Header["From"][0])]++
}
} else {
subjects[v] = 0
}
} else {
fmt.Println("error:",v,":",err)
stat["unknown"]++
}
}
tr1 := avl.New()
for k,v := range subjects {
fmt.Println(k,v)
article,err := conn.Head(k)
if err == nil {
tr1.InsertEqual(tree.Item{Key(v),RFC2047.Decode(article.Header["Subject"][0])})
} else {
log.Print(err)
}
}
tr := avl.New()
for k,v := range stat {
tr.InsertEqual(tree.Item{Key(v),k})
}
tr2 := avl.New()
for k,v := range readers {
tr2.InsertEqual(tree.Item{Key(v),k})
}
tr3 := avl.New()
for k,v := range repl {
tr3.InsertEqual(tree.Item{CRatio(stat[k],v),k})
}
out += fmt.Sprintln("\nPosters with most posts\nPosts\tPoster\tPosters",tr.Size())
for i := tr.Begin();i!=tr.End();i=i.Next() {
out += fmt.Sprintln(i.Value().Key.(Key),"\t",i.Value().Value.(string))
}
out += fmt.Sprintln("\nSubjects with most replies\nReplies\tSubject\tSubjects",tr1.Size())
for i := tr1.Begin();i!=tr1.End();i=i.Next() {
out += fmt.Sprintln(i.Value().Key.(Key),"\t",i.Value().Value.(string))
}
out += fmt.Sprintln("\nMost posts by newsreader,poster\nPosts\t\tReader,Poster\tReaders",tr2.Size())
for i := tr2.Begin();i!=tr2.End();i=i.Next() {
out += fmt.Sprintln(i.Value().Key.(Key),"\t",i.Value().Value.(Posters).reader,",",i.Value().Value.(Posters).poster)
}
out += fmt.Sprintln("\nPosters with most replies\nRatio\tReplies/Posts\tPoster")
for i := tr3.Begin();i!=tr3.End();i=i.Next() {
ratio := i.Value().Key.(Ratio)
out += fmt.Sprintf("%d/%d\t%f\t%s\n",ratio.replies,ratio.posts,float64(ratio.replies)/float64(ratio.posts),i.Value().Value.(string))
}
Back to comp.os.linux.advocacy | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-13 21:27 -0400
Re: Melzzzzz, where's your stats source code? Melzzzzz <mel@zzzzz.com> - 2016-05-14 04:11 +0200
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-13 23:08 -0400
Re: Melzzzzz, where's your stats source code? owl <owl@rooftop.invalid> - 2016-05-14 03:16 +0000
Re: Melzzzzz, where's your stats source code? Melzzzzz <mel@zzzzz.com> - 2016-05-14 05:22 +0200
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-14 20:47 -0400
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-14 00:02 -0400
Re: Melzzzzz, where's your stats source code? owl <owl@rooftop.invalid> - 2016-05-14 05:09 +0000
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-15 12:00 -0400
Re: Melzzzzz, where's your stats source code? owl <owl@rooftop.invalid> - 2016-05-15 17:07 +0000
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-15 14:12 -0400
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-15 20:05 -0400
Re: Melzzzzz, where's your stats source code? owl <owl@rooftop.invalid> - 2016-05-16 01:45 +0000
Re: Melzzzzz, where's your stats source code? owl <owl@rooftop.invalid> - 2016-05-16 02:06 +0000
Re: Melzzzzz, where's your stats source code? Melzzzzz <mel@zzzzz.com> - 2016-05-14 15:00 +0200
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-16 19:16 -0400
Re: Melzzzzz, where's your stats source code? Melzzzzz <mel@zzzzz.com> - 2016-05-17 01:28 +0200
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-16 19:45 -0400
Re: Melzzzzz, where's your stats source code? Steve Carroll <fretwizzer@gmail.com> - 2016-05-16 18:19 -0700
Re: Melzzzzz, where's your stats source code? DFS <nospam@dfs.com> - 2016-05-18 09:14 -0400
No body wants your defective source code John Gohde <john.h.gohde@gmail.com> - 2016-05-13 20:27 -0700
Re: No body wants your defective source code owl <owl@rooftop.invalid> - 2016-05-14 03:45 +0000
Can owl kindly STOP pooping crap all over the place? John Gohde <john.h.gohde@gmail.com> - 2016-05-14 05:26 -0700
Re: Melzzzzz, where's your stats source code? 7 <7@enemygadgets.com> - 2016-05-14 11:14 +0000
Re: Melzzzzz, where's your stats source code? John Gohde <john.h.gohde@gmail.com> - 2016-05-14 05:28 -0700
csiph-web