Espaço branco indesejado CSS

Question: Estou fazendo um site de reserva de atividades ao ar livre e estou com um problema no CSS.
No meu documento aparece sempre uma parte em branco abaixo da imagem, não percebo porquê. No dev tools do Chrome não aparece nada significativo, não consigo descobrir este problema.
E outra coisa: nos comentários, gostaria que quando alguém fizer um comentário, para não prejudicar o layout da página, gostaria que a área de comentários tivesse um scroll, como faço isso?
Segue o código abaixo:
HTML:
<?php
//inclui a BD
include('ligar_bd.php');

session_start();

 $no_session ="";

//id da atividade onde agarra atraves do URL
  $id_activity = $_GET['id'];
  // quero para mostrar toda a informação da atividade para depois estar predefenida no formulario
  //para puder mudar
  $sql = $db->prepare(" SELECT * FROM `Activity` where idActivity = :id ");

  $sql->bindParam(':id', $id_activity);

  $sql->execute();

  $row = $sql->fetchAll(PDO::FETCH_ASSOC);

      if(isset($_POST['commentary'])){

        if(isset($_SESSION['user'])){

          $id_activity = $_GET['id'];

          $user_id = $_SESSION['user']['idUser'];

          $comment = $_POST['comment'];

          $date = date('y-m-d');

            $comment = htmlspecialchars($comment, ENT_QUOTES, 'UTF-8');

            $sql = $db->prepare(" INSERT INTO `Comment` (`idActivity`,`idUser`, `comment`,`date`)
            VALUES (:idActivity,:idUser,:comment,:date)");

            //bind dos parametros, isto para evitar mysql injection
            $sql->bindParam(':idActivity', $id_activity);
            $sql->bindParam(':idUser', $user_id);
            $sql->bindParam(':comment', $comment);
            $sql->bindParam(':date', $date);

            //Executa a query que predefenimos
            $sql->execute();

            $count = $sql->rowCount();

            if ($count > 0){

            $success = "Comment done";

            }else {

             $error_comment = "error on inserting comment";

             var_dump($error_comment);

            }

        }else{

            $no_session = "To make a comment you need to be logged in first";

        }

    }

?>

<!DOCTYPE html>

        <meta charset="utf-8">

        <link rel="stylesheet" type="text/css" href="css/normalize.css">
        <link rel="stylesheet" type="text/css" href="css/Grid.css">
        <link rel="stylesheet" type="text/css" href="css/activity.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        <link href="https://fonts.googleapis.com/css?family=Lato:100,300,300i,400" rel="stylesheet">
        <title>Adventure</title>

<?php echo $row[0]['title'];?>

                    <?php
                        echo
                        '
                         <button class="btn-reservation">Make Reservation</button>
                        ';
                    ?>

<?php echo $row[0]['description'] ?>

Share with your friends

                    <?php

                      //query para listar as atividades
                      $sql = $db->prepare(" SELECT * FROM `Comment` where `idActivity` = :idActivity ");

                      $sql->bindParam(':idActivity', $id_activity);

                      $sql->execute();

                      $row = $sql->fetchAll(PDO::FETCH_ASSOC);

                      //para cada atividade uso o foreach para
                      foreach( $row as $value){

                       $id_user = $value['idUser'];

                         $sql = $db->prepare(" SELECT username FROM `user` where `idUser` = :id ");

                         $sql->bindParam(':id', $id_user);

                         $sql->execute();

                         $dados = $sql->fetchAll(PDO::FETCH_ASSOC);

                        echo
                        '

                        '.$dados[0]['username'].'
                        '.$value['date'].'

'.$value['comment'].'

                        ';
                      }
                        ?>

                            <form  method="POST">

                                <textarea placeholder="Write your comment here" name="comment"></textarea>

                                    <input class="btn-submit" type="submit" name="commentary" value="submit">

                                <?php echo $no_session ?>
                            </form>

CSS:
* ---------------------------------------------- */
/* BASIC SETUP */
/* ---------------------------------------------- */

/* Isto deve fazer-se sempre para remover qualquer margem, padding, etc */
* {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-appearance: none;
}

/* SCROLLBAR */

/* width */
::-webkit-scrollbar {
    width: 10px;
}

/* Track */
::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* Handle */
::-webkit-scrollbar-thumb {
    background: #27ae60;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
    background: #219251;
}

/* Selecinar cor, fontes e tamanhos padrão para todo o documento html */
html,
body {
    background-color: #fff;
    color: #555;
    font-family: "Lato";
    font-size: 20px;
    text-rendering: optimizeLegibility;
    overflow-x: hidden; /*isto esconde tudo o que va para alem do eixo x*/
}

/* ---------------------------------------------- */
/* REUSABLE COMPONENTS */
/* ---------------------------------------------- */

.row {
    max-width: 1140px;
    margin: 0 auto;
}

/*Espaço em branco em todas as seccoes*/
section {
    padding: 80px 0;
}

/*-----HEADLINE/TITULOS-----*/

h1, h2, h3 {
    font-weight: 300;
    text-transform: uppercase;
}

h1 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #fff;
    font-size: 240%;
    word-spacing: 4px;
    letter-spacing: 1px;
}

h2 {
    font-size: 180%;
    word-spacing: 2px;
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

h3 {
    font-size: 110%;
    font-weight: 400;
    margin-bottom: 15px;
}

/*-----LINKS-----*/

a:link,
a:visited {
    color: #00BFFF;
    text-decoration: none;
    padding-bottom: 1px;
    -webkit-transition: border-bottom 0.2s, border 0.2s, color 0.2s;
    transition:  border 0.2s, color 0.2s;
}

a:hover,
a:active {
    color: #555;
    border-bottom: 1px solid transparent;
}

/* ----------------------------------------------------------------------------------------------------- */

/* ---------------------------------------------- */
/* HEADER */
/* ---------------------------------------------- */

/* 100vh = 100% viewport */
header {
    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(64, 110, 142, 0.70)), to(rgba(0, 0, 0, 0.70))), url(img/tumblr_ng88k4nD8U1tv1qiho1_1280.gif);
    background-image: linear-gradient(rgba(0, 0, 0, 0.70), rgba(0, 0, 0, 0.70)), url(img/tumblr_ng88k4nD8U1tv1qiho1_1280.gif);
    background-size: cover;
    background-position: center;
    height: 27vh;
    background-attachment: fixed;
}

/*-----post----*/
.main-title {
    float: left;
    margin-top: 55px;
    list-style-type: none;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.157);
}

.main-title li h2 {
    display: inline;
    margin: 40px;
    padding: 8px 0;
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    list-style: none;
    font-size: 220%;
    font-weight: 300;
    letter-spacing: 2px;
}

/* ---------------------------------------------- */
/* LIST */
/* ---------------------------------------------- */

.post-img {
    margin: -16.3% 0 0 -20%;;
}

.post-img img {
    width: 100%;
    height: 100vh;
    object-fit: cover;
}

.description {
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
}

.description p {
    font-size: 80%;
    text-align: justify;
    line-height: 25px;
    letter-spacing: 1px;
    word-spacing: 1px;
}

.btn-reservation {
    width: 100%;
    height: 50px;
    float: right;
    border: 0;
    margin-top: -13%;
    font-size: 100%;
    font-weight: none;
    color: #fff;
    cursor: pointer;
    background-color: #27ae60;
    transition: background-color 0.2s;
    }

.btn-reservation:hover {
    background-color: #219251;
    }

    /* COMMENTS */

    .comment-section{
        margin-top: 10%;
        list-style: none;
        width: 100%;
    }

    .comment{
        width: 100%;
        display: flex;
        margin-bottom: 45px;
        flex-wrap: wrap;
    }

    .comment.user-comment{
        color:  #808080;
    }

    .comment.author-comment{
        color:  #60686d;
        justify-content: flex-end;
    }

    .comment .info{
        width: 17%;
    }

    .comment.user-comment .info{
        text-align: left;
    }

    .comment.author-comment .info{
        order: 3;
    }

    .comment .info a{   /* User name */
        display: block;
        text-decoration: none;
        color: #656c71;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        padding: 10px 0 3px 0;
    }

    .comment .info span{    /* Time */
        font-size: 11px;
        color:  #9ca7af;
    }

    .comment .avatar{
        width: 8%;
    }

    .comment.user-comment .avatar{
        padding: 10px 18px 0 3px;
    }

    .comment.author-comment .avatar{
        order: 2;
        padding: 10px 3px 0 18px;
    }

    .comment .avatar img{
        display: block;
    }

    .comment.user-comment .avatar img{
        float: right;
    }

    /* comment */

    .comment p{
        width: 100%;
        line-height: 1.5;
        padding: 18px 22px;
        width: 50%;
        position: relative;
        word-wrap: break-word;
    }

    .comment.user-comment p{
        background-color:  #f3f3f3;
    }

    .comment.author-comment p{
        background-color:  #e2f8ff;
        order: 1;
    }

    .user-comment p:after{
        content: '';
        position: absolute;
        width: 15px;
        height: 15px;
        background-color: #ffffff;
        border: 2px solid #f3f3f3;
        left: -8px;
        top: 18px;
    }

    .author-comment p:after{
        content: '';
        position: absolute;
        width: 15px;
        height: 15px;
        background-color: #ffffff;
        border: 2px solid #e2f8ff;
        right: -8px;
        top: 18px;
    }

    /* Comment form */

    .write-new{
        width: 93%;
    }

    .write-new textarea{
        color:  #444;
        font: inherit;

        outline: 0;
        border: 1px solid #cecece;
        background-color:  #fefefe;
        overflow: auto;
        width:100%;
        min-height: 80px;
        padding: 15px 20px;
    }

    .write-new img{
        margin-top: 15px;
    }

    @media (max-width: 800px){

        .comment p{
            width: 100%;
        }

        .comment.user-comment .info{
            order: 3;
            text-align: left;
        }

        .comment.user-comment .avatar{
            order: 2;
        }

        .comment.user-comment p{
            order: 1;
        }

        .comment.author-comment{
            justify-content: flex-start;
        }

        .comment-section{
            margin-top: 10px;
        }

        .comment .info{
            width: auto;
        }

        .comment .info a{
            padding-top: 15px;
        }

        .comment.user-comment .avatar,
        .comment.author-comment .avatar{
            padding: 15px 10px 0 18px;
            width: auto;
        }

        .comment.user-comment p:after,
        .comment.author-comment p:after{
            width: 12px;
            height: 12px;
            top: initial;
            left: 28px;
        }

        .write-new{
            width: 100%;
        }
    }

    input {
        padding: 0;
        border: none;
        font: inherit;
        color: inherit;
        cursor: pointer;
      }

/* modal */

.modal-body {
    position: fixed;
    width: 100%;
    height: 100vh;
    background-color: #219251;
    opacity: 0;
}

.modal-body:target {
    opacity: 1;
}

.btn-submit {
    height: 40px;
    width: 40%;
    font-family: "lato";
    font-weight: 300;
    margin-left: 68.5%;
    margin-top: 10px;
    font-size: 100%;
    text-transform: capitalize;
    cursor: pointer;
    float: left;
    color: #fff;
    background-color: #27ae60;
    transition: background-color 0.2s;
}

.btn-submit:hover {
    background-color: #219251;

}

/* Icons */

.social {
    margin-top: 5%;
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
}

ul {
    padding:0;
    list-style: none;
}
.social-icon {
    color: #fff;
}
ul.social-icons {
    margin-top: 10px;
}
.social-icons li {
    vertical-align: top;
    display: inline;
    height: 100px;
}
.social-icons a {
    color: #fff;
    text-decoration: none;
}
.fa-facebook {
    padding:20px 24px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    transition: .5s;
    color: #fff;
    background-color: #27ae60;
}
.fa-facebook:hover {
    background-color: #219251;
    color: #fff;
}
.fa-twitter {
    padding:20px 24px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    color: #fff;
    background-color: #27ae60;
    transition: .5s;
}
.fa-twitter:hover {
    background-color: #219251;
    color: #fff;
}
.fa-rss {
    padding:20px 24px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    color: #fff;
    background-color: #27ae60;
    transition: .5s;
}
.fa-rss:hover {
    background-color: #219251;
    color: #fff;
}

.fa-linkedin {
    padding:20px 24px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    color: #fff;
    background-color: #27ae60;
    transition: .5s;
}
.fa-linkedin:hover {
    background-color: #219251;
    color: #fff;
}
.fa-google-plus {
    padding:20px 20px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    color: #fff;
    background-color: #27ae60;
    transition: .5s;
}
.fa-google-plus:hover {
    background-color: #219251;
    color: #fff;
}

/* ---------------------------------------------- */
/* FOOTER */
/* ---------------------------------------------- */

footer {
   background-color: #333;
    padding:30px;
    font-size: 80%;

Isto é o que aparece, este espaço em branco, a imagem tem 100vh.
E gostaria de saber como faço a zona de comentários com scroll, porque quando tentei, bugou um pouco.
Comment: Vc tem um link pra gente acessar o site ou ele está apenas rodando ai localmente?
Comment: ele está rodando localmente mesmo...
Comment: E vc quer que a imagem vá até a parte mais escura logo abaixo?
Comment: Esse margin `-16.3%` na imagem é para ela fica sobre o conteúdo anterior?
Comment: é sim para ficar sobre o conteudo anterior.

Sim @hugocsl quero que a imagem vá até À parte escura embaixo.
Answer: O que está gerando esse espaço em branco é a propriedade padding nas section:
/*Espaço em branco em todas as seccoes*/
section {
    padding: 80px 0;
}

O que você pode fazer é remover esse padding apenas na section do post com :not(classe da section), caso as outras precisem mesmo desse padding:
section:not(.section-post) {
    padding: 80px 0;
}

É preciso ajustar também a altura da .row que guarda as divs da imagem e dos comentários, reduzindo a altura pelo margin negativo da imagem:

E no .col dos comentários reduzir também a altura em 90px:

Para fazer a zona de comentários com scroll automático, ajuste a altura height (também reduzindo para se ajustar na .row) e coloque também overflow na classe .comment-section:
.comment-section{
  margin-top: 10%;
  list-style: none;
  width: 100%;
  overflow: hidden auto;
  height: calc(100% - 250px);
}

No final irá ficar assim como neste exemplo (coloquei um fundo vermelho na coluna dos comentários para ilustrar). Execute em tela cheia:

* ---------------------------------------------- */
/* BASIC SETUP */
/* ---------------------------------------------- */

/* Isto deve fazer-se sempre para remover qualquer margem, padding, etc */
* {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-appearance: none;
}

/* SCROLLBAR */

/* width */
::-webkit-scrollbar {
    width: 10px;
}

/* Track */
::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* Handle */
::-webkit-scrollbar-thumb {
    background: #27ae60;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
    background: #219251;
}

/* Selecinar cor, fontes e tamanhos padrão para todo o documento html */
html,
body {
    background-color: #fff;
    color: #555;
    font-family: "Lato";
    font-size: 20px;
    text-rendering: optimizeLegibility;
    overflow-x: hidden; /*isto esconde tudo o que va para alem do eixo x*/
}

/* ---------------------------------------------- */
/* REUSABLE COMPONENTS */
/* ---------------------------------------------- */

.row {
    max-width: 1140px;
    margin: 0 auto;
}

/*Espaço em branco em todas as seccoes*/
section:not(.section-post) {
    padding: 80px 0;
}

/*-----HEADLINE/TITULOS-----*/

h1, h2, h3 {
    font-weight: 300;
    text-transform: uppercase;
}

h1 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #fff;
    font-size: 240%;
    word-spacing: 4px;
    letter-spacing: 1px;
}

h2 {
    font-size: 180%;
    word-spacing: 2px;
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

h3 {
    font-size: 110%;
    font-weight: 400;
    margin-bottom: 15px;
}

/*-----LINKS-----*/

a:link,
a:visited {
    color: #00BFFF;
    text-decoration: none;
    padding-bottom: 1px;
    -webkit-transition: border-bottom 0.2s, border 0.2s, color 0.2s;
    transition:  border 0.2s, color 0.2s;
}

a:hover,
a:active {
    color: #555;
    border-bottom: 1px solid transparent;
}

/* ----------------------------------------------------------------------------------------------------- */

/* ---------------------------------------------- */
/* HEADER */
/* ---------------------------------------------- */

/* 100vh = 100% viewport */
header {
    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(64, 110, 142, 0.70)), to(rgba(0, 0, 0, 0.70))), url(img/tumblr_ng88k4nD8U1tv1qiho1_1280.gif);
    background-image: linear-gradient(rgba(0, 0, 0, 0.70), rgba(0, 0, 0, 0.70)), url(img/tumblr_ng88k4nD8U1tv1qiho1_1280.gif);
    background-size: cover;
    background-position: center;
    height: 27vh;
    background-attachment: fixed;
}

/*-----post----*/
.main-title {
    float: left;
    margin-top: 55px;
    list-style-type: none;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.157);
}

.main-title li h2 {
    display: inline;
    margin: 40px;
    padding: 8px 0;
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    list-style: none;
    font-size: 220%;
    font-weight: 300;
    letter-spacing: 2px;
}

/* ---------------------------------------------- */
/* LIST */
/* ---------------------------------------------- */

.post-img {
    margin: -16.3% 0 0 -20%;;
}

.post-img img {
    width: 100%;
    height: 100vh;
    object-fit: cover;
}

.description {
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
}

.description p {
    font-size: 80%;
    text-align: justify;
    line-height: 25px;
    letter-spacing: 1px;
    word-spacing: 1px;
}

.btn-reservation {
    width: 100%;
    height: 50px;
    float: right;
    border: 0;
    margin-top: -13%;
    font-size: 100%;
    font-weight: none;
    color: #fff;
    cursor: pointer;
    background-color: #27ae60;
    transition: background-color 0.2s;
    }

.btn-reservation:hover {
    background-color: #219251;
    }

    /* COMMENTS */

.comment-section{
  margin-top: 10%;
  list-style: none;
  width: 100%;
  overflow: hidden auto;
  height: calc(100% - 250px);
}

    .comment{
        width: 100%;
        display: flex;
        margin-bottom: 45px;
        flex-wrap: wrap;
    }

    .comment.user-comment{
        color:  #808080;
    }

    .comment.author-comment{
        color:  #60686d;
        justify-content: flex-end;
    }

    .comment .info{
        width: 17%;
    }

    .comment.user-comment .info{
        text-align: left;
    }

    .comment.author-comment .info{
        order: 3;
    }

    .comment .info a{   /* User name */
        display: block;
        text-decoration: none;
        color: #656c71;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        padding: 10px 0 3px 0;
    }

    .comment .info span{    /* Time */
        font-size: 11px;
        color:  #9ca7af;
    }

    .comment .avatar{
        width: 8%;
    }

    .comment.user-comment .avatar{
        padding: 10px 18px 0 3px;
    }

    .comment.author-comment .avatar{
        order: 2;
        padding: 10px 3px 0 18px;
    }

    .comment .avatar img{
        display: block;
    }

    .comment.user-comment .avatar img{
        float: right;
    }

    /* comment */

    .comment p{
        width: 100%;
        line-height: 1.5;
        padding: 18px 22px;
        width: 50%;
        position: relative;
        word-wrap: break-word;
    }

    .comment.user-comment p{
        background-color:  #f3f3f3;
    }

    .comment.author-comment p{
        background-color:  #e2f8ff;
        order: 1;
    }

    .user-comment p:after{
        content: '';
        position: absolute;
        width: 15px;
        height: 15px;
        background-color: #ffffff;
        border: 2px solid #f3f3f3;
        left: -8px;
        top: 18px;
    }

    .author-comment p:after{
        content: '';
        position: absolute;
        width: 15px;
        height: 15px;
        background-color: #ffffff;
        border: 2px solid #e2f8ff;
        right: -8px;
        top: 18px;
    }

    /* Comment form */

    .write-new{
        width: 93%;
    }

    .write-new textarea{
        color:  #444;
        font: inherit;

        outline: 0;
        border: 1px solid #cecece;
        background-color:  #fefefe;
        overflow: auto;
        width:100%;
        min-height: 80px;
        padding: 15px 20px;
    }

    .write-new img{
        margin-top: 15px;
    }

    @media (max-width: 800px){

        .comment p{
            width: 100%;
        }

        .comment.user-comment .info{
            order: 3;
            text-align: left;
        }

        .comment.user-comment .avatar{
            order: 2;
        }

        .comment.user-comment p{
            order: 1;
        }

        .comment.author-comment{
            justify-content: flex-start;
        }

        .comment-section{
            margin-top: 10px;
        }

        .comment .info{
            width: auto;
        }

        .comment .info a{
            padding-top: 15px;
        }

        .comment.user-comment .avatar,
        .comment.author-comment .avatar{
            padding: 15px 10px 0 18px;
            width: auto;
        }

        .comment.user-comment p:after,
        .comment.author-comment p:after{
            width: 12px;
            height: 12px;
            top: initial;
            left: 28px;
        }

        .write-new{
            width: 100%;
        }
    }

    input {
        padding: 0;
        border: none;
        font: inherit;
        color: inherit;
        cursor: pointer;
      }

/* modal */

.modal-body {
    position: fixed;
    width: 100%;
    height: 100vh;
    background-color: #219251;
    opacity: 0;
}

.modal-body:target {
    opacity: 1;
}

.btn-submit {
    height: 40px;
    width: 40%;
    font-family: "lato";
    font-weight: 300;
    margin-left: 68.5%;
    margin-top: 10px;
    font-size: 100%;
    text-transform: capitalize;
    cursor: pointer;
    float: left;
    color: #fff;
    background-color: #27ae60;
    transition: background-color 0.2s;
}

.btn-submit:hover {
    background-color: #219251;

}

/* Icons */

.social {
    margin-top: 5%;
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
}

ul {
    padding:0;
    list-style: none;
}
.social-icon {
    color: #fff;
}
ul.social-icons {
    margin-top: 10px;
}
.social-icons li {
    vertical-align: top;
    display: inline;
    height: 100px;
}
.social-icons a {
    color: #fff;
    text-decoration: none;
}
.fa-facebook {
    padding:20px 24px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    transition: .5s;
    color: #fff;
    background-color: #27ae60;
}
.fa-facebook:hover {
    background-color: #219251;
    color: #fff;
}
.fa-twitter {
    padding:20px 24px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    color: #fff;
    background-color: #27ae60;
    transition: .5s;
}
.fa-twitter:hover {
    background-color: #219251;
    color: #fff;
}
.fa-rss {
    padding:20px 24px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    color: #fff;
    background-color: #27ae60;
    transition: .5s;
}
.fa-rss:hover {
    background-color: #219251;
    color: #fff;
}

.fa-linkedin {
    padding:20px 24px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    color: #fff;
    background-color: #27ae60;
    transition: .5s;
}
.fa-linkedin:hover {
    background-color: #219251;
    color: #fff;
}
.fa-google-plus {
    padding:20px 20px;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    color: #fff;
    background-color: #27ae60;
    transition: .5s;
}
.fa-google-plus:hover {
    background-color: #219251;
    color: #fff;
}

/* ---------------------------------------------- */
/* FOOTER */
/* ---------------------------------------------- */

footer {
   background-color: #333;
    padding:30px;
    font-size: 80%;
}

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">

<?php echo $row[0]['title'];?>

                         <button class="btn-reservation">Make Reservation</button>

<?php echo $row[0]['description'] ?>

Share with your friends

                        Usuário
                        10/11/2018

comentário

                        Usuário
                        10/11/2018

comentário

                        Usuário
                        10/11/2018

comentário

                        Usuário
                        10/11/2018

comentário

                        Usuário
                        10/11/2018

comentário

                            <form  method="POST">

                                <textarea placeholder="Write your comment here" name="comment"></textarea>

                                    <input class="btn-submit" type="submit" name="commentary" value="submit">

                                <?php echo $no_session ?>
                            </form>

Comment: Excelente, muito obrigado, deu certo.

Mas, quando a descrição da atividade é um pouco maior, a secção de comentários sai fora da página, como apresenta a imagem:

https://imgur.com/a/KCiGowf
Comment: Pois é. Creio que esse ajuste deve ser feito via JS, já que o CSS não tem como calcular de forma dinâmica a altura a ser reduzida no `calc`.
Answer: use na div da imagem o comando e na imagem o comando height: 100%
Estava com o mesmo problema no meu Web-site a um tempo, resolvi aplicando esse comando.

Espaço branco indesejado CSS


gridExtra "main" and "sub" parameters no longer recognized after upgrading to Version 2.0.0

Question: I recently updated gridExtra to Version 2.0.0, which was released July 14, 2015. It appears that the arguments "main" and "sub" are no longer recognized as the following code now places the two textGrobs into their own panels, i.e. previously there were four panels containing graphs sandwiched between a title section ("main") and a subtitle section ("sub"). Now there are 6 panels with the last two containing the text from "main" and "sub".
Is it possible to get the previous functionality back? If so, how? Thank you.
<code>library(ggplot2)
library(gridExtra)

graphA = ggplot(data.frame(x=rnorm(100), y=rnorm(100)), aes(x=x, y=y)) + geom_line()
graphB = ggplot(data.frame(x=rnorm(100), y=rnorm(100)), aes(x=x, y=y)) + geom_line()
graphC = ggplot(data.frame(x=rnorm(100), y=rnorm(100)), aes(x=x, y=y)) + geom_line()
graphD = ggplot(data.frame(x=rnorm(100), y=rnorm(100)), aes(x=x, y=y)) + geom_line()

grid.arrange(graphA, graphB, graphC, graphD, ncol=2,
         main = textGrob("Title", gp=gpar(fontsize=20,font=3)),
         sub = textGrob("Subtitle")
)
</code>
Comment: You have two option: Adapt your code to the major changes of the last update or install the old version.
Answer: Instead of "main" and "sub" you should now use "top" and "bottom".


Horizontal SUVAT problem (AS Level)

Question: Could someone please explain how you get the answer for the following question:
A car of mass 1300 kg is traveling at a speed of 30ms^-1 along a straight horizontal
motorway when the driver sees a traffic jam ahead and applies the brakes for 15 s.
The car covers a distance of 270 m while the driver is braking.

a) Find the speed of the car at the end of the 15 s braking interval.

My Working:
S = 1/2(v-u)t
270=15V-1/2(2)(15)^2
15V=495
V=33

Thanks
Comment: Could you include some of your work? thanks!
Comment: Sorry, forgot to include it. Please check now.
Comment: You want to use the fact that the work done is the change in kinetic energy and that the force applied by the brakes is constant on the fifteen second time interval during which the brakes were applied. So you get $$\frac{1}{2}mv_f^2-\frac{1}{2}mv_0^2=Fd$$ $$\frac{v_f-v_0}{15}=\frac{F}{m}$$ Now you can solve this system for $v_f$ which I'm getting to equal $6$
Comment: I see, makes sense now, thanks a lot
Answer: From the problem statement let $v_0= 30 \frac{m}{s}$, $m=1300 kg$, $\Delta x=270m$, $\Delta t=15s$, and let the force applied to the breaks be $F_b$.  We have,
$$
ma=-F_b
$$
which can be written,
$$
mv\frac{dv}{dx}=-F_b
$$
Integrating we get
$$
\frac{1}{2}v^2 |_{v_0}^{v_f}=-F_b \Delta x\\
\frac{1}{2}v_f^2=-F_b \Delta x + \frac{1}{2}mv_0^2\\
v_f = \sqrt{\frac{2}{m}(-F_b \Delta x + \frac{1}{2}mv_0^2)}
$$
We need to determine $F_b$.  Write,
$$
m\frac{dv}{dt}=-F_b
$$
integrate to get
$$
v=\frac{dx}{dt}=\frac{-F_b}{m}t + v_0
$$
Integrate again to get
$$
\Delta x=\frac{-F_b}{2m} t^2 + v_0 t\\
F_b=2m\frac{( v_0 t-\Delta x)}{t^2}
$$
Substituting $F_b$ in the equation for final velocity, we find,
$$
v_f = \sqrt{ v_0^2 - \frac{4\Delta x (  v_0 t -\Delta x)}{t^2}}
$$

Horizontal SUVAT problem (AS Level)


AWS Elastic Beanstalk Django Migration

Question: I have an EC2 instance set up through Beanstalk, but I cannot get the config to run migration
my .ebextension/django.config
option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: my_app.settings
  aws:elasticbeanstalk:container:python:
    WSGIPath: my_app.wsgi:application
    NumProcesses: 3
    NumThreads: 20
container_commands:
  00_test_output:
    command: "echo 'testing.....'"
  01_migrate:
    command: "python manage.py migrate"
    leader_only: true

After checking the logs, it says
Invalid HTTP_HOST header: '22.214.171.124'. You may need to add '22.214.171.124' to ALLOWED_HOSTS.
Invalid HTTP_HOST header: '172.31.0.249'. You may need to add '172.31.0.249' to ALLOWED_HOSTS.

Now even if I add these ip's to ALLOWED_HOSTS in my settings.py, the problem remains. I searched around here and found no answer to this specific issue
Without the migration commands, my server is built successfully and is running.
Anyone know why?
EDIT:
to add more info:
When I run eb deploy after committing to my github, i got error as following
2020-06-03 03:45:10    ERROR   [Instance: i-05f872f7e96ccd26d] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].
2020-06-03 03:45:11    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-06-03 03:45:11    ERROR   Unsuccessful command execution on instance id(s) 'i-05f872f7e96ccd26d'. Aborting the operation.
2020-06-03 03:45:11    ERROR   Failed to deploy application.

Then I go into web.stdout.log to find those allowed_host errors. Then again, from another post, it doesn't seem like adding these ip's help since they are AWS ip's
I can't locate other error logs from cloudwatch. This seems like the only suspect
The eb-engine.log only says
Error occurred during build: Command 01_migrate failed

so I knoe the echo worked.....
Comment: What database engine do you use? Is it mysql5.7?
Comment: Postgres. And I installed psycopg2 in requirement.txt
Answer: It turns out my migration does not run because the a data entry I put in violates the max_length of a CharField. locally I use sqlite3 so it ignores max_length......
I did not locate the error at first because eb log tells me to check cfn-init.log when in fact the error logs are in cfn-init-cmd.log, something that doesn't get registered in cloudwatch by default and eb doesn't show any indication to check for that log in doc OR terminal msg.
At the end, my config file looks like
option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: my_app.settings
  aws:elasticbeanstalk:container:python:
    WSGIPath: my_app.wsgi:application
    NumProcesses: 3
    NumThreads: 20
container_commands:
  00_test_output:
    command: "echo 'testing.....'"
  01_migrate:
    command: "source /var/app/venv/staging-LQM1lest/bin/activate && python3 manage.py migrate --noinput"
    leader_only: true

the venv sourcing path is found when ssh-ing into my ec2 instance.
For those of you who do not find useful info in eb logs, ssh into your EC2 instance (if you're using it) and check /var/log/*.log
Answer: If you are using MySQL, you have to do the below steps:

Add mysqlclient to your requirements.txt.
Add some packages to be installed in your EC2 instance with a config file:
packages:
  yum:
    python3-devel: []
    mariadb-devel: []

Check my recent question and answer for more details:
mysqlclient installation error in AWS Elastic Beanstalk
Answer: This is what it worked
.ebextensions/django.config
    option_settings:
      aws:elasticbeanstalk:application:environment:
        DJANGO_SETTINGS_MODULE: my_app.settings
      aws:elasticbeanstalk:container:python:
        WSGIPath: travel.wsgi:application
        NumProcesses: 3
        NumThreads: 20
    container_commands:
      01_collectstatic:
        command: "source /var/app/venv/staging-LQM1lest/bin/activate && python manage.py collectstatic --noinput"
      02_migrate:
        command: "source /var/app/venv/staging-LQM1lest/bin/activate && python manage.py migrate --noinput"
        leader_only: true

AWS Elastic Beanstalk Django Migration


WCF and MVC : Call stored procedures from web mvc application

Question: I've done a wcf service that deals with a database. In that WCF service i've created some stored procedures. That service is now accessible from my network (http: //myIP/MysService.csv/) and my stored procedures are accessible that way : http: //myIP/MysService.csv/MyProcedure?myParam=XXX.
I've a MVC4 application that is working with some local data (by local I mean a local database and a local WCF service, called that way for requests by example :
<code>public int getClientID(string login)
    {
        var context = new MyLocalService.MyLocalEntityEntities(new Uri(http://localhost:12345/MyWCF.svc/));
        var persons = context.PERSON.ToList();

        var cli = from person in persons
                     where person.LOGIN == login
                     select person.CLIENT_ID;

        int cliID = (int) cli.First();
        return cliID;
    }
</code>
Now, I'd like to plug the 2 : delete all the part that works with local data (var context=...) and replace it by a call to the stored procedure of my WCF service. How to do it ?
I've try to add my service using right click-> add as a service reference -> http: //myIP/MysService.csv/ for address by I cannot access to stored procedures. Is it the right way to work and if not, how to do it ? Thanks !
Answer: If you're going to use Stored Procedures then look at the SqlCommand class that will allow you to execute stored procedures on the database.
The other idea would be to consider what kind of Object-Relational Mapping tool you are using that may allow for SQL commands to be executed directly since you already seem to be using some LINQ in your code.

You'd pair the SqlCommand class with a SqlConnection class that have a direct connection to the database, presuming the stored procedure is MS-SQL Server or SQL Express where you want to execute the procedure in the DB.  Unless you have a very different configuration than what I've seen, most calls to stored procedures are done by wrapping some using statements for the connection and command to run the procedure.  Calling stored procedure from C# code has an example if you need it.
Comment: Thank you, i'm now working that way : String serviceAddress = ConfigurationManager.AppSettings["WCFADDRESS"];
            DataServiceContext context = new DataServiceContext(new Uri(serviceAddress));
            List prod = context.Execute(new Uri(serviceAddress + "sp2?cid="+clientID), "GET", false).ToList(); But I have an error according to OData protocol version (that is version 1 and should be at least version 3). How to update OData protocol version ?


How should I write a tutti chord?

Question: Somebody commented on my Pathetique Sonata orchestration that it is all wrong and how it is wrong. Here I will focus on the part of the comment related to tutti chords.
Here is the link to my orchestration:
Pathetique Sonata for Orchestra
And here is the full comment with what is relevant to the question put in bold text:

Very unbalanced and unidiomatic orchestration. There's a lot to go through here, but let's start with the first chord. The woodwind writing is horrible. The flute is in it's lower mid-register and will not be heard over the massive forte of the other instruments. The oboe is way to low in it's register to succesfully play the C in piano. It is very unclear how many of each instrument you have so that has to be clearly written out (my concern is primarily the clarinets and horns). The chord is voiced very badly with very thick harmony at the bottom and rather sparse higher up. Try to write tutti chords according to the harmonic series.
I don't understand at all why you want to double the melody line with the flute. And you don't use the piccolo as it's own instrument but rather as an extension of the flutes register. I also don't understand the need for bass clarinet, contrabassoon and alto trombone. You can do just fine without them.
Bar 11 you write the eighth note tremolo from the original score and write super fast double-tounge in the contrabassoon. This is super unidiomatic as well as tiring and on the border of unplayability for a longer period of time.
These are just a few things to think about. Balance is important too, remember that. I'm also working on orchestrating the Pathetique right now (not on musescore), as well as all the other Beethoven sonatas. It's a very big project and it takes time but it is definitely worth it!

And here are my thoughts on it again, relevant to the question:

The woodwind writing is horrible. The flute is in it's lower mid-register and will not be heard over the massive forte of the other instruments.
At least I'm not putting a forte dynamic in the first octave. That would be impossible, even for an advanced flutist. As for not being heard over the forte, that's a non-issue. I mean, just listen to the first movement of the Eroica symphony. Do you hear the flute as a distinct flute sound in the beggining tutti? Probably not, but it would sound different if the flute wasn't there. Are you saying that my flute part is worse than Beethoven's flute part because it won't be heard over the forte? Because Beethoven's flute part isn't really heard over the forte either.
The chord is voiced very badly with very thick harmony at the bottom and rather sparse higher up. Try to write tutti chords according to the harmonic series.
Are you just saying that because I have 3 bass woodwinds on top of the cellos and double basses playing a bass role? Without using brass instruments or omitting the bass woodwinds, there is nothing really I can do about the sparse harmony above. And if I write according to the harmonic series in every instrument, the flute would be like what 2 octaves up from where it is now? Given that it is already in the second octave, I might as well be writing the flute part in the piccolo staff if I obey the harmonic series. And I was told that the piccolo is unfit for the Grave section and that the more mellow flute would be a better high woodwind. Also you can see me using the harmonic series if you look specifically at the cellos and double basses

So how should I write this tutti chord? The comment about the harmonic series and the woodwind writing(specifically the flute and the forte dynamic) all has to do with the beginning C minor chord.
Here is how it is written currently:

Original piano chord + tonic an octave higher in the flute
Here is how it would be written if I obeyed the harmonic series:

Well, okay, number of octaves doesn't differ but if I obey the harmonic series, the bassoon and the previously lower clarinet will be an octave higher, and the violas will be higher than the 1st violins. Also, I have heard that you can't omit the fifth in a chord. This would tempt me into writing 2 notes for oboe, but then the melodic smoothness goes away unless I write everything in the oboe staff a fifth higher.
So, are my current tutti chords written wrongly? Because I don't see many differences between the current way my tutti chords are written and the harmonic series. By the way, all the pitches shown are in concert pitch.
Comment: @Caters sorry, I didn't see your comment earlier because of the lack of an @ tag.  The contrabassoon has certainly become increasingly important over time, but it is hardly necessary, even in the 20th and 21st centuries. The most unusual thing about your winds is that you don't have the same number of players for each instrument family (only one oboe). You'd commonly have two or three for each, often with some doubling, and you'd expect a dedicated part for piccolo, English horn, bass clarinet, or contrabassoon only if there are three or more players for each family of instrument.
Comment: At that point, how about trading which notes the violas and 1st violins play?
Comment: "Once you get to the times of Gustav Holst and The Planets, it becomes pretty much a requirement for the orchestra to have not only a contrabassoon player but also a contrabassoon part": but not in every piece (e.g., Shostakovich, 1st symphony and others).  At some point the trend towards ever-larger orchestras had to reverse, and it started in the early 20th century if not before.  Brahms used the contrabassoon in three of his four symphonies, omitting it in #2.
Comment: Is this from you? It sounds great! That's exactly what I would like to do with the Sonata in G.
Comment: Yes, it is my orchestration of the Pathetique Sonata that you hear at the link. I'm still working on orchestrating the development section of the sonata.
Comment: I don't understand what the commenter means about "based on harmonic series" - perhaps he means no inversions?  Otherwise, it's really a matter of assigning reasonable pitches to each instrument.  I would, however, dispense w/ the contrabassoon and bass clarinet unless you have specific solo work for them somewhere in the piece.
Comment: But a contrabasoon part is going to be expected in an orchestral score. And I do use the bass clarinet later on to give the basoonist a break.
Comment: @Caters there are plenty of orchestral pieces without contrabassoons.
Comment: Most of those though are from times before 1808, the year that Beethoven composed his fifth symphony. Ever since Beethoven's 5th was premiered, the contrabassoon has become more and more important.
Comment: So like, if there even is a bassoonist playing contrabassoon in a Mozart piece, it would simply be doubling the bassoon in octaves. In Beethoven's 5th, it gets its own part in the finale. And it only gets more important in the orchestra from there. Once you get to the times of Gustav Holst and The Planets, it becomes pretty much a requirement for the orchestra to have not only a contrabassoon player but also a contrabassoon part.
Comment: Have you done other orchestrations and then heard them played by an actual orchestra?
Comment: No, closest I have gotten to that is listening to an orchestration analysis of The Planets which included samples from a youth orchestra. But I figured that orchestrating a piano score would be way easier than writing a piece specifically for orchestra such as a symphony, mainly because I wouldn't be so overwhelmed with decisions. Besides, others have said that me getting my Pathetique Sonata orchestration performed has a slim chance of happening at best because the conductor prefers pieces originally written for orchestra over orchestrated piano scores.
Answer: Briefly: low notes are spaced farther apart.  Look at any piano or orchestral score, from Mozart to Mahler.  If there's a "four-note piano chord" extending below the bass clef, it's for exceptional color -- Liszt being deliberately muddy for eight bars; Beethoven hammering away to remind us that the piano is a percussion instrument, emphasizing rhythm over pitch.
Play something simple and familiar on the piano, and then try it two octaves lower.
Answer: My guess as to the meaning of "according to the harmonic series" is that the chord should be voiced with larger intervals at the bottom (more spaced out) and smaller intervals (denser) at the top. That way, there's less "mud" in the sound from small intervals in the low registers. The "according to the harmonic series" is just because the harmonic series follows that pattern if every note in it were to form a chord.
I believe Nikolai Rimsy-Korsakov had something to say to the effect of generally following the harmonic series in chord voicings in a book of his I read from the library, Principles of Orchestration, which I recommend highly, as it's pretty comprehensive, even if it might not be very current in its counselings.
It's a good arranging principle regardless of the style of music, but especially for powerful tutti sections, this general guideline can help to balance out the sound as well as make the chord sound full (the idea being that the more your chord follows the harmonic series, the more likely the audience will hear it as one entity, or something like that, anyway).
Note that the voicing below should have flats in front of every E note to make it C minor. Also, the colors are according to the second diagram, the one you said was resembling the harmonic series.

C2: On the bottom, it's the same note for the second double basses (the lower ones). So far, it's the same.
C3: Bass Clarinet and Double Bass on the octave over the C. I don't think putting that minor 3rd in the bass (C2-E♭2) is a great idea, just because that doesn't leave much room for the voicing to get denser in the upper register (you have 8 voices there). Also, more importantly, the minor third might come out muddy in the lower register, but an octave's never going to sound muddy (bass instruments play a lot of octaves, and that's one reason why).
G3: Timpani and cellos a fifth above that. Now we're getting narrower, and that note (G3)'s still within the cello and timpani range. If you want, I might double the timpani with the higher basses and bass clarinet to get the timpanis into their lower register, but I don't see a huge problem with leaving the timpanis on G3. Wouldn't want them on G2, though. Mud.
C4: Bassons play the only real logical choice. Notice that so far our chord is a direct copy of the harmonic series on C2? It doesn't have to be that way, but that'll surely help the audience hear it as one big sound.
E♭4: Lower Clarinet and Second Violins make sense on E♭4. You had them on G3. Bad Idea. For starters, G3 is the lowest any violin can play without subharmonics, and that means they're playing an open string. Maybe you want that sound, maybe you don't, but generally it's a good idea to keep the violins in more of the middle of their range, just for timbral purposes. E♭4 is a note that gives the violin players a much better shot at controlling their own sound and balancing with the rest of the orchestra. Not sure about clarinet, but I know clarinets can do an E♭4 for sure.
G4: First Violins and Oboe. Again, putting the 1st violins on their G string with your C4 is just not going to sound very nice. You don't want the violins on the 1st string very often. Again, it's not forbidden, but I think G4 is much better. Plus, we're retaining a harmonic series-like voicing, which was my main concern anyway.
C5: Higher Clarinet and High Violins. Why did you write the violas higher than the violins? If you want, the violas should be below the violins, probably on C4 with the Bassoons. Anyway, we deviated a little from the formula, but no biggie. I wouldn't start adding in notes like B♭4 unless that was a sound that I knew I wanted, but that's an option if you want to arrange other chords.
E♭5: Flute. Sounds alright. For a little more color, D5 could work, but that alters the harmony. Don't put the flutes a whole octave above the next highest voice. That spaces out the chord too much, in my opinion. C6 from the flutes is going to sound like a different note instead of blending into the chord.

To wrap it up, the biggest thing is that you should in this situation voice the chord in a pyramidal format: wide base, narrow top. And of course, play my suggestion against what you wrote. See which one you want to use. That's the whole point, anyway: If you want the sound you made, use that, but if you don't, it's great to know how to make other sounds, and this is a pretty useful voicing style to know how to use.
That, and unless you have a reason, don't put the violas over the violins. :)
Answer: Regarding the claim that you should write a tutti chord according to the harmonic series, in fact if you search "low interval limits", you'll see that writing  intervals too low would lead to some consequences. Your "harmony" would become rather percussive and muddy. You'll easily find there's certain limits for each interval (except for the octave), those "limits" may depend on the source, but they won't be too far off from each other. When you try writing tutti chords that obeys the low interval limits, you'll find yourself naturally writing according to the harmonic series. It might not be exactly the same, but it would be pretty similar.
Interestingly, doubling the violin melody line with the flute an octave above is actually common practice. The flute blends into the texture and disappears, especially in louder passages, but nevertheless contributes to the overall tone quality. Although, it's not advisable to just use the flutes that way throughout an orchestral piece or arrangement.

How should I write a tutti chord?


How do I adjust a variable for its covariates?

Question: I am trying to evaluate the relationship between two variables - x and y. Variable x has a number of known covariates: a, b, and c. I have identified how these covariates are related to x in r with the formula:
lm(x ~ a + b + c)
How do I adjust x such that I can plot a regression line for y ~ x?
I apologize if this is a simple question - everywhere that I look the answers to this question are to adjust it in the linear model itself by adding the covariates as terms (e.g. y ~ x + a + b + c). This does not seem right to me because while y may or may not covary with a, b, and c, I am only interested in controlling for the impact these have on x. Am I missing something conceptually? How can I do this in r?
Comment: You can consider plotting the residuals of `y ~ a+ b+ c` against `x ~ a +b+ c`. Alternately, you can create some ranges values of [a, b, c] and plot the bivariate y ~ x relation in a grid among those ranges (see `?coplot` in R for some motivating examples).
Comment: Is your question motivated by some application? It seems like you have a two-stage least squares problem.
Comment: See https://stats.stackexchange.com/questions/17336 if you need any elaboration of @AdamO's suggestions.
Comment: It sounds like what you want is `y ~ w`, where `w` is `x` adjusted for `a, b, c`.  But how would you know how to make this adjustment ? You could use some theoretical or empirical understanding of how `x, a, b, c` could be combined into `w`.  Or, I think, you would use `y ~ x + a + b + c`, and look at the predicted values from that regression.  That would be the best combination of `x, a, b, c` to predict `y` given the constraints of the chosen model.
Comment: This is helpful, thank you!
Comment: @SalMangiafico Yes, your first line is what I want, thank you! Can you briefly explain why ```y ~ x + a + b + c ``` would work for this?
Comment: A potentially useful search term is *partial regression plot*. E.g. see https://en.wikipedia.org/wiki/Partial_regression_plot particularly some of the references
Comment: @Glen_b Thank you!!
Comment: To add to the other comments: throughout you assume that the associations are linear, which might or might not be a justified assumption.
Answer: Answer mostly from comments
This answer assumes you want a linear combination of variables, without polynomials or interactions.
It sounds like what you want is y ~ w, where w is x adjusted for a, b, c. But how would you know how to make this adjustment ?

You could use some theoretical or empirical understanding of how x, a, b, c could be combined into w.

Or you could use y ~ x + a + b + c, and look at the predicted values from that regression. That would be the best combination of x, a, b, c to predict y given the constraints of the chosen model.

In the case of the second approach, you could extract the coefficients from the model, and consider the predicted values from the model to be your new w values.
But note that this is determined solely by the values in your current data set.
Also note that practically speaking, with the second approach, you are simply doing what you find to be the common approach to your problem, fitting a model y ~ x + a + b + c.


Arquivo XML sem informação de estilo associada

Question: Qual é o significado desta mensagem?

This XML file does not appear to have any style information associated
  with it. The document tree is shown below.

Tenho esta mensagem em um arquivo XML gerado dinamicamente e não sei o que quer dizer exatamente esta mensagem.
Comment: passa o arquivo num validador de xml: http://www.xmlvalidation.com/
Answer: Tradução:

Este arquivo XML aparenta não ter nenhuma informação de estilo associada. A árvore do documento está exibida abaixo

Quer dizer que o XML não dá nenhuma dica para o browser sobre como exibir seu conteúdo, e portanto o browser vai usar a apresentação padrão, em forma de árvore. Isso é uma mensagem do browser, absolutamente normal caso seu XML não tenha um CSS associado.


c# loop through combobox where datasource is a datatable with text

Question: Is it possible to run through every item in a combobox using a foreach loop? How would I do it?
The thing is I have a System.Data.DataRowView there because the combobox is attached to a DataTable. How do I convert from that to string?
Comment: are you doing this to look for a specific value in the combobox?  related to your last question?
Answer: Generally, it looks like this:
foreach(object item in myComboBox.Items)
{
   DataRowView row = item as DataRowView;

   if(row != null)
   {
        string displayValue = row["myColumnName"].ToString();

        // do something
   }
   else
       // error: item was not of type DataRowView
}

also see http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.items.aspx
Comment: item.ToString() will give you the value that is displayed in the combo box for that specific item.
Comment: @i am a girl, if you are looking for an item with specific text, there is a method for that.
Comment: @adrift thank u very much, the thing is i have 'System.Data.DataRowView' there because the combobox is attached to datatable, how do i convert frmo that to string
Comment: if your 'item' is of type DataRowView, you can type cast it:  DataRowView row = item as DataRowView;    and then you could get a specific column's value like this:   row["columnName"].
Comment: @remus great can u put this in your answer please
Answer: foreach (var item in combobox1.Items)
{
     //do stuff
}

If you know the content is a string, you can do
foreach (object item in combobox1.Items)
{
     string text = (item as string);
     //do stuff with the text
}

If you are using .net 3.5 or later, you can shorten it a bit by using the Cast<T>() Extension method of IEnumerable<T> (which is implemented by ObjectCollection, the type of ComboBox.Items):
foreach (string text in combobox1.Items.Cast<string>())
{
     //do stuff with the text
}

Comment: thank u  very much, the thing is i have 'System.Data.DataRowView'  there because the combobox is attached to datatable, how do i convert frmo that to string
Comment: You would need to know the specific index of the data that is displayed in the combobox and call item[index]. Sorry, I can't help you more because I have no experience concerning Databinding in WinForms.
Answer: Based on your previous question, it sounds like you want to loop through the items to find a matching text value.  Instead, you can use the ComboBox.FindStringExact method to do a case-insensitive search, which will return the index of the first match it finds, or -1 if it doesn't find the text in question:
comboBox1.SelectedIndex = comboBox1.FindStringExact("4");

Answer: Yes it is just a standard collection. Eg:
foreach(object item in myComboBox.Items)

"object" is probably (but not necessarily) a string. If you know it is always a string, you could change it to:
foreach(string item in myComboBox.Items)

Comment: the second code won't work, as myCombobox.Items is a collection of objects.
Answer: yes - iterate through the items collection of the control:
foreach(var item in this.myCombobox.Items)
{
    //your code
}

Comment: it's essentially the item.ToString() value
Comment: thank u very much, the thing is i have 'System.Data.DataRowView' there because the combobox is attached to datatable, how do i convert frmo that to string
Answer: foreach(ListItem item in this.myCombobox.Items)
{
    //...
}

Answer: foreach( object item in ComboBoxName.Items )
{
    <dosomething>
}

What else can I say?  This accesses them in order, but all will be objects.  It's up to you to determine the item's type.
Answer: I struggled for ages with this issue, as I often use ComboBox controls, binded to a List<>s  of various different classes.
I didn't really want to hardcode field names in my function, or have a separate SelectItemByValue function for each type of List<> class I'd be using.
I eventually came up with the following reusable solution.
List<EmployeeRecord> m_listOfEmployees = GetListOfEmployees();
...
comboBoxEmployees.DataSource = m_listOfEmployees;
comboBoxEmployees.DisplayMember = "EmployeeName";
comboBoxEmployees.ValueMember = "EmployeeID";

To select the ComboBox item with a particular Employee ID:
   int someEmployeeID = 4;
   ComboBoxHelper.SetComboBoxSelectionByValue<EmployeeRecord>(comboBoxEmployees, someEmployeeID);

And here's the function which does the work.
Brace yourself, it's not pretty.
public static void SetComboBoxSelectionByValue<T>(ComboBox ctrl, int? value)
{
    //  If the ComboBox has no items, disable it  (so the user can immediately see there's nothing selectable)
    ctrl.Enabled = (ctrl.Items.Count > 0);

    int inx = 0;
    foreach (T t in ctrl.Items)
    {
        foreach (PropertyInfo info in typeof(T).GetProperties())
        {
            if (info.Name == ctrl.ValueMember)
            {
                object val = info.GetValue(t, null);
                if (val.ToString() == value.Value.ToString())
                {
                    ctrl.SelectedIndex = inx;
                    return;
                }
            }
        }
        inx++;
    }

    if (ctrl.Items.Count > 0)
        ctrl.SelectedIndex = 0;
}

Notice how you have to call the function, passing it the type of objects that are being stored in each ComboBoxItem (EmployeeRecord, in this example), along with a pointer to your ComboBox and the Value of the item you want to set as the SelectedItem.
ComboBoxHelper.SetComboBoxSelectionByValue<EmployeeRecord>(comboBoxEmployees, someEmployeeID);

The function steps through the Items in the ComboBox, finds the "ValueMember" field in that item's record  (EmployeeID, in this example) and compares the ValueMember's value with the desired value parameter.
I know, I know, it's not pretty, but when you bind a List to a ComboBox, then you can't use DataRowView:
DataRowView row = item as DataRowView;
string displayValue = row["someColumnName"].ToString();

And if you want one generic SetComboBoxSelectionByValue function, which will work with Lists of any type of classes, then you need to start getting into PropertyInfos, to find the value of a field in your particular class.


Applying Pick's Theorem

Question: Let's say that $X$ is a parallelogram with vertices that have integer coordinates, how could I prove that $X$'s area is an integer?
The vertices are
$0, A, B$ and $A + B$. How would I do this?
Comment: In the future, please do not remove relevant context/working from your post. I don't know why you did that, and it is likely the reason why this post has accumulated three close votes (and nearly a fourth by me). MSE generally discourages contextless posts (where context can include your motivation, understanding, and attempts) - your edits to the question rendered this precisely such a post. (That's not to say your original post was *stellar* but you definitely made it worse in the eyes of MSE.) [cont.]
Comment: I have done some edits to your post to account for this - I included the original post it was written through a rollback (and after an accidental derp on my behalf restored the original title). The only edit that was retained was Andreas Blass' tag edits. The full revision history, for anyone who's curious -- https://math.stackexchange.com/posts/3146771/revisions
Answer: The area of the parallelogram with two sides defined by the position vectors $A=(a,b)$ and $B=(c,d)$ from the origin is given by the magnitude of the cross product of the vectors:
$$|A×B|=|(0,0,ad-bc)|=|ad-bc|$$
Since all of $a,b,c,d$ are integers here, the area $|ad-bc|$ is also an integer.
Answer: If $A=x_1 +iy_1$ and $B=x_2+iy_2$ then
$A\bar B = (x_1+iy_1)(x_2-iy_2) = (x_1x_2 +y_1y_2) + i(x_2y_1-x_1y_2)$
so $|Im(A\bar B)| = |x_2y_1-x_1y_2|$, which is the area of the parallelogram.

Applying Pick's Theorem


Comando em Javascript/Jquery de copiar e colar (ctrl + c)

Question: Quero simplesmente o comando em Javascript que copia e cola, independente se funciona em todos os browsers.
Existe uma pergunta semelhante aqui. Porém ela requer que funcione em todos os browsers. Maneira cross-browser de copiar texto para a Área de Transferência (Clipboard)
Esta outra pergunta não atende as minhas expectativas, pois preciso literalmente do comando ctrl c e não precisa funcionar cross browser. (pois o sistema vai ser só para mim)
OBS: Precisa ser Javascript, nada de outras linguagens.
Comment: Não entendi porque a pergunta sobre copiar texto pro clipboard não se aplica ao seu caso. (E qual é o browser que vc usa?)
Comment: Eu acho que não tinha necessidade de duplicar da sua outra questão, 3 pessoas já votaram por reabrir, era apenas questão de tempo e argumentar.
Comment: Você ainda não me respondeu, você quer copiar o texto da `` ou a `` formatada (com estilos etc) pra colar no Word por exemplo?
Comment: A resposta do @mgibsonbr funciona no meu caso. (Sem preferências de navegador) Não precisa copiar a formatação, apenas o conteúdo.
Answer:
Nota: essa solução é específica pro Internet Explorer

Você pode fazer isso através da função execCommand:

Crie um intervalo (range) e escolha que parte do seu documento será coberto por esse intervalo:
var range = document.createRange();
range.selectNode(divACopiar);

Coloque esse intervalo na seleção da janela:
window.getSelection().addRange(range);

Invoque o comando copy:
var sucesso = document.execCommand("copy");

Ao fazer isso, o browser vai exibir um alerta de segurança, pedindo ao usuário para dar permissão à sua página para acessar a área de transferência:

Se o usuário permitir, a função retornará true e o conteúdo da div escolhida estará na área de transferência.
Exemplo no jsFiddle.
Comment: Isso funcionou no meu Chrome/OSX (sem alerta de segurança).
Comment: Muito bom, eu usei o window.getSelection().removeAllRanges(); para remover a seleção do texto e ficar invisível para usuário.


A tela de confirmação do Primeface não funciona

Question: Essa é a tela que aparece no meu Browser

Quando aperto o botão de exclusão ele simplesmente não faz nada. Não gera nenhum erro no consoles do eclipse
Esse é o código separado
está problema aqui!

código completo
<ui:composition template="/WEB-INF/template/LayoutPadrao.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:define name="titulo">Pesquisa Produtos</ui:define>
    <ui:define name="corpo">

        <h:form>

Pesquisa de Produtos

                    <h:outputText value="123" />

                    <h:outputText value="Bola de morango" />

                    <h:outputText value="Doces - bolas de chikedkemd"  />

                    <h:inputText value="123" styleClass="moeda"/>

                    <h:outputText value="98" />

        </h:form>
    </ui:define>
</ui:composition>

porque será que não a aparece a tela de confirmação?
esse aqui foram as mensagens que geraram no consoles
mar 18, 2015 2:08:43 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTÊNCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:PeiddoVenda' did not find a matching property.
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version:        Apache Tomcat/8.0.20
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built:          Feb 15 2015 18:10:42 UTC
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number:         220.127.116.11
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name:               Windows 8.1
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version:            6.3
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture:          amd64
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home:             C:\Program Files\Java\jre1.8.0_31
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version:           1.8.0_31-b13
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor:            Oracle Corporation
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE:         C:\workspace Web\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME:         C:\workspace Web\apache-tomcat-8.0.20
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\workspace Web\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\workspace Web\apache-tomcat-8.0.20
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\workspace Web\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\workspace Web\apache-tomcat-8.0.20\endorsed
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=UTF-8
mar 18, 2015 2:08:43 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_31\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_31/bin/server;C:/Program Files/Java/jre1.8.0_31/bin;C:/Program Files/Java/jre1.8.0_31/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Java\jdk1.8.0_25\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Ruby21-x64\bin;C:\eclipse\eclipse luna\eclipse;;.
mar 18, 2015 2:08:43 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-nio-8080"]
mar 18, 2015 2:08:43 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
mar 18, 2015 2:08:43 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-nio-8009"]
mar 18, 2015 2:08:43 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
mar 18, 2015 2:08:43 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 1152 ms
mar 18, 2015 2:08:43 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
mar 18, 2015 2:08:43 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/8.0.20
mar 18, 2015 2:08:44 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFORMAÇÕES: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [123] milliseconds.
mar 18, 2015 2:08:46 PM com.sun.faces.config.ConfigureListener contextInitialized
INFORMAÇÕES: Inicializando Mojarra 2.2.8-02 ( 20140915-1602 https://svn.java.net/svn/mojarra~svn/tags/2.2.8-02@13678) para o contexto '/PedidoVenda'
mar 18, 2015 2:08:47 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFORMAÇÕES: JSF1048: Anotações PostConstruct/PreDestroy presentes.  Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas.
mar 18, 2015 2:08:48 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFORMAÇÕES: Running on PrimeFaces 5.1
mar 18, 2015 2:08:48 PM org.primefaces.extensions.application.PostConstructApplicationEventListener processEvent
INFORMAÇÕES: Running on PrimeFaces Extensions 3.0.0
mar 18, 2015 2:08:48 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-nio-8080"]
mar 18, 2015 2:08:48 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-nio-8009"]
mar 18, 2015 2:08:48 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 5017 ms

Comment: E no log do navegador, aparece alguma coisa?
Comment: aonde especificamente você está se referindo?
Comment: Por exemplo, no Google Chrome, você pode ver o log pelo atalho Ctrl+Shift+j, e também pode executar instruções em JavaScript.
Comment: ata entendi, vou verificar
Comment: ver se isso ajuda
Answer: Você está tentando programar manualmente a chamada ao confirmDialog. A idéia não é essa. A idéia é que o confirmDialog substitua a confirmação padrão do JavaScript, então você programa o botão normalmente para fazer o que tem que fazer, e configura-o para que seja invocada uma confirmação quando o botão é clicado.
Então, você não precisa programar a chamada do confirmDialog. Ao invés, você configura o botão para que a janela de confirmação seja automaticamente invocada.
Seu código deve ficar mais ou menos assim:

Veja as diferenças com relação ao seu código original:

Eu dei uma função ao botão de excluir (neste caso, a chamada do método fictício bean.excluir, que será feita pelo Primefaces usando Ajax).
Especifiquei uma tag p:confirm para o botão. Ela é responsável pelo acionamento do confirmDialog.
header e message são especificados na tag p:confirm, pois o dialog é genérico.
Adicionei a propriedade global ao confirmDialog. Este componente, por sua vez, não tem nenhuma ação explicitamente programada. São as classes ui-confirmdialog-yes e ui-confirmdialog-no nos botões que identificam qual botão o usuário clicou. Então, se o usuário clicar em "Sim", o método associado ao botão "Excluir" (no caso, bean.excluir) será invocado.


Large sample size creating significant variables

Question: I'm currently working with a large sample size (around 400,000 observations) where I did a t-test and the p-value turned out to be less than 0.001 for all variables. This ofcourse is not something that is impossible to observe. However, i became suspicious of it and generated a random variable between 0 and 20 to see. This also resulted in a variable significant at 5%, which is totally weird to me. What test(s) can I use to determine whether this is a valid p-value or whether this happened because the sample size was large?
Although I've followed some statistics, I'm by no means a statistics expert, so please pardon any "newb-ness" evident in my post.
Latex output of my table can be found below. Thanks for the help!
<code>             &     I      &     II     &    III     &     IV     &      V      &      VI     &     VII     &     VIII     \\
\midrule
const        & 0.0681***  & 0.2197***  & 0.2319***  & 0.2319***  & 0.2275***   & 0.1179***   & 0.1160***   & 0.1159***    \\
             & (0.0001)   & (0.0005)   & (0.0005)   & (0.0005)   & (0.0005)    & (0.0005)    & (0.0005)    & (0.0005)     \\
passive\_pct & -0.1791*** & -0.0599*** & -0.0540*** & -0.0540*** & -0.0545***  & -0.0743***  & -0.0734***  & -0.0734***   \\
             & (0.0012)   & (0.0012)   & (0.0012)   & (0.0012)   & (0.0012)    & (0.0010)    & (0.0010)    & (0.0010)     \\
log\_mcap    &            & -0.0079*** & -0.0084*** & -0.0084*** & -0.0082***  & -0.0040***  & -0.0039***  & -0.0039***   \\
             &            & (0.0000)   & (0.0000)   & (0.0000)   & (0.0000)    & (0.0000)    & (0.0000)    & (0.0000)     \\
bm           &            &            & -0.0049*** & -0.0049*** & -0.0050***  & -0.0016***  & -0.0016***  & -0.0016***   \\
             &            &            & (0.0001)   & (0.0001)   & (0.0001)    & (0.0001)    & (0.0001)    & (0.0001)     \\
ill          &            &            &            &            & 107.6237*** & -70.0441*** & -78.4087*** & -78.4107***  \\
             &            &            &            &            & (2.7307)    & (2.3192)    & (2.3322)    & (2.3322)     \\
baspread     &            &            &            &            &             & 0.6554***   & 0.5824***   & 0.5824***    \\
             &            &            &            &            &             & (0.0016)    & (0.0028)    & (0.0028)     \\
retvol       &            &            &            &            &             &             & 0.1127***   & 0.1127***    \\
             &            &            &            &            &             &             & (0.0036)    & (0.0036)     \\
random       &            &            &            &            &             &             &             & 0.0000*      \\
             &            &            &            &            &             &             &             & (0.0000)     \\
N            & 403264     & 403264     & 403264     & 403264     & 403264      & 403264      & 403264      & 403264       \\
R2           & 0.05       & 0.24       & 0.25       & 0.25       & 0.25        & 0.48        & 0.48        & 0.48         \\
</code>
Comment: An irrelevant variable should only be significant at $\alpha$ significance level in $\alpha$ fraction of times, even in large samples. I think you were simply unlucky with your random variable generation. If your repeated it 100 times, you should only find about 5 instances where the variable is significant at 5% level.
Comment: Thank you for your help. I indeed ran it a couple of times again and it resulted to be not significant. Should i be suspicious of all my variables being significant at such at 1% level? And if so, is there a way to adjust my p-value based on the data amount?
Answer: At $\alpha$ significance level, an irrelevant variable should only be significant in a fraction $\alpha$ of random samples, regardless of the sample size. I think you were simply unlucky with your random variable generation. If your repeated it 100 times, you should only find about 5 instances where the variable is significant at 5% level.

I indeed ran it a couple of times again and it resulted to be not significant. Should i be suspicious of all my variables being significant at such at 1% level? And if so, is there a way to adjust my p-value based on the data amount?

If your model is well specified, then the $p$-values are to be trusted. With a large sample, your tests have great power, so they are able to distinguish even small coefficients from zero. This is likely what is happening in your sample.
Your main problem might be that you are not interested in the null hypothesis per se. I.e. you are not interested in finding out whether the true coefficients are exactly equal to zero. You might instead be interested in whether the true coefficients are economically significant. For that you should inspect the point estimates (and the admittedly narrow intervals around them) and judge them w.r.t.  the subject-matter knowledge of the phenomenon you are modeling.
Answer: What test(s) can I use to determine whether this is a valid p-value or whether this happened because the sample size was large?
Nothing.  There are investigations you may be able to perform to determine if your model is bad, but not if the significance is significant.
As sample sizes become very large, Frequentist tests become very sensitive to small departures from your model.  Also, if your null is $\beta=0$, then it is also sensitive to slopes near zero but not actually zero.  If your sample is large enough, it can detect small differences from zero.
What you may be thinking of is the Jeffreys-Lindley Paradox where the Frequentist test falsifies the null when a Bayesian one strongly affirms the null.  You can find a paper on it at Lindley Paradox.
Things you can do is look at graphs of the bivariate plots.  You can also look at the marginal distributions and the relationships among the variables.
It should be noted that if you are setting a level of $\alpha$ such as $\alpha=.01$ then a p-value of $p<.0001$ is not more significant than one of $p<.001$.  The "extremeness" does not matter.  It is either in the rejection region, or it is not in the rejection region.
Now, if you are not fixing a cutoff, and you are using a p-value as a measure of the weight of the evidence against the null, then there is a difference in weight, but the idea of significance becomes blurry.
Comment: Thank you for the bivariate plots and marginal distribution, will definitely be using that to illustrate that the effect is within the data.


Given an integer n, return the largest number that contains exactly n digits. Why Codefights don't accept it?

Question:

const largestNumber = (n) => {
  let arr = [];
  let arr2 = [];
  let maxNum = 9;
  for (let i = 0; i < n; i++) {
    arr.push(i);
  }
  for (let j = 1; j <= arr.length; j++) {
    arr2.push(maxNum)
  }
  let s = arr2.join("");
  return s;
}
console.log(largestNumber(10))

Result Show: Error Output:Empty
Comment: Your function returns a string, but the question is looking for a number.
Answer: You might be returning that is a string type and result may be expected a number type. You just have to return type number as
return +s;

or
return parseInt(s)

1) There is no need to loop through after creating an array. Alternatively you can do as

const largestNumber = (n) => {
  return Math.pow(10, n) - 1;
};
console.log(largestNumber(10));

2) You can also achieve the same result with Array.from

const length = 10;
const result = Array.from({ length }, () => 9).join("");
console.log(result);
Answer: As mentioned the test is looking for a number but the function returns a string.
HR01M8055's answer is great. Here's mine which uses an array and returns a number.

function largestNumber(n) {
  return Number(Array(n).fill(9).join(''));
}

const result = largestNumber(10);

console.log(typeof result, result);
Comment: [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) is also a better option. If I'm not wrong. But I don't know which one is efficient `Array(n).fill(9).join('')` or `Array.from({ length }, () => 9).join("")`. Have a look at my answer. I've added another solution


Existence of unbounded operators on Banach spaces

Question: I'm confused by the questions Discontinuous linear functional and
Example of an unbounded operator
which ask about unbounded linear functionals/operators on Banach spaces.
I don't understand how these can even exist.
Let $X$ be a Banach space.   If $T$ is unbounded, then there exists a sequence $x_i \in X$ such that $\|x_i\|=1$ but $T(x_i)>i^3.$ Then we can let $x= \sum_i \frac{x_i}{i^2}.$ This is an element of $X$ by completeness but $T(x)$ is infinite. Hence $T$ isn't defined on $x.$
Comment: Unbounded operators are not continuous.
Comment: In case you didn't catch the point to Daniel's comment: When you say $Tx$ is infinite you're assuming that $T$ of that sum is the sum of $T$ of the individual terms. There's no reason that should be if $T$ is not continuous.
Answer: As the commenters said, your argument is flawed in the part where you conclude that (using notation $s_n=x_1+\dots+x_n$)
$$s_n\to x \text{ and } Ts_n\to \infty \overset{?}{\implies} Tx=\infty $$
You did prove something, however: your argument shows that an unbounded operator must be discontinuous. (This isn't obvious; in fact, on an incomplete normed space one can have an unbounded continuous operator, such as $(x_n)\mapsto (nx_n)$ on the space of sequences that are eventually zero, equipped with any $\ell^p$ norm)
Comment: I think the last sentence is not true: A linear operator is bounded if and only if it is continuous.


The Message Queuing service failed to join the computer's domain 'DOMAIN' Error 0xc00e0025

Question: Struggling to get MSMQ installed in Domain Integration mode on Windows 2012 (Azure). So far, I've provisioned a brand new Windows Server 2012 (R2) machine on the Azure platform and installed the Active Directory role and promoted the machine to a domain controller.
Once the AD was in place, I then added the MSMQ feature, along with the Directory Integration add on.
However, it will not install in AD integration mode. It will only work in Workgroup mode.
I can verify this by running the following powershell command:
New-MSMQQueue -name Queue1 -queuetype Public

When I run this command, I get the following error:
New-MsmqQueue : A workgroup installation computer does not support the operation.

The event viewer reveals to errors in the Application log:
1. The Message Queuing service failed to join the computer's domain 'DOMAIN'. Error 0xc00e0025:

2. Message Queuing was unable to create the msmq (MSMQ Configuration) object in Active Directory Domain Services. Error c00e0025h:

I'm struggling here. Any advice?
Comment: Would appreciate feedback on why the question was downvoted.
Comment: Again, why has this question been downvoted? Feedback please!
Answer: Can we get some more information on this? Below are some questions that came up for me after reading our post.
Did you replace 'DOMAIN' to omit your domain name or did you really try and create a domain named DOMAIN? That seems like a generic message and might not be the issue.
Have you confirmed that your Active Directory is actually working? Can you join other computers to the domain? Have you tried running DCDiag and Netdiag to validate the configuration?
There are also some specific things you have to do to get MSMQ working in this mode on an actual domain controller. Here is an example for 2008 on what needs to be done.
Any chance this helps?
Comment: Thanks for your reply. Yes I changed the domain to protect identity. The actual domain is valid. Yes AD is working, other machines are able to join. Thanks for the link, I'll check that out and report back... well done.
Answer: You didn't have access permissions to create the necessary objects in AD. What account were you logged in with?
Answer: I had similar problem, able to resolve after adding the account to delegate control to create objects at Active Directory Users and Groups -> Right Click on your DOMAIN -> Delegate Control
Similarly delegate control to Active Directory Sites and Services.


How much clock asynchronicity can secure protocols tolerate?

Question: I've noticed that connections to a secure server got reset if time is out of sync on a server.
I believe time synchronization protocols can be just as precise to the order of network latency with the external time servers, which could be as much as few hundreds of milliseconds.
What are the time precision requirements of TLS connections and certificate validation?
Comment: AFAIK purely from the TLS perspective the server time is irrelevant and for the client you need the date/time to be *somewhere* between the "Not valid before" and "Not valid after" dates encoded in the server certificate. Of course certain server implementations may for instance refuse loading expired server certificates and require more accurate time. The protocols that run on top of TLS may require much more accuracy though.
Comment: You asked about secure protocols in the title, but you reference TLS specifically in the question.  Some non-TLS VPN's use a nonce for replay prevention and don't rely on clock time at all.
Comment: I have not the time to write a proper answer at the moment, but most can tolerate up to a 5 minute delta between endpoints.
Comment: if you are talking about server certificate expiration, protocol itself does not mandate a skew. normally you would 1) trust the server certificate until the very second it expires but most importantly 2) every clever sysadmin renews ssl certificates far before the deadline. failing to #2 once resulted in a big halt at our company
Answer: I've heard 5 minutes thrown around several times as per EEAA's comment, but I honestly don't know why (and am looking forward to an explanation).
Bear in mind this is not the TLS protocol itself that has this precision-requirement, as per the documentation:

Clocks are not required to be set correctly by the basic TLS protocol; higher-level or application protocols may define additional requirements.
Comment: AFAIK the 5 minute delta @EEAA mention finds it's origin in the [MIT Kerberos specification](http://web.mit.edu/Kerberos/krb5-1.5/krb5-1.5.4/doc/krb5-admin/Clock-Skew.html) *"In order to prevent intruders from resetting their system clocks in order to continue to use expired tickets, Kerberos V5 is set up to reject ticket requests from any host whose clock is not within the specified maximum clock skew of the KDC"*
Comment: Also Windows Technet https://technet.microsoft.com/en-us/library/jj852172(v=ws.11).aspx the 5min is default and configurable.
Comment: In a blogpost at [https://blog.cloudflare.com/roughtime/](https://blog.cloudflare.com/roughtime/) **10 seconds** is suggested as sufficiently accurate:  *But for many applications, precise network time isn't essential; it suffices to be accurate, say, within 10 seconds of real time*


What is $\sum_{j=0}^{\infty}\frac{j+1}{2^j}$?

Question: What is $\sum_{j=0}^{\infty}\frac{j+1}{2^j}$?
I don't know what theorems or tricks to use to add up an infinite sum.
Comment: As you see in the answers below, by writing this as $\Sigma_{j=0}^{\infty} \frac{j}{2^j} + \Sigma_{j=0}^{\infty} \frac{1}{2^j}$, you now have an  arcane way of writing $2 + 2 = 4$. :p
Answer: Start with:
$$
\sum_{j \ge 0} z^j = \frac{1}{1 - z}
$$
Derive with respect to $z$, and evaluate at $z = \dfrac{1}{2}$.
Answer: I'll assume you know the sum formula for an infinite geometric series, so that you can find  $\Sigma_{j = 0}^{\infty} \frac{1^j}{2^j}.$
The other part of the infinite sum is  $\Sigma_{j = 0}^{\infty} \frac{j}{2^j}.$  Make a triangular stack of infinite series like this:
$$
\begin{array}{r}
& \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16}  + \ldots \\
&               \frac{1}{4} + \frac{1}{8} + \frac{1}{16}  + \ldots \\
&                             \frac{1}{8} + \frac{1}{16}  + \ldots \\
&                                           \frac{1}{16}  + \ldots \\
&           \ldots
\end{array}
$$
so that all the identical terms form columns.  Summed vertically, they are the terms of your series $\Sigma_{j = 0}^{\infty} \frac{j}{2^j}.$ [Note that $j = 0 $ produces no terms here.] Horizontally, each row is an infinite geometric series with ratio $r = \frac{1}{2}$ and a different initial term.  There will be a reasonable expression for the sum of the infinitude of these geometric series.  Now add that result to your earlier value for  $\Sigma_{j = 0}^{\infty} \frac{1^j}{2^j}.$
Comment: Thanks for better aligning my columns!
Answer: Let $S = \displaystyle\sum_{j=0}^\infty \frac{j+1}{2^j}$ and consider $1/2 S = \displaystyle\sum_{j=0}^\infty \frac{j+1}{2^{j+1}}.$ Note then that $S - 1/2 S = 1 +\displaystyle\sum_{j=0}^\infty \frac{1}{2^{j+1}} = 2,$ whence $S = 4.$
Answer: Let $$T_n=\sum_{j=0}^{n}\frac{j+1}{2^j} \,,$$
Then
$$2T_n=\sum_{j=0}^{n}\frac{j+1}{2^{j-1}}=\sum_{m=-1}^{n-1}\frac{m+2}{2^m}$$
$$2T_n= 2+\sum_{m=0}^{n-1}\frac{m+2}{2^m}= 2-\frac{n+1}{2^n}+\sum_{m=0}^{n}\frac{m+2}{2^m}$$
$$2T_n= 2-\frac{n+1}{2^n}+\sum_{m=0}^{n}\frac{m+1}{2^m}+\sum_{m=0}^{n}\frac{1}{2^m}$$
$$2T_n= 2-\frac{n+1}{2^n}+T_n+(2-\frac{1}{2^n+1})$$
Thus
$$T_n= 4-\frac{n+1}{2^n}-\frac{1}{2^n+1} \,.$$
It is easy now to calculate $\lim_n T_n$.
Answer: Let's split it into two series:
$\sum_{j=0}^{\infty} \frac{j}{2^j} + \sum_{j=0}^{\infty}\frac{1}{2^j}$.
The second series is a geometric series and I'm sure you know how to evaluate it (if not, see here). The first series is a little trickier and requires some calculus. Let's define the following series (or function, however you wish to look at it):
$\sum_{j=0}^{\infty}\left(\frac{x}{2}\right)^j$.
What happens if we differentiate this function? Is there a specific value of $x$ that can relate this new expression to your initial sum?


using multiple redis ports or instances with separate backup files

Question: I'm making new instances of redis by using different ports (Multiple Redis Instances)
How do I control where each port's dump.rdb backup file saves to?
Are both instances going to save to the same file? can I make separate backup files for each instance?
Thanks
Answer: You can have different configurations for each instance and use them like this:
<code>$ redis-server /path/to/redis1.conf
</code>
Each configuration defines the filename for the dump file in the following setting:
<code># The filename where to dump the DB
dbfilename dump1.rdb
</code>
Answer: You can use the install_server.sh script from the Redis git repository to easily setup multiple servers with their own configurations (port, rdb directory etc...)


Infinite Union of Open Sets is Closed Set

Question: I am trying rewrite the set:
$$E_1 = (0,1] $$
as a collection of countable unions or intersections. I understand there are a ton of ways to do this, however, I just want to make sure mine is correct so I understand how to evaluate these objects. My thought was to break this into:
$$E_1=(0,1)\cup[1]=\bigcup\limits_{n=2}^{\infty}[-\frac{1}{n},1-\frac{1}{n}] \cup\bigcap\limits_{n=2}^{\infty}(1-\frac{1}{n},1+\frac{1}{n}) $$
I believe the infinite union should be equal to $(0,1)$ and the infinite intersection should be equal to $[1]$ so that their union is simply $E_1$. Is this correct?
EDIT: This was supposed to read:
$$E_1=(0,1)\cup[1]=\bigcup\limits_{n=2}^{\infty}[\frac{1}{n},1-\frac{1}{n}] \cup\bigcap\limits_{n=2}^{\infty}(1-\frac{1}{n},1+\frac{1}{n}) $$
Comment: Adding on to Paulo's answer, here are a few ideas for you to try to get $(0, 1)$ (a) create intervals which "grow" to the right i.e. they are all of the form $(0, x_n)$ for each $n$, (b) create intervals which "grow" out from 0.5 i.e. they are all of the form $(0.5-y_n, 0.5+z_n)$ for each $n$. There are other approaches as well, of course, but these are the two that I think are easiest to "see".
Answer: The sequence of sets $\{I_n\}$ where $ I_n = [-\frac{1}{n},\frac{1}{n}]$ is decreasing, and $I_{n} \subset I_2$ (for all $n$), so its  union is just $I_2$. You wont get $E_1$ like this. You are right the intersection is 1. You can write $E_1$ directly as intersection (enumerable) of open sets.
While the infinite union of open sets can be closed (i.e $ \bigcup (-n,n) = \mathbb{R}$), it is necessarily open as well, so you cannot write $E_1$ as infinite union of open sets, because $E_1$ is not open.
Comment: Now it looks fine. You should try to show inclusions directly as well, i know its a bit boring, but it always works. Take a $x$ in $E_1$ and show its on the right hand side, and similarly for a $y$ on the right handed side, show its on $E_1$. If you are doing analysis 1, your teacher will likely want to see you do it on the tests as well.  Thats one of the reasons it would be easier to represent $E_1$ as intersection, this verification becomes easier.
Comment: Sorry I mistyped defining the infinite union. As I had it written in my notebook, it was supposed to be $[\frac{1}{n},1-\frac{1}{n}]$. Would that then be correct?
Comment: Thank you for the tip, I will definitely keep that in mind!