Super Challenge Bot Enhancements

Discuss technical problems and features here
User avatar
daegga
Blue Belt
Posts: 560
Joined: Thu Jul 09, 2015 12:00 am
Location: Upper Austria
Languages: Bavarian (spoken), German
-- ≥ C1 passive --
English (IELTS 8.5)
Scandinavian (a: N>D>S)
-- along the way --
French, Italian
-- can read with dict --
Old Norse
Language Log: https://forum.language-learners.org/vie ... 15&t=17055
x 951
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
jag nöjer mig med tystnad

User avatar
kanewai
Blue Belt
Posts: 753
Joined: Fri May 22, 2015 9:10 pm
Location: Honolulu
Languages: Native: English
Active: Italian
Maintenance: Spanish, French
Priors: Chuukese (Micronesian), Indonesian, Latin, Greek (epic and modern), Turkish, Arabic
x 3219
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
Super Challenge - 50 books
Italian: 11 / 50
Spanish: 50 / 50
French: 16 / 50

User avatar
rdearman
Site Admin
Posts: 7231
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
Language Log: viewtopic.php?f=15&t=1836
x 23122
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
: 0 / 150 Read 150 books in 2024

My YouTube Channel
The Autodidactic Podcast
My Author's Newsletter

I post on this forum with mobile devices, so excuse short msgs and typos.

User avatar
Allison
Orange Belt
Posts: 248
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 411

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: 7231
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
Language Log: viewtopic.php?f=15&t=1836
x 23122
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
: 0 / 150 Read 150 books in 2024

My YouTube Channel
The Autodidactic Podcast
My Author's Newsletter

I post on this forum with mobile devices, so excuse short msgs and typos.

User avatar
Serpent
Black Belt - 3rd Dan
Posts: 3657
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; Romanian, Galician; Danish, Swedish; Estonian
exploring: Latin, Karelian, Catalan, Dutch, Czech, Latvian
x 5179
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: 7231
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
Language Log: viewtopic.php?f=15&t=1836
x 23122
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
: 0 / 150 Read 150 books in 2024

My YouTube Channel
The Autodidactic Podcast
My Author's Newsletter

I post on this forum with mobile devices, so excuse short msgs and typos.

User avatar
Serpent
Black Belt - 3rd Dan
Posts: 3657
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; Romanian, Galician; Danish, Swedish; Estonian
exploring: Latin, Karelian, Catalan, Dutch, Czech, Latvian
x 5179
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
Blue Belt
Posts: 560
Joined: Thu Jul 09, 2015 12:00 am
Location: Upper Austria
Languages: Bavarian (spoken), German
-- ≥ C1 passive --
English (IELTS 8.5)
Scandinavian (a: N>D>S)
-- along the way --
French, Italian
-- can read with dict --
Old Norse
Language Log: https://forum.language-learners.org/vie ... 15&t=17055
x 951
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
jag nöjer mig med tystnad

User avatar
rdearman
Site Admin
Posts: 7231
Joined: Thu May 14, 2015 4:18 pm
Location: United Kingdom
Languages: English (N)
Language Log: viewtopic.php?f=15&t=1836
x 23122
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
: 0 / 150 Read 150 books in 2024

My YouTube Channel
The Autodidactic Podcast
My Author's Newsletter

I post on this forum with mobile devices, so excuse short msgs and typos.


Return to “Technical Support and Feature Requests”

Who is online

Users browsing this forum: No registered users and 2 guests