<commit_before>'use strict';

var url         = require('url');
var path        = require('path');
var http        = require('http');
var fs          = require('fs');
var unzip       = require('unzip');
var postgresdb  = require('pg');
var useOracle   = false;
var program     = require('commander');
var drivers     = new Object();
var connections = new Object();
var express     = require('express')
var app         = express()
var timeout     = 0;

path.join(__dirname, '../public/blockly/blockly_compressed.js')
path.join(__dirname, '../public/blockly/blocks_compressed.js')
path.join(__dirname, '../public/yazz_blockly_blocks.js')
path.join(__dirname, '../public/yazz_blockly_generator.js')
path.join(__dirname, '../public/yazz_blockly_output_code.js')
path.join(__dirname, '../public/blockly/msg/js/en.js')
path.join(__dirname, '../public/jquery-1.9.1.min.js')
path.join(__dirname, '../public/jquery.zoomooz.js')
path.join(__dirname, '../public/blockly_helper.js')
path.join(__dirname, '../public/blockly.png')
path.join(__dirname, '../public/polyfill.min.js')
path.join(__dirname, '../public/vue.min.js')
path.join(__dirname, '../public/vue.js')
path.join(__dirname, '../public/vuex.min.js')
path.join(__dirname, '../public/vuex.js')
path.join(__dirname, '../src/oracle.js')
path.join(__dirname, '../src/postgres.js')
path.join(__dirname, '../public/vue_components.js')
path.join(__dirname, '../public/vue_store.js')
path.join(__dirname, '../public/vue_setup.js')
path.join(__dirname, '../public/blockly_setup.js')
path.join(__dirname, '../public/tether.min.js')
path.join(__dirname, '../public/bootstrap.min.js')
path.join(__dirname, '../public/bootstrap.min.css')
path.join(__dirname, '../public/es6-shim.js')
path.join(__dirname, '../public/vue_app.css')
path.join(__dirname, '../public/components/connections_table.js')
path.join(__dirname, '../public/components/yazz_new_connection.js')
path.join(__dirname, '../public/components/oracle_view_connection.js')
path.join(__dirname, '../public/components/postgres_view_connection.js')
path.join(__dirname, '../public/components/oracle_add_connection.js')
path.join(__dirname, '../public/components/postgres_add_connection.js')
path.join(__dirname, '../public/dist/build.js')
path.join(__dirname, '../oracle_driver.zip')

function isNumber(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}

var type;
program
  .version('0.0.1')
  .option('-t, --type [type]', 'Add the specified type of app [type]', 'client')
  .option('-p, --port [port]', 'Which port should I listen on? [port]', parseInt)
  .option('-h, --host [host]', 'Server address of the central host [host]', 'yazz.com')
  .option('-s, --hostport [hostport]', 'Server port of the central host [hostport]', parseInt)
  .parse(process.argv);

  var port = program.port;
  if (!isNumber(port)) {port = 80;};
  var typeOfSystem = program.type;


  if (!(typeOfSystem == 'client' || typeOfSystem == 'server')) {
      console.log('-------* Invalid system type: ' + typeOfSystem);
      process.exit();
  };
  console.log('-------* System type: ' + typeOfSystem);
  console.log('-------* Port: ' + port);


var ip = require("ip");
console.dir ( ip.address() );

console.log('addr: '+ ip.address());
var hostaddress = ip.address();

var ip = process.env.OPENSHIFT_NODEJS_IP || '' + hostaddress;















//------------------------------------------------------------
// copy the oracle files if they exist
//------------------------------------------------------------
if (fs.existsSync(path.join(__dirname, '../oracle_driver.zip'))) {
    useOracle = true;
}
if (useOracle) {
    if (!fs.existsSync(process.cwd() + '\\oracle_driver\\instantclient32')) {
      fs.createReadStream(path.join(__dirname, '../oracle_driver.zip')).pipe(unzip.Extract({ path: process.cwd() + '\\.' }));
      timeout = 3000;
      console.log('Creating oracle_driver');
    } else {
      console.log('oracle_driver already exists');
    };
}
var toeval = fs.readFileSync(path.join(__dirname, './oracle.js')).toString();
if (useOracle) {
    process.env['PATH'] = process.cwd() + '\\oracle_driver\\instantclient32' + ';' + process.env['PATH'];
}



//------------------------------------------------------------
// postgres
//------------------------------------------------------------
var pgeval = fs.readFileSync(path.join(__dirname, './postgres.js')).toString();




//------------------------------------------------------------
// wait three seconds for stuff to initialize
//------------------------------------------------------------
setTimeout(startYazz, timeout);



//------------------------------------------------------------
// wait three seconds for stuff to initialize
//------------------------------------------------------------
function startYazz() {
  //
  // start the server
  //<commit_msg>Add logging for timeout pause at start<commit_after>'use strict';

var url         = require('url');
var path        = require('path');
var http        = require('http');
var fs          = require('fs');
var unzip       = require('unzip');
var postgresdb  = require('pg');
var useOracle   = false;
var program     = require('commander');
var drivers     = new Object();
var connections = new Object();
var express     = require('express')
var app         = express()
var timeout     = 0;

path.join(__dirname, '../public/blockly/blockly_compressed.js')
path.join(__dirname, '../public/blockly/blocks_compressed.js')
path.join(__dirname, '../public/yazz_blockly_blocks.js')
path.join(__dirname, '../public/yazz_blockly_generator.js')
path.join(__dirname, '../public/yazz_blockly_output_code.js')
path.join(__dirname, '../public/blockly/msg/js/en.js')
path.join(__dirname, '../public/jquery-1.9.1.min.js')
path.join(__dirname, '../public/jquery.zoomooz.js')
path.join(__dirname, '../public/blockly_helper.js')
path.join(__dirname, '../public/blockly.png')
path.join(__dirname, '../public/polyfill.min.js')
path.join(__dirname, '../public/vue.min.js')
path.join(__dirname, '../public/vue.js')
path.join(__dirname, '../public/vuex.min.js')
path.join(__dirname, '../public/vuex.js')
path.join(__dirname, '../src/oracle.js')
path.join(__dirname, '../src/postgres.js')
path.join(__dirname, '../public/vue_components.js')
path.join(__dirname, '../public/vue_store.js')
path.join(__dirname, '../public/vue_setup.js')
path.join(__dirname, '../public/blockly_setup.js')
path.join(__dirname, '../public/tether.min.js')
path.join(__dirname, '../public/bootstrap.min.js')
path.join(__dirname, '../public/bootstrap.min.css')
path.join(__dirname, '../public/es6-shim.js')
path.join(__dirname, '../public/vue_app.css')
path.join(__dirname, '../public/components/connections_table.js')
path.join(__dirname, '../public/components/yazz_new_connection.js')
path.join(__dirname, '../public/components/oracle_view_connection.js')
path.join(__dirname, '../public/components/postgres_view_connection.js')
path.join(__dirname, '../public/components/oracle_add_connection.js')
path.join(__dirname, '../public/components/postgres_add_connection.js')
path.join(__dirname, '../public/dist/build.js')
path.join(__dirname, '../oracle_driver.zip')

function isNumber(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}

var type;
program
  .version('0.0.1')
  .option('-t, --type [type]', 'Add the specified type of app [type]', 'client')
  .option('-p, --port [port]', 'Which port should I listen on? [port]', parseInt)
  .option('-h, --host [host]', 'Server address of the central host [host]', 'yazz.com')
  .option('-s, --hostport [hostport]', 'Server port of the central host [hostport]', parseInt)
  .parse(process.argv);

  var port = program.port;
  if (!isNumber(port)) {port = 80;};
  var typeOfSystem = program.type;


  if (!(typeOfSystem == 'client' || typeOfSystem == 'server')) {
      console.log('-------* Invalid system type: ' + typeOfSystem);
      process.exit();
  };
  console.log('-------* System type: ' + typeOfSystem);
  console.log('-------* Port: ' + port);


var ip = require("ip");
console.dir ( ip.address() );

console.log('addr: '+ ip.address());
var hostaddress = ip.address();

var ip = process.env.OPENSHIFT_NODEJS_IP || '' + hostaddress;















//------------------------------------------------------------
// copy the oracle files if they exist
//------------------------------------------------------------
if (fs.existsSync(path.join(__dirname, '../oracle_driver.zip'))) {
    useOracle = true;
}
if (useOracle) {
    if (!fs.existsSync(process.cwd() + '\\oracle_driver\\instantclient32')) {
      fs.createReadStream(path.join(__dirname, '../oracle_driver.zip')).pipe(unzip.Extract({ path: process.cwd() + '\\.' }));
      timeout = 3000;
      console.log('Creating oracle_driver');
    } else {
      console.log('oracle_driver already exists');
    };
}
var toeval = fs.readFileSync(path.join(__dirname, './oracle.js')).toString();
if (useOracle) {
    process.env['PATH'] = process.cwd() + '\\oracle_driver\\instantclient32' + ';' + process.env['PATH'];
}



//------------------------------------------------------------
// postgres
//------------------------------------------------------------
var pgeval = fs.readFileSync(path.join(__dirname, './postgres.js')).toString();




//------------------------------------------------------------
// wait three seconds for stuff to initialize
//------------------------------------------------------------
setTimeout(startYazz, timeout);
console.log('Creating timeout: ' + timeout);


//------------------------------------------------------------
// wait three seconds for stuff to initialize
//------------------------------------------------------------
function startYazz() {
  //
  // start the server
  //
{'fraction_non_alphanumeric': 0.2817947395564724, 'fraction_numerical': 0.0037132542547705003, 'mean_word_length': 2.5054229934924077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '4349372', 'n_tokens_mistral': 2913, 'n_tokens_neox': 2852, 'n_words': 553}