Contact Info / Websites

Entry #3

messing around with the NG BBS topics

2016-03-18 12:49:40 by RedN

I wrote a small program in Ruby that can gather interesting stats from any given topic in the NG forums:

1) The users who have posted the most in the given topic.

2) How many supporters,moderators,staff members have posted in the topic.

3) How many people with a given aura (gamers, audiophiles, programmers etc.) have posted in the topic.

4) The levels of the posters.

Tried finding the user who has posted the most on  (New User Introduction Thread), result :

It was kinda slow, 55 seconds to go through 1351 posts.4256992_145831977863_BJOO10u.png

Well, the topic has 1351 posts, and DoctorStrongBad has 243/1351 = 18% of the posts there, almost 1/5 !

The resulting USERS hash will contain all the posters, their post counts in the topic, their level, status, aura...

What is interesting is that it's possible to represent the data in a pie chart, with :

- Only 2 options : supporters vs non-supporters.

- Staff, Moderators and Members.

- By the levels (with or without ranges like 10-20,20-30 etc.).

- By the auras.

- By the usernames (only the top posters)

I found a good Ruby library to do it (

[EDIT] Here is the script, if anyone's interested:


You must be logged in to comment on this post.


2016-03-19 00:16:10

That's pretty sweet man, maybe tell Tom about it? Maybe he could use it for something

RedN responds:

Thanks, I don't think that Tom could need it, because he's able to run code on the server side.
You're welcome if you want the source code, or just an executable.


2016-03-20 17:53:36

you could do all this with dozens line of shell scripting, preferrable bash or korn. ruby is nice but not that efficiency.

RedN responds:

Yes, it could be done in Bash, but what I like in Ruby is:
1) it's good for string processing.
2) Because the resulting hash is enumerable, it's very simple and easy to manipulate it (sort, count, group-by etc.), with Bash, it wouldn't be as easy (imperative programming), for people who will use the script, Ruby is simplier I think.
example : group the users by their aura:
USERS.group_by{|k,v| v[:aura] }
# result : auras as keys, and arrays of users as values.
count the total number of posts made by supporters:
p USERS.reduce(0){|m,(k,v)| m + (v[:supporter] ? v[:count] : 0)}
# that is, start with 0, and on every user, if he's a supporter, add his post count to m, otherwise, leave m as it is (add 0 to it)
# result : 265