Super Challenge Bot Enhancements

Discuss technical problems and features here
User avatar
daegga
Green Belt
Posts: 387
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 407
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
Her kommer vinter'n - endelig fred å få

User avatar
kanewai
Orange Belt
Posts: 146
Joined: Fri May 22, 2015 9:10 pm
Location: Honolulu
Languages: Native: English
Super Challenge Romance (French, Italian, Spanish, and sometimes Latin)
Inactive: Turkish, Arabic, Bahasa Indonesian, Chuukese (Micronesian)
x 362
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
Louis Aragon, Aurélien: 120 / 700
FSI French, revisited: 13 / 24

Carlos Ruiz Zafón, La sombra del viento: 150 / 500
FSI Spanish: 37 / 55

Elena Ferrante, Storia del nuevo cognome: 216 / 480

User avatar
rdearman
Site Admin
Posts: 2223
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
French (studies), Italian (studies), Mandarin (studies),
Esperanto TAC (Only god knows why), Finnish (only in it for the cookies)
Language Log: viewtopic.php?f=15&t=1836
x 4396
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

User avatar
Allison
Orange Belt
Posts: 228
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 354

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
Correcciones son bienvenidas.

Spanish Super Challenge, as of March 1, 2017:
SC: 1598 / 5000 pages
SC: 3771 / 9000 minutes
SC: 305 / 610 days

User avatar
rdearman
Site Admin
Posts: 2223
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
French (studies), Italian (studies), Mandarin (studies),
Esperanto TAC (Only god knows why), Finnish (only in it for the cookies)
Language Log: viewtopic.php?f=15&t=1836
x 4396
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

User avatar
Serpent
Black Belt - 2nd Dan
Posts: 2269
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 2846
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
: 2 / 40 Budva na pjenu od mora: 3rd season (Croatian/Montenegrin)
LyricsTraining now offers Catalan, Turkish and Japanese romaji

User avatar
rdearman
Site Admin
Posts: 2223
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
French (studies), Italian (studies), Mandarin (studies),
Esperanto TAC (Only god knows why), Finnish (only in it for the cookies)
Language Log: viewtopic.php?f=15&t=1836
x 4396
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

User avatar
Serpent
Black Belt - 2nd Dan
Posts: 2269
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 2846
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
: 2 / 40 Budva na pjenu od mora: 3rd season (Croatian/Montenegrin)
LyricsTraining now offers Catalan, Turkish and Japanese romaji

User avatar
daegga
Green Belt
Posts: 387
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 407
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
Her kommer vinter'n - endelig fred å få

User avatar
rdearman
Site Admin
Posts: 2223
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
French (studies), Italian (studies), Mandarin (studies),
Esperanto TAC (Only god knows why), Finnish (only in it for the cookies)
Language Log: viewtopic.php?f=15&t=1836
x 4396
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


Return to “Technical Support and Feature Requests”

Who is online

Users browsing this forum: No registered users and 1 guest