<commit_before><!DOCTYPE html>
<html>
  <head>
    <title>Custom infowindow example | CartoDB.js</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
    <style>
      html, body, #map {
        height: 100%;
        padding: 0;
        margin: 0;
      }
    </style>

    <link rel="stylesheet" href="http://libs.cartodb.com/cartodb.js/v3/3.12/themes/css/cartodb.css" />
  </head>
  <body>
    <div id="map"></div>

    <script type="infowindow/html" id="infowindow_template">
      <span> custom </span>
      <div class="cartodb-popup">
        <a href="#close" class="cartodb-popup-close-button close">x</a>
         <div class="cartodb-popup-content-wrapper">
           <div class="cartodb-popup-content">
             <img style="width: 100%" src="http://rambo.webcindario.com/images/18447755.jpg">
             <!-- content.data contains the field info -->
             <h4>{{content.data.name}}</h4>
           </div>
         </div>
         <div class="cartodb-popup-tip-container"></div>
      </div>
    </script>

    <script src="http://libs.cartodb.com/cartodb.js/v3/3.12/cartodb.js"></script>

    <script>
      cartodb.createVis('map', 'http://midja.portal.midja.org/api/v2/viz/b7711414-2111-11e4-96b7-fa163e6cce2e/viz.json')
  .done(function(vis, layers) {
    // layer 0 is the base layer, layer 1 is cartodb layer
    // when setInteraction is disabled featureOver is triggered
    layers[1].setInteraction(true);
    layers[1].on('featureOver', function(e, latlng, pos, data, layerNumber) {
      cartodb.log.log(e, latlng, pos, data, layerNumber);
    });

    // you can get the native map to work with it
    var map = vis.getNativeMap();

    // now, perform any operations you need, e.g. assuming map is a L.Map object:
    // map.setZoom(3);
    // map.panTo([50.5, 30.5]);
  });
    </script>
  </body>
</html>

<!--
{
  user_name: 'mycartodbuser',
  sublayers: [{
    sql: "SELECT * FROM table_name";
    cartocss: '#layer { marker-fill: #F0F0F0; }'
  }],
  tiler_protocol: 'https', // Optional
  tiler_host: 'cartodb.com', // Optional
  tiler_port: 80 // Optional
}
--><commit_msg>feat(map): add running sql query and plotting output<commit_after><!DOCTYPE html>
<html>
  <head>
    <title>Custom infowindow example | CartoDB.js</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
    <style>
      html, body, #map {
        height: 100%;
        padding: 0;
        margin: 0;
      }
    </style>

    <link rel="stylesheet" href="http://libs.cartodb.com/cartodb.js/v3/3.12/themes/css/cartodb.css" />
  </head>
  <body>
    <div id="map"></div>

    <script type="infowindow/html" id="infowindow_template">
      <span> custom </span>
      <div class="cartodb-popup">
        <a href="#close" class="cartodb-popup-close-button close">x</a>
         <div class="cartodb-popup-content-wrapper">
           <div class="cartodb-popup-content">
             <img style="width: 100%" src="http://rambo.webcindario.com/images/18447755.jpg">
             <!-- content.data contains the field info -->
             <h4>{{content.data.name}}</h4>
           </div>
         </div>
         <div class="cartodb-popup-tip-container"></div>
      </div>
    </script>

    <script src="http://libs.cartodb.com/cartodb.js/v3/3.12/cartodb.js"></script>

    <script>
  //     cartodb.createVis('map', 'http://midja.portal.midja.org/api/v2/viz/b7711414-2111-11e4-96b7-fa163e6cce2e/viz.json')
  // .done(function(vis, layers) {
  //   // layer 0 is the base layer, layer 1 is cartodb layer
  //   // when setInteraction is disabled featureOver is triggered
  //   layers[1].setInteraction(true);
  //   layers[1].on('featureOver', function(e, latlng, pos, data, layerNumber) {
  //     cartodb.log.log(e, latlng, pos, data, layerNumber);
  //   });

  //   // you can get the native map to work with it
  //   var map = vis.getNativeMap();

  //   // now, perform any operations you need, e.g. assuming map is a L.Map object:
  //   // map.setZoom(3);
  //   // map.panTo([50.5, 30.5]);
  // });



// cartodb.createVis('map', 'http://midja.portal.midja.org/api/v2/viz/b7711414-2111-11e4-96b7-fa163e6cce2e/viz.json');

var sublayer = {
    sql: "SELECT the_geom_webmercator,cartodb_id FROM iloc_2011_aust",
    cartocss: "/** simple visualization */ #iloc_2011_aust{ polygon-fill: #FF6600; polygon-opacity: 0.7; line-color: #FFF; line-width: 1; line-opacity: 1; }",
  };

var map = L.map('map', { 
          zoomControl: false,
          center: [0, 0],
          zoom: 3
        });

// add a nice baselayer from Stamen 
        L.tileLayer('https://maps.nlp.nokia.com/maptiler/v2/maptile/newest/normal.day/{z}/{x}/{y}/256/png8?lg=eng&token=A7tBPacePg9Mj_zghvKt9Q&app_id=KuYppsdXZznpffJsKT24', {
          attribution: 'Stamen'
        }).addTo(map);

cartodb.createLayer(map, {
  user_name: "midja",
tiler_protocol: "http",
tiler_domain: "portal.midja.org",
tiler_port: "8181",
// sql_api_protocol: "http",
// sql_api_domain: "portal.midja.org",
// sql_api_endpoint: "/api/v1/sql",
// sql_api_port: 8080,
// cdn_url: null,

  
  type: 'cartodb',
  sublayers: [sublayer]
})
.addTo(map);


setTimeout(function() {
	sublayer.sql = "SELECT the_geom_webmercator,cartodb_id FROM ste_2011_aust;"
	console.log('hello');
}, 5000);


//   var sql = new cartodb.SQL({ user: 'midja', host: 'portal.midja.org:8080'});
// sql.execute("SELECT * FROM iloc_2011_aust")
//   .done(function(data) {
//   	console.log('hello world');
//     console.log(data.rows);
//   })
//   .error(function(errors) {
//     // errors contains a list of errors
//     console.log("errors:" + errors);
//   })
    </script>
  </body>
</html>

<!--
{
  user_name: 'mycartodbuser',
  sublayers: [{
    sql: "SELECT * FROM table_name";
    cartocss: '#layer { marker-fill: #F0F0F0; }'
  }],
  tiler_protocol: 'https', // Optional
  tiler_host: 'cartodb.com', // Optional
  tiler_port: 80 // Optional
}
-->
{'fraction_non_alphanumeric': 0.1828214971209213, 'fraction_numerical': 0.034069097888675626, 'mean_word_length': 2.782819116757411, 'pattern_counts': {'":': 0, '<': 83, '<?xml version=': 0, '>': 83, 'https://': 1, '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': '1483230', 'n_tokens_mistral': 2480, 'n_tokens_neox': 2294, 'n_words': 424}