Modal Box Repeated 3 Times

Question: I'm working on this page, and it's main idea to click one of these buttons
and it will open a popup modal box with a certain video
i'm trying this with the same video it's not a problem
but the problem that when you try to close the video it appears that there's 3 modal boxes opened so you have to close 3 times. my expectations that it will be one box to close not 3 of course.
I've tried to make every video a variable number on a href tag like this
<button href="#0" class="cd-popup-trigger">Marwan Moussa</button>
<button href="#1" class="cd-popup-trigger">Final Maro Trying</button>
<button href="#2" class="cd-popup-trigger">Marwaaaaan</button>
But Not Working.

jQuery(document).ready(function ($) {
    //open popup
    $('.cd-popup-trigger').on('click', function (event) {
        event.preventDefault();
        $('.cd-popup').addClass('is-visible');
    });

    //close popup
    $('.cd-popup').on('click', function (event) {
        if ($(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup')) {
            event.preventDefault();
            $(this).removeClass('is-visible');
        }
    });
    //close popup when clicking the esc keyboard button
    $(document).keyup(function (event) {
        if (event.which == '27') {
            $('.cd-popup').removeClass('is-visible');
        }
    });
});
@import url('https://fonts.googleapis.com/css?family=Inconsolata|Source+Sans+Pro:200,300,400,600');
body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #E0E0E0;
    overflow: hidden;
}

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
main {
    display: block;
}

body {
    line-height: 1;
}

ol,
ul {
    list-style: none;
}

blockquote,
q {
    quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: "";
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

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

Primary style

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

html * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*,
*:after,
*:before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

body {
    font-size: 100%;
    font-family: "Lato", sans-serif;
    color: #8f9cb5;
    background-color: #ffd88f;
}

a {
    color: #35a785;
    text-decoration: none;
}

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

Modules - reusable parts of our design

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

.img-replace {
    /* replace text with an image */
    display: inline-block;
    overflow: hidden;
    text-indent: 100%;
    color: transparent;
    white-space: nowrap;
}

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

xnugget info

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

.cd-nugget-info {
    text-align: center;
    position: absolute;
    width: 100%;
    height: 50px;
    line-height: 50px;
    bottom: 0;
    left: 0;
}

.cd-nugget-info a {
    position: relative;
    font-size: 14px;
    color: #5e6e8d;
    -webkit-transition: all 0.2s;
    -moz-transition: all 0.2s;
    transition: all 0.2s;
}

.no-touch .cd-nugget-info a:hover {
    opacity: 0.8;
}

.cd-nugget-info span {
    vertical-align: middle;
    display: inline-block;
}

.cd-nugget-info span svg {
    display: block;
}

.cd-nugget-info .cd-nugget-info-arrow {
    fill: #5e6e8d;
}

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

Main components

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

header {
    height: 200px;
    line-height: 200px;
    text-align: center;
    background-color: #5e6e8d;
    color: #fff;
}

header h1 {
    font-size: 20px;
    font-size: 1.25rem;
}

.cd-popup-trigger {
    display: block;
    width: 170px;
    height: 50px;
    line-height: 50px;
    margin: 3em auto;
    text-align: center;
    color: #fff;
    font-size: 14px;
    font-size: 0.875rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 50em;
    background: #35a785;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.07);
}

@media only screen and (min-width: 1170px) {
    .cd-popup-trigger {
        margin: 6em auto;
    }
}

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

xpopup

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

.cd-popup {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background-color: rgba(94, 110, 141, 0.9);
    opacity: 0;
    visibility: hidden;
    -webkit-transition: opacity 0.3s 0s, visibility 0s 0.3s;
    -moz-transition: opacity 0.3s 0s, visibility 0s 0.3s;
    transition: opacity 0.3s 0s, visibility 0s 0.3s;
}

.cd-popup.is-visible {
    opacity: 1;
    visibility: visible;
    -webkit-transition: opacity 0.3s 0s, visibility 0s 0s;
    -moz-transition: opacity 0.3s 0s, visibility 0s 0s;
    transition: opacity 0.3s 0s, visibility 0s 0s;
}

.cd-popup-container {
    position: relative;
    width: 90%;
    max-width: 400px;
    margin: 4em auto;
    background: #fff;
    border-radius: 0.25em 0.25em 0.4em 0.4em;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    -webkit-transform: translateY(-40px);
    -moz-transform: translateY(-40px);
    -ms-transform: translateY(-40px);
    -o-transform: translateY(-40px);
    transform: translateY(-40px);
    /* Force Hardware Acceleration in WebKit */
    -webkit-backface-visibility: hidden;
    -webkit-transition-property: -webkit-transform;
    -moz-transition-property: -moz-transform;
    transition-property: transform;
    -webkit-transition-duration: 0.3s;
    -moz-transition-duration: 0.3s;
    transition-duration: 0.3s;
}

.cd-popup-container p {
    padding: 3em 1em;
}

.cd-popup-container .cd-buttons:after {
    content: "";
    display: table;
    clear: both;
}

.cd-popup-container .cd-buttons li {
    float: left;
    width: 50%;
    list-style: none;
}

.cd-popup-container .cd-buttons a {
    display: block;
    height: 60px;
    line-height: 60px;
    text-transform: uppercase;
    color: #fff;
    -webkit-transition: background-color 0.2s;
    -moz-transition: background-color 0.2s;
    transition: background-color 0.2s;
}

.cd-popup-container .cd-buttons li:first-child a {
    background: #fc7169;
    border-radius: 0 0 0 0.25em;
}

.no-touch .cd-popup-container .cd-buttons li:first-child a:hover {
    background-color: #fc8982;
}

.cd-popup-container .cd-buttons li:last-child a {
    background: #b6bece;
    border-radius: 0 0 0.25em 0;
}

.no-touch .cd-popup-container .cd-buttons li:last-child a:hover {
    background-color: #c5ccd8;
}

.cd-popup-container .cd-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
}

.cd-popup-container .cd-popup-close::before,
.cd-popup-container .cd-popup-close::after {
    content: "";
    position: absolute;
    top: 12px;
    width: 14px;
    height: 3px;
    background-color: #8f9cb5;
}

.cd-popup-container .cd-popup-close::before {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    left: 8px;
}

.cd-popup-container .cd-popup-close::after {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
    right: 8px;
}

.is-visible .cd-popup-container {
    -webkit-transform: translateY(0);
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    transform: translateY(0);
}

@media only screen and (min-width: 1170px) {
    .cd-popup-container {
        margin: 8em auto;
    }
}

h1 {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 22px;
    color: #151E3F;
    font-weight: 300;
    letter-spacing: 2px;
}

.wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    >* {
        margin: 5px;
    }
}

.media {
    width: 300px;
    height: 200px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

img {
    max-width: 100%;
    height: auto;
}

.layer {
    opacity: 0;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 10px;
    height: 90%;
    background: #FFF;
    color: #151E3F;
}

p {
    transition: all 0.9s ease;
    transform: scale(0.1)
}

p {
    font-family: 'Inconsolata', monospace;
    text-align: center;
    font-size: 15px;
    letter-spacing: 1px;
}

.media:hover .layer {
    opacity: 0.8;
    width: 90%;
    transition: all 0.5s ease;
}

p {
    transform: scale(1);
    transition: all 0.9s ease;
}

@media (max-width: 800px) {
    body {
        transform: scale(0.6);
    }
}

@media (max-width: 600px) {
    .wrapper {
        display: block;
        >* {
            margin: 10px;
        }
    }
}

        <title>..</title>

        <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
        <link href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.0.0/magnific-popup.min.css" rel="stylesheet">
        <link href="style.css" rel="stylesheet">

        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

        <link rel="icon" href="http://laurefinch.beget.tech/fav.ico">

Lectures

Second AJAX Example!

                    <button href="#0" class="cd-popup-trigger">Marwan Moussa</button>

                            <video style="padding:30px;" width="320" height="240" controls>
                                <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
                                Your browser does not support the video tag.
                            </video>
                            Close

Sheraton

                    <button href="#1" class="cd-popup-trigger">Final Maro Trying</button>

                            <video style="padding:30px;" width="320" height="240" controls>
                                <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
                                Your browser does not support the video tag.
                            </video>
                            Close

Sheraaaton

                    <button href="#0" class="cd-popup-trigger">Marwaaaaan</button>

                            <video style="padding:30px;" width="320" height="240" controls>
                                <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
                                Your browser does not support the video tag.
                            </video>
                            Close

ggggg

Answer: By using .next() in the example below it seems to solve your problem:
$('.cd-popup-trigger').on('click', function(event) {
  event.preventDefault();
  $(this).next('.cd-popup').addClass('is-visible');
});

Also please note you have 2 x  tag in your document.
The problem was that you were adding the class is-visible to all cd-popup elements.

jQuery(document).ready(function($) {
  //open popup
  $('.cd-popup-trigger').on('click', function(event) {
    event.preventDefault();
    $(this).next('.cd-popup').addClass('is-visible');
  });

  //close popup
  $('.cd-popup').on('click', function(event) {
    if ($(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup')) {
      event.preventDefault();
      $(this).removeClass('is-visible');
    }
  });
  //close popup when clicking the esc keyboard button
  $(document).keyup(function(event) {
    if (event.which == '27') {
      $('.cd-popup').removeClass('is-visible');
    }
  });
});
@import url('https://fonts.googleapis.com/css?family=Inconsolata|Source+Sans+Pro:200,300,400,600');
body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #E0E0E0;
  overflow: hidden;
}

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
main {
  display: block;
}

body {
  line-height: 1;
}

ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

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

Primary style

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

html * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*,
*:after,
*:before {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  font-size: 100%;
  font-family: "Lato", sans-serif;
  color: #8f9cb5;
  background-color: #ffd88f;
}

a {
  color: #35a785;
  text-decoration: none;
}

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

Modules - reusable parts of our design

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

.img-replace {
  /* replace text with an image */
  display: inline-block;
  overflow: hidden;
  text-indent: 100%;
  color: transparent;
  white-space: nowrap;
}

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

xnugget info

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

.cd-nugget-info {
  text-align: center;
  position: absolute;
  width: 100%;
  height: 50px;
  line-height: 50px;
  bottom: 0;
  left: 0;
}

.cd-nugget-info a {
  position: relative;
  font-size: 14px;
  color: #5e6e8d;
  -webkit-transition: all 0.2s;
  -moz-transition: all 0.2s;
  transition: all 0.2s;
}

.no-touch .cd-nugget-info a:hover {
  opacity: 0.8;
}

.cd-nugget-info span {
  vertical-align: middle;
  display: inline-block;
}

.cd-nugget-info span svg {
  display: block;
}

.cd-nugget-info .cd-nugget-info-arrow {
  fill: #5e6e8d;
}

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

Main components

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

header {
  height: 200px;
  line-height: 200px;
  text-align: center;
  background-color: #5e6e8d;
  color: #fff;
}

header h1 {
  font-size: 20px;
  font-size: 1.25rem;
}

.cd-popup-trigger {
  display: block;
  width: 170px;
  height: 50px;
  line-height: 50px;
  margin: 3em auto;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-size: 0.875rem;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 50em;
  background: #35a785;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.07);
}

@media only screen and (min-width: 1170px) {
  .cd-popup-trigger {
    margin: 6em auto;
  }
}

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

xpopup

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

.cd-popup {
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(94, 110, 141, 0.9);
  opacity: 0;
  visibility: hidden;
  -webkit-transition: opacity 0.3s 0s, visibility 0s 0.3s;
  -moz-transition: opacity 0.3s 0s, visibility 0s 0.3s;
  transition: opacity 0.3s 0s, visibility 0s 0.3s;
}

.cd-popup.is-visible {
  opacity: 1;
  visibility: visible;
  -webkit-transition: opacity 0.3s 0s, visibility 0s 0s;
  -moz-transition: opacity 0.3s 0s, visibility 0s 0s;
  transition: opacity 0.3s 0s, visibility 0s 0s;
}

.cd-popup-container {
  position: relative;
  width: 90%;
  max-width: 400px;
  margin: 4em auto;
  background: #fff;
  border-radius: 0.25em 0.25em 0.4em 0.4em;
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  -webkit-transform: translateY(-40px);
  -moz-transform: translateY(-40px);
  -ms-transform: translateY(-40px);
  -o-transform: translateY(-40px);
  transform: translateY(-40px);
  /* Force Hardware Acceleration in WebKit */
  -webkit-backface-visibility: hidden;
  -webkit-transition-property: -webkit-transform;
  -moz-transition-property: -moz-transform;
  transition-property: transform;
  -webkit-transition-duration: 0.3s;
  -moz-transition-duration: 0.3s;
  transition-duration: 0.3s;
}

.cd-popup-container p {
  padding: 3em 1em;
}

.cd-popup-container .cd-buttons:after {
  content: "";
  display: table;
  clear: both;
}

.cd-popup-container .cd-buttons li {
  float: left;
  width: 50%;
  list-style: none;
}

.cd-popup-container .cd-buttons a {
  display: block;
  height: 60px;
  line-height: 60px;
  text-transform: uppercase;
  color: #fff;
  -webkit-transition: background-color 0.2s;
  -moz-transition: background-color 0.2s;
  transition: background-color 0.2s;
}

.cd-popup-container .cd-buttons li:first-child a {
  background: #fc7169;
  border-radius: 0 0 0 0.25em;
}

.no-touch .cd-popup-container .cd-buttons li:first-child a:hover {
  background-color: #fc8982;
}

.cd-popup-container .cd-buttons li:last-child a {
  background: #b6bece;
  border-radius: 0 0 0.25em 0;
}

.no-touch .cd-popup-container .cd-buttons li:last-child a:hover {
  background-color: #c5ccd8;
}

.cd-popup-container .cd-popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
}

.cd-popup-container .cd-popup-close::before,
.cd-popup-container .cd-popup-close::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 14px;
  height: 3px;
  background-color: #8f9cb5;
}

.cd-popup-container .cd-popup-close::before {
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
  left: 8px;
}

.cd-popup-container .cd-popup-close::after {
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  transform: rotate(-45deg);
  right: 8px;
}

.is-visible .cd-popup-container {
  -webkit-transform: translateY(0);
  -moz-transform: translateY(0);
  -ms-transform: translateY(0);
  -o-transform: translateY(0);
  transform: translateY(0);
}

@media only screen and (min-width: 1170px) {
  .cd-popup-container {
    margin: 8em auto;
  }
}

h1 {
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 22px;
  color: #151E3F;
  font-weight: 300;
  letter-spacing: 2px;
}

.wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  >* {
    margin: 5px;
  }
}

.media {
  width: 300px;
  height: 200px;
  overflow: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

img {
  max-width: 100%;
  height: auto;
}

.layer {
  opacity: 0;
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 10px;
  height: 90%;
  background: #FFF;
  color: #151E3F;
}

p {
  transition: all 0.9s ease;
  transform: scale(0.1)
}

p {
  font-family: 'Inconsolata', monospace;
  text-align: center;
  font-size: 15px;
  letter-spacing: 1px;
}

.media:hover .layer {
  opacity: 0.8;
  width: 90%;
  transition: all 0.5s ease;
}

p {
  transform: scale(1);
  transition: all 0.9s ease;
}

@media (max-width: 800px) {
  body {
    transform: scale(0.6);
  }
}

@media (max-width: 600px) {
  .wrapper {
    display: block;
    >* {
      margin: 10px;
    }
  }
}

  <title>..</title>

  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.0.0/magnific-popup.min.css" rel="stylesheet">
  <link href="style.css" rel="stylesheet">

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

  <link rel="icon" href="http://laurefinch.beget.tech/fav.ico">

Lectures

Second AJAX Example!

        <button href="#0" class="cd-popup-trigger">Marwan Moussa</button>

            <video style="padding:30px;" width="320" height="240" controls>
  <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
            Close

Sheraton

        <button href="#1" class="cd-popup-trigger">Final Maro Trying</button>

            <video style="padding:30px;" width="320" height="240" controls>
  <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
            Close

Sheraaaton

        <button href="#0" class="cd-popup-trigger">Marwaaaaan</button>

            <video style="padding:30px;" width="320" height="240" controls>
  <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
            Close

ggggg

Modal Box Repeated 3 Times


Is there a downside to going multiple days without sleeping?

Question: While adventuring and completing side quests, I'd realized I'd gone days without stopping to rest and cashing in my experience (thanks to those nighttime hunts). My party has started complaining of being tired and looking forward to a good night's rest. Are their conversations just flavor or are there any negative effects to keeping my party up for multiple days without sleeping?
Comment: Hot Network Questions, here we come...
Comment: As a reminder, comments are for the actual question itself -- not unnecessary chatter.
Answer: Apparently there is a penalty for going more than 3 days without sleep, according to the wikia page on Lodgings:

The party can go 3 days without sleep, after which they lose any status buffs.

According to an an interview with Final Fantasy XV's director:

The way it works is, if you don't sleep for long periods, you don't get a negative status – rather it's the opposite. "Buffs" are statuses with positive effects, and you stop getting those. Basically, things like increased spirits or feeling good or other added bonuses stop getting applied if you don't sleep for long periods of time.

However, you can maximize your EXP gains by refraining from sleeping. If you rack up a ton of EXP and spend 30k to sleep in the nice hotel that gives you 3x EXP boost (it's in Altissia, talk to the receptionist on the right), you will be able to level up a lot more than if you sleep every night, as you probably can't afford to shell out 30k every night.
Past chapter 9, you can return to sleep in this hotel by talking to Umbra.
From personal experience, I've run for 2 in-game days straight (gotta max out Survival!) and fought every dropship along the way, as well as captured an outpost. I didn't notice any penalties during these fights.
Comment: @djechlin This is not remotely realistic.  After being sleep deprived for 3 days, you should risk decapitating yourself with melee weapons, not "no longer gets positive buffs".
Comment: glad to see FF games are finally getting realistic.
Comment: @Nelson The sarcasm passed about a mile above your head...
Comment: @Chris I found an explanation.
Comment: So if at 2 days 23 hours sleep I go to a diner and get some food it will expire an hour later? This sounds unlikely. It feels more likely that this is just related to the fact that food buffs are limited duration. Or are there other non-food buffs that you get that might require rest?
Comment: Excellent find with the status buffs. Do you know what kind of status buffs these refer to? For example, will Ignis's Enchant still work after staying awake for three days?
Comment: @Chris It definitely doesn't apply to food buffs. I've run around for a week straight and still got food buffs fine.
Answer: Apart from the occasional complaint of your crew there isn't really any penalty involved with being awake for several days.
Now this doesn't mean it's a good idea to stay awake forever since the only way to level up is sleeping.
After some time you will simply be too low of a level to fight certain enemies (especially enemies that can lock onto you with ranged attacks) and you might not be able to progress any further without the extra stats you'd get from leveling up.
Also If you decide to stay awake for longer during low levels there isn't really much to do during the nighttime apart from running away from high levelled monsters.
Sources: Haven't slept in 12 days.
Comment: "Sources: Haven't slept in 12 days." Are you referring to your FFXV party, or yourself? :)
Comment: Well, themselves obviously.


Check All Not Disabled

Question: Researching on here I found code that checks if a checkbox is disabled and I am attempting to implement it into my code with no luck.
HTML:
<input type="checkbox" name="file1" id="pdf1" class = "pdffiles" value="101SP01.dwg" disabled="disabled"/><button type = "button" class = "btn btn-primary btn-sm hidden-sm hidden-xs"> PDF</button>

<input type="checkbox" name="file2" id="pdf2" class = "pdffiles" value="101SP02.dwg" /><button type = "button" class = "btn btn-primary btn-sm hidden-sm hidden-xs"> PDF</button>

JQuery:
function pdf(source) {
  $('input[name=pdffiles]').each(function(){
    if(!$(this).attr('disabled'))
      checkboxes[i].checked = source.checked;
  };
};

When I click the checkbox that selects all, it still selects all. Here is the previously working code that selects all as well (before I made the above changes):
function pdf(source) {
  checkboxes = document.getElementsByClassName('pdffiles');
  for(var i=0, n=checkboxes.length;i<n;i++) {
    checkboxes[i].checked = source.checked;
  }
}

The goal is to check only the checkboxes that are not disabled.
Also, incase this helps, here is the checkbox that is clicked that runs the code:
<input type="checkbox" onClick="pdf(this)" class = "hidden-xs hidden-sm">

Oh and also, I have tried .prop instead of .attr
The Fiddle code provided below works perfectly! But I don't understand why it is not applying to my code:
function pdf(source) {
$('.pdffiles').not(':disabled').prop('checked', source.checked);

};
And I didn't change anything else..
Something else must be enabling the select all, but I cannot figure out what in the code I am editing.
I marked this question as answered because the code provided works perfectly. Something else in my own code is causing the select all. The code I am working on isn't my own but instead a co-workers, so I will have to try to work with him on getting figuring that part out I appreciate the help!
Answer: You can use .not() with disabled-selector to exclude the disabled elements, also note that pdffiles is a class not name
function pdf(source) {
    $('input.pdffiles').not(':disabled').prop('checked', source.checked);
};

Demo: Fiddle
Comment: Or similarly `.is(":enabled")`
Comment: That's weird, you're right, it is a class not a name. How is checking all then?
Comment: @Christine268 it is not actually working - http://jsfiddle.net/arunpjohny/y8greaq3/2/
Comment: It is though, when I click the checkbox to check all, all are checked. In my code I mean.
Comment: See edit for changes...the Fiddle code works but not when applied to my code. :(
Answer: for example:

$('.pdffiles').not(':disabled').prop('checked', true);

<input type="checkbox" name="file1" id="pdf1" class = "pdffiles" value="101SP01.dwg" disabled="disabled"/><button type = "button" class = "btn btn-primary btn-sm hidden-sm hidden-xs"> PDF</button>

<input type="checkbox" name="file2" id="pdf2" class = "pdffiles" value="101SP02.dwg" /><button type = "button" class = "btn btn-primary btn-sm hidden-sm hidden-xs"> PDF</button>

Check All Not Disabled


How to call a function from another window in WPF

Question: assume I have 2 windows first being managestock and second being add design so the code of managestock loads a list from my sql server
here is the code of what I tried code for managestock-
using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows;
using System.Windows.Controls;

namespace Test_app
{
    public partial class ManageStock : Window
    {

        DBAccess dBAccess = new DBAccess();
        DataTable dt = new DataTable();

        public ManageStock()
        {

            InitializeComponent();
            Clearlist();
            LoadList();
        }

        public void Clearlist()
        {
            dt.Clear();
            lstBox.ItemsSource = null;
            lstBox.Items.Clear();
        }
        public void LoadList()
        {
            Clearlist();
            string query = "select * from DesignTB";
            dBAccess.readDatathroughAdapter(query, dt);
            lstBox.ItemsSource = dt.DefaultView;
            dBAccess.closeConn();
        }

Code for add Design-
private void Upload(object sender, RoutedEventArgs e)
        {
            try
            {

                int dsCode = Convert.ToInt32(Name_txt.Text);
                byte[] images = null;
                FileStream stream = new FileStream(imglocation, FileMode.Open, FileAccess.Read);
                BinaryReader brs = new BinaryReader(stream);
                images = brs.ReadBytes((int)stream.Length);
                SqlCommand insertCMD = new SqlCommand("insert into DesignTB(DesignCode,DesignIMG) values(@dsCode,@images)");
                insertCMD.Parameters.AddWithValue("@dsCode", dsCode);
                insertCMD.Parameters.AddWithValue("@images", images);
                int row = dBAccess.executeQuery(insertCMD);
                if (row == 1)
                {
                    ManageStock ms = new ManageStock();
                    ms.LoadList();
                    Close();
                }
            }
            catch (Exception)
            {

                MessageBox.Show("Unsuccessful");
            }
        }
    }
}

I would like to refresh the lstbox after the upload button is clicked how should I do it?
Comment: This really not how it works. You must use data binding and bind the ListBox to an the DataTable. When you bind the ListBox to a common data context of both windows the ListBox will update automatically. You must move the complete database and update logic and the data source to a separate class. Then create and instance of this class and assign the same instance to both DataContext properties of each window. Now each window can call the method of the *same* instance by referencing the DataContext.
Comment: Must? Technically, you don't absolutely have to use mvvm with Wpf. If you don't use mvvm then you are going to find people suggest you do so.
Comment: @Andy I'm not saying he must use MVVM. I'm not even mentioning MVVM. I said he must use data binding because he has to move the logic to the DataContext where he can't (shouldn't) directly reference the controls. Data binding is not MVVM.
Comment: You must operate on the same ManageStock instance that is already displaying. You can't create a new instance only to call a method. Usually you would wrap the db access into a dedicated globally shared class that exposes read and write API. This class naturally has full awareness of any changes that have been committed. Simply allow your ManageStock to observe this repository class for changes. That's the proper way. A "simpler" solution involves data binding as mentioned before where the database handling takes place in the same class that also exposes the data source for the DataGrid.
Answer: I don't know why it didn't call 'ms.Show()'
if (row == 1)
{
    ManageStock ms = new ManageStock();
    ms.LoadList();
    Close();
}

I don't know the exact situation, but my answer is this.
If the ManageStock window is already active
private void Upload(object sender, RoutedEventArgs e)
{
    // your code...

    // refresh all ManageStock Window
    foreach (Window window in Application.Current.Windows)
        if (window is ManageStock manageStock)
            manageStock.LoadList();
}

.NET Framework 4.7.2
Comment: You should understand that the original code is the result of a very bad class design. Analogous to the principle that a class must not know the internals of another class, one Window must not know the layout of another Window. The only reason why the second window is calling LoadList() on the ManageStock window is because it knows the details of the ManageStock window. A general solution is tolet the first window observe the ManageStock window for changes to allow it to update itself. In this particular scenario the recommended solution would be to observe the database for changes instead.
Comment: Regarding my downvote: your solution, apart from introducing more bad design (because it is based on the current bad design) is that it simply won't work. You can't create a random instance, call its methods and close it afterwards. Let aside that the Window can only show the updated list when it is visible, you must operate on the same instance that is already existing. Unless the modified variables are static class variables the changes are instance related. Your solution generally doesn't work.


Is there a test to see if unknown object is of a value type?

Question: The definition of Value Type I'm working with.
If I get an object member
class SampleClass{

    object SampleMember{ get; set; }
}

And set it in one function...
public SampleClass foo(SampleClass bar){

      bar.SampleMember = 6m;
      return bar;
}

And need to test it in another; the test needs to know if it's a reference type, or a value type (in this case; decimal).
public SampleClass blick(SampleClass spok){

    if( TestUtilities.IsAValueType(bar.SampleMember) )
    {
        DoBlickWorkOnSpok(spok)
    }
    return spok;
}

What sort of test can be done on spok to test if it's a value type?
Comment: @chomba Given the context, I don't think the OP is actually referring to built in types, but if he is, he should use that term, because if he did, then the question would be answerable as that is a well defined term.  What you linked to is in the *VB.NET* specs, and is specific to that language.  The types in that list will also differ from the built in types in C#, which is why using proper terminology is important; it changes the meaning.
Comment: @Servy Primitive Types aka Predefined types or built-in types, check this out : https://msdn.microsoft.com/en-us/library/aa711900%28v=vs.71%29.aspx
Comment: @Servy FWIW the language specification refers to `int` and `double` as primitive types in the introduction, but you're right that it isn't a formal definition.
Comment: Just as a FYI, apparently built-in types and primitive types are not the same have a look at this answer: ["Primitive types" versus "built-in value types"](http://stackoverflow.com/a/16589255/3052062)
Comment: Fair enough - I'll update the question to make it more clear. I was asking the wrong question. Sorry for that.
Answer: try:
bar.SampleMember.GetType().IsPrimitive
In your example you specifically mention "decimal" Microsoft doesn't define decimal as a primitive. If you also check whether it is specifically a decimal, in addition to IsPrimitive that may get you what you need:
bar.SampleMember.GetType().IsPrimitive || bar.SampleMember is decimal

Comment: Your definition of primitive seems to conflict with the OP's definition.  (Which is unsurprising, given that there are many different definitions of the term in general, and C# doesn't define one for the language.)
Comment: @dman2306 That's the CLR's definition of "is a primitive".  The OP doesn't seem to be looking for that, given his question.
Comment: @dman2306 You have no idea what he wants, because there are at least half a dozen different readings of the question.  Being fairly close but subtly off is very likely to be *worse* than not having an answer at all.  Having an incorrect answer that looks like it is correct is *actively harmful*.  Blindly guessing among many different options not only a waste of time, but is actively harmful.  The OP needs to clarify what he is actually asking for.  Just picking some random option out of a hat to answer isn't helping.
Comment: @Servy. I disagree. Given that the OP did not define "primitive" I believe using the definition provided by the CLR is appropriate. Words have meanings. If someone does not provide a specific definition they wish to use, then it is correct to use the standard definition. Just because you do not believe Microsoft's definition of primitive does not make their definition wrong. Calling this answer "actively harmful" seems inappropriate as well as StackOverflow is not just a Q&A forum, it is a learning and discussion forum. I bet there are people who read this and didn't know IsPrimitive existed.
Comment: @Servy Microsoft defines it as: "The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single." according to IsPrimitive. However, the OP does mention decimal. Decimal is not included in that list. I will update my answer
Comment: @Servy I will revise my answer if the OP clarifies. At this point though, I think this is going to be very close (if not exactly) what the OP wants based on my reading of the question.
Comment: Given that the OP didn't define primitive, and it can mean lots of different things in lots of different situations *we don't know what he means*.  You're taking the word that he used and *using it in an entirely different context*.  He could have meant the CLR's definition of a primitive, he could have meant VB's definition of a primitive, he could have meant a built in type, he could have meant a value type, he could have had his own definition separate from all of the others, etc.  And of course, as per the edit to the question, it turns out you *didn't* guess correctly in your blind guess.
Comment: I never said that MS's definition of the term is wrong.  MS itself has several definitions, and *none of them apply to the context of the question*.  MS has given certain words certain meanings *in particular contexts*.  Outside of those contexts, they don't apply.  Saying that your incorrect answer to a question is helpful because someone didn't know about some of the information in your incorrect answer is also a false argument.  If you want to inform people about the existence of `IsPrimitive` then do so in response to a question where that information is actually the correct answer.
Answer: There isn't any definition of primitive types in C#. All types inherit the System.Object and they are split into two categories, the reference types and the value types.  The

The above picture is taken from C#  Language Specification version 5.
Comment: Well, I wouldn't say that there's "no concept" of primitive types - the [.NET Framework](https://msdn.microsoft.com/en-us/library/system.type.isprimitive%28v=vs.110%29.aspx) itself identifies certain types as primitive - but there's not a single definition for "primitive" types specific to C# (`string` and `decimal` are not primitive types as defined by the framework).
Comment: @DStanley There is no *unified* or *clear* concept of a primitive type in that context.  There are lots of subtly or even radically different things that people mean when they use the term.  For the purposes of answering a question about it, "tons of wildly inconsistent concepts" is pretty darn close to "no concept".
Comment: @DStanley I agree with you. This was actually my intention saying that there isn't any concept of primitive types in `C#`. I didn't mention the .NET framework, because in this case there are certain primitive types. Furthermore, for the first time I tried to search in the C# language specification the term primitive and I didn't find anything. Thanks for your comment.
Comment: @Servy I agree, but I would still argue that "no definition" is much closer to the truth than "no concept".
Comment: @DStanley I changed the term "concept" to "definition", hoping to not causing any problem.
Answer: primitive types can be determined
as:
var p = 0;
 bool result = p.GetType().IsPrimitive
value types can be determined
as:
     var a = 0;
     bool x = a is System.ValueType;

//x = true in this case
also it is the compiler which defines its primitive types.
CLR only understands the types as either Value types or Reference types.
Comment: Why do you equate "primitive type" with value types? Would you consider some `struct ExtremelyComplicatedMess { /* 1000 properties go here */ }` a "primitive type"? Would the OP? Fact is, the OP hasn't stated (as of now) what he considers a primitive type (except that `decimal` is one of them), so this is really not much more than a guess in the dark.
Comment: @stakx Well, in the case of the question, he wants to know if it's "a primitive or a reference type", meaning one or the other; that only makes sense if by "primitive" he meant "value type".  But that's still a pretty shaky argument.  Fundamentally the question is unclear, and unfortunately people are choosing to throw darts at the dart board blindly rather than closing the unclear question as unclear.
Comment: @Servy: _"unfortunately people are choosing to throw darts at the dart board blindly rather than closing the unclear question as unclear"_. Well said. That's exactly what I intended to hint at with my above comment.
Comment: @stakx got your point about answering an incomplete question, and anyways my answers for *primitive type is incorrect. Will correct it
Comment: Even though the question wasn't clear I gave this the answer because he covered all the bases anyway and instead of squabbling over various possible meaning gave possible other avenues of reasonable answers to my poorly worded OP.


Updating an item in an array updates them all

Question: I'm working on an application using vuejs with vuex which uses projects, with each project having one or more jobs.
I can add, delete and update the jobs. The adding and deleting is working perfect, but the updating is not.
The state in the vuex dev tools:

My HTML:

                <input type="text" name="jobs[function][]" class="form-control" v-model="job.function" @change="updateJobValue(index, 'function', $event.target.value)"/>

                <input type="number" name="jobs[profiles][]" class="form-control" v-model="job.profiles" @change="updateJobValue(index, 'profiles', $event.target.value)"/>

            <button v-if="index == 0" class="btn btn-success btn-sm" @click="addJob"></button>
            <button v-if="index > 0" class="btn btn-danger btn-sm" @click="deleteJob(index);"></button>

As you can see, I have a v-for that is showing all my jobs. When editing a value inside my jobs, I use the @change event to update my value. And, at the bottom, I have two buttons to add and remove a job row.

My stores are divided into modules. The main store looks like this:
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const state = {};

const getters = {};

const mutations = {};

const actions = {};

//Separate Module States
import jobCreator from './modules/job-creator/store';

export default new Vuex.Store({
    modules: {
        jobCreator: jobCreator
    },
    state,
    actions,
    mutations,
    getters
});

The module store for this specific problem:
import store from './../../store'

const state = {
    project: {
        title: null,
        description: null,
        jobs: []
    },
    defaultJob: {
        function: '',
        title: '',
        description: '',
        profiles: 1,
        location_id: '',
        category_id: '',
        budget: '',
    },
};

const getters = {}

const mutations = {

    addJob(state, job) {
        state.project.jobs.push(job);
    },
    deleteJob(state, index) {
        state.project.jobs.splice(index, 1);
    },
    updateJobValue(state, params) {
        Object.assign(state.project.jobs[params.jobIndex], {
            [params.field]: params.value
        });
    }
};

const actions = {
    addJob: function (context) {
        context.commit('addJob', state.defaultJob);
    },
    deleteJob: function (context, index) {
        context.commit('deleteJob', index);
    },
    updateJobValue: function (context, params) {
        context.commit('updateJobValue', params);
    },
};

const module = {
    state,
    getters,
    mutations,
    actions
};

export default module;

The project state is mapped to a computed property of my vue instance:
computed: {
       ...mapState({
           project: state => state.jobCreator.project,
       }),
}

The problem is the following: In the image of the application, you can see that I entered "vin" in one of the fields, but all of the fields are updating.

So, all of the function fields of all the jobs have been updated to my last entry, instead of only the one I want.
What am I doing wrong?
PS:
I also tried the following in my mutation function:
updateJobValue(state, params) {
    var job = state.project.jobs[params.jobIndex];
    job[params.field] = params.value;

    Vue.set(state.project.jobs, params.jobIndex, job);
}

But it's giving me the same result.
UPDATE: As requested, I created a jsFiddle to show my problem
Comment: Could you possibly turn this into a jsfiddle? Since it is a rather long question it will be much easier for people to help you out that way.
Comment: I added a jsfiddle explaining my problem
Answer: The issue is in your addJob action:
addJob: function (context) {
    context.commit('addJob', state.defaultJob);
},

You are referencing the state.defaultJob object each time you add a new job. That means each item in the state.project.jobs array is referencing the same object.
You should create a copy of the object when passing it to the addJob mutation:
addJob: function (context) {
    context.commit('addJob', Object.assign({}, state.defaultJob));
},

Or, just pass in a new object with the default properties each time:
addJob: function (context) {
    context.commit('addJob', {
        function: '',
        title: '',
        description: '',
        profiles: 1,
        location_id: '',
        category_id: '',
        budget: '',
    });
},

Here's a working fiddle.
Here's a post explaining how variables are passed in Javascript: Javascript by reference vs. by value
Answer: I would give the following advice:
Use v-bind:value="job.function instead of v-model="job.function" because you want only a one way binding. This your code more predictable.
Add a v-key="job" to your  v-for="(job, index) in project.jobs" element just to be sure that the rendering works correctly.
The first two lines should be enought, the object is still reactive.
var job = state.project.jobs[params.jobIndex];
job[params.field] = params.value;

Vue.set(state.project.jobs, params.jobIndex, job);

PS: In my fiddle the @change did only fire when i hit enter or left the input.
Comment: I added a jsfiddle explaining my problem
Comment: Your problem is in the line `context.commit('addJob', state.defaultJob);`
your adding/referencing the same object all the time. Just change it to `context.commit('addJob', Vue.extend({},state.defaultJob))` and then your will get a new object for each line.


How do I protect paint on a steel outer door from scratching?

Question: I need to attach a plastic guard onto an outer steel door, to protect the paint from scratching by my dog (and visiting dogs...this is a rural setting).
Is there a glue that is clear that I can use?  Should I screw this onto the steel door?
Answer: I would avoid drilling into the door for a couple of reasons. It may void any warranty on the door and if the dog was able to get a corner or edge loose they may damage the door pulling at the plastic. Cut a piece of lexan or plexiglass large enough to cover the area of potential damage. It needs to be large enough so the dog cannot grab the top while on its' hind legs. If it is a large dog you may have to cut a hole to go around the door knob. If the door has a paneled design stamped into it drill several small holes in the bottom side of the Lexan. This will prevent condensation from forming between it and the door. I would then adhere it to the door with clear exterior chaulking applied around the entire perimeter of the panel. It may help to lightly sand the Lexan where the adhesive will be to get a better bond. Position it in place with clamps or duct tape until the chaulking has set.
Comment: Won't you see the caulk through the lexan?  Not even clear caulk is invisible. Also if you sand the lexan, you'll see that too.
Answer: Training and deterrents
Teach your dogs not to scratch. They make sprays and other products to deter dogs from scratching/digging at stuff, apply some of that to the door to deter other dogs from scratching.

Active ingredients: sodium lauryl sulfate 0.6%, garlic oil 0.4% and
clove oil 0.4%
Inactive ingredients: citrus pectin, hydrogenated
vegetable oil and water

These products usually contain extracts of stinky things dogs don't like, to prevent dogs from scratching/digging in treated areas.
If you see the dog scratching, correct the behavior. Be consistent, and don't get frustrated, it may take some time to un-teach this behavior.
Why do dogs scratch?
Dogs mark things in many ways.  The most obvious and well known method is to pee on something, but they also mark using glands in their feet.  If you've ever seen a dog poop, and then do the "poop dance". they're not trying to bury the poop, they are marking.  If your dogs are scratching at the door, they are also leaving scent markers that other dogs can smell. When other dogs encounter these markers, they may try to re-mark the area.  The sprays mentioned above may also cover the marking scent left by your dogs, which could prevent other dogs from trying to re-mark the door.


How to un-enrage a wave in GemCraft: Chasing Shadows?

Question: I accidentally enraged a wave that I didn't want to enrage. Is there any way to undo this?
Answer: From Steam v.1.0.4 release notes:

New features/changes:

Press delete over a wave stone to remove enraging

So, to un-enrage a wave, press Delete with mouse over the wave stone you want to un-enrage. This will erase all gems bombs dropped on that wave stone. The mana you spent on enraging the wave will not be restored.


How does Aion differentiate itself from Everquest?

Question: Is Aion another Everquest clone?
Comment: I think the title should be swapped with the body. The body asks an answerable, objective question. The current title is rather subjective and presents itself as argumentative.
Comment: @hobodave - You make sense.
Answer: Although I haven't played recently, I played for several months after the initial release.  Aion does have some features that set it apart:

Flight: all characters can "fly" from an early level.  In many places, you are only allowed to glide, and your flight time is limited (and can be increased with equipment and potions). This can still make getting around much faster, or at least more entertaining.  No mounts are required, but there are "wing" upgrades that get pretty pricey.
Flying combat: you can fight in the air, and attack others from ground or sky.  This gets interesting when you take into account limited flight time - not only do you have to try and win the fight, but you may have to pop potions or maneuver to avoid falling to your death when your wings get tired.
Crafting system: the addition of NPC work-orders allows you to trade money and craft time for leveling up, and there is always a work-order recipe available for your current level.  This avoids the problem of having to find a new recipe and adequate ingredients every time a certain craft skill goes up a few levels.  The system also allows any player to reach very high levels in all crafting skills, if they're persistent enough and willing to spend the money.  There is also an interesting mechanic that causes random craft attempts to create improved items (but crafting can also fail, depending on skill level).  The main downside of the crafting system is that it's very grindy.  If you want to max a skill, prepare to spend a lot of time and money.

One of the strongest aspects of Aion is the PvP gameplay.  Some things worth mentioning on that topic:

Fighting in the air, as described above.
A large, 3-level, dedicated PvP zone, essentially a bunch of floating rocks in space.
In the PvP zone, there are several fortresses (on each level) that become attackable at semi-random times.  The two player factions can own fortresses, and a third, NPC faction (that swoops in in a giant spaceship) will sometimes attack as well.  Attacking the fortress involves coordinated groups capturing artifacts that bestow advantages, breaking down fortress defenses and killing NPC defenders, and finally defeating a powerful boss to complete the capture.  The faction that captures a fortress gets to use the NPCs there and the dungeon.  When I was playing, there were some lag problems due to the quantity of players participating, but this may have improved since then.  Even with the lag, it was still a lot of fun.
A PvP currency used for buying PvP equipment and consumables.  This can be gained from defeating enemy players (anywhere) and completing quests and killing monsters in the PvP zone.
Portals: Each faction has several zones geared more toward PvE and leveling, and these are mostly separated.  However, portals appear randomly, but pretty frequently, and these allow players to cross over to the enemy zones and attack.  There are a few quests that specifically require the player to go through portals and mess around with the opposing side.  Personally, I found this mechanic more interesting than just having shared zones where the factions clash (although that is also present in the PvP zone.

Overall, Aion had some interesting features, and I felt like it did stand out from the crowd more than most games.  Castle defense/capture is a great mechanic, and I had missed it from my days playing Ragnarok Online.
What ultimately caused me to stop playing was the level grind.  Like many (most?) games originally from Asia, grinding monsters is the main activity, and leveling is pretty slow.  There are quests, but the effort to reward ratios get pretty unimpressive as you get closer to the level cap.  The PvP zone was fun, but not fast leveling.  Organized dungeon raids may be the way to go, I never really got into that while I was playing.  I have also seen announcements that say the exp grind has been improved, so my info may be out of date.
Comment: This is the kind of answer I've been looking for. I think I'll have to pass though. I am generally a casual player so I'll be torn to pieces in PVP and if I have to grind I'll pretty much stop playing. Thanks.
Comment: Flying is only possible in 5% of the world and in the shared pvp region. It's just a thing to attract more people until they see that crafting takes all their money and transforms weeks of effort into nothing.


Covariant derivative of a constant vector field

Question: I am trying to figure out that if $X$ is locally constant, i.e. in some coordinate system, the coefficient function is a constant function, then whether the covariant derivative of $X$ is 0. In $\mathbb R^n$ I guess this is true. But what about the general case, how can I derive this from the properties of covariant derivative?
Answer: This is certainly not true - in fact, for any non-vanishing vector field $X$ there is a coordinate system $x^i$ in which $X = \partial/\partial x^1$. Remember the coordinate formula for the covariant derivative is $$\nabla_i X^j = \partial_i X^j + \Gamma_{ik}^j X^k,$$ so the equivalence of $X$ being parallel (zero covariant derivative) and having constant components holds only when the Christoffel symbols vanish. This is true only in flat spaces, and even then only in particular coordinates.
Comment: @AlexM. You can interpret it as a genuine coordinate formula so long as you read $\nabla_i X^j$ as $(\nabla_i X)^j$.
Comment: I believe that this is written in abstract index notation, right? $X^j$ is not the $j$-th coordinate of  $X$, but rather stands for the field $X$ with an abstract index $j$, right? Otherwise I don't see how that could be true.


Why is the coproduct denoted by "plus" and the product denoted by "times"?

Question: I found out today on Internet about the notions of products and coproducts. I was wondering why the product was written with the "times" sign and the coproduct was written with the "plus" sign. Please explain simply because I just started reading about this stuff and I basically know nothing yet.
Answer: One explanation:

The product in the category of sets is the cartesian product. And $|A\times B| = |A| \times |B|$.

Indeed, this is why $\times$ is a good notation for the cartestian product of sets!

The coproduct in the category of sets is the disjoint union. And $|A\sqcup B| = |A| + |B|$.

This suggests that $+$ would be a very good notation for disjoint union of sets. But it's more common to write $\sqcup$ in analogy with the usual union symbol $\cup$. Actually, it's also quite common in category theory to see the notation $\sqcup$ for coproducts in arbitrary categories, borrowed from the notation in the category of sets.


Does "old" rsh exist in Ubuntu?

Question: I wanted to try out rsh (or rshell?) - the old, insecure way of logging in remotely.
On my Ubuntu 11.04, it turns out an rsh command exists:
$ which rsh
/usr/bin/rsh

... however, it turns out it is a mere symlink for ssh:
$ ls -la `which rsh`
lrwxrwxrwx 1 root root 21 2011-03-25 16:07 /usr/bin/rsh -> /etc/alternatives/rsh

$ ls -la $(readlink -f `which rsh`)
-rwxr-xr-x 1 root root 391580 2011-04-02 12:16 /usr/bin/ssh

Does this "old" rsh exist in Ubuntu repositories - and if so, how do I install it? Also, is rsh also split in client and server packages - and if so, which packages are those?
Comment: The package `rsh-client` looks promising
Comment: Many thanks, @GeraldSchneider - indeed, just installed it, and now `rsh` is not ssh anymore; and there is a `rsh-server` package too... Could you post this as an answer so I can accept it?
Answer: There are two versions. Classic rsh-{server,client} and the newer rsh-redone-{server,client} (which still has no encryption but has support for things like IPv6).
$ apt-cache show ^rsh  # output is trimmed

Package: rsh-server
Description-en: server program for remote shell connections
 This package contains rexecd, rlogind and rshd.

Package: rsh-client
Description-en: client programs for remote shell connections
 This package contains rsh, rcp and rlogin.

Package: rsh-redone-client
Description-en: Reimplementation of rsh and rlogin
 Rsh-redone is a reimplementation of the remote shell clients and servers.
 It is written from the ground up to avoid the bugs found in the standard
 clients and servers. It also fully supports IPv6.
 .
 This package provides rsh and rlogin.

Package: rsh-redone-server
Description-en: Reimplementation of rshd and rlogind
 Rsh-redone is a reimplementation of the remote shell clients and servers.
 It is written from the ground up to avoid the bugs found in the standard
 clients and servers. It also fully supports IPv6.
 .
 This package provides rshd and rlogind.

Comment: Many thanks for that @Oli - would never have guessed there are two implementations of `rsh`; great to know this. Cheers!
Answer: You can install the package rsh-client.
Installing it should change the symlink to the newly installed rsh file, if not you can change it using update-alternatives.
Comment: Check also the answer by [@Oli](http://askubuntu.com/a/338319/6808) for the alternative "redone" implementation of `rsh`.
Answer: Please try to install the following packages:
rsh-client - client programs for remote shell connections
rsh-server - server program for remote shell connections
Thomas
Comment: Many thanks for that \@tpf - @GeraldSchneider was faster in this case; cheers!
Answer: Look at the packages rsh-redone-client and rsh-redone-server.
They do the job.

Does "old" rsh exist in Ubuntu?


How to provide saas customer with server snapshot for business continuity concerns

Question: I'm proposing a SaaS solution to a prospective client to avoid the need for local installation and upgrades. The client uploads their input data as needed and downloads the outputs, so data backup and maintenance is not an issue, but continuity of the online software service is a concern for them.
Code escrow would appear to be overkill here and probably of little value. I was wondering is there an option along the lines of providing a snapshot image of a cloud server that includes a working version of the app, and for that to be in the client's possession for use in an emergency where they can no longer access the software.
This would need to be as close to a point and click solution as possible - say a one page document with a few steps that a non web savvy IT person can follow - for starting up the backup server image and being able to use the app. If I were to create a private AWS EBS snapshot / AMI that includes a working version of the application, and they created an AWS account for themselves, might they be able to kick that off easily enough?
Update:the app is on heroku at the moment so hopefully it'd be pretty straightforward to get it running in amazon EC2.
Comment: You can create an AMI and share it with other accounts. Using that AMI, they should be able to launch it immediately. They will not be able to download or transfer it off of aws, at least not very easily.
Comment: That sounds absolutely perfect. Time to port to EC2 and test out the process, thanks
Answer: Host their app at any major PAAS providers, such as EngineYard or Heroku.  Check their code into a private Github repository that you can assign them as the owner.  That way they have access to the source code and can create a new instance quickly using the repository as the source.
I don't see the need to create an entire service mirror for a Rails app, unless there are specific configuration needs that can't be contained in the project or handled through capistrano.
Comment: The client isn't a tech co so a git repo wouldn't be much use to them and I'd prefer not to give them up front access to the source code.


Will my upgrades be available when I replay missions?

Question: I've been saving up all my credits. I'm at level 23 now and I'm going to replay all the missions to get the achievements. Will the upgrades I buy now apply to the missions I replay? Will any of them? Some of them? How doe sit work?
Comment: The only reason to do this is to get all of the upgrade achievements in one go. (Save, buy all of one category, load, buy all of another category, etc.)
Comment: Uhh, even if that did work, why save up?  It's not like you're earning interest, and the upgrades aren't getting any cheaper...
Comment: Yes, the easiest way to get all the armory and mercenary achievements are to play through quickly on casual and don't spend any of your credits until you're ready to farm the achievements.
Comment: @BlueRaja: You might save up credits to burn them on the later-game units.  Whether or not that's a good idea...
Answer: When you replay a mission you only have the upgrades you had the first time you played through
As @Raven pointed out in the comments in the branching missions if you replay the other path you'll have all the current upgrades.  When I finally got around to playing Safe Haven I had battlecruisers already.
Comment: This is not completely correct -- I think that you might be able to use ALL upgrades if your replay the "either or" mission that you skipped when you first had to make the choice. But generally, Davy8 is correct.
Comment: So I shot myself in the foot? Awesome.
Comment: Yes, I forgot about that part but you are correct.
Comment: Yeah... I just played one of those, and it was so easy :)


Laravel: Error in sending Mail using gmail

Question: My system submits a form which contains data that will be sent through the controller:
<code>Mail::to( $requests->input('email') )->send( new ResultMail($requests));
</code>
This error shows up whenever I try to submit my form data. I've double checked my user credentials in .env and they are correct.
Comment: Check out https://stackoverflow.com/questions/31091096/push-notification-crypto-error
Comment: Don't hide error details as image links. Provide them as copyable, searchable text.
Answer: This problem is caused due to a bad configuration of SSL in your server. Make sure curl is installed on it and that .crt file exists.


What are the benefits of rallying all workers to the left or right-most mineral node?

Question: I see a lot of SC2 pros rallying all their workers to the left or right-most mineral patch.
What are the benefits of doing so versus rallying to the middle patch or versus changing your rally point during the game?
Thank you.
Answer: It's not really about left or right. At the start of the game, it's about efficiency based on the distance to the nexus / hatchery / command center. If you look closely, you can see some minerals are closer to the nexus than others. For example in the screenshot below:

The bottom-most mineral patch is closer to the nexus than the second-to-the-bottom patch. You will yield a slightly better income having a worker on the closer patch than the further one. So, rally to a close patch.
Furthermore, you can micro your workers to pair up on close patches instead of spreading out 1-worker-per-patch including the far patches. Basically, select a worker that you know is going to mine on a far mineral patch, and manually right-click him on a close mineral patch. If the close patch is occupied, just spam click it until he starts mining.
It's slightly advantageous to set your rally point to unoccupied mineral patches. The way sc2 works, when your worker spawns, he moves to the rally point, then starts mining. If the rally point is set on an occupied mineral patch, the worker will then move away to find a vacant patch. If you set the rally point to a patch that's already vacant, it will save the worker time having to search for one. As your minerals become saturated, you will have to start being more clever because there will be no vacant patches. You can try to set the rally point to a patch where you see a worker is just about done mining.
Later, as all your close mineral patches are saturated, it is slightly better to rally to the middle patch of the mineral field. For example, imagine rallying to the top-most patch. A new probe spawns, moves to the top mineral patch, but it's already saturated. The probe will then move to a free patch - potentially all the way across the mineral field. If you rallied to the middle patch, newly spawned probes will travel a maximum of half the size of the mineral field.
These types of advantages are extraordinarily minute, and the only time most people even think about it is when there's literally nothing else to do in the game, at the very start usually.
Personally I sometimes do these kinds of things because it gets my brain primed to find every possible advantage. Just don't let it take anything away from the important decisions of the game. For example, if you try to micro a worker to a close patch on the first return trip of the game, it can cause you to be late making your 2nd worker.
Comment: I just tested this, and found that mining from a close patch vs. a far patch yields an extra 5 minerals per minute per worker. But the effort it takes to mine the close patches and the lost mining time to micro your workers there actually reduces this to almost no gain at all. I end up with about an extra 5-10 minerals during the first minute of the game by doing my best worker micro (versus doing no micro and no worker split at all). This already-tiny benefit then reduces further as mining saturates.
Answer: "Worker splitting" can slightly improve your economy, though the debate continues about whether it's enough to make it worth it.
l46kok explains the most common method in his TeamLiquid forum post "Worker Splitting & Improving Mining Efficiency." This method ensures your workers start mining as quickly as possible without moving to another mineral patch.

Thereafter, a worker rally point is often set to the closest mineral patch.


Additional type in template deduction guide

Question: This snippet demonstrates how to use deduction guides to allow source_location::current together with parameter packs (see https://stackoverflow.com/a/57548488/1421332):
template <typename... Params>
struct Test
{
   Test(Params&&... params,
        const std::source_location& loc = std::source_location::current());
};

template <typename ...Params>
Test(Params&&...) -> Test<Params...>;

Which is used like this:
Test(5, 'A', 3.14f, "foo");

Now I want to extend the struct Test by an additional Type T that shall be specified explicitly. I tried the following but the deduction guide is not accepted:
template <typename T, typename... Params>
struct Test
{
    Test(Params&&... params,
         const std::source_location& loc = std::source_location::current());
};

template <typename T, typename ...Params>
Test(Params&&...) -> Test<T, Params...>;

Compiler says:

deduction guide template contains a template parameter that cannot be
  deduced.

I need the additional T to allow struct Test to internally build an object of a user specified type.
It should be used like this:
Test<MyType>(5, 'A', 3.14f, "foo");

Is it possible to define a deduction guide including the additional T?
Answer: You cannot do it in this syntax:
Test<MyType>(5, 'A', 3.14f, "foo");

Because there is no such thing as "partial" class template argument deduction. It's all or nothing - you either specify all the class template parameters or none of the class template parameters.
However, you can just move the type over:
template <typename T> struct type_t {};
template <typename T> inline type_t<T> type{};

Test(type<MyType>, 5, 'A', 3.14f, "foo");

And now you deduced the type. You can even write the deduction guide to require this usage:
template <typename T, typename ...Params>
Test(type_t<T>, Params&&...) -> Test<T, Params...>;

Although Test's constructor still needs to take a type_t<T> argument first.
Comment: Since C++20 one can use `std::type_identity` so instead of your own `type_t` one can use `std::type_identity` and then instead of sending `type` send `std::type_identity{}`.


Power BI: Merge Rows Where Column Values Match

Question: I want to merge the rows of my table whenever the column values match. For instance, here is the table currently:
Commodity | Region | Unit  | 2007   | 2008  | 2009
 Corn |        US  |    $  |    10  | null  | null
 Corn |        US  |    $  |  null  | 20    | null
 Corn |        US  |    $  |  null  | null  | 30

I want it to look like:
 Corn |        US  |    $    |  10  | 20  | 30

I have found a resource online saying to first select columns Commodity, Region, Unit and unpivot the others, then to pivot the newly created attribute column and select the value column for my values. However, that just results in the same table as before.
Comment: Did this answer work for you? If so, please accept it so we can mark as solved
Answer: One way in powerquery. Assumes that the grouping are on Commodity/Region/Unit and that the number of columns after that is dynamic
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
base = {"Commodity", "Region", "Unit"},
#"Grouped Rows" = Table.Group(Source,base, {{"data", each
    let #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(_, base, "Attribute", "Value")
    in Table.Pivot(#"Unpivoted Other Columns", List.Distinct(#"Unpivoted Other Columns"[Attribute]), "Attribute", "Value")
    , type table }}),
Columns=List.Difference(Table.ColumnNames(Source),base),
#"Expanded data" = Table.ExpandTableColumn(#"Grouped Rows", "data", Columns,Columns)
in #"Expanded data"


Scroll Images in a scrollview Android

Question: Hello I am relatively new to android developing. What I am trying to do is create a scroll view where I can scroll through multiples images vertically how do I do that? I tried searching for it but I cannot seem to find a solution for it? should I add multiple image view in a scroll view is that possible? if so how?
please help.
Answer: Use GridView for that
GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a ListAdapter.
Take and try this Example
or
Create the RelativeLayout  inside the ScrollView and add multiple imageview inside the Realtive layout..
Comment: Thank you I'll try this example and update you with where I have come!
Answer: First of all if you want to scroll through multiples images vertically then you can use the List View OR Grid view in Android.Both scrolls Vertically.If you want to achieve it through scroll View you can do that by using layout weights to your images or assigning fix height to your images i.e you need to do extra efforts.So better to use List View. You can use the below link for the demo of list view : -
<code>http://www.mkyong.com/android/android-listview-example/
</code>
Comment: Thank you I tried the horizontal scroll view and it seemed to work for me. the problem in vertical scroll view is that it doesn't scroll to the next image it just shows one image. I have no idea why! because the same method works fine for horizontal scroll view!

Scroll Images in a scrollview Android


OPCUA: How to call nested method

Question: I'm tryng to call "Select" method using OPCUA Foundation libraries.

and this is how I call it
 NodeId node = new NodeId("ns=2;s=/Methods/Filehandling");
 NodeId method = new NodeId("ns=2;s=/Methods/Filehandling/Select");
 object[] arguments = new object[2];

 arguments[0] = new NodeId($"ns=2;s={filePath}");
 arguments[1] = channel;

 var callResult = this.OpcUaBaseDriver.Session.Call(node, method, arguments);

The execution raise the exception
BadNodeIdUnknown

I'm able to call methods like "GiveUserAccess" or "GetUserAccessRights" that are not listed within "Filehandling" folder in this way
NodeId node = new NodeId("ns=2;s=/Methods");
NodeId method = new NodeId("ns=2;s=/Methods/GiveUserAccess");
object[] arguments = new object[2];

arguments[0] = userName;
arguments[1] = accessRight;

var callResult = this.OpcUaBaseDriver.Session.Call(node, method, arguments);

It looks like the problem is the nesting level of Select method within Methods folder.
Ideas?
Comment: I suspect the nesting problem because a wrong file path will give a BadInvalidArgumentException (based on the documentation..)
Comment: _"It looks like the problem is the nesting level of Select method within Methods folder."_ I'd rather suspect `arguments[0] = new NodeId($"ns=2;s={filePath}");` to be incorrect. But I have no idea how you could verify or falsify that suspicion. What is the vaue of `filePath`? Does it actually exist? Is argument[0] of that method actually supposed to be a NodeId?
Comment: filePath is the correct file path to select, it exists within the CNC.  In the documentation that argument is supposed to be a NodeId.  I copied from the NodeId propriety I found using UAExpert
Comment: Valid point. Have you been trying out different combinations. For example "s=/Methods" as node and "s=/Methods/Filehandling/Select" as method? Maybe there's also an example in the docs?
Comment: Yes, I tryed almost every combination without any luck.  The documentation, as example, refer using their own app not using a c# application
Answer: For this method, you should provide the Node ID of the program you want to select, not the Node ID of the Method's folder...
Try something like
NodeId node = new NodeId("ns=2;s=/FileSystem/Part Program/NC_PROG1.MPF");

Comment: Nope, I tryed but it doesn't work
Comment: Are you sure about the node Id ? Look for one Program Under FileSystem/Part Program/ and verify the NodeId is correct.
Comment: What you are suggesting is right when you want to delete a file or create a folder, but to call that method I had to use the Method's parent folder as NodeId and the Method's nodeid as MethodId,  If I use the solution you suggest I keep on get the exception BadNodeIdUnknown.
Comment: "The "Select" method is provided under "Methods > Filehandling" in the address space, which allows the selecting of a part program from the NC file system. You can call this method and select the file to be executed by providing the node identifier of the file in address space and the channel number."
Comment: Can you upload a screenshot of the NodeID of any program file (*.mpf) ?
Comment: BTW what is the value of {filePath} ?
Comment: How can I upload a screenshot in comments?  filePath value is "Sinumerik/FileSystem/Sub Program/CAMBIO_PALLET.MPF", and it exist within the NC

OPCUA: How to call nested method


How to prove $ \prod_{d|n} d= n^{\frac{\tau (n)}{2}}$

Question: how to prove:
$$ \prod_{d|n} d= n^{\frac{\tau (n)}{2}}$$
$\prod_{d|n} d$ is product of all of distinct positive divisor of $n$,
$\tau (n)$ is number (count)of all of positive divisor of $n$
Comment: Maybe to take $\log$ ?
Comment: @agustin The title of your post is "all latex" which disables the option "open the link in new tab." So I edited it.
Answer: Hint: If $k$ divides $n$, then $\frac {n}{k}$ is an integer that divides $n$.
This allows you to pair up the divisors, to show that $$(\prod_{d \mid n} d )^2 = \prod_{d \mid n} n = n^{\tau(n)}.$$

Elaborated:
$$(\prod_{d \mid n} d )^2 = (\prod_{d \mid n} d ) ( \prod_{d \mid n} \frac {n}{d} ) = \prod_{d \mid n} d \times \frac {n}{d} = \prod_{d \mid n} n = n^{\tau(n)}.$$
Comment: I think element of the product must be distinc
Comment: @agustin Yes they are. Read my updated answer for how to do the pairing.
Comment: Where have you shown that the elements are distinct? @CalvinLin
Answer: Note that positive divisors of $n$ go in pairs, as if $d$ is such a divisor, so is $n/d$.
However, some care must be taken when $n = k^2$ is a perfect square, because you have only one factor $k$ in the product. In this case
$$
\prod_{d \mid n, d \ne k} = n^{\frac{\tau(n)-1}{2}}.
$$
Now multiply both sides by $k = n^{1/2}$.
Answer: suppose $\tau(n)=r (I)$,$d_1,...,d_r$ is all of distinc positive divisor $n$
$d_i|n$ thus $\frac n{d_i}|n$ so {$\frac n{d_1},...,\frac n{d_r}$}$\subset${$d_1,...,d_r$}
also we have: $d_i=\frac n{\frac n{d_i}}=\frac n{d_j}$ so
{$\frac n{d_1},...,\frac n{d_r}$}$=${$d_1,...,d_r$}
$$\prod_{d|n} d =d_1...d_r=\frac n{d_1}.....\frac n{d_r}$$ so $n^r=(d_1...d_r)^2$
$n^{\frac r2}=\prod_{d|n} d =d_1...d_r=n^{\frac {\tau(n)}2}$
Answer: Note that for each divisor $d$ of $n$ there is divisor $d'=n/d$ such that $dd'=n$.
The result then follows at once if $n$ is not a square.
I'll leave this case for the reader. :-)


A question about Linked List

Question: Im copying an array of objects to the linked list  from a student class that i already made, but in the 5th line , the following error is showing : (" cannot find symbol - class E ")
Why is that?
import java.util.*;

public class StudentLinkedList
{

    private List<E[]> studentLL = new LinkedList<E[]>();

    public StudentLinkedList(Student[] st)
    {
        for(int i = 0; i < st.length; i++)
        {
            studentLL.add(st[i]);
        }

    }
}

Comment: we couldn't find that symbol either...
Comment: What is E supposed to be?  Is it a generic, or a class you have already defined?
Comment: @WM: Do you really want a List that contains Arrays that contain Students?
Comment: @Jason : yea im trying to do that but im not that familiar with the concept...
Answer: You probably wanted to write:
private List<Student> studentLL = new LinkedList<Student>();

instead.
When declaring such a field, you specify the type of the elements of a list. The type you have specified is E, but the compiler doesn't know anything called that.
Comment: yea this worked but now the method add(st[i]);  is the problem.. should i cast it.. ?
Answer: Try changing the LinkedList instanciator to private List<Student> studentLL= new LinkedList<Student>();
Comment: yea this worked but now the method add(st[i]); is the problem.. should i cast it.. ?

A question about Linked List


Mix SSL certificates

Question: I'd like to have a SSL certificate for domainA that load images from domainB (I load them from another cookieless domain to improve page speed). I know that all elements coming from domainB should be over SSL, but do i need to secure this second domain with a certificate coming from the same provider? I mean, could I mix a page with a ie verisign certificate with images coming over SSL from another domain with a different - and cheaper - certificate?
Answer: Yes, it will work and show no error in the browser. It's the same if you for example include Google Fonts (via e.g. https://fonts.googleapis.com) or Bing Maps using their SSL certificates. There shouldn't be a problem.
Comment: Of course! I'm embarrassed for having asked this dumb question :)
Comment: @Sergi Never be embarrassed for asking :) Your question has now helped archived the answer for other curious people. It's the whole point of Stack Overflow!
Comment: I think it's actually a very good question! Is it fair to say that only the quality of the certificate of the initial request (fetching the HTML page itself) is what determines the certificate quality that the browser displays to users (green or grey URL bar)?
Comment: What happens if the main domain's certificate is EV (Green) and the cookieless domain certificate is not EV? Will the green status appear in the browser?

Mix SSL certificates


Why do files created by Mousepad or Leafpad not have extensions by default?

Question: Normally, every text document has an extension. With LibreOffice Writer, the extension could be .odt or .doc, etc depending on your preference but mousepad and leafpad don't provide extensions automatically. I do not mind that, but I do not understand why those files do not have an extension. Why is that?
Comment: You write "Normally, every text document has an extension" but that isn't strictly true. See https://unix.stackexchange.com/a/267250/61798
Comment: Normally in Windows, but there are many examples of files without any extension in Linux.
Comment: Possible duplicate: https://askubuntu.com/questions/803434/do-file-extensions-have-any-purpose-for-the-operating-system
Answer: With LibreOffice Writer you are creating an Open Document (word document) file, so by default it suggests odt extension because it knows what the file is supposed to be.
With leafpad, ,mousepad, gedit, and any other text editors the options are endlessness.
The file can be a simple text file or anything else. it can be a PHP, Perl or Python script, it can be an HTML or XML markup language, JSON file, config file or anything else that you can think of.
So it doesn't use any extension by default. That is up to you to choose the one which best suits you.


Using git / folder owned by root

Question: I decided to switch to Kubuntu from Windows.
I was setting up XAMPP which installs in /opt/lampp/.
Now I want to set up my work environment for a project I'm working on but git doesn't have permission to access root.
When I try to assign a folder (/opt/lampp/htdocs/project-sbc/) it says the following:
Git: fatal: could not create work tree dir '/opt/lampp/project-sbc':
Permission denied

How can I fix this?
Answer: The simple solution is to execute git clone command in your /home directory, in a location which is owned by you.
e.g. in a sub-folder dev-projects in your /home/username folder.
If from some reasons, the content of the git repository should be located in /opt/lampp/project-sbc then you should execute the git clone command as root, using the sudo command:
sudo git ...... (your git command)

Also as mentioned in the comment:
The user can change the owner of the folder from root to himself.
sudo chown username /opt/lampp

Follow with git command in that folder
git clone .....

Comment: @user535733 Thanks for the commet!
Comment: chown: changing ownership of '...': Operation not permitted
Comment: @jtlz2 please add the original command you enter before you got the error

Using git / folder owned by root


C# ignore WCF contract mismatch for backward compatability?

Question: The problem is this:
<code>[DataContract]
public class StatusA : StatusBase {}
[DataContract]
public class StatusB : StatusBase {}

[DataContract]
[KnownType(typeof(StatusA))]
[KnownType(typeof(StatusB))]
public class StatusBase {}
</code>
If I provide this API to end user - all will be fine, but then, later, I add new status:
<code>[DataContract]
public class StatusC : StatusBase {}

[DataContract]
[KnownType(typeof(StatusA))]
[KnownType(typeof(StatusB))]
[KnownType(typeof(StatusC))]
public class StatusBase {}
</code>
And then if end-user stumble in this particular instance - he will catch contract mismatch exception, which in this particular case I want to be ignored just like JSON do when deserializing something unknowable (just fills whatever it can). For example, for paging methods like this, it is critical:
<code>List<StatusBase> GetStatuses(int offset, int count);
</code>
So, my options is to wrap it up into byte[] and then manually deserialize it (which will bring a lot of partial duplicated classes) or somehow to tell WCF dispatcher to try soft-deserialize this.
What are my options? Can this be done?
Comment: if you want micky-mouse serialization, use json, datacontracts will break for various reasons, because they are a contract...  there isn't really much you can do about it.. this might help though https://learn.microsoft.com/en-us/dotnet/framework/wcf/best-practices-data-contract-versioning
Answer: How about avoiding the need for selective serialization altogether by loading the Known Types dynamically using this little trick:
<code>[KnownType("GetKnownTypes")]
public class StatusBase
{
        private static Type[] GetKnownTypes()
        {
            var types = new List<Type>();

            //add all your types here using reflection.
            return types.ToArray();
        }
}
</code>
Comment: And how it negatiate client error about contract mismatch?
Comment: Which contract mismatch? You won't get contract mismatch if you're telling WCF all known types. All you've to do is load all types from a particular location so the new contracts get loaded automatically.  Should I know the reason for down vote?
Comment: "Backward compatability" in title of question and question itself is the reason for downvote. Client don't have type at all (not even close have it, literally, it doesn't exist in client dll) but server do have it and some of clients which updating every day probably have it too, what it means? - contract mismatch, and your code sample won't help here.
Comment: You didn't mention if the clients have no access to your new types. My solution only works if somehow your clients have access to the new types. In your case it is not advisable to create new sub types as you cannot pass them through known types way. Check out 13th point in [this](https://learn.microsoft.com/en-us/dotnet/framework/wcf/best-practices-data-contract-versioning) guideline by Microsoft. You need to re-design your service versioning mechanism.
Comment: What else I need to mention? How is this exception ever occurs in my examples above if not when user doesn't have access to new type set? If user have new type set - both of my examples will work and no exception will occur. As to proposal of redesign - this is what I asked about, no point to point.


Nested loop not iterating properly

Question: I have this piece of Code in which there are two loops 'i' and 'j'.
'j' is the inner loop variable and it supposed to run 999 to 100 on single run of outer loop.
but it runs randomly like,
suppose i=999
j=912
j=911
j=910
j=909
j=908
j=907
j=906

Then suddenly inner loop quits, decrements by 1 from outer loop and makes i=998
then start 'j' loop
j=908
j=907
j=906
j=905
j=906
j=905
j=904
j=903
j=902

then quits inner loop ................
    int product=0;
    mainloop:
    for(int i=999;i>99;i--){
        for(int j=999;j>99;j--){
            boolean flag= doSomething(i*j);
            if(flag){
                product=i*j;
                System.out.println("Digits are: "+i+" and "+j);
                break mainloop;
            }
        }
    }

 public  boolean doSomething(int product){
        String original= Integer.toString(product),reverse="";
        int length = original.length();
        for ( int i = length - 1; i >= 0; i-- )
            reverse = reverse + original.charAt(i);
        return (original.equals(reverse));

    }

why is it happening? why inner loop doesnot complete cycle from 999 to 100?
EDIT: To clear, 'flag' will be true only if j=913 and i=993 , this is the main issue that loop doesn't break at this point because 'j' never comes to 913 but it randomly generates number.Moreover 'break' will break the mainloop not only the inner loop.
Comment: look at the code in doSomething. that should clear it up
Comment: You are explicitly breaking out of it and back to the main loop at the end of the `if`...
Comment: Can you show the code of `doSomething`?
Answer: You have a condition in the inner loop - if(flag) - which, if true, breaks from that loop. That's the reason the inner loop doesn't complete. It doesn't run "randomly". Its behavior depends on the result of the doSomething(i*j) method call.
Running your code with some additional debug prints and the implementation of doSomething you claim to have :
  int product=0;
  mainloop:
  for(int i=999;i>99;i--){
    System.out.print ("\n"+i+":");
    for(int j=999;j>99;j--){
      System.out.print (j+",");
      boolean flag= doSomething(i*j);
      if(flag){
        product=i*j;
        System.out.println("\nDigits are: "+i+" and "+j);
        break mainloop;
      }
    }
  }

  public static boolean doSomething(int k)
  {
      return k == 913*993;
  }

gives the expected output:
999:999,998,997,996,995,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,...,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,
998:999,998,997,996,995,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,...,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,
997:999,998,997,996,995,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,...,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,
996:999,998,997,996,995,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,...,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,
995:999,998,997,996,995,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,...,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,
994:999,998,997,996,995,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,...,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,
993:999,998,997,996,995,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,979,978,977,976,975,974,973,972,971,970,969,968,967,966,965,964,963,962,961,960,959,958,957,956,955,954,953,952,951,950,949,948,947,946,945,944,943,942,941,940,939,938,937,936,935,934,933,932,931,930,929,928,927,926,925,924,923,922,921,920,919,918,917,916,915,914,913,
Digits are: 993 and 913

EDIT, doSomething you posted returns true when i==995 and j==583. That's when you break the loop.
Comment: 'flag' will be true only if j=913 and i=993 , this is the main issue that loop doesn't break at this point because j never comes to 913 but it randomly generates number. and 'break' will break the main loop not only the inner loop.
Comment: @HappyDev i==995 comes before i==993, so (i==995,j==583) comes before (i==993,j==913).

Nested loop not iterating properly


Only allow one UIGestureRecognizer available at a time Swift

Question: I have a list of UIView. Each of them has its own UIPanGestureRecognizer. How can I make an only UIView available to be dragged at a time?
Now if I use 2 fingers, I can drag 2 UIView.
Comment: please add code to show how you are doing it
Comment: You should probably use one touch gesture for the container and then detect based on tap location which view was touched in the list.
Answer: I found a solution
Use isExclusiveTouch on UIView will make only one UIGestureRecognizer available at a time
Comment: you just set `isExclusiveTouch ` to `true` when init your `UIView`. Automatically only the `UIGestureRecognizer ` of that `UIView` is available at a time.


Add DropzoneJS for file upload with Laravel 5

Question: I have a form with files uploading input that is working well but I want replace it with DropzoneJS to add drag and drop functionality but any files get uploaded with DropzoneJS.
This what my wiew looks like:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Testing DropzoneJS with Laravel 5</title>

<link rel="stylesheet" href="{{ asset('css/dropzone.min.css') }}">

            <form class="form-horizontal dropzone dz-clickable" action="{{url('/upload)}}" method="post"  enctype="multipart/form-data">

            <input id="name" name="name" type="text" placeholder="Your Name" class="form-control">

Drag Photos to Upload

            Or click to browse

            <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">

            <button type="submit" class="btn btn-primary btn-lg">Add</button>
          </form>

my route file:
Route::post('/upload', function(){
    $the_new_product->name = Input::get('name');
    $the_new_product_picture = Input::file('file');

    return dd($the_new_product_picture); // I get Null as respons
});

I get Null as respons, so I guess the file is not uploaded.
Am I missing something?
Comment: please post your javascript(with the dropjs implementation)
Comment: Well I guess I am missing something but I was following this tutorial http://maxoffsky.com/code-blog/howto-ajax-multiple-file-upload-in-laravel/ and as far as I know, He didn't mention I have to use/add a JavaScript code/implementation :/
Comment: hmmm true, you really don't need to have any javascript code. Do you have any console errors? Try looking at the newtwork panel and see which parameters are posted
Comment: OK, I just check the network panel but only the text field name is posted and not the file field...
Comment: Could you check if when you drop a file, an input type="file" is injected into your form? Using the web inspector in chrome or firebug?
Comment: ok, I think this is a lil advanced for me, I don't know where to check this in Firebug :/
Comment: @FabioAntunes Hello, I've been trying to make this work but still no luck... I tried this code: https://paste.ee/p/rpIDK and if I drop a file (without clicking the submit button), I get this in the network panel: parameters https://paste.ee/p/UTPuJ . And If I click the submit button I get this https://paste.ee/p/kPKeV
Comment: If I manage to have some spare time I would try to implement dropJS today. Just for clarification which laravel you are using?
Comment: That would be awesome ... I am using Laravel 5.0
Answer: Well I tried dropzone.js and it was was blazing fast and everything worked fine.
And after looking at your code, I think I figured out your problem:
On your route.php you have this:
Route::post('/upload', function(){
    $the_new_product->name = Input::get('name');
    $the_new_product_picture = Input::file('file');

    return dd($the_new_product_picture); // I get Null as respons
});

This is wrong, you see when you want to fetch a file you must use Request not Input, Input was used on Laravel 4.2.
Just copy and paste this and overwrite your upload route on your routes.php
Route::post('/upload', function () {
    //check if file was uploaded
    if (Request::hasFile('file'))
    {
        //houston we have a file!
        $file = Request::file('file');

        //move it to our public folder and rename it to $name
        Request::file('file')->move('images', 'insert_file_name.'.$file->getClientOriginalExtension());
        echo 'file uploaded!';
        var_dump($file);
    }else{
        echo 'no file, no bueno';
    }
});

And that's it! If you want to read more about getting form inputs and files you should read the Request documentation also since you usually want to validate that input, take a look at Validation documentation
EDIT:
Here's my View:
<!DOCTYPE html>

        <title>Laravel</title>

        <link href='//fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" type="text/css" href="{{ asset('css/dropzone.css') }}">

                 <form class="form-horizontal dropzone dz-clickable" action="{{url('/upload')}}" method="post"  enctype="multipart/form-data">

                    <input id="name" name="name" type="text" placeholder="Your Name" class="form-control">

Drag Photos to Upload

                    Or click to browse

                    <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">

                    <button type="submit" class="btn btn-primary btn-lg">Add</button>
                  </form>

Comment: OK, Thanks, Am testing your version, will let you know.
Comment: I just replaced the code and get a "no file, no bueno" meaning am still having the same problem :/ ... can you post your view file (the form)?
Comment: Well This is really really weird now... Still same result :/
Comment: Well check your laravel logs, maybe you have some error there, you can find your logs under `storage\logs\laravel-2015-06-DAY.log`
Comment: Still same problem, one thing I notice though while inspecting in the browser is that once I drop a file, all input are posted (via Ajax???) but when hit the submit button only the name input and the token are posted. And that log file show this: `#33 {main}
[2015-06-13 22:41:22] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to a member function move() on a non-object' in C:\Bitnami\nginxstack-1.6.2-1\nginx\html\L5\app\Http\routes.php:328
Stack trace:
#0 {main}  `
Comment: you are right, I just checked again and dropzone submits your files via ajax, you can't submit files and other html input. If you check your public folder you must have a file that was uploaded via ajax.
Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/80492/discussion-between-asme-just-and-fabio-antunes).