text:
Q: I made a rock paper scissors game with javascript and I'm having trouble with keeping score, I really lost

function computerPlay() {
    let [min, max] = [1, 3]
    let randomNumber =  Math.floor(Math.random() * (max - min + 1)) + min;
    if(randomNumber == 1) return 'ROCK'
    else if(randomNumber == 2) return 'PAPER'
    else return 'SCISSORS'
  }

  function play(playerSelection, computerSelection) {
    let move = playerSelection;
      let com = computerSelection;
      if(move == 'ROCK' &&  com == 'SCISSORS') return 'ROCK beats SCISSORS';
      else if(move == 'ROCK' && com == 'PAPER') return 'PAPER beats ROCK'
      else if(move == 'SCISSORS' && com == 'ROCK') return 'ROCK beats SCISSORS'
      else if(move == 'SCISSORS' && com == 'PAPER') return 'SCISSORS beat PAPER'
      else if(move == 'PAPER' && com == 'SCISSORS') return 'SCISSORS beat PAPER'
      else if(move == 'PAPER' && com == 'ROCK') return 'PAPER beats ROCK'
      else if(move == com) return 'DRAW'
  }

let playBtn = document.querySelector('.play-btn');
let container1 = document.querySelector('.container1');
playBtn.addEventListener('click', makeContainer);

// This is the function that creates the page that needs the player's input(rock, paper or scissors)
function makeContainer() {

  container1.remove();

  let con = document.createElement('div');
  con.classList.add('container');
  let h1 = document.createElement('h1');
  h1.classList.add('one');
  h1.textContent = 'ROCK PAPER SCISSORS';
  let h12 = document.createElement('h1');
  h12.classList.add('two');
  h12.textContent = 'ROUND 1';
  let h13 = document.createElement('h1');
  h13.classList.add('three');
  h13.textContent = 'MAKE YOUR MOVE';

  let buttons = document.createElement('div');
  buttons.classList.add('buttons');

  let btn1 = document.createElement('div');
  btn1.classList.add('rock');
  let span = document.createElement('span');
  span.textContent = 'ROCK';
  btn1.append(span);

  let btn2 = document.createElement('div');
  btn2.classList.add('paper');
  let span2 = document.createElement('span');
  span2.textContent = 'PAPER';
  btn2.append(span2);

  let btn3 = document.createElement('div');
  btn3.classList.add('scissors');
  let span3 = document.createElement('span');
  span3.textContent = 'SCISSORS';
  btn3.append(span3);

  buttons.append(btn1, btn2, btn3);

  con.append(h1, h12, h13, buttons);

  document.body.append(con);

  const container = document.querySelector('.container');
  const rock = document.querySelector('.rock');
  const paper = document.querySelector('.paper');
  const scissors = document.querySelector('.scissors');
  [rock, paper, scissors].forEach((c) => c.addEventListener('click', (e) => {
    // console.log(e.target);
    containerDisappear(container, c)
  }));
}

// This function removes the makeContainer page(the one that shows rock paper scissors) and adds a transition to it
function containerDisappear(con, r) {
  let choi = r;
  con.style.transitionProperty = 'opacity';
  con.style.transitionDuration = '1s';
  con.style.opacity = '0';
  setTimeout(() => con.remove('container'), 1000);
  animation(choi);
}

// This function displays the animation that pops up after the the makeContainer page has disappeared
function animation(r) {
  let choic = r;
  const waitdiv = document.createElement('div');
    waitdiv.classList.add('waitdiv');
    const div1 = document.createElement('div');
    const div2 = document.createElement('div');
    const div3 = document.createElement('div');
    div1.classList.add('div1');
    div2.classList.add('div2');
    div3.classList.add('div3');
    div1.textContent = 'ROCK...';
    div2.textContent = 'PAPER...';
    div3.textContent = 'SCISSORS...';
    waitdiv.append(div1, div2, div3);
    document.body.append(waitdiv);

    setTimeout(() => {
        div1.style.transitionProperty = 'opacity';
        div1.style.transitionDuration = '.6s';
        div1.style.opacity = '1';
    }, 600);

    setTimeout(() => {
        div2.style.transitionProperty = 'opacity';
        div2.style.transitionDuration = '.6s';
        div2.style.opacity = '1';
    }, 1200);

    setTimeout(() => {
        div3.style.transitionProperty = 'opacity';
        div3.style.transitionDuration = '.6s';
        div3.style.opacity = '1';
    }, 1800);

    setTimeout(() => {
        waitdiv.style.transitionProperty = 'opacity';
        waitdiv.style.transitionDuration = '.3s';
        waitdiv.style.opacity = '0';
        waitdiv.remove();
    }, 2400);

    setTimeout(() => {
      results(choic)
    }, 2400);
}

// This function displays the player's move vs the computer's move and then displays information about who lost
/* Theres a 0:1 right at the bottom of this page, it's static, it doesn't update after each move, it's actually one of the things I'm
struggling with */
function results(c) {
  const cShoot = document.createElement('div');
    cShoot.classList.add('container-shoot');
    const shoot = document.createElement('h1');
    shoot.classList.add('shoot');
    const round = document.createElement('h1');
    round.classList.add('round');
    const versus = document.createElement('div');
    versus.classList.add('versus');
    const v = document.createElement('div');
    v.classList.add('v');
    const h6 = document.createElement('h6');
    const choice = document.createElement('div');
    choice.classList.add('choice');
    const vs = document.createElement('div');
    vs.classList.add('v');
    const v2 = document.createElement('div');
    v2.classList.add('v');
    const choice2 = document.createElement('div');
    choice2.classList.add('choice');
    const h62 = document.createElement('h6');

    // ----------------second part---------------------------------------
    const info = document.createElement('div');
    info.classList.add('info');
    const h2 = document.createElement('h2');
    const h3 = document.createElement('h3');
    const span = document.createElement('span');

    // ---------------------third part------------------------------------
    const score = document.createElement('div');
    score.classList.add('score');
    const span2 = document.createElement('span');
    span2.classList.add('player');
    const span3 = document.createElement('span');
    span3.classList.add('colon');
    const span4 = document.createElement('span');
    span4.classList.add('com');

    // ---------------------time to append stuff--------------------------------------------
    cShoot.append(shoot, round, versus, info, score);
    versus.append(v, vs, v2);
    v.append(h6, choice);
    vs.textContent = 'VS';
    v2.append(choice2, h62);
    info.append(h2, h3);
    h3.append(span);
    span2.textContent = '0';
    span3.textContent = ':';
    span4.textContent = '1';
    score.append(span2, span3, span4);

    // ----------------adding text--------------------------------------------
    shoot.textContent = 'SHOOT!!!';
    round.textContent = 'ROUND 1';
    h6.textContent = 'YOU';
    choice.textContent = (c.classList.value == 'rock') ? 'ROCK' :
    c.classList.value == 'paper' ? 'PAPER' :
    c.classList.value == 'scissors' ? 'SCISSORS' : null;
    vs.textContent = 'VS';
    choice2.textContent = computerPlay();
    h62.textContent = 'COM';
    h2.textContent = play(choice.textContent, choice2.textContent);
    span.textContent = s();
    if(span.textContent == 'YOU WIN THIS ROUND') span.style.color = 'green';
    else span.style.color = 'red'

    // -------------------------function-------------------------------------------------
    function s() {
      if(choice.textContent == 'ROCK' && choice2.textContent == 'SCISSORS') {
        return 'YOU WIN THIS ROUND'
      }
      else if(choice.textContent == 'ROCK' && choice2.textContent == 'PAPER') {
        return 'YOU LOSE THIS ROUND'
      }
      else if(choice.textContent == 'SCISSORS' && choice2.textContent == 'ROCK') {
        return 'YOU LOSE THIS ROUND'
      }
      else if(choice.textContent == 'SCISSORS' && choice2.textContent == 'PAPER') {
        return 'YOU WIN THIS ROUND'
      }
      else if(choice.textContent == 'PAPER' && choice2.textContent == 'SCISSORS') {
        return 'YOU LOSE THIS ROUND'
      }
      else if(choice.textContent == 'PAPER' && choice2.textContent == 'ROCK') {
        return 'YOU WIN THIS ROUND'
      }
    }
    // --------------------------------------------------------------------------

    document.body.append(cShoot);
    // cShoot is the first variable that was created inside this function, it's the div tha holds everything on this page

}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    color: white;
}

body {
    background-color: #333;
}

.container {
    height: 100vh;
    text-align: center;
    position: relative;
    opacity: 1;
}

.buttons {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    column-gap: 30px;
}

.rock {
    border-radius: 20px;
    height: 150px;
    width: 200px;
    border: 2px solid red;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.05s;
}

.rock:hover {
    cursor: pointer;
    transform: scale(1.05);
}

.paper {
    border-radius: 20px;
    height: 150px;
    width: 200px;
    border: 2px solid red;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.05s;
}

.paper:hover {
    cursor: pointer;
    transform: scale(1.05);
}

.scissors {
    border-radius: 20px;
    height: 150px;
    width: 200px;
    border: 2px solid red;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.05s;
}

.scissors:hover {
    cursor: pointer;
    transform: scale(1.05);
}

span {
    font-size: 22px;
}

.one {
    position: relative;
    top: 40px;
}

.two {
    position: relative;
    top: 60px;
}

.three {
    position: relative;
    top: 80px;
    font-size: 23px;
}

.waitdiv {
    display: flex;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.div1 {
    opacity: 0;
    font-size: 75px;
}

.div2 {
    opacity: 0;
    font-size: 75px;
}

.div3 {
    opacity: 0;
    font-size: 75px;
}

.container-shoot {
    height: 100vh;
    text-align: center;
    position: relative;
}

.shoot {
    font-size: 80px;
    position: relative;
    top: 50px;
}

.round {
    position: relative;
    top: 55px;
}

.versus {
    display: flex;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 50px;
    width: 80%;
}

.v {
    display: flex;
    text-align: center;
    flex-basis: 100%;
    justify-content: space-evenly;
    align-items: center;
}

.choice {
    border-radius: 20px;
    text-align: center;
    border: 2px solid red;
    /* font-size: 30px; */
    height: 100px;
    display: flex;
    align-items: center;
}

.info {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translate(-50%, -70px);
}

.info h3 span {
    color: white;
}

.score {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translate(-50%, -20px);
}

.score span {
    font-size: 70px;
}

.container1 {
    height: 100vh;
    position: relative;
}

.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    cursor: pointer;
    color: black;
    font-size: 16px;
    border-radius: 12px;
    border: none;
}

.next {
    border-radius: 17px;
    border: none;
    position: absolute;
    left: 90%;
    top: 90%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    padding: 12px 18px;
    color: black;

}

        <button class="play-btn">PLAY</button>

I made a rock paper scissors game with javascript and I'm having trouble with keeping score.
I need a way to keep track of who is winning between the player and the computer, that score should be displayed right at the bottom of the page.
If you run the whole code(html, css and javascript), you will see this example right at the bottom of the last page
I encourage you to please run the whole code
Here's my HTML file:

<button class="play-btn">PLAY</button>

Here's the code i wrote in my JAVASCRIPT file:
function computerPlay() {
let [min, max] = [1, 3]
let randomNumber =  Math.floor(Math.random() * (max - min + 1)) + min;
if(randomNumber == 1) return 'ROCK'
else if(randomNumber == 2) return 'PAPER'
else return 'SCISSORS'

}
function play(playerSelection, computerSelection) {
let move = playerSelection;
  let com = computerSelection;
  if(move == 'ROCK' && com == 'SCISSORS') return 'ROCK beats SCISSORS';
  else if(move == 'ROCK' && com == 'PAPER') return 'PAPER beats ROCK'
  else if(move == 'SCISSORS' && com == 'ROCK') return 'ROCK beats SCISSORS'
  else if(move == 'SCISSORS' && com == 'PAPER') return 'SCISSORS beat PAPER'
  else if(move == 'PAPER' && com == 'SCISSORS') return 'SCISSORS beat PAPER'
  else if(move == 'PAPER' && com == 'ROCK') return 'PAPER beats ROCK'
  else if(move == com) return 'DRAW'

}
let arr = [];

let playBtn = document.querySelector('.play-btn');
let container1 = document.querySelector('.container1');
playBtn.addEventListener('click', makeContainer);

This is the function that creates the page that needs the player's input(rock, paper or scissors)
function makeContainer() {

  container1.remove();

  let con = document.createElement('div');
  con.classList.add('container');
  let h1 = document.createElement('h1');
  h1.classList.add('one');
  h1.textContent = 'ROCK PAPER SCISSORS';
  let h12 = document.createElement('h1');
  h12.classList.add('two');
  h12.textContent = 'ROUND 1';
  let h13 = document.createElement('h1');
  h13.classList.add('three');
  h13.textContent = 'MAKE YOUR MOVE';

  let buttons = document.createElement('div');
  buttons.classList.add('buttons');

  let btn1 = document.createElement('div');
  btn1.classList.add('rock');
  let span = document.createElement('span');
  span.textContent = 'ROCK';
  btn1.append(span);

  let btn2 = document.createElement('div');
  btn2.classList.add('paper');
  let span2 = document.createElement('span');
  span2.textContent = 'PAPER';
  btn2.append(span2);

  let btn3 = document.createElement('div');
  btn3.classList.add('scissors');
  let span3 = document.createElement('span');
  span3.textContent = 'SCISSORS';
  btn3.append(span3);

  buttons.append(btn1, btn2, btn3);

  con.append(h1, h12, h13, buttons);

  document.body.append(con);

  const container = document.querySelector('.container');
  const rock = document.querySelector('.rock');
  const paper = document.querySelector('.paper');
  const scissors = document.querySelector('.scissors');
  [rock, paper, scissors].forEach((c) => c.addEventListener('click', (e) => {
    // console.log(e.target);
    containerDisappear(container, c)
  }));
}

This function removes the makeContainer page(the one that shows rock paper scissors) and adds a transition to it
function containerDisappear(con, r) {
  let choi = r;
  con.style.transitionProperty = 'opacity';
  con.style.transitionDuration = '1s';
  con.style.opacity = '0';
  setTimeout(() => con.remove('container'), 1000);
  animation(choi);
}

This function displays the animation that pops up after the the makeContainer page has disappeared
 function animation(r) {
  let choic = r;
  const waitdiv = document.createElement('div');
    waitdiv.classList.add('waitdiv');
    const div1 = document.createElement('div');
    const div2 = document.createElement('div');
    const div3 = document.createElement('div');
    div1.classList.add('div1');
    div2.classList.add('div2');
    div3.classList.add('div3');
    div1.textContent = 'ROCK...';
    div2.textContent = 'PAPER...';
    div3.textContent = 'SCISSORS...';
    waitdiv.append(div1, div2, div3);
    document.body.append(waitdiv);

    setTimeout(() => {
        div1.style.transitionProperty = 'opacity';
        div1.style.transitionDuration = '.6s';
        div1.style.opacity = '1';
    }, 600);

    setTimeout(() => {
        div2.style.transitionProperty = 'opacity';
        div2.style.transitionDuration = '.6s';
        div2.style.opacity = '1';
    }, 1200);

    setTimeout(() => {
        div3.style.transitionProperty = 'opacity';
        div3.style.transitionDuration = '.6s';
        div3.style.opacity = '1';
    }, 1800);

    setTimeout(() => {
        waitdiv.style.transitionProperty = 'opacity';
        waitdiv.style.transitionDuration = '.3s';
        waitdiv.style.opacity = '0';
        waitdiv.remove();
    }, 2400);

    setTimeout(() => {
      results(choic)
    }, 2400);
}

This function displays the player's move vs the computer's move and then displays information about who lost
Theres a 0:1 right at the bottom of this page, it's static, it doesn't update after each move, it's actually one of the things I'm struggling with
function results(c) {
  const cShoot = document.createElement('div');
    cShoot.classList.add('container-shoot');
    const shoot = document.createElement('h1');
    shoot.classList.add('shoot');
    const round = document.createElement('h1');
    round.classList.add('round');
    const versus = document.createElement('div');
    versus.classList.add('versus');
    const v = document.createElement('div');
    v.classList.add('v');
    const h6 = document.createElement('h6');
    const choice = document.createElement('div');
    choice.classList.add('choice');
    const vs = document.createElement('div');
    vs.classList.add('v');
    const v2 = document.createElement('div');
    v2.classList.add('v');
    const choice2 = document.createElement('div');
    choice2.classList.add('choice');
    const h62 = document.createElement('h6');

    // ----------------second part---------------------------------------
    const info = document.createElement('div');
    info.classList.add('info');
    const h2 = document.createElement('h2');
    const h3 = document.createElement('h3');
    const span = document.createElement('span');

    // ---------------------third part------------------------------------
    const score = document.createElement('div');
    score.classList.add('score');
    const span2 = document.createElement('span');
    span2.classList.add('player');
    const span3 = document.createElement('span');
    span3.classList.add('colon');
    const span4 = document.createElement('span');
    span4.classList.add('com');

    // ---------------------time to append stuff--------------------------------------------
    cShoot.append(shoot, round, versus, info, score);
    versus.append(v, vs, v2);
    v.append(h6, choice);
    vs.textContent = 'VS';
    v2.append(choice2, h62);
    info.append(h2, h3);
    h3.append(span);
    span2.textContent = '0';
    span3.textContent = ':';
    span4.textContent = '1';
    score.append(span2, span3, span4);

    // ----------------adding text--------------------------------------------
    shoot.textContent = 'SHOOT!!!';
    round.textContent = 'ROUND 1';
    h6.textContent = 'YOU';
    choice.textContent = (c.classList.value == 'rock') ? 'ROCK' :
    c.classList.value == 'paper' ? 'PAPER' :
    c.classList.value == 'scissors' ? 'SCISSORS' : null;
    vs.textContent = 'VS';
    choice2.textContent = computerPlay();
    h62.textContent = 'COM';
    h2.textContent = play(choice.textContent, choice2.textContent);
    span.textContent = s();
    if(span.textContent == 'YOU WIN THIS ROUND') span.style.color = 'green';
    else span.style.color = 'red'

    // -------------------------function-------------------------------------------------
    function s() {
      if(choice.textContent == 'ROCK' && choice2.textContent == 'SCISSORS') {
        return 'YOU WIN THIS ROUND'
      }
      else if(choice.textContent == 'ROCK' && choice2.textContent == 'PAPER') {
        return 'YOU LOSE THIS ROUND'
      }
      else if(choice.textContent == 'SCISSORS' && choice2.textContent == 'ROCK') {
        return 'YOU LOSE THIS ROUND'
      }
      else if(choice.textContent == 'SCISSORS' && choice2.textContent == 'PAPER') {
        return 'YOU WIN THIS ROUND'
      }
      else if(choice.textContent == 'PAPER' && choice2.textContent == 'SCISSORS') {
        return 'YOU LOSE THIS ROUND'
      }
      else if(choice.textContent == 'PAPER' && choice2.textContent == 'ROCK') {
        return 'YOU WIN THIS ROUND'
      }
    }
    // --------------------------------------------------------------------------

    document.body.append(cShoot);
    // cShoot is the first variable that was created inside this function, it's the div tha holds everything on this page

}

Here's my css file:
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    color: white;
}

body {
    background-color: #333;
}

.container {
    height: 100vh;
    text-align: center;
    position: relative;
    opacity: 1;
}

.buttons {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    column-gap: 30px;
}

.rock {
    border-radius: 20px;
    height: 150px;
    width: 200px;
    border: 2px solid red;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.05s;
}

.rock:hover {
    cursor: pointer;
    transform: scale(1.05);
}

.paper {
    border-radius: 20px;
    height: 150px;
    width: 200px;
    border: 2px solid red;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.05s;
}

.paper:hover {
    cursor: pointer;
    transform: scale(1.05);
}

.scissors {
    border-radius: 20px;
    height: 150px;
    width: 200px;
    border: 2px solid red;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.05s;
}

.scissors:hover {
    cursor: pointer;
    transform: scale(1.05);
}

span {
    font-size: 22px;
}

.one {
    position: relative;
    top: 40px;
}

.two {
    position: relative;
    top: 60px;
}

.three {
    position: relative;
    top: 80px;
    font-size: 23px;
}

.waitdiv {
    display: flex;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.div1 {
    opacity: 0;
    font-size: 75px;
}

.div2 {
    opacity: 0;
    font-size: 75px;
}

.div3 {
    opacity: 0;
    font-size: 75px;
}

.container-shoot {
    height: 100vh;
    text-align: center;
    position: relative;
}

.shoot {
    font-size: 80px;
    position: relative;
    top: 50px;
}

.round {
    position: relative;
    top: 55px;
}

.versus {
    display: flex;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 50px;
    width: 80%;
}

.v {
    display: flex;
    text-align: center;
    flex-basis: 100%;
    justify-content: space-evenly;
    align-items: center;
}

.choice {
    border-radius: 20px;
    text-align: center;
    border: 2px solid red;
    /* font-size: 30px; */
    height: 100px;
    display: flex;
    align-items: center;
}

.info {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translate(-50%, -70px);
}

.info h3 span {
    color: white;
}

.score {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translate(-50%, -20px);
}

.score span {
    font-size: 70px;
}

.container1 {
    height: 100vh;
    position: relative;
}

.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    cursor: pointer;
    color: black;
    font-size: 16px;
    border-radius: 12px;
    border: none;
}

.next {
    border-radius: 17px;
    border: none;
    position: absolute;
    left: 90%;
    top: 90%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    padding: 12px 18px;
    color: black;

}

A: Problem

"...I'm having trouble with keeping score. I need a way to keep track of who is winning between the player and the computer,..."

I cannot be specifically say what the problem is in OP (Original Post) code because it's too bloated. Instead of combing through 200 lines and ending up rewriting 80% of the code, I have made a roshambo game that behaves and appears simular to the OP code (see Example B).
Solutions
<form> & Form Controls
The best HTML layout for simple games is a <form> and form controls. The HTMLFormElement and HTMLFormControlsCollection interfaces allow us to use a terse and versatile syntax (see Figure IA and Figure IB)
Figure IA - Simple HTML layout of <form> and form controls
<form id='contacts'>
  <fieldset name='group'>
    First Name:
      <input id='firstname' value='zer0'>

    Last Name:
      <input id='lastname' value='0ne'>

  </fieldset>
  <fieldset name='group'>
    <output id='fullname'></output>
  </fieldset>
  <fieldset name='group'>
    Phone: <input id='phone' type='tel'>
    <button type='reset'>Reset</button>
    <button>Submit</button>
  </fieldset>
</form>

Figure IB - A comparison between DOM interfaces

Objective
HTMLFormElement
Common DOM Methods

<form>
const C = document.forms.contacts
const C = document.getElementById('contacts')

All form controls
const all = C.elements
const all = C.querySelectorAll('fieldset, input, button')

All <fieldset>s
const sets = all.group
const sets = C.querySelectorAll('fieldset')

Get the value of <input id='phone'>
let cell = all.phone.value
let cell = C.querySelector('#phone').value

Also see Form Properties and Methods
Special Events
There are also events that are made exclusively for <form>s and form controls (see Figure II). Specialized behavior allows us to write less and control which elements can react and which elements to exclude. Moreover, it's important to know how to delegate events by binding events to a parent or ancestor element of multiple origin elements (buttons, inputs, etc) and writing  event handlers that target specific elements.
Figure II - Special Events

Event
Tags
Trigger
Behavior

submit
<form>
1. User is focused on a text field and hits the Enter/Return key.2. User clicks a <button>, <input type='submit'>, or <input type='image'>.3. .submit() method.
<form> will send the values of all form controls❉ that have a [name] attribute to a server. If there is no server then it will return a blank page.

reset
<form>
1. User clicks a button with type="reset"2. .reset() method
All form control values entered by the user are removed

change
<form> and form controls❉
User enters data or selects a value on/from a form control then loses focus

input
<form> and  form controls❉
User enters data or selects a value on/from a form control

✳ buttons: <button> with or without type: "button", "submit", "reset", and <input> with one of the following type: "button", "submit", "reset", "image"
❉ buttons✳ and <output> are excluded
Incrementing .value Property and Closures - See Example A

*

*Define a variable at initial number (usually 0) outside of any function.

*Reference a form control that has or can have a .value property.

*Increment the variable from #1.

*Assign the value of the variable from #1 to the referenced form control from #2

In #1 we define a variable (it can be a number, an index of an array or an object value from a property, etc) outside of the function because once a function ends, everything within is garbage collected, so the value must be outside but within scope of the function, see Closures.
Details are commented in both Example A and Example B
Example A

// Define values outside of function #1
const coin = {
  sides: ['https://i.ibb.co/QvT4L5k/heads.png', 'https://i.ibb.co/C6Y3HKd/tails.png'],
  heads: 0,
  tails: 0
};
// Reference the <form>
const UI = document.forms.toss;
// Prevent normal <form> behavior during a submit event
UI.onsubmit = e => e.preventDefault();
// Bind <form> to click event
UI.onclick = flipCoin;
// Event handler passes Event Object by default
function flipCoin(e) {
  // Get a random number between 0 and 1
  let side = Math.random() < 0.5 ? 0 : 1; // 0 or 1
  // Reference the element the user clicked
  const clk = e.target;
  // Reference all form controls
  const IO = this.elements;
  /*
  If the user clicked input#flip...
  ...change it's src...
  ...increment coin = {heads or tails}...
  ...assign heads/tails value of {coin} to the <output>s
  */
  if (clk.id === 'flip') {
    clk.src = coin.sides[side];
    side === 0 ? coin.heads += 1 : coin.tails += 1;
    IO.heads.value = coin.heads;
    IO.tails.value = coin.tails;
  }
}
<form id='toss'>
  <input id='flip' src='https://i.ibb.co/QvT4L5k/heads.png' type='image'>
 Heads: <output id='heads'></output>
 Tails: <output id='tails'></output>
</form>

Example B

// Reference <form>
const game = document.forms.roshambo;
// Collect all <dialog> into an array
const dialogs = [...document.querySelectorAll('dialog')];
// Define an object outside of functions to keep track of the score
const score = {
  turn: 0,
  wins: 0,
  lost: 0,
  draw: 0
};
/*
Bind the "DOMContentLoaded" event to the document
When all DOM content is loaded...
...close all <dialog>s...
...open the first <dialog>
*/
document.addEventListener('DOMContentLoaded', function() {
  dialogs.forEach(d => d.close());
  dialogs[0].showModal();
})
// Bind "reset" event to <form>
game.onreset = phase0;
// Bind "click" event to <form>
game.onclick = choice;
// Event handler passes Event Object by default
function choice(event) {
  // Reference the tag the user clicked
  const clicked = event.target;
  // Reference all form controls
  const IO = this.elements;
  /*
  If the user clicked a [name="clear"]...
  ...reset all of {score}'s properties to 0...
  ...trigger a "reset" event on <form>
  */
  if (clicked.name === 'clear') {
    for (let prop in score) {
      score[prop] = 0;
    }
    this.reset();
  }
  /*
  If the user clicked a [name="rps"]...
  ...close all <dialog>...
  ...open the third <dialog>...
  ...define an array -
     index 0 is the value of the clicked <button> converted into a number
     index 1 is the result of rand()
     [(0-2), (0-2)]...
  ...call phase2() passing the array and a reference to all form controls
  */
  if (clicked.name === 'rps') {
    dialogs.forEach(d => d.close());
    dialogs[2].showModal();
    let RPS = [parseInt(clicked.value), rand()];
    phase2(RPS, IO);
  }
}
// Event handler passes the Event Object by default
function phase0(event) {
  // Prevent the <form> from clearing out all of the <output>
  event.preventDefault();
  // Reference all form controls
  const IO = this.elements;
  // Close all <dialog>s
  dialogs.forEach(d => d.close());
  // Open the second <dialog>
  dialogs[1].showModal();
  // Increment score: {turn}
  score.turn += 1;
  // call phase1() passing the reference to all form controls
  phase1(IO);
}
// Pass the reference to all form controls
function phase1(IO) {
  // Reference all form controls in fieldset#choices
  const io = IO.choices.elements;
  // Update all <output> under fieldset#choices
  io.round.value = score.turn;
  io.wins.value = score.wins;
  io.lost.value = score.lost;
  io.draw.value = score.draw;
}
// Pass the array of numbers and the reference to all form controls
function phase2(RPS, IO) {
  // Define an array of strings
  const text = ['ROCK..., ', 'PAPER..., ', 'SCISSORS... '];
  // Define a number that will be the base amount of ms for timeouts
  let time = 600;
  // Call animate() passing array, a selector of tag to append to, and time
  animate(text, '#animation h1', time);
  // Call phase3() passing what phase2() passed on the calculated time
  setTimeout(() => {
    phase3(RPS, IO);
  }, (text.length + 4) * time);
}
// Pass array and reference
function phase3(RPS, IO) {
  // Close all <dialog>s
  dialogs.forEach(d => d.close());
  // Open the fourth <dialog>
  dialogs[3].showModal();
  // Call outcome() passing the array and reference
  outcome(RPS, IO);
}
// Displays 'ROCK..., ', 'PAPER..., ', 'SCISSORS... ' at timed intervals
function delay(array, title, time) {
  array.forEach((segment, index) => {
    setTimeout(() => {
      const tag = document.createElement('b');
      tag.textContent = segment;
      tag.className = 'fadeIn';
      title.append(tag);
    }, index * time);
  });
}
// Runs delay() and animates "GO!"
function animate(array, selector, time = 1000) {
  const title = document.querySelector(selector);
  delay(array, title, time);
  setTimeout(() => {
    title.replaceChildren();
    title.insertAdjacentHTML('beforeend', `<b class='zoom'>GO!</b>`);
  }, (array.length + 1) * time);
  setTimeout(() => {
    title.className = 'fadeOut';
    title.replaceChildren();
  }, (array.length + 3) * time);
  title.className = '';
}
// Returns a random number in the range of 0-2
function rand() {
  return Math.floor(Math.random() * 2) + 1;
}
// Pass the numbers derived from choice(e)
function play(pick, comp) {
  // This is a ternary expression - an abbreviated if/else statement
  return pick === comp // if user's num equals cpu's num
    ? 0 // return 0
    : comp === pick - 1 // if cpu's num is 1 less than user's num
    ? 1 // return 1
    : comp === 2 && pick === 0 // if cpu num is 2 AND user's num is 0
    ? 1 // return 1
    : -1; // else return -1
}
// Pass the array and reference
function outcome(RPS, IO) {
  // Define an array of RPS
  const played = [' Rock', ' Paper', '✂ Scissors'];
  // Reference all form controls under fieldset#outcome
  const io = IO.outcome.elements;
  // Get the return of play() passing the two numbers of the given array
  let wld = play(RPS[0], RPS[1]);
  // Assign values to the <output>s
  io.you.value = played[RPS[0]];
  io.cpu.value = played[RPS[1]];
  io.round.value = score.turn;
  io.draw.value = score.draw;
  io.wins.value = score.wins;
  io.lost.value = score.lost;
  // Determine what will be displayed by the return of play()
  switch (wld) {
    case 0:
      score.draw += 1;
      io.draw.value = score.draw;
      io.message.value = "It's a Draw";
      io.vs.value = "Ties with";
      break;
    case 1:
      score.wins += 1;
      io.wins.value = score.wins;
      io.message.value = "You Win";
      io.vs.value = "Beats";
      break;
    case -1:
      score.lost += 1;
      io.lost.value = score.lost;
      io.message.value = "You Lose";
      io.vs.value = "is Beaten by";
      break;
    default:
      break;
  }
}
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@300&family=Raleway:wght@500&display=swap');
@keyframes click {
  0% {
    transform: scale(1.0);
  }
  50% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1.0);
  }
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes zoom {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(4);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  font: 300 4vmin/1 Oswald;
}

body {
  background-color: #333;
  color: #fff;
}

form {
  position: relative;
  min-height: 100%;
}

dialog {
  position: absolute;
  top: 20%;
  left: 50%;
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
  border-color: transparent;
  background-color: #333;
  transform: translate(-50%);
  overflow: hidden;
}

dialog::backdrop {
  background-color: #333;
}

.phase {
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  min-width: 70vw;
  padding: 1rem;
  border-color: transparent;
  color: #fff;
}

.buttons {
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-around;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-color: transparent;
}

legend {
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-left: 50%;
  padding: 1rem;
  color: #fff;
  transform: translateX(-50%);
}

h1,
h2,
h3 {
  font-family: Raleway;
  white-space: nowrap;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2.25rem;
}

h3 {
  font-size: 1.75rem;
}

.score {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  min-width: 100%;
}

output,
b {
  display: inline-block;
}

output::after {
  content: attr(value);
}

.wins::before {
  content: 'Won ';
}

.lost::before {
  content: 'Lost ';
}

.draw::before {
  content: 'Draw ';
}

button {
  display: inline-flex;
  flex-flow: row nowrap;
  justify-content: center;
  align-items: center;
  height: 4rem;
  width: 10rem;
  border: 0.2rem solid red;
  border-radius: 2rem;
  color: #fff;
  font: inherit;
  font-size: 2rem;
  font-variant: small-caps;
  background-color: #333;
  cursor: pointer;
}

button:hover {
  background-color: #fff;
  color: red;
}

button:active {
  animation: click 0.3s forwards;
}

button:focus {
  outline: 0;
}

.fadeIn {
  animation: fadeIn 0.6s ease-out;
}

.fadeOut {
  animation: fadeOut 0.6s ease-in;
}

.zoom {
  animation: zoom 0.5s ease-out forwards;
}

.number {
  font-family: Consolas;
}
<form id="roshambo">

  <dialog>
    <fieldset id='start' class='phase'>
      <button name='continue' type="reset">Play</button>
    </fieldset>
  </dialog>

  <dialog>
    <fieldset id='choices' class='phase'>
      <legend>

Rock, Paper, Scissors

Round <output name='round' class='number'></output>

Make Your Move

            <output name='wins' class='number'></output>

            <output name='lost' class='number'></output>

            <output name='draw' class='number'></output>

      </legend>
      <fieldset class='buttons'>
        <button name='rps' value='0' type='button'> Rock</button>
        <button name='rps' value='1' type='button'> Paper</button>
        <button name='rps' value='2' type='button'>✂ Scissors</button>
      </fieldset>
    </fieldset>
  </dialog>

  <dialog>
    <fieldset id='animation' class='phase'>
      <legend>

      </legend>
    </fieldset>
  </dialog>

  <dialog>
    <fieldset id='outcome' class='phase'>
      <legend>

<output id='message'></output>

Round <output name='round' class='number'></output>

Your
          <output id='you'></output>
          <output id='vs'></output> Your Opponent's
          <output id='cpu'></output>

            <output name='wins' class='number'></output>

            <output name='lost' class='number'></output>

            <output name='draw' class='number'></output>

      </legend>

      <fieldset class='buttons'>
        <button name='continue' type='reset'>Continue</button>
        <button name='clear' type='reset'>Clear</button>
      </fieldset>
    </fieldset>
  </dialog>

</form>


text:
Q: How Can I use the blockly with my own create blockly? I want to know how can I use my own create block in blockly, I have the toolbox xml, my workspace created.
Integrate my workspace with my new blocks created for programming in JS

redpajama_set_name: RedPajamaStackExchange


text:
Q: Left outer join with a condition I haven't been able to confirm an answer to this question anywhere... I have some code like this (PL/SQL):
select
    tbl1.ID
    , tbl1.col1
    , tbl1.col2
    , tbl2.col1
from
    table1 tbl1
    , table2 tbl2
where
    (tbl1.ID = tbl2.ID(+)
    and tbl2.col2 = 12345)

I'm left outer joining to table2 (tbl2 could have NULLs), indicated by the "(+)" notation, but I also need to filter by tbl2.col2 = 12345. Is it still a left outer join if I'm adding that condition, or is there a way to specify that tbl2.col2 = 12345 should also be a left join? In other words, I'm concerned that I might need to do something like "tbl2.col2 = 12345(+)" but I'm not sure either.
Thanks for any information. Not very familiar with PL/SQL, and having debug auto-generated PL/SQL code at that!

A: You don't have to use the "old" Oracle's outer join operator (+); Oracle supports JOINs since version 9i (unless I'm wrong), and that's quite a long ago.
I didn't understand what you want to get as a result, but - it makes a difference whether you put that condition into the join, or apply it as a filter in where clause.
If you know Scott's sample schema, dept table contains department 40 while no employees in emp table work in that department. Therefore, it can be used to illustrate what you are asking. Compare the following queries:
Here, deptno = 40 is part of the JOIN:
SQL> select d.deptno, d.dname, e.ename
  2  from dept d left join emp e on e.deptno = d.deptno and d.deptno = 40
  3  order by d.deptno, e.ename;

    DEPTNO DNAME          ENAME
---------- -------------- ----------
        10 ACCOUNTING
        20 RESEARCH
        30 SALES
        40 OPERATIONS

In another example, deptno = 40 is in where clause and is used as a filter:
SQL> select d.deptno, d.dname, e.ename
  2  from dept d left join emp e on e.deptno = d.deptno
  3  where d.deptno = 40
  4  order by d.deptno, e.ename;

    DEPTNO DNAME          ENAME
---------- -------------- ----------
        40 OPERATIONS

SQL>

As I said: I don't know which option you want, but I hope that those examples will help you decide whether you need the 1st or the 2nd query.


text:
Q: What is the equivalent in nodeJS of the expression below? Can someone help me to get this done in NodeJs
Below is an example (C#) with brief description on how to compute signature: I want it in Node JS

*

*Encode the lower case of integrator key to bytes in UTF-8 format var keyToBytes = Encoding.UTF8.GetBytes(integratorKey.ToString().ToLower());

*Create a HMACSHA256 routine that uses the key bytes as the encryption key var hmacSha256 = new System.Security.Cryptography.HMACSHA256(keyToBytes);

*Create the signature by encrypting the encoded endpoint (Absolute path of the URI only) and timestamp var signatureBytes = utf8.GetBytes(String.Concat(new Uri(url).AbsolutePath, timeStamp));

*Convert the encrypted string to base-64 string format var signature = Convert.ToBase64String(hmacSha256.ComputeHash(signatureBytes));

A: You can try this:
const crypto = require('crypto');
const url = require('url');

const urlExample = 'http://localhost/test/resource';
const integratorKeyString = 'dDASDaGdj5R1kf5151ladAFvv';
const keyToBytes = Buffer.from(integratorKeyString.toLowerCase());
const hmacSha256 = crypto.createHmac('SHA256', keyToBytes);
const signatureBytes = Buffer.from(url.parse(urlExample).pathname + Date.now());
const signature = hmacSha256.update(signatureBytes).digest('base64');

console.log(signature);


text:
Q: pgfplots: don't plot each point from table I have a large file with data which I want to plot using pgf. Since I don't want to edit the file and it consists of roughly 5000 data points, compiling takes quite a while. Is there any way to tell pgfplots to plot only every n-th data point?
Here is an example:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{filecontents}
\begin{filecontents*}{mydata.csv}
x,       y
1,       0.000004824
2,       0.000004687
3,       0.000009425
4,       0.000004794
5,       0.000004565
\end{filecontents*}

\begin{document}
\begin{tikzpicture}
\begin{axis}[]
\addplot table [col sep=comma] {mydata.csv};
\end{axis}
\end{tikzpicture}
\end{document}


text:
Q: Insert mood auto activated after text selection in android studio I have set up my android studio with all plugins I had before. I am facing a problem and I can not resolve it, The problem is when I am selecting a line to edit or delete the cursor then turns into insert mood and then I can not do nothing like deleting or editing. How can I resolve this? I am using Android Studio 4.0.
This is the video link I uploaded it to show you the problem just 1 min video. This will clarify my statements.
See The Problem in This Video

A: I got the solution here,
This made my day.....
Solution Link
Solution Video

Check for the first time if you didn't activate the insert mode. Keyboard shortcuts for the android studio will not be the source of that bug. You have to check the Android Studio plugin to disable the one which causes the problem of typing.

A: You just have to uninstall or disble the ideavim plugin and you're good to go.


text:
Q: How do you dynamically expand array and update? I am trying to wrap my head around how the logic works.  The idea is to dynamically allocate memory because I won't know how many iterations the program will go through and I can't use vectors.  So here is an abstraction of what I have so far.  I have a do while loop that contains the variable count which will act as the SIZE of the array.  update is what will be stored in the array.  The thing i can't figure out is how to update the array iPoint without making an infinite amount of if else statements.  I know there is a better way but at this point my brain is fried.
#include <iostream>
#include <string>

using namespace std;

int main()
{

    int iTickets, count = 0, update = 0;
    int *tempiPoint = NULL;
    int *iPoint = NULL;

    do
    {
        count++;
        update++;

        if (count == 1)
        {

            tempiPoint = new int[count];
            for (int i = 0; i < count; i++)
            {
                *(tempiPoint + i) = update;
            }

        }
        else if (count > 1)
        {

            iPoint = new int[count];
            for (int i = 0; i < count; i++)
            {
                *(iPoint + i) = *(tempiPoint + i);

            }
            *(iPoint + count) = update;

        }

    } while (count != 10);
    for (int i = 0; i < count; i++)
    {
        cout << *(iPoint + i);
}
    delete[] tempiPoint;
    delete[] iPoint;
    return 0;
}

A: Every time the loop iterates, you need to:

*

*Free tempiPoint's memory, as it was dynamically allocated in the previous iteration.

*Reallocate it with iPoint's current size.

*Copy iPoint's data into tempiPoint.

*Free iPoint's memory and reallocate it with the new size.

*Copy tempiPoint's data back into iPoint and then add the new value to the end of iPoint.

Also, note that *(iPoint + count) is equivalent to iPoint[count] (and that this is the syntax you should be using).
This appears to be homework so I'm leaving the implementation to you.
A far better  and simpler solution (pointed out in the comments by Ben Voigt) is to simply have tempiPoint point to iPoint's memory, reallocate iPoint, transfer the data back to iPoint using tempiPoint and then free the memory.


text:
Q: how to get json data in a list with link Hi i am able to get json data as a list in html page but i like to get as a list of link. Because when i click on the link it will show details.
What i have done in tenantlistmob.php
<?php
include('connection.php');
$result = mysql_query("SELECT * FROM tenanttemp");
while ($row = mysql_fetch_assoc($result))
{
$array[] = array($row['TenantFirstName']);
}
echo json_encode($array);
?>

Then my html page is
<!DOCTYPE HTML>

<link rel="stylesheet" href="../jasmine-device_2/styles/main.css" />

<form name="index">

</form>

The output is
 Humayun
 Sahjahan
 Bayezid
 Bayezid
 Asaduzzaman
 Mouri

I am getting the TenantFirstName as a list.But i like to get it as a list of link.Because when i click on a name it will show details of that name. How can i do both work(as a list of link and when click on a link it will show details in a html page query from mysql database)?
Please help.

A: use table like below
<!DOCTYPE HTML>

<link rel="stylesheet" href="../jasmine-device_2/styles/main.css" />

 <form name="index">

        Name

</form>


text:
Q: Transmission lines I have a little confusion about power transmission lines. In my home town, there are 4 conductors parallel to each other coming down from the main road on steel poles. Then, on every street, two conductors are distributing power to each home. Now, the four condctors which are coming down from the road — are these are called bundled condutors (no spacers are present between them)? Are they a 3 phase 4 wire system? And also explain the conductors that are distributing power on the streets.

A: They are almost certainly not bundled conductors (see Electrotechnik).  Those are only used on high voltage transmission lines.
They are very likely to be a 3-phase 4-wire system, with three phase (live, hot) conductors and one shared neutral.  Premises that only need a single-phase supply will get a tap off one phase and the neutral.


text:
Q: What is JMS?XML in JMS I have a very basic question.Please help me in understanding this.
What is actually JMS? How we need to configure it ?
Recently I heard from one of my colleague that in JMS,the XML tags will not be represented as "<" and ">" rather it would be as "ampersand+lt;" and "ampersand+gt;". Is that true?
I have tried to understand JMS concepts.But could not get a clear picture.
Could someone explain in simple way.

A: Well you have got the concept wrong, which is already pointed out in the comments... Anyway, you can put XML in a JMS message body and send that JMS message to a messaging engine. XML could be put in the JMS text message as is and no changes are required, like the one you have mentioned.
One of the reasons your colleague could have told you this is because the receiver of the JMS message might want the XML is some format.
JMS is a messaging API and XML is a markup language.


text:
Q: POP-UP to display library pictures? Currently we have a SharePoint 2010 "Picture Library Slideshow Web Part" implemented, which is able to display pictures from a Picture Library in a Random Order.
However, there is very little customization and when a user clicks on the picture, it opens a new tab with the picture by itself. What I would like to do instead is to open a pop-up box and display the picture with the option to see all of the pictures in the library. Something like the following but better looking, and hopefully automatically resizable.

To get the windows above to pop-up, all I had to do was:
1. Add a Content Editor
2. Click HTML and add the HTML line of code

The problem is how can we integrate both in one, and make it more user friendly.

*

*Is there a webpart out there that is able to do these two things?

*Or does it require creating a customized webpart.

A: There's no OOB WebPart for your requirement, but I would suggest rather than creating a webpart, you can do the entire stuff using JavaScript/jQuery + Ajax + SharePoint WebService, use SharePoint WebServices (you need Lists.asmx) to fetch data and use any third party jQuery library like jQuery UI, Kendo UI or any other library that suits your need for the pop up, you will have complete control, design the pop up window as you want
Hope this helps :)


text:
Q: google api client could not connect LocationService.API is unavailable Im trying to make a service that tracks the phone with the google fused location api but the GoogleApiClient can't connect to LocationService.API
This is the message i get when i search in the console for google api client
    Couldn't connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null}
The GoogleApiClient code i used to connect is this
mGoogleApiClient = new GoogleApiClient.Builder(this)
        .addConnectionCallbacks(this)
        .addOnConnectionFailedListener(this)
        .addApi(LocationServices.API)
        .build();

just like every tutorial on the internet tells me to use.
Do anyone know why this doesn't work for me?
I can get the gps position from the android api.

A: From discussion, it sounds like you are not making multiple connection requests (if necessary) to the api client. Also, try adding the following permissions to the manifest.
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


text:
Q: Void Overload incompatible with glutDisplayFunc Currently, I'm writing a small engine using GLUT. I've been stuck on this one problem that is super frustrating. All of the solutions I've seen online didn't seem to help me out.
I have a function with the glutDisplayFunc in it called:
void Window::Initialize(int argc, char ** argv, void* renderFunc)

The renderFunc is the parameter I pass into the glutDisplayFunc like so:
glutDisplayFunc(renderFunc);

Whenever I throw that in though I get this error:

argument of type "void " is incompatible with parameter of type "void ()()"

I'm absolutely clueless how as to solve this.
For whatever reason, you may need extra code to debug this. Here are my Render and Initialize functions I'm dealing with.
void Window::Initialize(int argc, char ** argv, void* renderFunc)
{
    Debug debug;
    Window localWindow;
    Core::Shader_Loader shaderLoader;
    program = shaderLoader.CreateProgram("shader.vert", "shader.frag");

    system("title Sandbox");

    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(WindowPosX, WindowPosY);
    glutInitWindowSize(WindowWidth, WindowHeight);
    glutCreateWindow(title);

    glutInit(&argc, argv);
    glewInit();
    if (glewIsSupported("GL_VERSION_4_3"))
    {
        debug.Message("GLEW Version 4.3");
    }
    else
    {
        debug.Error(101, "GLEW 4.3 is not supported");
    }

    glEnable(GL_DEPTH_TEST);
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

    glutDisplayFunc(renderFunc);
    glutMainLoop();
}

And
void Window::RenderScene(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glClearColor(0.0, 0.0, 0.0, 1.0);

    glUseProgram(program);
    glDrawArrays(GL_TRIANGLES, 0, 3);

    glutSwapBuffers();
}

A: glutDisplayFunc takes a pointer-to-function as its argument.  void* renderFunc declares a pointer to data (of unknown type).  These types are incompatible.
You need:
void Window::Initialize(int argc, char ** argv, void (*renderFunc)())

A: glutDisplayFunc expects a pointer to a function that returns void and takes no arguments. What you're passing as parameter is a pointer to void. These are very different things and in fact may even have different size.
The correct type is void (*)(void) and to define a variable or parameter symbol with it you write void (*name)(void).
P.S.: I already see the next problem coming: You're probably going to try to pass a member function of your class and you'll get a error of the like "expected void()(void) but argument is of type void Window::()(void) – type mismatch". A member function has a "hidden" / implicit first parameter this. And GLUT doesn't know how to deal with that.


text:
Q: Read & Write files synchronously using Azure Pipelines I have two pipelines in azure, lets call them A and B. A creates a file, if not present it will update and B will read it. A generally takes ~5 mins to write completely. Now, sometime while A is already updating the file( ~5 mins is going on), B reads it and gets old data.
Is there any way to make B wait until writing is completed. Some sort of lock mechanism on file itself ?
Thank you !

A: You could try to add a PowerShell task to wait the pipeline A's result first in pipeline B by using the REST API:
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/get?view=azure-devops-rest-6.0
If the result is not "succeeded" stop the pipeline B.
Start-Sleep -Seconds 300
$Urinew = "https://<Org>/<project>/_apis/build/builds/"
$Uri = $Urinew+$buildId+"?api-version=6.0"
$responseFromGet = Invoke-RestMethod -Method Get -ContentType application/json -Uri $Uri -Headers @{Authorization=("Basic {0}" -f $base64authinfo)}
Write-host $responseFromGet
$result= $responseFromGet.result
if ($result -ne "succeeded") {
 for($i=1; $i-le 5; $i++){
 Start-Sleep -Seconds 60
 Write-host "wait for pipeline A"
#Get new pipeline A's result
$responseFromGet = Invoke-RestMethod -Method Get -ContentType application/json -Uri $Uri -Headers @{Authorization=("Basic {0}" -f $base64authinfo)}
Write-host $responseFromGet
$result= $responseFromGet.result
}
}

And you could also use the invoke REST API Approvals and Checks in the Environment to get the build result.


text:
Q: ERROR ORA-00937 when trying to select another attribute I am trying to project the highest average GPA of the students by majors.
It works if I don't SELECT major and leave it out.
This is what I have:
SELECT  MAX(avg_gpa), major
FROM    (SELECT major, AVG(gpa) AS avg_gpa
        FROM Student
        GROUP BY  major);

My error: ORA-00937: not a single-group group function

A: SELECT
  MAX(avg_gpa) as max_avg_gpa,
  min(major) keep (dense_rank first order by avg_gpa desc) as best_major
FROM (
  SELECT
    major,
    AVG(gpa) AS avg_gpa
  FROM Student
  GROUP BY  major
)


text:
Q: Git update or clone As part of a script that collects external dependencies for a project, I want to check if a dependency is available at the right version.
Currently, I check if the folder exists, and if it does, fetch and check out to the version and if not, clone at that version.
I have something like this:
if [ -d $REPO_DIR ]; then
    echo "Updating to [$(REPO_VERSION)]";
    git --git-dir=$(REPO_DIR)/.git --work-tree=$(REPO_DIR) fetch
    git --git-dir=$(REPO_DIR)/.git --work-tree=$(REPO_DIR) checkout $(REPO_VERSION)
else
    echo "Cloning to [$(REPO_VERSION)]";
    git --git-dir=$(REPO_DIR)/.git --work-tree=$(REPO_DIR) clone --branch $(REPO_VERSION) $REPO_ADDRESS $REPO_DIR 2> /dev/null;
fi

Wondering if there is a more git native way of doing this?
-- Edit --
To add more context, for the project, these dependencies are already managed by a package manager (pip). The only reason I am doing this, is for building a docker image (which cannot install those libraries via pip since they are private repositories).
That's why, I wouldn't use submodules, since the dependency is already managed without the submodule overhead.

A: Another option is to use git submodule/subtree.
Submodule or subtree are git projects inside another git project.
The concept its that you have a standalone code which is a fully separated git repository. This way you can manage 3rd party code inside your main project.
Here is a sample on how your project will look like using submodule.

subtree
The main difference between subtree to submodule is where the code is managed.   Under submodules it a seperated repository while using subtree the code is part of your main repository.


text:
Q: GLSL Smoothly change temperature(color) of mesh over time I am writing a small program using three.js.
I have rendered mesh from PLY object. And I want to heat polygons that are close to the mouse position. When I move mouse, all polygons near must smoothly change color to the red, and other polygons must smoothly return to their normal color over time.
I have succeeded in getting mouse position and changing color of the nearest polygons, but I don't know how to solve smooth fading over time for the other polygons.
Should I do it in shader or I should pass any additional data to the shader?

A: I would do something simple like this (in a timer):
dtemp = Vertex_temp - background_temp;
Vertex_temp -= temp_transfer*dtemp*T/dt;

where temp_transfer=<0,1> is unit-less coefficient will adjust the speed of heat transfer. The dt [sec] is time elapsed (interval of your timer or update routine) and T [sec] is time scale for the temp_transfer coefficient.
So if your mouse is far than let background_temp=0.0 [C] and if not set it to background_temp=255.0 [C] now you can use the Vertex_temp directly to compute color ... using it as Red channel <0,255>
But as you can see this is more suited to do on CPU side instead of in GLSL because you need to update the color VBO each frame using its previous values... In GLSL you would need to encode it into texture or something and render back the new values into another one and then converting it back to VBO that is too complicated... maybe compute shader could do it in single pass but I am not familiar with those.


text:
Q: How to remove a programatically loaded reCAPTCHA V2? On an ajax-based or js-based website or a single page application you can call grecaptcha.render('targetId', ...) to create the reCAPTCHA element on demand.
But how can you remove it once the reCAPTCHA is no longer needed?
Creating and deleting the reCaptcha HTML by switching routes leads to a "memory leak".
I am looking for something like reCaptcha.destroy().


text:
Q: Как правильно перенести текст в буфер? Подскажите пожалуйста что не так? Программа не компилируется и грешит на
""  source.GetLeight()+1)  "" и "  LPCSTR(source)  ", как исправить? Спасибо большое!
#include "stdafx.h"
#include <iostream>
#include <string>
#include <windows.h>
#include <string.h>

#pragma comment(lib, "user32.lib")
#pragma comment(lib, "Framedyn.lib")
using namespace std;

string First("* ["), second("|"), three, fifi("]"), link, source;

int main(void)
{
setlocale(LC_ALL,"Russian");
//в эту переменную нужно записать текст, который в дальнейшем поместится в буфер обмена
//чтение текста из буфера обмена
cout<< "Введи название мода:";
cin>> three;

string fromClipboard;//в эту переменную сохраним текст из буфера обмена
if ( OpenClipboard(0) )//открываем буфер обмена
{
   HANDLE hData = GetClipboardData(CF_TEXT);//извлекаем текст из буфера обмена
   char*chBuffer=(char*)GlobalLock(hData);//блокируем память
   fromClipboard=chBuffer;
   GlobalUnlock(hData);//разблокируем память
   CloseClipboard();//закрываем буфер обмена
}
cout<< First<<fromClipboard<< second<< three<< fifi<< endl;
link=First+fromClipboard+second+three+fifi;
cout<< link<< endl;
source=link;
//запись текста в буфер обмена
if(OpenClipboard(0))//открываем буфер обмена
{
   HGLOBAL hgBuffer;
   char* chBuffer;
   EmptyClipboard(); //очищаем буфер
   hgBuffer=GlobalAlloc(GMEM_DDESHARE, source.GetLeight()+1);//выделяем память
   chBuffer=(char*)GlobalLock(hgBuffer); //блокируем память
   strcpy(chBuffer, LPCSTR(source));
   GlobalUnlock(hgBuffer);//разблокируем память
   SetClipboardData(CF_TEXT, hgBuffer);//помещаем текст в буфер обмена
   CloseClipboard(); //закрываем буфер обмена
}

return 0;
}

A: По поводу MS-специфичных типов удобно пользоваться сайтом MSDN или же локальной справкой MSVS. Вот, например, на этой странице можно найти, что тип CString содержится в заголовочном файле "afx.h".
http://msdn.microsoft.com/en-us/library/aa300688%28v=vs.60%29.aspx
Для использования средств MFC (доступности тех же заголовочных файлов) необходимо убедиться, что по пути меню студии Project->имя_проекта properties...->Configuration Properties->General->Project Defaults свойство "Use of MFC" установлено в "Use MFS in a ..."
LPCSTR - это не класс, а синоним типа const char* (если навести мышь на этот тип, можно увидеть попап с текстом typedef-подстановки), читать как Long Pointer Const String, то есть длинный указатель на константную строку (в С строки - массивы char с дополнительным элементом - нульсимволом '\0'). Потому нельзя вот так вызывать "конструктор". А создается строка как всегда:
LPCSTR str = "Sample text";

В данном контексте, у класса std::string для доступа к указателю на строку в C-стиле есть метод c_str(), а у CString - GetBuffer().
// для std::string source
    strcpy(chBuffer, source.c_str());

// для CString source
    strcpy(chBuffer, source.GetBuffer());

// для LPCSTR source
    strcpy(chBuffer, source);


text:
Q: determine the effect of treatment on a person I have a group of patients who receive a special treatment. The effect of the treatment on the patients is decided according to the changes in the FEV1 value of the patients before and after the treatment. However, there is no consensus information on deciding effect of this treatment. I have the clinical information of this group for before and after treatment. I want to label patients according to whether or not the treatment is effecting them in order to build a machine learning model. Which statistical test is more appropriate for this? Would I say that the treatment according to the test has a statistically significant effect on the person?
Thank you


text:
Q: How to make Interactive Display Window with using kinect I want to do something like this http://www.youtube.com/watch?v=xFgvNMN2DiQ&feature=related
I wanna track head with kinect and when its goes to left reverse the video when it stops pause the video on the right play the video.Can anyone help me with sample or useful tutorial for this ? Thank you

A: first go thorough simple application example to access kinect data there are tutorials on getting started with kinect in here
http://channel9.msdn.com/coding4fun/kinect/Getting-started-with-Kinect-development-quickly-with-the-Kinect-for-Windows-Quickstart-Series
starting in this skeletal Tracking example you will see the way you have to access the kinect joints, in example they use left and right hand and HEAD!!, so you then need to access a video player of your choice and get the api to access scrolling bar and then bind the head's X coordinates to player's scroll position.
cheers!!..


text:
Q: Are the Ralink RT3090 drivers incompatible with Ubuntu 10.10? Ralink Technology publishes their drivers in source code form on their website here.
When complied with make and make install in 10.04, the drivers worked well in 32 and 64 bit versions of Lucid. However, when compiled for the 64 bit version of Maverick, it does not work at all, and 32 bit Maverick, it works but randomly disconnects.
Both versions of Maverick say "[Proprietary] Driver is activated but not in use" in the Proprietary Drivers dialog.
Do the drivers just need to be updated? Is there an easy fix?

A: From the bug report post #103 work fine on a MSI U210:
Go to your terminal and type in this command: lsmod | grep rt
Your output will look something similar to this one:
rt2860sta 488820 0
rt2800usb 37372 0 [...]

open your Terminal and first type in this:
 sudo modprobe rf rt2800pci
 sudo modprobe -rf rt2860sta
 sudo modprobe rt2860sta

Just as you type in this, your networkmanager connects automatically and works! But to close the whole thing up, you need to type in this command:
echo blacklist rt2800pci | sudo tee -a /etc/modprobe.d/blacklist.conf

Then you are done and your networkmanager will work for you again.

A: I also have Ralink RT3090 wifi on my laptop. I'm using Kubuntu 10.10 64-bit. I installed driver from source, after installation (K)ubuntu loads 2800pci version instead of 3090sta. You have to fix it by manually editing some files.
Open /etc/modprobe.d/blacklist.conf (as root) and add at the end:
blacklist rt2800pci.
Also open (as root) file /etc/modules and add:
rt3390sta
I followed this post and it is working now.

A: I would also suggest doing this:
lsmod | grep ^rt
How many rt modules are running on your system?  If it is more than one, it may be conflicting.  I have a RAlink card, and initially, two rt modules were both trying to use my card, and the conflict made networking unusable.  I blacklisted one of them, and now it works fine.  This is for RAlink and not RT3090, so YMMV.


text:
Q: What is entity-name and entity-type in Apache Kafka? I'm recently learning Apache Kafka. In the quick start tutorial, I found the following command:
bin/kafka-configs.sh  --zookeeper localhost:2181 --alter --add-config 'producer_byte_rate=1024,consumer_byte_rate=2048' --entity-name clientA --entity-type clients

But I can't find the explanation of these two required parameters: "entity-name" and "entity-type" in the documentation. Could someone elaborate what these are for? Where can I set it?

A: If you check out the source, you can see:
val entityType = parser.accepts("entity-type", "Type of entity (topics/clients)")
....
val entityName = parser.accepts("entity-name", "Name of entity (topic name/client id)")

So it's a switch -- you can either config topics or clients, which you reference either via topic name or client ID.


text:
Q: Celery - Schedule periodic task at the end of another task I want to schedule a periodic task with Celery dynamically at the end of another group of task.
I know how to create (static) periodic tasks with Celery:
CELERYBEAT_SCHEDULE = {
      'poll_actions': {
          'task': 'tasks.poll_actions',
          'schedule': timedelta(seconds=5)
      }
}

But I want to create periodic jobs dynamically from my tasks (and maybe have a way to stop those periodic jobs when some condition is achieved (all tasks done).
Something like:
@celery.task
def run(ids):
    group(prepare.s(id) for id in ids) | execute.s(ids) | poll.s(ids, schedule=timedelta(seconds=5))

@celery.task
def prepare(id):
    ...

@celery.task
def execute(id):
    ...

@celery.task
def poll(ids):
    # This task has to be schedulable on demand
    ...

A: The straightforward solution to this requires that you be able to add/remove beat scheduler entries on the fly. As of the answering of this question...
How to dynamically add / remove periodic tasks to Celery (celerybeat)
This was not possible. I doubt it has become available in the interim because ...
You are conflating two concepts here. The notion of "Event Driven Work" and the idea of "Batch Schedule Driven Work"(which is really just the first case where the event happens on a schedule). If you really consider what you are doing here you'll find that there is a rather complex set of edge cases. Messages are distributed in nature what happens when groups spawned from different messages start creating conflicting entries? What do you do when you find yourself under a mountain of previously scheduled kruft?
When working with messaging systems you are really looking to build recursive trees. Spindles of work that do something and spawn more messages to do more things. Cycles(intended or otherwise) aside these ultimately achieve their base cases and terminate.
The answer to whatever you are actually trying to achieve lies with re-encoding your problem within the limitations of your messaging system and asynchronous work framework.


text:
Q: Configuring Nagios event_handler for different checks levels of a service without overlap Running Nagios Core 4.0.2 and using latest NRPE on clients.
We have 3 service definitions to check one piece of software at different levels each minute:

*

*Open TCP port check

*Process is running check

*Application layer check by sending data to the socket and expecting some return value

Upon a failed state of any of those checks we would call an event_handler
to restart the service up to 3 times. If the state isn't OK after 3 then escalate.
The issue is there are a number of combinations where if one service will fail another
is expected to be in a CRITICAL state. If we have a event_handler for each of these and two fail then the restart script via event_handler would be called twice.

*

*e.g. If the process is not running, then the TCP
port will not be open and the application layer check will fail.

*e.g. The TCP port could be CRITICAL because of a firewall misconfigured rule or network condition and the application layer will fail because it can't be reached but the process is still running

Question: How can we ensure the event handler gets called by only one failed service check
and not for each failed service of the 3 resulting in 2 or more restarts as their states
change to CRITICAL? e.g. if the 3 service checks enter CRITICAL then that would be 3 restarts
in 1 minute, and 6 restarts in 2 minutes (assuming the restart failed to bring the services back to OK state).
I believe service dependencies may be the right solution but I'm not sure how to go about
creating them to satisfy the different conditions.

A: Service dependencies is the way to do it.
You want to make your Application layer service check dependent on your Process Running check.
You want to make your Process Running Check dependent on your TCP port check.
You want to make all of these dependent on a host (not service) check - this addresses the "network conditon" failure scenario.
These can get very complicated very quickly, but the basic idea is:
define servicedependency{
host_name                      TheServer
service_description            The Service I Depend On
dependent_host_name            TheServer
dependent_service_description  The Dependent Service
execution_failure_criteria     n
notification_failure_criteria  w,u,c

}
execution_failure_criteria is really the workhorse here: it lists states that the master service can be in for this service not to be checked (in this case, if service "The Service I Depend On" is in state "notify".  You can specify multiple options (as in the line below).
Here's a good explanation of nagios configuration options.
http://nagios.frank4dd.com/docs/en/objectdefinitions.html#servicedependency


text:
Q: python3 django manage.py runserver error I have a project in AWS cloud9.
I tried to login via LinkedIn or Facebook, I use django.
When I run the command: python manage.py runserver 0.0.0.0:8080 I get
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 307, in execute
    settings.INSTALLED_APPS
  File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 110, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/ec2-user/environment/gowith/django_social_project/django_social_project/settings.py", line 17, in <module>
    from config import *
  File "/usr/local/lib/python3.4/site-packages/config.py", line 733
    except Exception, e:
                    ^
SyntaxError: invalid syntax

A: There is a syntax error in except Exception, e: be cause in python 3, you should write except (Exception, e):
If you use an external package, ensure it is Python3 compatible, or use python 2.7 yourself otherwise.


text:
Q: Identifier missing on GameCenter Firebase Auth I have implemented auth in PlayGames for Android. When users sign in, their usernames show up under "Identifier" in the fireBase console.
In GameCenter, it does not:
public void AuthenticateToGameCenter(Action onAuthenticationComplete = null)
    {
        Social.localUser.Authenticate(success =>
        {
            Debug.Log("Game Center Initialization Complete - Result: " + success);
            if (onAuthenticationComplete != null)
                onAuthenticationComplete();
        });
    }

    public Task SignInWithGameCenterAsync()
    {
        var credentialTask = Firebase.Auth.GameCenterAuthProvider.GetCredentialAsync();
        var continueTask = credentialTask.ContinueWithOnMainThread((Task<Credential> task) =>
        {
            if (!task.IsCompleted)
                return null;

            if (task.Exception != null)
                Debug.Log("GC Credential Task - Exception: " + task.Exception.Message);

            var credential = task.Result;
            Debug.Log($"credential { task.Result}");

            var loginTask = auth.SignInWithCredentialAsync(credential);
            return loginTask.ContinueWithOnMainThread(handleLoginResult);
        });

        return continueTask;
    }

    private void GameCenterLogin()
    {
        // first initialize, then sign in
        var signinAsync = new Action(() => SignInWithGameCenterAsync());
        AuthenticateToGameCenter(signinAsync);
    }

Am I authing wrong?


text:
Q: Finding variance without the data A researcher is testing the effectiveness of a political video. She has randomly sampled 120 people to test the video. For each person, there is 50% chance the person will be Democrat and 50% chance the person will be Republican. Republicans have 75% chance of reacting to the video and Democrats have 25% chance of reacting to the video.
What is the expected value and variance of the number of people in the $ 120 $ who respond to the video?
Expected value is straight forward: $ (120*0.5*0.25)+(120*0.5*0.75)=60 $
How do I go about finding the variance though? Is it $ 0 $?

A: Let $Z$ be the number of people that react to the video. Then we can write $Z=X+Y$, where $X$ is the number of Republican subject that react and $Y$ the number of Democrat subjects. For a fixed number $K=k$ of Republican test subjects, $X$ and $Y$ are independent and have the following distributions: $X|k\sim Bin(k, 0.75), Y|k\sim Bin(120-k, 0.25).$
We then have the conditional expectation $E(Z|K)=0.75K+(120-K)0.25=30+0.5K$. We also know the distribution of the number of Republican subjects: $K\sim Bin(120, 0.5)$. We then have the total expectation: $E(Z)=E(E(Z|K))=E(30+0.5K)=30+0.5E(K)=90.$ The variance we can find using the law of total variance in a similar way.


text:
Q: XmlDocument - ParentNode and DocumentType are null In .NET what does it mean if you LoadXml() into the XmlDocument object and then ParentNode and DocumentType are null?
Also, I get this as the answer to xmldoc.FirstChild.Value:
version="1.0" encoding="utf-8"
Is this right? Been a while since I have done any XML DOM stuff.
The file is encoded UTF-8. Think that shouldn't be an issue.
Is there a simple true/false validation method for my doc?
UPDATE:
If the NodeType is Element how do you return the "tag name"?
CURRENT THINKING:
xmldoc.ChildNodes[1].Name;
I noticed the Name property is Get only. Whats the best tool to use if you wanted to swap the root tag for something else (like 'feed' to 'container'), but wanted something a little more lightweight than XSLT, and not simple text/replace.
Would still like to see a LINQ to XML example. Thanks for everyone's help. Guess its been longer than I thought since I have looked at the XML stuff in .NET.

A: From the MSDN documentation, XmlDocument.ParentNode always returns null - the document itself is the root, so it has no parent.  The DocumentType property returns the DOCTYPE tag, which your example doesn't have.

A: The root element is always accessible through the XmlDocument.DocumentElement property.
The name of the root element could be determined using XmlDocument.DocumentElement.LocalName string property.
If you want to rename the root element, you're better off using another instance of XmlDocument, add a root element using XmlDocument.CreateNode, call it what you like, then
loop children of the original document's root element and use the CloneNode (bool deep) method, in conjunction with the XmlNode.ImportNode method to copy the rest of the original document to the new document.


text:
Q: "UnboundLocalError: local variable 'input' referenced before assignment" for nearly every input in my code x = int(0)
ans1 = int(0)
ans = int(0)
with open('risk_q.txt') as r:
    for x in range(12):
        mylist = [line.rstrip('\n') for line in r]
        ans1 = int(input())             #Error occurs in this line

This error occurred with a different input earlier in the code so I got the input before the function and then passed it through the parameter of the function.

A: Check back through your code.  It appears as though you have used input as a variable name, and therefore overwritten the builtin function.


text:
Q: Is there a way to bind another function like limit() to pymongo query based on condition? I have a query which is as below:
def get_data(self, limit=None):
    # I just want to add limit() in case it is set, not otherwise
    self.collection.find(condition)

self.collection refers to the collection in the class. If limit parameter is set I need to bind limit() pymongo function to the query.
NB: the limit is just a sample case it could be any function like sort, etc. So I just want to know is there a mechanism to bind params like this?

A: below 2 queries return same results
self.collection.find()
self.collection.find().sort([("$natural", pymongo.ASCENDING)])

Sort Natural Order
and also below 2 queries return same results
self.collection.find()
self.collection.find().limit(0)

A limit of 0 is equivalent to no limit. source
so you can combine these and write a single line query as follows
self.collection.find().limit(self.limit or 0).sort(self.sort or [("$natural", pymongo.ASCENDING)])

If you have set values for limit/sort they will be applied otherwise will be ignored.

A: Do you mean like this?:
def get_data(self, limit=None):
    cursor = self.collection.find(condition)
    if limit is not None:
        return cursor.limit(limit)
    else:
        return cursor


text:
Q: Downscale image preserving tiny details Is there an algorithm that would allow to downscale image but preserve the little details like tiny cracks and scratches?
For example, let's say we have a photo 1024x1024 of banana on neutral background. And banana has some tiny cracks and some tiny dots of beginning of rotting.
Now if we downscale banana down to let's say 264x264 - we loose those tiny cracks and dots. Is there a way to downscale but preserve those tiny details?
Maybe some smart algorithm that will detect density of the information in the image? Like if we consider the image of banana - it's mostly has very little information - mostly it's a same smooth yellowish color on white background. And cracks and dots are like dense objects in such environment.
Maybe there's some smart algorithm that can detect that and preserve those small information-dense objects on the picture?


text:
Q: jQuery individual lists sliding up and down I'm not really experienced with jQuery but I couldn't find an answer for this. What I exactly want to do is when people click on the img with the class machine-dropdown that the div overview does slideToggle. I got multiple lists on this page with the same construction so I need them to work individual.

I tryed it with many methods that jquery already has. .closest .first .find but still when i click it slides all lists.
Thanks for the help already!

A: You could do it like this:
Change your HTML to this:

Note that I've added data-target="#overview-1" to the machine-dropdown image and id="overview-1" to the overview div.
Now use the following javascript/jquery:
$(function(){
    $(".machine-dropdown").each(function(){
        $(this).click(function(){
            var target = $(this).data("target");
            $(target).slideToggle();
        });
    });
});

A: use this attribute in your code.
$('.machine-dropdown').click(function(){
$(this).next().next().next().find('.overview').slideToggle();
});

I think it will solve your problem.


text:
Q: Web service with Axis2 without using eclipse plugin Just wanted to know can we create web service with Axis2 without using eclipse plugin.
If yes please share how can i do that.

A: Yes its possible,
Quick start with example here : http://axis.apache.org/axis2/java/core/docs/quickstartguide.html


text:
Q: Retrieve data from multiple arrays Here are list of arrays which i echoed in

 Array
    (
    [CustomerID] => manish14
    [TicketID] => 45691
    [TicketNumber] => 1045828
    [CustomerUserID] =>
    )
 Array
(
[CustomerID] => ghisingraaz@gmail.com
[TicketID] => 45686
[TicketNumber] => 1045823
[CustomerUserID] => ghisingraaz@gmail.com
)
Array
(
[CustomerID] => ranjana@classic.com.np
[TicketID] => 45661
[TicketNumber] => 1045798
[CustomerUserID] => ranjana@classic.com.np
)
........
........
........

I want to display customerID , TicketID and TicketNumber of each array in a  table format. How can i retrieve those values. I have this in multiple foreach loop thats why i am having problem getting those values.
Here is my code incase anyone wants to see.  phpfiddle.org/main/code/wb4u-nrsj
You can find my code in this PhpFiddle.

A: <?PHP
error_reporting(0);
//////// OTRS specific information ////////
$url = "https://otrs.classic.com.np/otrs/rpc.pl"; //// URL for OTRS server
$username = "ctdeveloper"; //// SOAP username set in sysconfig
$password = "ctdeveloper"; //// SOAP password set in sysconfig
$TicketID = $_GET['id'];
########################################################################
#### You don't have to change anything below here, although you can ####
########################################################################
#### Initialize new client session ####
echo "

CustomerID	TicketID	TicketNumber
";
$client = new SoapClient(
    null,
    array(
        'location' => $url,
        'uri' => "Core",
        'trace' => 1,
        'login' => $username,
        'password' => $password,
        'style' => SOAP_RPC,
        'use' => SOAP_ENCODED
    )
);

#### Initialize new client session ####
$client = new SoapClient(
    null,
    array(
        'location' => $url,
        'uri' => "Core",
        'trace' => 1,
        'login' => $username,
        'password' => $password,
        'style' => SOAP_RPC,
        'use' => SOAP_ENCODED
    )
);

$queues = array(1 => "Postmaster",
    2 => "Raw",
    3 => "Junk",
    4 => "Retail Support",
    5 => "Enterprise Support",
    6 => "Sales",
    7 => "Marketing",
    8 => "Fiber Survey",
    9 => "Fiber Support",
    10 => "Billing",
    11 => "NOC",
    12 => "Wireless Support",
    13 => "Core-Tasks",
    14 => "Chitwan",
    15 => "Developer",
    16 => "Operations",
    17 => "Administration",
    18 => "Hetauda",
    19 => "Business",
    20 => "Info",
    21 => "Corporate",
    22 => "Wireless Survey",
    23 => "Recovery",
    24 => "L2-Support",
);

foreach ($queues as $queue_number => $queue_name) {
#### Create and send the SOAP Function Call ####
    $TicketDetail_search = $client->__soapCall("Dispatch",
        array($username, $password,
            "TicketObject", "TicketSearch",
            "Result", "ARRAY",
            "UserID", 1,
            "QueueIDs", array($queue_number),
            "StateType", "open"
        ));

    // REMOVE s-gensym
    $ticketInfo = array();
    if ($TicketDetail_search) {
        foreach ($TicketDetail_search as $name => $value){
            if (false !== strpos($name, "s-gensym"))
            {
                    $ticketInfo[] = $value;
            }
        }
    }

    foreach($ticketInfo as $TicketID)
    {
        $TicketDetail_get = $client->__soapCall("Dispatch",
            array($username, $password,
                "TicketObject", "TicketGet",
                "TicketID", $TicketID,
            ));
        foreach($TicketDetail_get as $t)
        {
            $ticketInfo1 = array();
            $i = 0;
            foreach ($TicketDetail_get as $name => $value){ // explode the xml response
                if (false !== strpos($name, "s-gensym")){
                    $temp[$i] = $value;
                    if($i > 0) {
                        $v = $temp[$i-1];
                        if($i % 2 != 0){
                            $ticketInfo1[$v] = $value;
                        }
                    }
                    $i++;
                }

            }

        }
        echo "
";
        echo "" . $ticketInfo1['CustomerID'] . "	";
        echo "" . $ticketInfo1['TicketID'] . "	";
        echo "" . $ticketInfo1['TicketNumber'] . "	";

        echo "
";

    }

    }
echo "
";
?>

Is this what you are looking for ?


text:
Q: Tem como recuperar quais PDOStatement no PDO PHP foram criado? Vejam só, eu utilizo o PDO no PHP para executar minhas Querys, acontece as vezes uso a mesma query em outras janelas e então preciso montar novamente a mesma Query na outra página.
O que tenho em mente:
Quero guardar o select numa session para reutilizar na proxima página, assim tenho certeza de que estou usando a mesma query (pra trazer o mesmo resultado) e evito redigitação o que poderia me levar a erros.
Então tenho:
$SQL = "select * from tabela where (codcli = :codcli) and (pedido in(:codigos)))";

$Query = Database::Prepare($SQL);
$Query->bindValue(":codcli", "234");
$Query->bindValue(":codigos", "1,2,4,6,7,8");
$Query->Execute();

Eu consigo guardar o $SQL

$_SESSION["SQL_TEXT"] = $SQL;

Tem uma forma de pegar quais PDOStatement (bindValue) foram criados e seus respectivos valores?
Eu tentei dar um var_dump em $Query->bindValue() mas sem sucesso, na Query ele só mostra o texto
Eu querys dar um foreach no binvValue pra guardar os paremetros e seus devidos valores
$parametros = array();

    foreach ($Query->bindValue as $key=>$value){
      $parametros[$key] = $value;
    }

A: É possível a partir da versão 7.2, visualizar as informações contidas em uma instrução que foi montada no $dbh->prepare que prepara uma instrução SQL a ser executada pelo método PDOStatement::execute().
Sobre PDOStatement::debugDumpParams: responsável por despejar um comando  SQL - Ele fornecerá a consulta SQL em uso, o número de parâmetros usados (Params), a lista de parâmetros com seu nome ou posição de chave, seu nome, sua posição na consulta (se isso for suportado pelo driver PDO, caso contrário, será -1)
Um exemplo retirado da documentação PHP, porém sem a saída completamente formatada com os valores(Sent SQL), parâmetros... Veja:
<?php
/* Execute a prepared statement by binding PHP variables */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour');
$sth->bindParam(':calories', $calories, PDO::PARAM_INT);
$sth->bindValue(':colour', $colour, PDO::PARAM_STR, 12);
$sth->execute();

$sth->debugDumpParams();

?>

O exemplo acima irá imprimir:
SQL: [96] SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour
Params:  2
Key: Name: [9] :calories
paramno=-1
name=[9] ":calories"
is_param=1
param_type=1
Key: Name: [7] :colour
paramno=-1
name=[7] ":colour"
is_param=1
param_type=2

A partir da versão 7.2, agora retorna o SQL enviado ao banco de dados, você visualiza onde contém Sent SQL:
...
$sth->bindValue(':campo', "Um valor qualquer", PDO::PARAM_STR);
...
$sth->debugDumpParams();

Saída do $sth->debugDumpParams():
SQL: [60] SELECT campo
    FROM  tabela
    WHERE campo LIKE :campo
Sent SQL: [79] SELECT campo
    FROM  tabela
    WHERE campo LIKE 'Um valor qualquer'
Params:  1
Key: Name: [5] :campo
paramno=-1
name=[5] ":campo"
is_param=1
param_type=2

Observe que isso só estará disponível se as "emulated prepared statements"(https://stackoverflow.com/a/15718418/3658278) estiverem ativadas.
No seu caso teríamos que usar uma expressão regular ou outra forma para pegar o valor que começa a partir do Sent SQL:. Sabendo que public PDOStatement::debugDumpParams(void):void não retorna nada, pois o resultado é enviado diretamente para o navegador, então é preciso ativar o buffer de saída (ob_start()) para capturar a saída dessa função e salvá-la em uma string. Daí sim realizar o tratamento e recuperar o trecho referente ao comando SQL final.
Veja:
$SQL = "select * from tabela where (codcli = :codcli) and (pedido in(:codigos)))";

$Query = Database::Prepare($SQL);
$Query->bindValue(":codcli", "234");
$Query->bindValue(":codigos", "1,2,4,6,7,8");
$Query->Execute();

ob_start();
$Query->debugDumpParams();
$conteudo = ob_get_contents();
ob_end_clean();

$iniciaEm = strpos($conteudo, "Sent SQL:") + strlen("Sent SQL:");
$finalizaEm = strpos($conteudo, "Params:", $iniciaEm);
$resultadoParcial = substr($conteudo, $iniciaEm, $finalizaEm - $iniciaEm);

$res = preg_replace("/[][0-9]/", "", $resultadoParcial );

//Aqui está sua SQL...
//$_SESSION["SQL_TEXT"] = $res;
echo $res;

Viu como é possível? Porém, isso num projeto em produção é preciso ficar atento para possíveis mudanças em versões futuras, como uma simples mudança na saída do texto "Sent SQL" para qualquer outro texto.


text:
Q: Feature vector as input to an RNN For fun and in order to get a deeper understanding of recurrent neural networks, I am writing my own RNN-based syntactic dependency parser from scratch. In this case, each sentence is a sequence of words, from which a sequence of parser actions is to be predicted.
Now if each word was simply represented by a number, this would not be a problem, as there would have been a one-to-one mapping between the dimensionality of the input to the network, and the network's output. However, in my case each word is represented by an N-dimensional word embedding, whereas each predicted parser action is an integer value within a limited space.
This means my network needs to accept a sequence of feature vectors as input, and then output a sequence of integers.
Currently (parts of) my initialization and forward code looks like this:
def __init__(self, trans_dim, out_dim, feature_vec_size=1, hidden_dim=100, trunc=4):
    self.trans_dim = trans_dim
    self.hidden_dim = hidden_dim
    self.out_dim = out_dim
    self.trunc = trunc

    # U = input -> hidden weights
    self.U = np.random.uniform(-np.sqrt(1./trans_dim), np.sqrt(1./trans_dim), (hidden_dim, trans_dim))
    # V = hidden -> output weights
    self.V = np.random.uniform(-np.sqrt(1./hidden_dim), np.sqrt(1./hidden_dim), (out_dim, hidden_dim))
    # W = s1 -> s2 weights
    self.W = np.random.uniform(-np.sqrt(1./hidden_dim), np.sqrt(1./hidden_dim), (hidden_dim, hidden_dim))

def forward(self, steps):
    # Number of time steps
    t_steps = len(steps)
    print t_steps
    # The initial hidden
    states = np.zeros((t_steps + 1, self.hidden_dim))
    # Output at each time step
    output = np.zeros((t_steps, self.out_dim))

    # Looping through time steps
    for t in np.arange(t_steps):
        print steps[t]
        # This is where the problem is. Indexing U by steps[t] will not work when steps
        # contains floats.
        states[t] = np.tanh(self.U[:, steps[t]] + self.W.dot(states[t-1]))
        output[t] = self.softmax(self.V.dot(states[t]))

Which leads to the question -- how can I make my network accept a sequence of feature vectors as inputs, and then output a sequence of integers representing parser actions in each time step?
I am sorry if this is a dumb question; I am merely a novice when it comes to neural networks, but I wish to learn. Any help would be greatly appreciated.


text:
Q: How to map python dictionaries key values with unequal length of items? Suppose we have two dictionaries as below:
dict_a_to_b = {2:4, 6:9, 9:3}

dict_a_to_c = {2: 0.1, 6:0.2, 9: 0.8, 10:0.6, 50: 0.77, 12:0.56}

How to map these two dictionaries to make dict_c_to_b in python? The items in second dictionary is greater than items in first.
Output should be:
dict_c_to_b = {0.1:4, 0.2:9, 0.8:3}

A: You can use a dictionary comprehension:
{c: dict_a_to_b[a] for a, c in dict_a_to_c.items() if a in dict_a_to_b}

Do note that dictionary values don't have to be unique. If dict_a_to_c has duplicate values, the key associated with the last one wins here, assuming it is also available as a key in dict_a_to_b.

A: You can iterate for k in dict_a_to_b and select corresponding values from both dictionaries.
dict_c_to_b = {dict_a_to_c[k]: dict_a_to_b[k] for k in dict_a_to_b}
{0.1: 4, 0.2: 9, 0.8: 3}


text:
Q: PBE-SHA1-3DES uses 168 bit triple DES? I'm using the following command to encrypt my private key file using OpenSSL:
$ openssl pkcs8 -topk8 -inform PEM -outform DER -in private_key.pem -out private_key.der  -v1 PBE-SHA1-3DES

The documentation states that the option -v1 PBE-SHA1-3DES will encrypt using triple DES, but doesn't mention which keying option it is using. Can I assume that it uses 168 bit triple DES?

A: The answer seems to be yes, when I read the file from Java(see also my other question), I can get the algorithm viz.:
1.2.840.113549.1.12.1.3 from algParams.getAlgorithm()
Googling this yields: pbeWithSHAAnd3-KeyTripleDES-CBC
See also: http://www.oid-info.com/get/1.2.840.113549.1.12.1.3
This is a 3key triple DES, which entails 168 bits.
public static byte[] decryptPrivateKey(byte[] key) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
    PBEKeySpec passKeySpec = new PBEKeySpec("p".toCharArray());

    EncryptedPrivateKeyInfo encryptedKey = new EncryptedPrivateKeyInfo(key);
    System.out.println(encryptedKey.getAlgName());
    System.out.println("key length: " + key.length);
    AlgorithmParameters algParams = encryptedKey.getAlgParameters();
    System.out.println(algParams.getAlgorithm());


text:
Q: Same rotated component matrix in Factor Analysis despite using different data normalizations I'm using SPSS for factor analysis with these options:
FACTOR
  /VARIABLES VAR00001 VAR00002 VAR00003 VAR00004 VAR00005 VAR00006
  /MISSING LISTWISE
  /ANALYSIS VAR00001 VAR00002 VAR00003 VAR00004 VAR00005 VAR00006
  /PRINT UNIVARIATE INITIAL CORRELATION SIG DET KMO INV REPR AIC EXTRACTION ROTATION
  /PLOT EIGEN ROTATION
  /CRITERIA MINEIGEN(1) ITERATE(25)
  /EXTRACTION PC
  /CRITERIA ITERATE(25)
  /ROTATION VARIMAX
  /METHOD=CORRELATION.

Before inserting data to the software I normalized (and in one case standardize) data:

*

*Using values-min/max-min transformation.

*Using values A as denominator of all features.

*Using B values (different with A) as denominator of all features.

*Using C values (different with A and B) as denominator of all features.

*standardize data using mean and std.

*Using Raw data as input of factor analysis of SPSS.

Output of SPSS:
Rotated Component Matrix
              Component
              1       2
VAR00001    .973    -.062
VAR00002    .911    -.134
VAR00003    .833    -.035
VAR00004    .972    -.102
VAR00005    -.236   .823
VAR00006    .062    .878
Extraction Method: Principal Component Analysis.
 Rotation Method: Varimax with Kaiser Normalization.
a Rotation converged in 3 iterations.

In all cases I have same Rotated Component Matrix (other reports are same too)! Why? Is this a bug or because of Correlation Method or VARIMAX rotation?

A: It seems (/METHOD=CORRELATION) that you are asking SPSS to perform FA on the correlation matrix (actually by typing /EXTRACTION PC you seem to be performing PCA and not FA, but it does not matter for this question).
Correlation matrix does not change if you scale individual variables, so any amount of normalizing or standardizing would not change it. You can think of it as if all the variables are automatically standardized to have zero mean and unit variance prior to the PCA/FA analysis. No wonder you always get the same result.
Varimax rotation has nothing to do with it.