<commit_before>extends layout
block content
    #serverinfo
      p Agent: #{host.agentip}, Agent port: #{host.agentport}, Container host name: #{host.conatiner}
      
    #map
    
    script(type='text/javascript').
        var map = L.map('map').setView([#{mapdata.lat}, #{mapdata.lon}], 10);
        L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
            attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
            maxZoom: 18,
            id: 'mapbox.streets',
            accessToken: '#{mapdata.key}'
        }).addTo(map);        

        var markerseq = 0;
        var done = false;
        var clientinfo = {
            id: '#{mapdata.clientid}',
            lat: #{mapdata.lat}, 
            lon: #{mapdata.lon}
        };
        
        var client = null;
        var connected = false;
        function init_client() {
            client = io.connect('/client', {
                'reconnection': true,
                'reconnectionDelay': 1000,
                'reconnectionMaxDelay': 3000,
                'reconnectionAttempts': 30
            });
            
            // socket.io client events
            client.on('connect', function() { 
                console.log('Connected.');
                connected = true;
                if(!done) {   
                    console.log('Emit hello.');
                    client.emit('hello', JSON.stringify(clientinfo));
                } else {
                    console.log('Markers done.');
                    client.disconnect();
                }
            });
            client.on('reconnect_failed', function() {
                if(!done) {
                    console.log('Reconnect failed.  Retry, not done.');
                    setTimeout(function() {
                        init_client();
                    }, 3000);
                } else  {
                    console.log('Reconnect failed.  Dont Retry, done.');
                    client.disconnect();
                }
            });
            client.on('disconnect', function() {
                console.log('Disconnected.');
                connected = false;
            });
            client.on('error', function(err) {
                console.log('Error: ' + err);
            });
            client.on('reconnect_error', function(err) {
                console.log('Reconnect error: ' + err);
            });
            
            // socket.io application events
            client.on('status', function() {
                console.log('Request for client status.');
                if(connected) {
                    client.emit('status', JSON.stringify({ 
                        markerseq: markerseq,
                        done: done
                    }));
                }
            });
            client.on('done', function() {
                console.log('Marker streaming done.');
                done = true;
                if(connected) {
                    client.disconnect();
                }   
            });
            client.on('point', function(data) {
                console.log("Got point: " + data);
                point = JSON.parse(data);
                var marker = L.marker([point.latitude, point.longitude]).addTo(map);
                marker.bindPopup("<a href=\"" + point.link + "\">" + point.name + "</a>");
                markerseq++;
            });
        }
        init_client();
        
        <commit_msg>fix typo<commit_after>extends layout
block content
    #serverinfo
      p Agent: #{host.agentip}, Agent port: #{host.agentport}, Container host name: #{host.container}
      
    #map
    
    script(type='text/javascript').
        var map = L.map('map').setView([#{mapdata.lat}, #{mapdata.lon}], 10);
        L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
            attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
            maxZoom: 18,
            id: 'mapbox.streets',
            accessToken: '#{mapdata.key}'
        }).addTo(map);        

        var markerseq = 0;
        var done = false;
        var clientinfo = {
            id: '#{mapdata.clientid}',
            lat: #{mapdata.lat}, 
            lon: #{mapdata.lon}
        };
        
        var client = null;
        var connected = false;
        function init_client() {
            client = io.connect('/client', {
                'reconnection': true,
                'reconnectionDelay': 1000,
                'reconnectionMaxDelay': 3000,
                'reconnectionAttempts': 30
            });
            
            // socket.io client events
            client.on('connect', function() { 
                console.log('Connected.');
                connected = true;
                if(!done) {   
                    console.log('Emit hello.');
                    client.emit('hello', JSON.stringify(clientinfo));
                } else {
                    console.log('Markers done.');
                    client.disconnect();
                }
            });
            client.on('reconnect_failed', function() {
                if(!done) {
                    console.log('Reconnect failed.  Retry, not done.');
                    setTimeout(function() {
                        init_client();
                    }, 3000);
                } else  {
                    console.log('Reconnect failed.  Dont Retry, done.');
                    client.disconnect();
                }
            });
            client.on('disconnect', function() {
                console.log('Disconnected.');
                connected = false;
            });
            client.on('error', function(err) {
                console.log('Error: ' + err);
            });
            client.on('reconnect_error', function(err) {
                console.log('Reconnect error: ' + err);
            });
            
            // socket.io application events
            client.on('status', function() {
                console.log('Request for client status.');
                if(connected) {
                    client.emit('status', JSON.stringify({ 
                        markerseq: markerseq,
                        done: done
                    }));
                }
            });
            client.on('done', function() {
                console.log('Marker streaming done.');
                done = true;
                if(connected) {
                    client.disconnect();
                }   
            });
            client.on('point', function(data) {
                console.log("Got point: " + data);
                point = JSON.parse(data);
                var marker = L.marker([point.latitude, point.longitude]).addTo(map);
                marker.bindPopup("<a href=\"" + point.link + "\">" + point.name + "</a>");
                markerseq++;
            });
        }
        init_client();
        
        
{'fraction_non_alphanumeric': 0.14236730215333973, 'fraction_numerical': 0.006034837470854478, 'mean_word_length': 1.256188118811881, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5850778', 'n_tokens_mistral': 1949, 'n_tokens_neox': 1824, 'n_words': 335}