Wednesday 17 October 2018

wisconsin field trip


pospac


file -> new blank -> project -> import
email screenshot, FTP files

-------------------------------------------

RCX

2 lines, second & last
include raw, rad files
check cal, dark, rad, ATT
push 3,4 frame
FTP PIX, ATT files

-----------------------------------------------

FTP

www.itres.com
create folder with date

--------------------------------------------

daily task

afternoon checks

afternoon weather check
contact Proj. Manager/lead
ship data (every three days)

evening prep

clean pos card, hard drives
final weather check
contact proj
record daily weather
update proj. Manager/lead

acquisition flight

follow checklist
ensure logs are completed

post acquisition

backup data twice
complete formal logs
rcx second & last acquisition line
extract vnav from pos
ftp raw pos and rcx output
email update (logs) to team

-------------------------------------------

weather condition

if heavy rain, wait for 24h
take off after 10:30pm, text manager
day temp 10-15c, night temp <4c
wind >16knots, no flight

---------------------------------------------

sample log

daily temperature high/low, rain, cloud

line id | file # | heading | speed | wind heading | altitude | IT(ms) | pressure | temperature | humidity |

---------------------------------------------

expense

oct 18

food
driving 130km

oct 19

hard drive 2 x 8T, 2 x 2T

oct 20

taxi x 2

Oct 21

United luggage
Visa
Taxi

oct22

walmart hard drive, screwdriver

oct30

koodo phone roaming charge 35

oct31

car gas, jet fuel

nov2

jet fuel, target hard drive, fedex


------------------------------------------

working hours

oct 18 bundle, ghost lake, cps flight ops overhead - 12h
oct 19 field data QA training Wisconsin project  - 4h, vacation - 4h
oct 20  visa application, flight change Wisconsin project - 8h
oct 21 mobilization flight, acquisition flight - 24h
oct 22 acquisition flight, solving pos card problem - 16h
oct 23 acquisition flight - 12h
oct 24 acquisition flight - 12h
oct 25 acquisition flight - 12h
oct 26 acquisition flight - 12h
oct 27 acquisition flight - 12h
oct 28 weather rain downtime - 8h
oct 29 mechanical inspection downtime - 8h
oct 30 acquisition flight - 8h
oct 31 mobilization to kenosha - 8h
nov 1 weather down temperature hot - 8h
nov 2 acquisition flight - 12h


Tuesday 16 October 2018

erwin Data Modeler




  • easy to use
         
  • native support for many databases
         CA ERwin Data Modeler (or ERwin for short) is a data modeling and database design tool that is used to create conceptual, logical, and physical data models. ERwin can create the actual database from the physical model, and create different physical implementations from a single logical model. ERwin can also reverse-engineer existing databases into a data model diagram. ERwin works with many database management systems (DBMS). Outputs from the tool include entity-relationship (ER) diagrams and standard or custom reports on all objects in the design (tables, fields, relationships).

      Access, IBM DB2, Informix, MySQL, MS SQL Server, Netezza, Oracle, PostgreSQL, Sybase, and others via ODBC/ANSI SQL

      Schedule ongoing metadata scans for the widest array of metadata targets, enabling automated data harvesting to update the catalog while leaving any enrichments in place. These capabilities, combined with lifecycle management, keep metadata current with full versioning and change management, reducing expensive manual tasks and rework.
  • entended support with more bridges
  • reverse engineer db
        mongodb, azure xml, add user defined properties
  • document model and extend with udps
  • complete compare
       Use the Complete Compare feature to compare the following items:


A data model with a different data model
A data model with a database
A data model with a script file
A database with a different database


  • forward engineer/alter
      Now that we’ve finalized our physical data model, we’ll want to create a physical database from it through forward engineering. Before we generate any code, however, we’ll want to validate our model to make sure that it will generate valid SQL structures for the database. CA ERwin Data Modeler has a process called Check Model which allows us to do a validation of the physical model before we reverse engineer. To run this validation, select Actions|Forward Engineer|Check Model from the Main Menu. A model validation report will be generated, as shown in Figure 19.79, which alerts you to any design errors in the model that will affect forward engineering[19].
  • source to target mapping
  • version control
       From release 9.0 onward, the way you access the Model Manager has changed. In fact the term Model Manager is also no longer used—it is now called the Mart. The Mart is built on a three-tier architecture, which includes a database, a web server, and a client. You may have seen the term MartServer in the installation documents and you may have looked for its meaning.

The term MartServer refers to the software that helps you connect a database to a client, through a web server. To understand this better, consider the Mart architecture as three layers of sheets, Sheet 1, Sheet 2, and Sheet 3. Assume that Sheet 1 is at the bottom and Sheet 3 is at the top.

Sheet 1 refers to the Mart database. You install database software and create a database to use as the Mart. It can be an Oracle, a Microsoft SQL Server, or a Sybase Adaptive Server database.
Sheet 2 refers to the web server. The web server is the software that connects the Mart database with the client. You can use the default web server (Tomcat) that comes with the Mart, or install a web server of your choice.
Sheet 3 refers to the client. CA ERwin Mart Administrator and CA ERwin Data Modeler both are clients. CA ERwin Mart Administrator is installed when you install Mart Server.
MartSever is not a computer, it is a software program. It helps you connect to the Mart database from CA ERwin Mart Administrator and CA ERwin Data Modeler, through Tomcat (default web server). When you install MartServer, CA ERwin Mart Administrator is installed.

hide unhide different versions.
  • reporting
   logical view: data flow to different entities, definition of entities. logical model, physical model.

react audio recorder


reference:
https://github.com/hackingbeauty/react-mic
http://hackingbeauty.com/voicerecordpro/
https://blog.udacity.com/2014/11/front-end-web-developers-what-youll_12.html

Saturday 13 October 2018

react speech synthesis

project linkhttp://chuanshuoge1-react-speech-synthesis.surge.sh/



app.js

import React, { Component } from 'react';
import './App.css';

import speakingImg from './speaking.gif';
import speakerImg from './speaker.png';

import 'antd/dist/antd.css';  // or 'antd/dist/antd.less';
import { Slider, Select, Row, Col, Input, Button } from 'antd';
const Option = Select.Option;
const { TextArea } = Input;

class App extends Component {

  constructor(props) {
    super(props)
    
    this.state={
      rate: 1,
      pitch: 1,
      voicesOption: [],
      voicesObj: [],
      selectedVoice: '',
      text: '',
      speaking: false,
    }
  }

  addVoiceOption = (item, index) =>{
    this.setState(prev=>{
      return{voicesOption: prev.voicesOption.concat(
        <Option key= {index} value={item.name}>{item.name} {item.lang}</Option>
      )}
    })
  }

  addVoiceObj = (voices) => {
    this.setState({voicesObj: voices});
  }

  voiceChange = (e) => {
    this.setState({selectedVoice: e});
  }

  textChange = (e) =>{
    this.setState({text: e.target.value});
  }

  rateChange = (e) =>{
    this.setState({rate: e});
  }

  pitchChange = (e) =>{
    this.setState({pitch: e});
  }

  speak = () =>{

    if(synth.speaking){
      console.error('busy speaking');
      return
    }

    if(this.state.selectedVoice===''){
      alert('please select a voice');
      return;
    }
    else{
      //is speaking
      this.setState({speaking: true});

      //speech synthesis the text
      const speechSynth = new SpeechSynthesisUtterance(this.state.text);

      //speak end
      speechSynth.onend = e => {
        this.setState({speaking: false});
      }

      //speak error
      speechSynth.onerror = e => {
        console.error('something went wrong');
      }

      //speak voice
      const voice = this.state.voicesObj.filter(x=>x.name === this.state.selectedVoice);
      speechSynth.voice = voice[0];

      //speak pitch and rate
      speechSynth.rate = this.state.rate;
      speechSynth.pitch = this.state.pitch;

      //speak
      synth.speak(speechSynth);
    }
  }

  render() {  

    let voices = [];

    //populate voices dropdown list
    const getVoices = () => {
      voices = synth.getVoices();  

      if(voices.length > 0){
        //clear voiceoptions
        this.setState({voicesOption:[]});
        //add voice options
        voices.map((item,index) => this.addVoiceOption(item, index));

        //add voice object
        this.addVoiceObj(voices);
      }
    }

    //speech synth is an async function, wait for voices to be added
    if(synth.onvoiceschanged !== undefined){
      synth.onvoiceschanged = getVoices;     
    }

    return (
      <div>
        <Row>
          <Col style={{marginLeft: 40}}>
            <img src={this.state.speaking? speakingImg: speakerImg}
               alt='speaker'></img>
          </Col>
          <Col>
            text input: <br/>
            <TextArea placeholder="Autosize height based on content lines"
              style={{width: 300}} autosize onChange={(e)=>this.textChange(e)}/>
          </Col>
          <Col>          
            rate:
            <Slider min={0} max={2} defaultValue={1} step={0.1} style={{width: 300}}
              onChange={(e)=>this.rateChange(e)}></Slider>
          </Col>
          <Col>
            pitch:
            <Slider min={0} max={2} defaultValue={1} step={0.1} style={{width: 300}}
              onChange={(e)=>this.pitchChange(e)}></Slider>
          </Col>
          <Col>
            voice: <br/>
            <Select defaultValue = 'select a voice' style={{width: 300}}
              onChange={(e)=>this.voiceChange(e)}>
              {this.state.voicesOption}
            </Select>            
          </Col>
          <Col>
            <br/>
            <Button type="primary" style={{width: 300}} 
              onClick={()=>this.speak()}>Speak</Button>
          </Col>
          <Col>
            <br/>
            browser may not support this browser api
          </Col>
        </Row>
      </div>
    );
  }
}

const synth = window.speechSynthesis;

export default App;

------------------------------------------------------

package.json

{
  "name": "speech-synthesis",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "antd": "^3.10.1",
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-scripts": "2.0.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

---------------------------------------
reference:

Friday 12 October 2018

Hyper-V Installing Microsoft Server 2016 and SQL server




  1. Host o/a - win 10 edu
  2. install vmware workstation or activate hyper-v
  3. download an o/s iso (win server 2016 datacenter)
  4. download sqlserver
  5. download ssms


Friday 5 October 2018

node express + socket.io

3 guys join the real-time chat hosted on 1 server (duplicated web pages). 
They send messages to server. 

server assign IDs to connected clients and broadcast received data to all connections.


package.json

{
  "name": "socketio",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ejs": "^2.6.1",
    "express": "^4.16.3",
    "jquery": "^3.3.1",
    "socket.io": "^2.1.1"
  }
}

-----------------------------------

server.js

const express = require('express');
const socketIO = require('socket.io');
const path = require('path');
const bodyParser = require('body-parser');
const exphbs = require('ejs');


const PORT = process.env.PORT || 3000;
const INDEX = path.join(__dirname, 'index.html');

const app = express();

app.set('view engine', 'ejs');

//Body parser Middleware
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.get('/', (req, res) => res.render('index'));

const server = app.listen(PORT, () => console.log(`Listening on ${ PORT }`));

const io = socketIO(server);

let clientNum = 0;

io.on('connection', (socket) => {

  clientNum++;
  let currentTime = new Date();
  const socketId = socket.id;

  const connectionRes = currentTime.toLocaleString() + ' ' + 
      socketId + ' connected. ' +clientNum.toString() + ' online';

  console.log(connectionRes);

  //send to self when connected
  io.to(socketId).emit('server_connect', connectionRes);

   //response to client send event
  socket.on('client_chat', data=>{
    currentTime = new Date();

    //send to everyone except self
   socket.broadcast.emit('server_chat', 
     {
       name: data.name==''? socketId.toString() : data.name,
       message: data.message,
     }); 
   })


  socket.on('disconnect', () => {
    clientNum--;
    currentTime = new Date();

    console.log(currentTime.toLocaleString(), 
      'client disconnected. users', clientNum);
  });
});

-----------------------------------------

index.ejs

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width-device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous"/>
    <title>socket.io chat</title>
</head>
<body>
        <p id='connectionStatus'></p>

        <div style="height:300px;
                 background-color: lightgray;
                 overflow: scroll"
                 id = 'chatDialog'
                 >
        </div>

        <input placeholder='Name' id='name'/>
        <br/>

        <textarea style="width:350px; height:100px" placeholder='Message'
             id='message'></textarea>
        <br/>

        <button onclick='sendMessage()'>send</button>
        
        <script src="/socket.io/socket.io.js"></script>
        <script>
          var socket = io();
          var nameInput = document.getElementById('name');
          var messageInput = document.getElementById('message');
          var connectionStatus = document.getElementById('connectionStatus');
          var chatDialog = document.getElementById('chatDialog');

          function sendMessage(){
            socket.emit('client_chat', {
                name: nameInput.value,
                message: messageInput.value,
            });

            chatDialog.innerHTML = chatDialog.innerHTML + '<div>' + 
            '<span style="color: green">me:</span> '
            + messageInput.value +
            '</div>'
          }

           socket.on('server_connect', function(data){
            connectionStatus.innerHTML = data;
          });

          socket.on('server_chat', function(data) {

            chatDialog.innerHTML = chatDialog.innerHTML + '<div>' + 
            '<span style="color: blue">' + data.name + ':</span> '
             + data.message +
            '</div>'

          });

        </script>
      </body>
</html>

-------------------------------------
reference: