<NME> TCPSocketServer.java
<BEF> package com.tonybeltramelli.swat.server.network;

import com.tonybeltramelli.swat.server.Const;
import com.tonybeltramelli.swat.server.data.DataStore;
import com.tonybeltramelli.swat.server.data.SensorDataPoint;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author Tony Beltramelli www.tonybeltramelli.com - created 23/07/15
 */
public class TCPSocketServer extends Thread implements IServer
{
    private ServerSocket _listener;
    private DataStore _dataStore;

    public TCPSocketServer(int port, DataStore dataStore) throws IOException
    {
        _dataStore = dataStore;

        _listener = new ServerSocket(port);
        _listener.setReuseAddress(true);

        System.out.println("Start TCP Socket Server on port " + port);
    }

    @Override
    public void run()
    {
        super.run();

        try
        {
            try
            {
                while(true)
                {
                    listen();
                }
            } catch(IOException e)
            {
                e.printStackTrace();
            } finally
            {
                close();
            }
        } catch(IOException e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public void listen() throws IOException
    {
        Socket socket = _listener.accept();

        try {
            BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            String data = input.readLine();

            System.out.println(data);

            if(data.equals(Const.START_SESSION))
            {
                _dataStore.generateSessionID();
            }else if(data.equals(Const.END_SESSION))
            {
                _dataStore.save();
            }else{
                _dataStore.store(data, SensorDataPoint.class);
            }
        } catch(Exception e) {
            e.printStackTrace();
        } finally {
            socket.close();
        }
    }

    @Override
    public void close() throws IOException
    {
        _listener.close();
    }
}

<MSG> subfigure segmented signal

<DFF> @@ -63,7 +63,7 @@ public class TCPSocketServer extends Thread implements IServer
             BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
             String data = input.readLine();
 
-            System.out.println(data);
+            System.out.println(Const.getDataSnapshot(data));
 
             if(data.equals(Const.START_SESSION))
             {

{'commit': 'diff --git a/server/analytics/main.py b/server/analytics/main.py\nindex 3e43151..aca1f1d 100644\n--- a/server/analytics/main.py\n+++ b/server/analytics/main.py\n@@ -38,4 +38,5 @@ class Main:\n \n main = Main()\n #main.process_all()\n-main.train()\n\\ No newline at end of file\n+#main.train()\n+main.process("69141736")\n\\ No newline at end of file\ndiff --git a/server/analytics/modules/sensor/Sensor.py b/server/analytics/modules/sensor/Sensor.py\nindex 6053516..7c65a20 100644\n--- a/server/analytics/modules/sensor/Sensor.py\n+++ b/server/analytics/modules/sensor/Sensor.py\n@@ -158,6 +158,11 @@ class Sensor:\n         if self.view is not None:\n             self.view.plot_sensor_data_and_label("{} segmentation".format(self.name), self.timestamp, self.x, self.y, self.z, label_timestamps, labels)\n \n+        import pylab\n+        f, axes = pylab.subplots(4, 2, sharex=\'col\', sharey=\'row\')\n+\n+        axes = [axes[0, 0], axes[1, 0], axes[2, 0], axes[3, 0], axes[0, 1], axes[1, 1], axes[2, 1], axes[3, 1]]\n+\n         for i in range(0, len(label_timestamps)):\n             center_timestamp_index = (np.abs(self.timestamp - label_timestamps[i])).argmin()\n \n@@ -169,6 +174,13 @@ class Sensor:\n             #if self.view is not None:\n             #    self.view.plot_sensor_data("{} key {}".format(self.name, labels[i]), timestamp_sample, x_sample, y_sample, z_sample)\n \n+            import pylab\n+\n+            axes[i].plot(x_sample, color=\'r\', label=\'x\')\n+            axes[i].plot(y_sample, color=\'g\', label=\'y\')\n+            axes[i].plot(z_sample, color=\'b\', label=\'z\')\n+            axes[i].set_title("{} key {}".format(self.name, labels[i]))\n+\n             output_file.write("label:{}\\n".format(labels[i]))\n \n             for j in range(0, len(x_sample)):\ndiff --git a/server/port/out/artifacts/server_jar/server.jar b/server/port/server.jar\nsimilarity index 77%\nrename from server/port/out/artifacts/server_jar/server.jar\nrename to server/port/server.jar\nindex c6a04b8..eb9d73d 100644\nBinary files a/server/port/out/artifacts/server_jar/server.jar and b/server/port/server.jar differ\ndiff --git a/server/port/src/com/tonybeltramelli/swat/server/Const.java b/server/port/src/com/tonybeltramelli/swat/server/Const.java\nindex cffd434..15ba10a 100644\n--- a/server/port/src/com/tonybeltramelli/swat/server/Const.java\n+++ b/server/port/src/com/tonybeltramelli/swat/server/Const.java\n@@ -23,4 +23,12 @@ public class Const\n     public static final String DATA_OUT_PATH = "../data/raw/" + SESSION_ID + "_" + SENSOR_NAME + ".csv";\n     public static final String CSV_HEADER_SENSOR = Const.TIMESTAMP + "," + Const.X + "," + Const.Y + "," + Const.Z;\n     public static final String CSV_HEADER_LABEL = Const.TIMESTAMP + "," + Const.LABEL;\n+    //\n+    public static final String getDataSnapshot(String data)\n+    {\n+        int length = data.length();\n+        int max = 50;\n+        return data.substring(0, length < max ? length : max) + (length < max ? "" : "...");\n+    }\n+\n }\ndiff --git a/server/port/src/com/tonybeltramelli/swat/server/network/HTTPServer.java b/server/port/src/com/tonybeltramelli/swat/server/network/HTTPServer.java\nindex efcdfab..247168c 100644\n--- a/server/port/src/com/tonybeltramelli/swat/server/network/HTTPServer.java\n+++ b/server/port/src/com/tonybeltramelli/swat/server/network/HTTPServer.java\n@@ -3,6 +3,7 @@ package com.tonybeltramelli.swat.server.network;\n import com.sun.net.httpserver.HttpExchange;\n import com.sun.net.httpserver.HttpHandler;\n import com.sun.net.httpserver.HttpServer;\n+import com.tonybeltramelli.swat.server.Const;\n import com.tonybeltramelli.swat.server.data.DataStore;\n import com.tonybeltramelli.swat.server.data.LabelDataPoint;\n \n@@ -56,7 +57,7 @@ public class HTTPServer extends Thread implements IServer, HttpHandler\n         BufferedReader input = new BufferedReader(new InputStreamReader(httpExchange.getRequestBody()));\n         String data = input.readLine();\n \n-        System.out.println(data);\n+        System.out.println(Const.getDataSnapshot(data));\n \n         try {\n             _dataStore.store(data, LabelDataPoint.class);\ndiff --git a/server/port/src/com/tonybeltramelli/swat/server/network/TCPSocketServer.java b/server/port/src/com/tonybeltramelli/swat/server/network/TCPSocketServer.java\nindex 3acf03a..42605bb 100644\n--- a/server/port/src/com/tonybeltramelli/swat/server/network/TCPSocketServer.java\n+++ b/server/port/src/com/tonybeltramelli/swat/server/network/TCPSocketServer.java\n@@ -63,7 +63,7 @@ public class TCPSocketServer extends Thread implements IServer\n             BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));\n             String data = input.readLine();\n \n-            System.out.println(data);\n+            System.out.println(Const.getDataSnapshot(data));\n \n             if(data.equals(Const.START_SESSION))\n             {\n', 'commit_subject': 'subfigure segmented signal', 'repo_name': 'tonybeltramelli/Deep-Spying', 'committer': {'name': 'Tony Beltramelli', 'email': '138945954cb51e49907e313d948c7977e813126b@gmail.com', 'time_sec': '1441728363', 'tz_offset': '120', 'date': {'seconds': '1441728363'}}, 'commit_tree': '979bf42812997120954b77a9ff190ecc09f2651f', 'commit_message': 'subfigure segmented signal\n', 'language_name': 'C++', 'license': 'apache-2.0', 'hunks': '@@ -63,7 +63,7 @@ public class TCPSocketServer extends Thread implements IServer\n             BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));\n             String data = input.readLine();\n \n-            System.out.println(data);\n+            System.out.println(Const.getDataSnapshot(data));\n \n             if(data.equals(Const.START_SESSION))\n             {\n', 'addition_count': 1, 'deletion_count': 1, 'src_file': 'a/server/port/src/com/tonybeltramelli/swat/server/network/TCPSocketServer.java', 'tgt_file': 'b/server/port/src/com/tonybeltramelli/swat/server/network/TCPSocketServer.java', 'file_extension': '.java', 'before_file': 'package com.tonybeltramelli.swat.server.network;\n\nimport com.tonybeltramelli.swat.server.Const;\nimport com.tonybeltramelli.swat.server.data.DataStore;\nimport com.tonybeltramelli.swat.server.data.SensorDataPoint;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.net.ServerSocket;\nimport java.net.Socket;\n\n/**\n * @author Tony Beltramelli www.tonybeltramelli.com - created 23/07/15\n */\npublic class TCPSocketServer extends Thread implements IServer\n{\n    private ServerSocket _listener;\n    private DataStore _dataStore;\n\n    public TCPSocketServer(int port, DataStore dataStore) throws IOException\n    {\n        _dataStore = dataStore;\n\n        _listener = new ServerSocket(port);\n        _listener.setReuseAddress(true);\n\n        System.out.println("Start TCP Socket Server on port " + port);\n    }\n\n    @Override\n    public void run()\n    {\n        super.run();\n\n        try\n        {\n            try\n            {\n                while(true)\n                {\n                    listen();\n                }\n            } catch(IOException e)\n            {\n                e.printStackTrace();\n            } finally\n            {\n                close();\n            }\n        } catch(IOException e)\n        {\n            e.printStackTrace();\n        }\n    }\n\n    @Override\n    public void listen() throws IOException\n    {\n        Socket socket = _listener.accept();\n\n        try {\n            BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));\n            String data = input.readLine();\n\n            System.out.println(data);\n\n            if(data.equals(Const.START_SESSION))\n            {\n                _dataStore.generateSessionID();\n            }else if(data.equals(Const.END_SESSION))\n            {\n                _dataStore.save();\n            }else{\n                _dataStore.store(data, SensorDataPoint.class);\n            }\n        } catch(Exception e) {\n            e.printStackTrace();\n        } finally {\n            socket.close();\n        }\n    }\n\n    @Override\n    public void close() throws IOException\n    {\n        _listener.close();\n    }\n}\n', 'message': 'subfigure segmented signal\n', 'author_name': 'Tony Beltramelli', 'lang': 'java'}