Super Challenge Bot Enhancements

Discuss technical problems and features here
User avatar
daegga
Green Belt
Posts: 396
Joined: Thu Jul 09, 2015 12:00 am
Location: Upper Austria
Languages: -
-- ≥ C1 passive --
Bavarian**, German*
English (IELTS 8.5)
+ Scandinavian (a: N>S>D)
-- ≤ A2 --
French, Finnish
+ Old Norse, Slovene
Language Log: viewtopic.php?f=15&t=704
x 424
Contact:

Re: Super Challenge Bot Enhancements

Postby daegga » Mon May 02, 2016 5:53 pm

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.
0 x
vse je v redu

User avatar
kanewai
Green Belt
Posts: 383
Joined: Fri May 22, 2015 9:10 pm
Location: Honolulu
Languages: Native: English
Active: French, Italian, Spanish, Arabic
Inactive: Turkish, Indonesian, Pááfang
Very Inactive: Latin, Ancient Greek
x 1254
Contact:

Re: Super Challenge Bot Enhancements

Postby kanewai » Mon May 02, 2016 7:52 pm

I would have never figured out that it was reading #movies as Moldavian.
1 x
Santiago Posteguillo, Las legiones malditas: 65 / 100
Victor Hugo, Quatrevingt-treize: 95 / 350
Italo Calvino, Marcovaldo: 65 / 150
L.L. Arabic: 15 / 30
Margaret Atwood, The Testaments: 300 / 415

User avatar
rdearman
Site Admin
Posts: 4728
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
Language Log: viewtopic.php?f=15&t=1836
x 11275
Contact:

Re: Super Challenge Bot Enhancements

Postby rdearman » Mon May 02, 2016 8:18 pm

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.
3 x
: 6 / 100 100 Italian paperbacks:
: 306 / 75000 Output Challenge 2019 (普通话写作):

Lollygagging Podcast available on iTunes

User avatar
Allison
Orange Belt
Posts: 247
Joined: Fri Dec 18, 2015 4:21 am
Location: New York City, NY, US
Languages: English (native), Spanish (high intermediate-ish), American Sign Language (ASL) (I dabble occasionally)
Language Log: viewtopic.php?f=15&t=5177
x 410

Re: Super Challenge Bot Enhancements

Postby Allison » Fri May 27, 2016 3:01 am

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:
1 x

User avatar
rdearman
Site Admin
Posts: 4728
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
Language Log: viewtopic.php?f=15&t=1836
x 11275
Contact:

Re: Super Challenge Bot Enhancements

Postby rdearman » Mon Jun 06, 2016 9:06 pm

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.
1 x
: 6 / 100 100 Italian paperbacks:
: 306 / 75000 Output Challenge 2019 (普通话写作):

Lollygagging Podcast available on iTunes

User avatar
Serpent
Black Belt - 3rd Dan
Posts: 3419
Joined: Sat Jul 18, 2015 10:54 am
Location: Moskova
Languages: heritage
Russian (native); Belarusian, Polish

fluent or close: Finnish+ (certified C1), English; Portuguese, Spanish, German+, Italian+
learning: Croatian+, Ukrainian, Czech; Romanian+, Galician; Danish, Swedish
exploring: Latin, Karelian, Catalan, Dutch, Chaucer's English
+ means exploring the dialects/variants
x 4581
Contact:

Re: Super Challenge Bot Enhancements

Postby Serpent » Sat Jun 11, 2016 2:22 pm

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:
0 x
LyricsTraining now has Finnish and Polish :)
Corrections welcome

User avatar
rdearman
Site Admin
Posts: 4728
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
Language Log: viewtopic.php?f=15&t=1836
x 11275
Contact:

Re: Super Challenge Bot Enhancements

Postby rdearman » Sat Jun 11, 2016 9:23 pm

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.
1 x
: 6 / 100 100 Italian paperbacks:
: 306 / 75000 Output Challenge 2019 (普通话写作):

Lollygagging Podcast available on iTunes

User avatar
Serpent
Black Belt - 3rd Dan
Posts: 3419
Joined: Sat Jul 18, 2015 10:54 am
Location: Moskova
Languages: heritage
Russian (native); Belarusian, Polish

fluent or close: Finnish+ (certified C1), English; Portuguese, Spanish, German+, Italian+
learning: Croatian+, Ukrainian, Czech; Romanian+, Galician; Danish, Swedish
exploring: Latin, Karelian, Catalan, Dutch, Chaucer's English
+ means exploring the dialects/variants
x 4581
Contact:

Re: Super Challenge Bot Enhancements

Postby Serpent » Fri Nov 25, 2016 11:50 pm

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?
0 x
LyricsTraining now has Finnish and Polish :)
Corrections welcome

User avatar
daegga
Green Belt
Posts: 396
Joined: Thu Jul 09, 2015 12:00 am
Location: Upper Austria
Languages: -
-- ≥ C1 passive --
Bavarian**, German*
English (IELTS 8.5)
+ Scandinavian (a: N>S>D)
-- ≤ A2 --
French, Finnish
+ Old Norse, Slovene
Language Log: viewtopic.php?f=15&t=704
x 424
Contact:

Re: Super Challenge Bot Enhancements

Postby daegga » Wed Apr 19, 2017 4:46 pm

The bot seems to be hanging in an endless loop ...
1 x
vse je v redu

User avatar
rdearman
Site Admin
Posts: 4728
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
Language Log: viewtopic.php?f=15&t=1836
x 11275
Contact:

Re: Super Challenge Bot Enhancements

Postby rdearman » Wed Apr 19, 2017 7:40 pm

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.
0 x
: 6 / 100 100 Italian paperbacks:
: 306 / 75000 Output Challenge 2019 (普通话写作):

Lollygagging Podcast available on iTunes


Return to “Technical Support and Feature Requests”

Who is online

Users browsing this forum: No registered users and 1 guest