Page 5 of 6

Re: Super Challenge Bot Enhancements

Posted: Mon May 02, 2016 5:53 pm
by daegga
Something like that should work for fixing the language matching problem:

in database.php

Code: Select all

function findLanguageInString($string)
{
    // get a list of options
    global $preferences;
    global $link;
    $columnnames = array("Code", "Name");
    $data = mysqli_query($link, "SELECT ".implode(", ", $columnnames)." FROM Language")
    or die(__FILE__.__LINE__.mysqli_error($link));

    // check against all languages in the database
    while($info = mysqli_fetch_array($data))
    {
        // check against all specified columns
        foreach($columnnames as $columnname)
        {
            if (preg_match("/#".$info[$columnname]."(#|\s|$)/i", $string) === 1)
                return $info;
        }
    }
   
    // return it
    return null;
}


I don't know any php and it isn't tested, so use with care. Only the body of the foreach loop was changed.

Re: Super Challenge Bot Enhancements

Posted: Mon May 02, 2016 7:52 pm
by kanewai
I would have never figured out that it was reading #movies as Moldavian.

Re: Super Challenge Bot Enhancements

Posted: Mon May 02, 2016 8:18 pm
by rdearman
daegga wrote:Something like that should work for fixing the language matching problem:

in database.php

Code: Select all

function findLanguageInString($string)
{
    // get a list of options
    global $preferences;
    global $link;
    $columnnames = array("Code", "Name");
    $data = mysqli_query($link, "SELECT ".implode(", ", $columnnames)." FROM Language")
    or die(__FILE__.__LINE__.mysqli_error($link));

    // check against all languages in the database
    while($info = mysqli_fetch_array($data))
    {
        // check against all specified columns
        foreach($columnnames as $columnname)
        {
            if (preg_match("/#".$info[$columnname]."(#|\s|$)/i", $string) === 1)
                return $info;
        }
    }
   
    // return it
    return null;
}


I don't know any php and it isn't tested, so use with care. Only the body of the foreach loop was changed.

A programmer once said, "I have a problem, I'll use a regular expression." Now the programmer has two problems. :lol:

I will have a look at it. That is also the function which need to be repaired to match a 3 character code first, then the 2 character codes.

Re: Super Challenge Bot Enhancements

Posted: Fri May 27, 2016 3:01 am
by Allison
rdearman wrote:
Yuurei wrote:There seems to be a little problem with the participant pages on the SC website. It shows the following warning everywhere:

Code: Select all

Warning: Division by zero in /home/xgipubli/public_html/sc2016-17/participant.php on line 341

OK, there was a problem with the code which calculated the dates and the amount of books you'll read. This worked before the 1st of May because the days remaining in the challenge were zero, and you can divide zero by zero, but not any other number. Why it didn't occur to me to look at the actual numbers I don't know. Anyway I've just rolled back 1 version and I'll fix that when I get back from the Polyglot conference, it doesn't effect the functioning of the bot.

I'm checking in for an update on this one, since we're approaching the point where the math becomes slightly harder for me to do on my own once the number of days into the challenge isn't just the date. :lol:

Re: Super Challenge Bot Enhancements

Posted: Mon Jun 06, 2016 9:06 pm
by rdearman
Allison wrote:
rdearman wrote:
Yuurei wrote:There seems to be a little problem with the participant pages on the SC website. It shows the following warning everywhere:

Code: Select all

Warning: Division by zero in /home/xgipubli/public_html/sc2016-17/participant.php on line 341

OK, there was a problem with the code which calculated the dates and the amount of books you'll read. This worked before the 1st of May because the days remaining in the challenge were zero, and you can divide zero by zero, but not any other number. Why it didn't occur to me to look at the actual numbers I don't know. Anyway I've just rolled back 1 version and I'll fix that when I get back from the Polyglot conference, it doesn't effect the functioning of the bot.

I'm checking in for an update on this one, since we're approaching the point where the math becomes slightly harder for me to do on my own once the number of days into the challenge isn't just the date. :lol:

I've put this change live now. Let me know if you encounter any problems.

Re: Super Challenge Bot Enhancements

Posted: Sat Jun 11, 2016 2:22 pm
by Serpent
would it be possible to make the bot just use the text in quotation marks as title, without searching it for keywords/tags? during the previous challenge I watched a video called "how to learn everything in 20 hours" :lol:

Re: Super Challenge Bot Enhancements

Posted: Sat Jun 11, 2016 9:23 pm
by rdearman
Serpent wrote:would it be possible to make the bot just use the text in quotation marks as title, without searching it for keywords/tags? during the previous challenge I watched a video called "how to learn everything in 20 hours" :lol:

I will look at it.

Re: Super Challenge Bot Enhancements

Posted: Fri Nov 25, 2016 11:50 pm
by Serpent
That's a minor thing but is it possible to change the bot link that's displayed in "posted via Language Challenge Bot"? right now it links to the static site.

also did surrealix ever give you the code for the totals ranking?

Re: Super Challenge Bot Enhancements

Posted: Wed Apr 19, 2017 4:46 pm
by daegga
The bot seems to be hanging in an endless loop ...

Re: Super Challenge Bot Enhancements

Posted: Wed Apr 19, 2017 7:40 pm
by rdearman
daegga wrote:The bot seems to be hanging in an endless loop ...

Can you send me the link to the page you're trying to see? It seems fine to me.