User talk:ObelusPA2

IdefixBot: Interwiki
Does your bot changes interwikis without your input at all?

And, how does it select random mainspace pages? The namespace parameter doesn't work to me.

--  Naista2002 ᐸ Talk Contribs  14:45, 9 November 2014 (UTC)


 * Also, how does it work automatically? --  Naista2002 ᐸ Talk Contribs  14:58, 9 November 2014 (UTC)
 * I am no longer using Pywikibot, I wrote my bot in Java because there was not enough interesting features in Pywikibot and because my bot is not only working on interwiki links on the French wiki (and because I like programming ^^).


 * But I think that I was using autonomous and random:100 parameters. • ObelusPA2 d · FR Admin · 15:12, 9 November 2014 (UTC)
 * Have you written API to write, login and edit wiki pages through base MediaWiki API yourself or used a ready one (e.g WikiLink, Java Wiki Bot Framework, Wiki.java etc.)? dand0 (talk) 16:33, 9 November 2014 (UTC)
 * I am using JWBF (except for deletion and move logs). • ObelusPA2 d · FR Admin · 16:42, 9 November 2014 (UTC)
 * Thanks (again)! Also, does "Except" mean that you use your own scripts for deletetion and move logs? dand0 (talk) 16:49, 9 November 2014 (UTC)
 * Likely, yes. --  Naista2002 ᐸ Talk Contribs  16:51, 9 November 2014 (UTC)
 * Yes, I had problems with JWBF, so I wrote scripts to read logs with api.php. • ObelusPA2 d · FR Admin · 16:57, 9 November 2014 (UTC)
 * Thanks, anyway! I'm so glad that I will be programming again! --dand0 (talk) 17:05, 9 November 2014 (UTC)

My bot
Can you set a bot flag on my bot JARVISTheBot? I intend to use it on French wiki to fix interlanguage links. -- Naista2002 ᐸ Talk Contribs  10:38, 22 November 2014 (UTC)
 * I'm not a bureaucrat, try to ask Itouchmasterpro. • ObelusPA2 d · FR Admin · 11:24, 22 November 2014 (UTC)

Interwikis in translation articles
Please don't fix interwikis in articles that are parts of translation projects. Wikis in other languages don't have them, so having interwikis there is useless. -- Naista2002 ᐸ Talk Contribs  12:34, 29 November 2014 (UTC)
 * Ok, but I don't understand why translation projects can't have links to other languages, why is it useless ? • ObelusPA2 d · FR Admin · 12:40, 29 November 2014 (UTC)
 * Oops, I maybe forgot that we may need to prepare interwikis so that the target wikis have them being up-to-date. But it will mostly matter when the translations are done.
 * Also, please fix your signature: you meant to put  instead of.
 * -- <b style=color:purple>Naista2002</b> ᐸ <small style="display:inline-block;line-height:9px;vertical-align:-3px">Talk Contribs </i> 13:01, 29 November 2014 (UTC)
 * I removed the color in my signature, it was useless...


 * I think that I will put a priority to articles that are not part of translation projects. • ObelusPA2 d · FR Admin · 13:15, 29 November 2014 (UTC)
 * How it is done? -- <b style=color:purple>Naista2002</b> ᐸ <small style="display:inline-block;line-height:9px;vertical-align:-3px">Talk Contribs </i> 13:38, 29 November 2014 (UTC)
 * I am not using Pywikibot. I write my bot in Java, with JWBF, so I can do everything I want. • ObelusPA2 d · FR Admin · 13:42, 29 November 2014 (UTC)
 * I know, but... Does it exclude translation pages by ignoring the sub-categories of ? -- <b style=color:purple>Naista2002</b> ᐸ <small style="display:inline-block;line-height:9px;vertical-align:-3px">Talk Contribs </i> 13:49, 29 November 2014 (UTC)
 * No, it just looks in the title if there is things like "/cz" or "/ro". I made a list of language tags. • ObelusPA2 d · FR Admin · 13:56, 29 November 2014 (UTC)

IdefixBot summary translation
The summaries for your bot are not translated according to the wiki.

Suggestion: Add an associative array ("map") with language codes as keys, and translated text as values. They are to be in some constant storage class or something like that.

Example for "Adding" text: public static HashMap<String, String> addingTrans = new HashMap<String, String>(number_of_languages); // ...   public YourClass(arguments) { // ...       addingTrans.put("en", "Adding"); addingTrans.put("fr", "Ajoute"); addingTrans.put("ru", "Добавление"); // ...   }

-- <b style=color:purple>Naista2002</b> ᐸ <small style="display:inline-block;line-height:9px;vertical-align:-3px">Talk Contribs </i> 18:53, 2 December 2014 (UTC)
 * I already made a class for this, but I put only French and English... It is now supposed to speak Russian, I will try to find translations for other languages.


 * Can you just translate "Minor changes around interwiki links" into russian please ? And are "изменил" and "удалил" good translations for "modifying" and "removing" ? • ObelusPA2 d · FR Admin · 21:08, 2 December 2014 (UTC)
 * «Малые изменения интервики-ссылок». For sentence «Robot modifying/removing xx» they are. dand0 (talk) 03:34, 3 December 2014 (UTC)
 * Or «изменение» for modifying and «удаление» for removing, it is your choice what to use. dand0 (talk) 03:36, 3 December 2014 (UTC)
 * • ObelusPA2 d · FR Admin · 17:53, 3 December 2014 (UTC)
 * You did not enabled russian translation for minor changes and it will be better to use the second variant for modifying and removing interwikis. dand0 (talk) 13:04, 5 December 2014 (UTC)
 * I don't understand what you mean with "the second variant"… • ObelusPA2 d · FR Admin · 13:21, 5 December 2014 (UTC)
 * I mean it is better to use «изменение» for modifying and «удаление» for removing. Is the russian translation for minor changes enabled? dand0 (talk) 13:36, 5 December 2014 (UTC)
 * I don't have translation for "Minor changes around interwiki links", so russian translation is not enabled yet for this sentence. • ObelusPA2 d · FR Admin · 13:46, 5 December 2014 (UTC)

I told you it in my first message in the conversation. dand0 (talk) 13:49, 5 December 2014 (UTC)
 * Ok, sorry, it seems that I need to buy glasses... • ObelusPA2 d · FR Admin · 13:51, 5 December 2014 (UTC)
 * Google Translate works well for short phrases, but not full sentence.  a20001017 Talk 06:06, 6 December 2014 (UTC)
 * "Minor changes around interwiki links" translates to "Небольшие изменения возле интервики-ссылок". -- <b style=color:purple>Naista2002</b> ᐸ <small style="display:inline-block;line-height:9px;vertical-align:-3px">Talk Contribs </i> 08:17, 6 December 2014 (UTC)

Can you give me the full database of translations? (or perhaps a link to it in some site?) — Yours, Agent Nick the Red37 (t &middot; c) f.k.a. Naista2002 14:14, 6 February 2015 (UTC)


 * And, please change “Малые изменения интервики-ссылок” to “Малые изменения возле интервики-ссылок”; Dand0 mistranslated something. — Yours, Agent Nick the Red37 (t &middot; c) f.k.a. Naista2002 15:57, 6 February 2015 (UTC)
 * My bot only speaks French, English and Russian, I didn't have time to find the other translations, sorry...


 * In french, "Adding" is "Ajout de", "Modifying" is "Modification de" and "Removing" is "Suppression de". • ObelusPA2 d · FR Admin · 16:28, 6 February 2015 (UTC)
 * NickTheRed, are you kidding me? Bot changes interwikis theirselves and nothing around them (for example position (places them after categories)). dand0 (talk) 17:58, 6 February 2015 (UTC)
 * No, but the English phrase is “Minor changes around interwiki links”. That means that it does changes around the links, not to them directly. So the proper translation is “Малые изменения возле интервики-ссылок”. Yours, Agent Nick the Red37 (t &middot; c) f.k.a. Naista2002 18:10, 6 February 2015 (UTC)
 * Have you ever actually seen what the bot did with this summary? ObelusPA2, what does bot do with this summary? List all occasions, please. dand0 (talk) 11:37, 8 February 2015 (UTC)
 * This summary is supposed to be chosen when there is no link addition, modification or deletion. But it is true that there are some bugs, and there is sometimes link deletion with this summary. But initially, this summary is chosen when links are not modified. More of the bugs with that are only on the English wiki. And it is not a reason to fight... • ObelusPA2 d · FR Admin · 13:49, 8 February 2015 (UTC)
 * OK. NickTheRed37, I apologize, you were right. --dand0 (talk) 16:38, 9 February 2015 (UTC)

JWBF
Where to find a documentation on how to write a bot in JWBF? I want to extend JARVIS’ possibilities with it. I’m Nick the Red37, a ru.wiki mod (fka Naista2002) (talk)</b> 17:45, 19 January 2015 (UTC)
 * I only used this to write my bot : http://jwbf.sourceforge.net/doc/


 * But of course, I'm here if you need some help. • ObelusPA2 d · FR Admin · 17:51, 19 January 2015 (UTC)
 * I did found the README.md in the downloaded package. I also have an IDE to build a bot.
 * Now, another problem: I have a lot of .jar libraries in the /lib sub-folder, listed below. What I need to import, and what I don’t?

commons-codec-1.6.jar commons-lang3-3.3.2.jar commons-logging-1.1.3.jar fluent-hc-4.3.4.jar guava-17.0.jar httpclient-4.3.4.jar httpcore-4.3.2.jar httpmime-4.3.4.jar jackson-annotations-2.4.0.jar jackson-core-2.4.1.1.jar jackson-databind-2.4.1.1.jar javax.inject-1.jar jdom2-2.0.5.jar jsr305-3.0.0.jar jwbf-3.0.0-SNAPSHOT.jar slf4j-api-1.7.7.jar
 * I’m Nick the Red37, a ru.wiki mod (fka Naista2002) (talk)</b> 18:00, 19 January 2015 (UTC)
 * Here is what I have : http://i.imgur.com/Z3NZjOa.png It is a bit strange, but it works... • ObelusPA2 d · FR Admin · 18:06, 19 January 2015 (UTC)
 * This is not related to JWBF, but how to make the stdin input not be shown? I.e. for inputting passwords. I’m <b style=color:gray>Nick</b> <b style=color:#001d54>the</b> <b style=color:#6b160f>Red37</b>, a ru.wiki mod f.k.a. Naista2002 </b> 14:12, 21 January 2015 (UTC)
 * I don't know if it is possible in Java. I put passwords in the source code. • ObelusPA2 d · FR Admin · 14:45, 21 January 2015 (UTC)

How to get a diff (revision difference) in JWBF? I’m <b style=color:gray>Nick</b> <b style=color:#001d54>the</b> <b style=color:#6b160f>Red37</b>, a ru.wiki mod f.k.a. Naista2002 </b> 18:01, 22 January 2015 (UTC)
 * There is no way to do that in the API, you have to create the algorithm. • ObelusPA2 d · FR Admin · 18:12, 22 January 2015 (UTC)
 * I found an API for that : https://code.google.com/p/google-diff-match-patch/ • ObelusPA2 d · FR Admin · 18:33, 22 January 2015 (UTC)

Q: How to get results of MediaWiki API requests in JWBF? Like this one: <?xml version="1.0"?> <tokens edittoken="6c82e3a4f17f52ff1e2e4a16b64fed10+\" /> I’m <b style=color:gray>Nick</b> <b style=color:#001d54>the</b> <b style=color:#6b160f>Red37</b>, f.k.a. Naista2002 </b> 14:50, 27 January 2015 (UTC)
 * There is nothing in the API to do that, I use scripts like this one (to get some logs). • ObelusPA2 d · FR Admin · 16:10, 27 January 2015 (UTC)
 * Does this work with POST requests or do I have to use a different code for them? — Yours, Agent Nick the Red37 (t &middot; c) f.k.a. Naista2002 16:15, 9 February 2015 (UTC)
 * I don't know, I never tried to do that. • ObelusPA2 d · FR Admin · 16:21, 9 February 2015 (UTC)

I want to make a page saving thread to save pages separately from the main, editing thread. I have: public class Main {

// the page saving thread public static class UploadThread extends Thread { // omitted constructors

public void run { // run loop while (true) { try { synchronized (this) { if (!uploadThreadActive) // if inactive... wait; // wait until receiving a page }                   while (uploadThreadActive) { // while active... // Retrieve a page from queue Article page = pageQueue.poll; if (page == null) { // empty? // turn the thread off System.out.println("Stopping upload thread"); uploadThreadActive = false; } else { // upload System.out.print("Saving “" + page.getTitle + "”..."); page.save; System.out.println("done"); }                   }                } catch (InterruptedException exc) { // ...               }            }        }        // page queue; it is a priority queue so the smaller pages are saved first private PriorityQueue<Article> pageQueue = new PriorityQueue<Article>(20,           new Comparator<Article> {

@Override public int compare(Article o1, Article o2) { if (o1.getText.length < o2.getText.length) { return 1; } else if (o1.getText.length > o2.getText.length) { return -1; } else { return 0; }               }            });        public boolean postPage(Article page) {            return pageQueue.offer(page);        }    }    // builds the client    public static HttpActionClient createClient(String site) {        return HttpActionClient.builder                .withUrl(site)                .withUserAgent("JARVISTheBot/naista2002.recover@gmail.com/JWBF-3.0.0-SNAPSHOT")                .withRequestsPerUnit(10, TimeUnit.MINUTES)                .build;    }    // thread settings    private static boolean uploadThreadActive = true;    private static UploadThread uploadThread = new UploadThread("UploadThread");

/**    * @param args */   public static void main(String[] args) { // TODO Auto-generated method stub MediaWikiBot wikiBot = new MediaWikiBot(createClient("http://minecraft-ru.gamepedia.com/")); // usernames and passwords are stored in an object in the same package as this class wikiBot.login(ConstData.data.username.get("gamepedia"), ConstData.data.password.get("gamepedia")); // define pages Article page1 = new Article(wikiBot, "Участник:JARVISTheBot/Песочница"); Article page2 = new Article(wikiBot, "Участник:JARVISTheBot/Песочница2"); Article page3 = new Article(wikiBot, "Участник:NickTheRed37/Песочница"); // do edits page1.setText(page1.getText.replace("Test", "Тест")); page1.setEditSummary("Бот: Тест"); page2.setText(page2.getText.replace("Тест", "Test")); page2.setEditSummary("Бот: Тест"); page3.setText(page3.getText.replace("ЙЦУКЕН", "QWERTY")); page3.setEditSummary("Бот: Тест"); // apply edits uploadThread.start; // start the thread postPage(page1); // post pages postPage(page2); postPage(page3); while (uploadThreadActive) {} // wait until the thread turning off }   public static boolean postPage (Article page) { System.out.println("Adding page “" + page.getTitle + "” to the queue"); boolean val = uploadThread.postPage(page); if (!uploadThreadActive) { System.out.println("Restarting upload thread"); uploadThreadActive = true; uploadThread.notify; }       return val; }

}

But I get: Adding page “Участник:JARVISTheBot/Песочница” to the queue Adding page “Участник:JARVISTheBot/Песочница2” to the queue Adding page “Участник:NickTheRed37/Песочница” to the queue Stopping upload thread and the program hangs. Is there something I need to check on my end? — <b style=color:maroon;font-family:sans-serif>NickTheRed37</b> t ⁄ c (f.k.a. Naista2002) 18:38, 4 March 2015 (UTC)
 * Good news : your script works !


 * Bad news : as you can see here, I only changed the login line...


 * This is not really helpful, I think that the problem is related to the "pageQueue" object, but I don't know how "PriorityQueue" works...
 * Here is what I get :

Start Logged in ! Adding page “????????:JARVISTheBot/?????????” to the queue Adding page “????????:JARVISTheBot/?????????2” to the queue Adding page “????????:NickTheRed37/?????????” to the queue Saving “????????:NickTheRed37/?????????”...done Saving “????????:JARVISTheBot/?????????”...done Saving “????????:JARVISTheBot/?????????2”...done Stopping upload thread
 * Sorry for the "?". • ObelusPA2 d · FR Admin · 01:49, 5 March 2015 (UTC)
 * PriorityQueue is a variant of normal queue that orders items by priority (determined by the comparator object; in the code above, the bigger the page, the bigger is priority). However I didn't need a such queue lol.
 * “?” is normal, I use UTF-8 while you may use a different character set.
 * — <b style=color:maroon;font-family:sans-serif>NickTheRed37</b> t ⁄ c (f.k.a. Naista2002) 05:35, 5 March 2015 (UTC)
 * Is the script now working for you ? • ObelusPA2 d · FR Admin · 19:33, 6 March 2015 (UTC)
 * I’ve changed the code drastically. The notify call fails with  . —  <b style=color:maroon;font-family:sans-serif>NickTheRed37</b> t/c (f.k.a. Naista2002) 15:38, 8 March 2015 (UTC)

Interwiki
I noticed that this bot is sometimes glitching out.

Brazilian interwiki on this page was incorrect, and I [ fixed] it.

But previously there was a more severe error – just look at [ this].

— <b style=color:maroon;font-family:sans-serif>NickTheRed37</b> t ⁄ c (f.k.a. Naista2002) 17:20, 5 March 2015 (UTC)
 * Thank you, I will investigate on it as soon as I have some free time. • ObelusPA2 d · FR Admin · 19:31, 6 March 2015 (UTC)
 * []. And replace  in your signature with   to save on size. —  <b style=color:maroon;font-family:sans-serif>NickTheRed37</b> t/c (f.k.a. Naista2002) 15:27, 8 March 2015 (UTC)
 * [] —  <b style=color:maroon;font-family:sans-serif>NickTheRed37</b> t/c (f.k.a. Naista2002) 15:36, 19 March 2015 (UTC)
 * I have temporarily disabled templates in the bot, there are too many problems with them, I am looking for solutions. Thank you for reporting this error ! • ObelusPA2 d · FR Admin</i> · 16:28, 19 March 2015 (UTC)