Draw checker board

For an assignment, I had to draw a checkers board, with blue and red checkers, in python. What I have works, but I’m wondering if there’s a more elegant and/or efficient way to accomplish this feat? Any and all suggestions are welcome!

import turtle  def draw_box(t,x,y,size,fill_color):   t.penup()    t.goto(x,y)    t.pendown()    t.fillcolor(fill_color)   t.begin_fill()      for i in range(0,4):     board.forward(size)      board.right(90)    t.end_fill()   def draw_circle(t,x,y,radius,color):   t.penup()   t.goto(x,y)   t.pendown()   t.fillcolor(color)   t.begin_fill()   t.circle(radius)   t.end_fill()  def draw_chess_board():   square_color = "black"    start_x = 0    start_y = 0    box_size = 30    for i in range(0,8):        for j in range(0,8):           draw_box(board, start_x + j * box_size, start_y + i * box_size, box_size, square_color)           square_color = 'black' if square_color == 'white' else 'white'           if square_color == 'black' and i < 3:               draw_circle(board, board.xcor() + (box_size / 2), board.ycor() - box_size, box_size / 2, "red")           if square_color == 'black' and i > 4:               draw_circle(board, board.xcor() + (box_size / 2), board.ycor() - box_size, box_size / 2, "blue")          square_color = 'black' if square_color == 'white' else 'white'   board = turtle.Turtle()  draw_chess_board()  turtle.done() 

Java League of Legends ping checker

I’m still a freshman and this one of my first projects I made using Java and Swing.

The program is a simple League of Legends multi-threaded ping checker that pings the server 10 times to get an average ping and determine the max and minimum ranges.

How can I make my code cleaner instead of writing so many if statements? Any suggestions or tips are greatly appreciated.

To check your ping you can download the software here.

import java.awt.Color; import javax.swing.text.AttributeSet; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; import java.net.InetAddress; import java.util.GregorianCalendar; import java.util.*;  import javax.swing.JProgressBar; /**  *  * @author User  */ public class App {       public static void sendPingRequest2(String ipAddress, javax.swing.JTextPane jTextPane1, javax.swing.JTextPane jTextPane2, javax.swing.JTextField jTextField1) {          try {             for (int i = 0; i < 10; i++) {                 InetAddress inet = InetAddress.getByName(ipAddress);                 long finish = 0;                 long start = new GregorianCalendar().getTimeInMillis();                 System.out.println("Sending Ping Request to " + ipAddress);                 long sum = 0;                  List < Long > list = new ArrayList < > ();                    if (inet.isReachable(5000)) {                      finish = new GregorianCalendar().getTimeInMillis();                     long value = finish - start;                      list.add(value);                     long lowest = Collections.min(list);                     System.out.println("value" + lowest);                     sum = value + value / 10;                     if (value < 250) {                          jTextPane1.setText("Ping RTT: " + value + "ms");                         jTextPane2.setText("average ping: " + sum + "ms");                         jTextField1.setText("" + lowest + "ms");                         jTextPane1.setBackground(Color.green);                         jTextPane2.setForeground(Color.green);                         jTextField1.setBackground(Color.green);                     } else if (value > 250 || value < 500) {                          jTextPane1.setText("Ping RTT: " + value + "ms");                         jTextPane2.setText("average ping: " + sum + "ms");                         jTextField1.setText("" + lowest + "ms");                         jTextPane1.setBackground(Color.yellow);                         jTextPane2.setBackground(Color.yellow);                         jTextField1.setBackground(Color.yellow);                      } else {                          jTextPane1.setText("Ping RTT: " + value + "ms");                         jTextPane2.setText(" " + sum + "ms");                         jTextField1.setText("" + lowest + "ms");                         jTextPane1.setBackground(Color.red);                         jTextPane2.setBackground(Color.red);                         jTextField1.setBackground(Color.red);                     }                  } else {                     System.out.println(ipAddress + " NOT reachable.");                 }             }         } catch (Exception e) {             System.out.println("Exception:" + e.getMessage());         }     }      public static void main(String[] args) {         App m = new App();         NewJFrame jf = new NewJFrame();        }      void sendPingRequest(String string) {         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.     } } 

Gui.java

package selenium;  import java.net.InetAddress; import java.util.GregorianCalendar; import javax.swing.JProgressBar; import javax.swing.JTextField;  /**  *  * @author User    public class NewJFrame extends javax.swing.JFrame {       * Creates new form NewJFrame      */     public NewJFrame() {         initComponents();     }     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {         // TODO add your handling code here:          App m = new App();           if (jRadioButton1.isSelected()) {                Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.141.3", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();              t1.start();         }         if (jRadioButton2.isSelected()) {               Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.156.1", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();         }           if (jRadioButton3.isSelected()) {                 Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.142.3", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();           }          if (jRadioButton4.isSelected()) {                 Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.136.3", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();           }          if (jRadioButton5.isSelected()) {                 Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.131.3", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();           }        }      private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {         // TODO add your handling code here:     }      private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {         // TODO add your handling code here:     }         private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {         // TODO add your handling code here:         App m = new App();           if (jRadioButton1.isSelected()) {                Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.141.3", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();              t1.start();         }         if (jRadioButton2.isSelected()) {               Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.156.1", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();         }           if (jRadioButton3.isSelected()) {                 Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.142.3", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();           }          if (jRadioButton4.isSelected()) {                 Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.136.3", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();           }          if (jRadioButton5.isSelected()) {                 Thread t1 = new Thread(new progress(jProgressBar1));             t1.start();             Thread t2 = new Thread(new Runnable() {                 @Override                 public void run() {                     m.sendPingRequest2("104.160.131.3", jTextPane1, jTextPane2, jTextField1); // Insert some method call here.                 }                });              t2.start();           }        }      private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {         // TODO add your handling code here:     }      private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {         // TODO add your handling code here:     } 

constants.java

public enum Constants {     NA ("104.160.131.3"), EUW("104.160.141.3"),EUNE("104.160.142.3"),KOR("104.160.156.1"),LAN("104.160.136.3");      private String ip;      Constants(String ip){         this.ip = ip;     }      public String getIp(){         return ip;     } } 

Ip multiaccount checker PHP (Нахождение дубликатов пользователей по IP)

Подскажите, пожалуйста, Есть таблица Access-Log пользователей, вида “User ID” “IP” “Date”. Возможно ли найти все дубликаты-мультиаккаунты в ней без огромной нагрузки на mySQL запросами и большой нагрузкой на сервер? Не могу подобрать оптимальный алгоритм, все что придумываю – долго обсчитывается или создает огромную нагрузку на MySQL.

Пример (логи захода):
“10” “155.166.11.2” “2018-01-22 13:08:36”
“122” “127.0.0.1” “2018-01-22 13:19:00”
“13” “144.11.11.4” “2018-01-31 17:16:56”
“10” “127.0.0.1” “2018-01-31 17:26:35”
“99” “155.166.11.2” “2018-01-31 17:26:55”
“13” “12.11.22.4” “2018-01-31 17:43:56”
“18” “145.106.11.2” “2018-01-31 18:50:18”
“11” “144.11.11.4” “2018-01-31 18:54:18”

Result:
“10, 99, 122” – один и тот же пользователь.
“11, 13” – один и тот же пользователь.

Scrapebox proxy checker stops checking after 150 proxies

Hello Loopline and all others. Happy Holidays!

I have been using scrapebox for the last 8 or so years to do various blackhat spamming. I used to use private proxies.
Recently I scraped some public ones using internal scraper. I had about 13k proxies. So when I start checking everything goes as planned until about line 120-150. It just stops and hangs. The stop button is unresponsive. I mean I can push the stop button but it doesn’t do a thing. I tried to load 200 proxies and SB still stops and hangs around line 130-150. Before I start bugging the support with this I was wondering if any of you fine fellows encountered an issue like that. Who would know better then Loopline, right? Smile

If you have any ideas about adjusting TCP timeouts on Windows 7 or any other methods that would allow me to verify public proxies please let me know.

My next step would be decrease timeout of the TCP connections in registry unless you have any better ideas.

Cheers!

M

How do I enable the browser spell checker in WYSIWYG editor?

I want to use the in-browser spell checker within the Drupal 7 WYSIWYG editor, which is currently disabled by default.

I found this post but the settings aren’t availble in my Drupal module. When I go to Home » Administration » Configuration » Content authoring there doesn’t seem to be a place to enable or turn off the disabled browser spell checker. Thanks for any help!

Best Paid Plagiarism Checker tool at Present (copyscape is not worthy at all now)

Hi, I have been using copyscape.com premium version for years but recently got surprised to know that it is not working like before. It is showing 100% uniqueness while scanning the plagiarised contents. I cleared all the catches to confirm the best results. But for last couple of months it's showing wrong results. Please suggest the best paid plagiarism tool (paid) that give the best and genuine result..

Best way to find sites in google that links back to another site (backlink checker)

How can i make this happen?

for example. 

I have a site which is abc.com and i want to search google who links to my site abc.com)

perhaps ill provide anchor text?branding?naked url?root domain?

what is the best way to do this? 

it is like ahrefs a backlink checker but its a real time scraping from scrapebox?

and I can export all the backlinks to excel file and it provides the backlink lists and anchor text linked to abc.com

Which is the best free plagiarism checker software/tool online ?

Hi,

I'm a content writer and I'm very strict in providing 100% original content to my buyers. Sometimes in order to meet the deadlines, I have to hire extra writers from dp/gaf etc. I have been using www.articlechecker.com to check their articles.

But I think this online tool doesn't give right results all the time, especially in the case of spun articles. I don't want to see any problems from my buyer's side. And I always want it to be 100 % unique, whether it is…

Which is the best free plagiarism checker software/tool online ?