Page 1 of 2

Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 12:26 am
by PeterT
Hi all!

As you have undoubtedly noticed, the forum was down for a while because I had to move hosts (which involved a lot of database and file shuffling etc). Because I was already changing a lot anyway I also took this chance to upgrade to phphBB3. So far, the conversion process seems to have worked well, but if any bugs crop up please post about them here.

The change in host and forum software has a few advantages:
  • Better user registration CAPTCHA should mean that I no longer have to activate accounts manually.
  • The performance issues that sometimes came up at the old host should not happen any more.
  • PHPbb3 has better, integrated support for file attachments.

The most important drawback (for you, for me there is also the matter of it being more expensive ;)) is that my new host does not support ruby scripts, so for now the medal script will not update. If anyone has the expertise to rewrite it in php, perl or python then contact me.

I'm sorry for the delay (and the delay in activations that preceeded it), but I now work 40 hours a week and don't have as much time to spend on this as before. With the new forum software at least the account activation problem should be solved.

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 12:57 am
by PeterT
Here is the original code for the current medal updating script, in case anyone wants to try porting it:
Code: Select all
require "mysql"

UR_V = "0.6"

CON = ["Classic Contest", ""N" Contest", ""A" Contest",
         ""B" Contest", ""C" Contest", "Design Competition", "End"]
         
LRD = /^.+?: L:? (.*?) D:? (.*?)$/
LR = /^.+?: L:? (.*?)$/
LD = /^.+?: (.*?)$/

l_winners = Hash.new(0)
d_winners = Hash.new(0)
c_winners = Hash.new(0)

L_FAC = D_FAC = C_FAC = 1

CHAMPION_LIGHT = 15
CHAMPION_DARK = 16

ARMADEUS = 14
DARK_MASTER = 13
LIGHT_MASTER = 12
CONTEST_LORD = 11
CONTEST_LEGEND = 10
CONTEST_VETERAN = 9
CONTEST_WINNER = 8

def split_add(match, hash)
   spl = match.split("and").map { |s| s.strip }
   spl.each { |l| hash[l] += 1 }
end

begin
   my = Mysql::new("localhost", "[username]", "[password]", "[dbname]")
   medalpost = my.query("SELECT post_text FROM `phpbb_posts_text` WHERE `post_id`=3685")
   medalpost.each do |row|
      text = row[0].gsub(/\[.*?\]/, "")
      CON.each_index do |i|
         break unless i+1 < CON.length
         reg = Regexp.new(Regexp.escape(CON[i]) + "(.*)" + Regexp.escape(CON[i+1]), Regexp::MULTILINE)
         conlines = reg.match(text)[1]
         conlines.each do |line|
            #puts "line: #{line}"
            if i == CON.length-2
               if m=LD.match(line)
                  #puts "LD: #{m[1]}"
                  split_add(m[1], c_winners)
               end
               next
            end
            if m=LRD.match(line)
               #puts "LRD: #{m[1]} ||| #{m[2]}"
               split_add(m[1], l_winners)
               split_add(m[2], d_winners)
            elsif m=LR.match(line)
               #puts "LR: #{m[1]}"
               split_add(m[1], l_winners)
            end
         end
      end
   end
   
   totals = Hash.new(0)
   l_winners.each { |k,v| totals[k] += v*L_FAC }
   d_winners.each { |k,v| totals[k] += v*D_FAC }
   c_winners.each { |k,v| totals[k] += v*C_FAC }
   
   totals = totals.sort { |a,b| -(a[1]<=>b[1])}
   l_h = l_winners
   d_h = d_winners
   l_winners = l_winners.sort { |a,b| -(a[1]<=>b[1])}
   d_winners = d_winners.sort { |a,b| -(a[1]<=>b[1])}
    c_winners = c_winners.sort { |a,b| -(a[1]<=>b[1])}   
   
   #p l_winners
   #p d_winners
   #p c_winners
   
   tallypost ="[u:63374fd4cb]Overall standing:[/u:63374fd4cb]\n\n"
   totals.each_with_index do |(name, points), i|
      tallypost += "[b:63374fd4cb]#{(i+1).to_s}[/b:63374fd4cb] - [i:63374fd4cb]#{name}[/i:63374fd4cb] - #{points} point#{points>1?'s':''}\n"
   end
   tallypost +="\n\n[u:63374fd4cb]Light medals:[/u:63374fd4cb]\n\n"
   l_winners.each do |name, medals|
      tallypost += "[b:63374fd4cb]#{name}[/b:63374fd4cb] - " + ":lms:"*medals + "\n"
   end
   tallypost +="[color=#DDDDEE:63374fd4cb][/color:63374fd4cb]\n\n[u:63374fd4cb]Dark medals:[/u:63374fd4cb]\n\n"
   d_winners.each do |name, medals|
      tallypost += "[b:63374fd4cb]#{name}[/b:63374fd4cb] - " + ":dms:"*medals + "\n"
   end
   tallypost +="[color=#DDDDEE:63374fd4cb][/color:63374fd4cb]\n\n[u:63374fd4cb]Design medals:[/u:63374fd4cb]\n\n"
   c_winners.each do |name, medals|
      tallypost += "[b:63374fd4cb]#{name}[/b:63374fd4cb] - " + ":cms:"*medals + "\n"
   end
   tallypost += "[color=#DDDDEE:63374fd4cb][/color:63374fd4cb]\n\n(autogenerated on #{Time.now} by updateranking.rb #{UR_V} - DO NOT EDIT THIS POST)"
   
   #puts "UPDATE phpbb_posts_text SET post_text=\"#{my.escape_string(tallypost)}\" WHERE `post_id`=3686"
   
   my.query("UPDATE phpbb_posts_text SET post_text=\"#{my.escape_string(tallypost)}\" WHERE `post_id`=3686")
   
   totals.each do |name, points|
      next if name == "PeterT"
      rank = CONTEST_WINNER
      if l_h[name] >= 15 && d_h[name] >= 10 then rank = ARMADEUS
      elsif l_h[name] >= 15 then rank = LIGHT_MASTER
      elsif d_h[name] >= 10 then rank = LIGHT_MASTER
      elsif points >= 10 then rank = CONTEST_LORD
      elsif points >= 6 then rank = CONTEST_LEGEND
      elsif points >= 3 then rank = CONTEST_VETERAN
      end
      rank = CHAMPION_DARK if d_winners[0][1] == d_h[name]
      rank = CHAMPION_LIGHT if l_winners[0][1] == l_h[name]
      #puts "Making #{name} a #{rank}"
      my.query("UPDATE phpbb_users SET user_rank=#{rank} WHERE `username`=\"#{my.escape_string(name)}\"")
   end
   
ensure
   my.close() if my
end

If you're feeling adventurous you can also try adding the other contest types or additional ouput options ;)

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 3:44 am
by CN Player
oh yeah,am I the 1st one back here.
Peter, I think you shall send an email to each member to let they know that the forum is back.

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 1:09 pm
by NickyNick
Peter, I'll try to find some time and rewrite it on PHP.
And... welcome back everybody! :)

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 1:18 pm
by FF
Nick, please find what's wrong in this script :)
Peter, thank u for rewiving the forum

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 1:21 pm
by NickyNick
And, Peter: I'm not playing a lot, but thank you for new forum. And, maybe we should finish upgrade with new rank pictures (for Masters and Armadeus)? :wink:

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 1:38 pm
by JonathanF
The forum's back!! :) I better get back to playing ;)

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 2:23 pm
by cablelag
Nice. Waiting for your new game :)

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 5:14 pm
by PeterT
CN Player wrote:Peter, I think you shall send an email to each member to let they know that the forum is back.
Good idea, I did that.

NickyNick wrote:And, Peter: I'm not playing a lot, but thank you for new forum. And, maybe we should finish upgrade with new rank pictures (for Masters and Armadeus)? :wink:
I'll see what I can do. I didn't realize we now had an Armadeus :o

cablelag wrote:Nice. Waiting for your new game :)
I'm not Peter Stock -- this really causes a lot of misunderstandings...

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 8:34 pm
by mark_man
:D :D :D :D :D :D :D :D :D :D :D :D glad to see you all again

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Fri Jan 18, 2008 11:36 pm
by NickyNick
mark_man wrote::D :D :D :D :D :D :D :D :D :D :D :D glad to see you all again

Hi my old mate!!! :D :D :D I'm so happy to see you! :armadillo:

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Sat Jan 19, 2008 1:57 am
by ConstableBrew
So all it takes to get registered on this site is to force PeterT to change web hosts?

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Sat Jan 19, 2008 10:52 am
by PeterT
ConstableBrew wrote:So all it takes to get registered on this site is to force PeterT to change web hosts?
No, force me to change forum versions (which has only become possible recently with the release of phpBB3).

Let's just hope that the new image verification system is enough to deter spambots. Believe it or not, but I'm also a lot happier if I don't have to activate each new user manually :P

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Sat Jan 19, 2008 11:49 pm
by JonathanF
Not only the forum's back but markman's back also! That's great!! can't wait to play your levels you made some of the best contests ever!

Re: Metaclassofnil.com moved, forum software upgraded

PostPosted: Sun Jan 20, 2008 5:22 pm
by JustcallmeDrago
CN Player wrote:Peter, I think you shall send an email to each member to let they know that the forum is back.


Heh, I didn't check my email :lol:


It's good to be back.