parser for building a network diagram of method dependencies

Wednesday: Linux, PHP, Python

Is there a code parser (utility, script) to visualize the class structure (in the form of a network diagram) in object-oriented programming? I have a file module Import.php consists of one class with about 50 methods inside and I need to get a network diagram of the relationships of these methods.

Here's a sample of what should happen: enter image description here

  • Regex to match copyright statements

    I don't know much of regex, and I'm trying to find a pattern that allows me to match copyright statements such as:

    'Copyright © 2019 Company All Rights Reserved'
    '© 2019 Company All Rights Reserved'
    '© 2019 Company'

    And as many other combinations as possible.

    I found this regex pattern in

    /(?!.*(?:\{|\}|\);))(?:(copyright)[ \t]*(?:(©|\(c\)|&#(?:169|xa9;)|©)[ \t]+)?)(?:((?:((?:(?:19|20)[0-9]{2}))[^\w\n]*)*)([ \t,\w]*))/i

    I was trying it here and while it works with 'Copyright © 2019 Company All Rights Reserved', it doesn't work with '© 2019 Company All Rights Reserved'. How can I change it for it to also match when the word Copyright is not there?

  • How could I use blocking (net.Conn) Read() fonction, non-blocking with Channel and Select?

    I am making a network game over a TCP connection and I am faced to a problem. I need to read/send data on the server side for updating the game, but the Read() function is blocking my main server loop. As I will do in C, I have search for a poll function but I didn't find any with net.Conn type.

    I've viewed many time that people advise to use Channels coupled with Select but it is really confusing me.

    I have already tried to use goroutines for:

    • Calling Read() function but I get this error: panic: too many concurrent operations on a single file or socket.

    • Calling the server loop handler but still blocking.

    Furthermore, as you can imagine, I launch the launchServer() function into a goroutine in the main.

    How could I use Channels and Select for dodge this quite hassle problem. It really paralyses my into my project advancement.

    Here is my server code:

    package main
    func send(conn net.Conn, data string){
    func recovery(conn net.Conn) (string){
        buf := make([]byte, 1024)  
        return string(buf)
    func launchServer(address string , port string){
        listener, err := net.Listen("tcp", address + ":" + port)
        if err != nil {
            fmt.Println("Error listening: ", err.Error())
        conn, err := listener.Accept()
        if err != nil {
            fmt.Println("Error accepting: ", err.Error())
        defer listener.Close()
        var data string
        var playerUsernames []string
            data = recovery(conn)
            if data[0:3] == "LOG"{
                playerUsernames = append(playerUsernames, data[4:])

    Thank you in advance, 3t13nn3.

  • Port not reachable although it is in a listening state

    I am using vagrant to deploy several redis nodes.


    On one hand

    (master)*$ vagrant ssh redis.node.1
    Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-143-generic x86_64)
    New release '18.04.2 LTS' available.
    Run 'do-release-upgrade' to upgrade to it.
    Last login: Mon Mar 18 15:03:21 2019 from
    vagrant@redis:~$ ss -tulapn | grep -i 6379
    tcp    LISTEN     0      128       *:6379                  *:*                  
    tcp    LISTEN     0      128       *:16379                 *:*                  
    tcp    LISTEN     0      128      :::6379                 :::*                  
    tcp    LISTEN     0      128      :::16379                :::*   

    But from my host machine:

    (master)*$ ping -c 1 redis.node.1
    PING redis.node.1 ( 56(84) bytes of data.
    64 bytes from redis.node.1 ( icmp_seq=1 ttl=64 time=0.235 ms
    --- redis.node.1 ping statistics ---
    1 packets transmitted, 1 received, 0% packet loss, time 0ms
    rtt min/avg/max/mdev = 0.235/0.235/0.235/0.000 ms
    (master)*$ nc -zv -w 2 redis.node.1 6379
    nc: connect to redis.node.1 port 6379 (tcp) failed: Connection refused
    nc: connect to redis.node.1 port 6379 (tcp) failed: Connection refused

    How is this possible?

    How can I further troubleshoot this?

    I have disabled and stopped ufw on redis.node.1, just in case.

  • Automating bad network connection simulation with XCTest

    I have a set of automated UI tests for our iOS app, written with XCTest. It was required for some test cases to be verified in bad network connection conditions.

    I am aware that it is possible to simulate bad network connection by using Network Link Conditioner. I know that you can enable it in settings of a real device and a simulator as well. There seem to be only manual steps involved in enabling and setting the desired state.

    But, I was wondering if it was possible to automate this process - how would you go about running a suite of automated tests on the CI (if some of them are to be tested in bad network conditions)?

    We are not using real devices for automated testing. I do not have the access to the machines running test suites for CI. I do not have a dedicated machine that could always have NLC enabled and set, nor can I manipulate network itself (router etc). We do not use mocks in our tests.

  • How to call multiple arrays in a void method?

    I am stuck on how to call my readData method. I get a cannot find symbols (playerName,battingArray) error message. -Am I not calling it correctly? -Is the method set up to populate the arrays properly?

    I am not even sure if this is the best way to go about doing this: "Create a void readData method: Include parameters for array of player names, array of batting averages for each player, array of player home run totals, array of player strike out totals, array of player walk totals, and total number of players. The method will read all values from the user and store the values in the appropriate arrays. "


    //Import util to accept input
    import java.util.Scanner;
        public static Scanner input = new Scanner(;
        public static void main(String[] args) {
            //Assign number of players to variable and call method readNumPlayers
            int numPlayers = readNumPlayers();
            //Call readData method
            readData(playerName, numPlayers, battingArray);
    }//end main
        //readNumPlayers method
        public static int readNumPlayers() {
            System.out.println("Number of players: ");
            int numPlayers = input.nextInt();
            if (numPlayers <=0) {
                System.out.println(" Error- Try again ");
                System.out.println("Number of players: ");
                numPlayers = input.nextInt();
            }//end catch to ensure entry is positive integer
            return numPlayers;  //return
        }//end readNumPlayers
        //readData method
        public static void readData(String[] playerName, int numPlayers,
                                    double[] battingArray) {
            playerName = new String[numPlayers];
            System.out.println("Enter player's last name: ");
            for (int i = 0; i < playerName.length; i++) {
                playerName[i] =;
            }  //end for loop
            battingArray = new double[numPlayers];
                    System.out.println("Enter player's batting average: ");
                    for (int i = 0; i < battingArray.length; i++) {
                battingArray[i] = input.nextDouble();
            }// end for loop
          }//end readData
  • Instead of returning the correct value, the method, which was meant to return distance between 2 points, returns 0.0

    Please excuse if my code looks bad I am very new to programming.

    This program is supposed to create 10 objects that have x,y,z coordinates and find the distance between them.

    Every time I run the main method, the distance always returns 0.

    Why is this happening?

    public double distance(FireFlyBAS f1)
        double fx = f1.x; //passed from FireFlyBAS f1
        double fy = f1.y;
        double fz = f1.z;
        double xx = ((x - fx) * (x - fx)); //x,y,z are all created previously in the class
        double yy = ((y - fy) * (y -fy));
        double zz = ((z - fz) * (z -fz));
        double distance = Math.sqrt(xx + yy + zz);
        return distance;
    public class DeathMatchBAS
    public static void main(String args[])
        double x = 0;
        double y = 0;
        double z = 0;
        boolean l = true;
        FireFlyBAS f1 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f2 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f3 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f4 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f5 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f6 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f7 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f8 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f9 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS f10 = new FireFlyBAS(x,y,z,l);
        FireFlyBAS[] flies = {f1, f2, f3, f4, f5, f6, f7, f9, f9, f10};
        int count = 10;
        double distance = .5;
        for(int i = 0; i < flies.length; i++)
            l = true;
            if(l == true)
               distance = flies[i].distance(flies[i]);
                if(distance <= 1.0)
                    l = false;
                    System.out.println("There are " + count + " fireflies alive");
  • Array iteration by using two for loops and print the values



    Now I am able to add the elements in an array and print the values, but to solve my problem i need to add the values of dimensionalTwo[0][1], dimensionalTwo[0][2], dimensionalTwo[0][3], dimensionalTwo[1][1], dimensionalTwo[1][2], dimensionalTwo[1][3], dimensionalTwo[2][1], dimensionalTwo[2][2], dimensionalTwo[2][3] separately and print the results, providing my updated code snippet below

    function adding particularSet(arr) {
        let dimensionalTwo = [[0, 0, 0, 0, 0, 0], [5, 5, 5, 0, 0, 0], [10, 10, 10, 0, 0, 0], [0, 0, 0, 0, 0, 0], [5, 5, 5, 0, 0, 0], [10, 10, 10, 0, 0, 0]];
        let    twoDimensionalAdded = 0;
        for (let outerLoop = 0; outerLoop < dimensionalTwo.length; outerLoop++) {
            for (let innerLoop = 0; innerLoop < dimensionalTwo[outerLoop].length; innerLoop++) {
                console.log("dimensionalTwo[outerLoop][innerLoop]--->", dimensionalTwo[outerLoop][innerLoop]);
                twoDimensionalAdded += dimensionalTwo[outerLoop][innerLoop]; // add item to sum
        console.log("twoDimensionalAdded--->", twoDimensionalAdded);


    • I'm new to js.
    • I am trying to iterate a two dimensional array and add the values then print it.
    • But the the problem is I am not able to print the values.
    • It would be great if you let me know.
    • So that I can iterate my array and print results for my future tasks.
    • Providing my code snippet below
    var DimensionalTwo = [
        [0, 0, 0],
        [5, 5, 5],
        [10, 10, 10]
    for (let outerLoop = 0; outerLoop < DimensionalTwo.length; outerLoop++) {
      for (let innerLoop = 0; innerLoop < DimensionalTwo[outerLoop].length; innerLoop++) {
        console.log("DimensionalTwo[outerLoop][innerLoop]--->", DimensionalTwo[outerLoop][innerLoop]);
        let TwoDimensonalTemporayStorage = DimensionalTwo[outerLoop][innerLoop];
        let twoDimensionalAdded = TwoDimensonalTemporayStorage + DimensionalTwo[outerLoop][innerLoop];
        console.log("twoDimensionalAdded--->", twoDimensionalAdded);
      //console.log("inner for loop twoDimensionalAdded--->", twoDimensionalAdded);
  • how to draw a network diagram whose notes are arranged like a matrix?

    I want to draw a network diagram that all of notes are arranged like a matrix,so they can connect by horizontal and vertical vectors. I've known that I could draw it by using the Python's networkx module,but the result was all of notes were randomly arranged,so all of the notes connected by oblique line rather than horizontal and vertical vectors. How can I do that?

  • Is this normalized correctly?

    I need to normalize this database. This is for an application that will be allowing users to sign up for gaming tournaments that will be hosted at actual locations. When you search for a tournament the user can either register for the tournament, sponsor the event, or view the tournament. There will be multiple tournaments such as Fortnite, Apex, and what have you. The games will be on platforms like PS4 , PC, and Xbox one. Multiple players can be in a tournament, and they can be signed up for multiple tournaments at a time, same for viewers and sponsors. Each result should be stored such as wins and losses, and be put into the leaderboards. Please help me normalize this ERD diagram.

    enter image description here

  • Interactive block diagram

    I need to create something like interactive block diagram using JavaScript and PHP. For example, a question is displayed in front of a person, depending on his answer, another question is highlighted, and so on. The path followed by the user is saved.

    Question: Do you need additional service?
    There are two possible answers:
    1) Yes
    2) No

    1) -> What services do you need? (after answering this question there will be next question, etc.)
    2) -> Ok

    I would like to ask for help about advice on how to store data, and how to implement it in general. It would be great if there is any kind of library for creating such things.