text:
Q: Контекст события для определенного элемента в jquery Resource:
Карточки товара
let product     = $('.product');
  let productLink = product.find('.product__link');
  let productFrame = product.find('.product__frame');
  let productImages = product.find('.product__images');

  product.on('mouseover', function () {

    productLink.html('detail').addClass('visible');
    productFrame.addClass('active');
    productImages.addClass('hidden');

  });

  product.on('mouseout', function () {

    productLink.html('').removeClass('visible');
    productFrame.removeClass('active');
    productImages.removeClass('hidden');

  });

Summary:
В этой верстке есть карточки товара, к которым надо применить анимацию. Когда наводится курсор на карточку товара, почему-то она применяется для всех.
Пытался циклом пройтись, все равно jq ругается. Порылся в инете предлагают через each(). Но не разобрался!
Question:
Как же  тогда пройтись с помощью  цикла и сделать контекст для определенного элемента в jq (чтобы только в одной карточке срабатывала анимация) ?? Возможно есть  другие способы??

A:

var target,
  productLink,
  productFrame,
  productImages;

document.body.addEventListener('mouseover', () => {
  target = event.target;

  while (target != document.body) {
    if (target.tagName == 'LI' && !target.classList.contains('title-link')){
      // нашли элемент, который нас интересует!
      productLink = target.querySelector('.product__link-wrap');
      productFrame = target.querySelector('.product__frame');
      productImages = target.querySelector('.product__images');

      productLink.classList.add('visible');
      productFrame.classList.add('active');
      productImages.classList.add('hidden');

      return;
    }

    target = target.parentNode;
  }
})

document.body.addEventListener('mouseout', () => {

  if (target.tagName == 'LI' && !target.classList.contains('title-link')) {
    productLink.classList.remove('visible');
    productFrame.classList.remove('active');
    productImages.classList.remove('hidden');
  }

})
html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%
}

body {
  margin: 0
}

details,
main {
  display: block
}

h1 {
  font-size: 2em;
  margin: .67em 0
}

hr {
  box-sizing: content-box;
  height: 0;
  overflow: visible
}

code,
kbd,
pre,
samp {
  font-family: monospace, monospace;
  font-size: 1em
}

a {
  background-color: transparent
}

abbr[title] {
  border-bottom: none;
  text-decoration: underline;
  text-decoration: underline dotted
}

b,
strong {
  font-weight: bolder
}

small {
  font-size: 80%
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline
}

sub {
  bottom: -.25em
}

sup {
  top: -.5em
}

img {
  border-style: none
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0
}

button,
input {
  overflow: visible
}

button,
select {
  text-transform: none
}

[type=button],
[type=reset],
[type=submit],
button {
  -webkit-appearance: button
}

[type=button]::-moz-focus-inner,
[type=reset]::-moz-focus-inner,
[type=submit]::-moz-focus-inner,
button::-moz-focus-inner {
  border-style: none;
  padding: 0
}

[type=button]:-moz-focusring,
[type=reset]:-moz-focusring,
[type=submit]:-moz-focusring,
button:-moz-focusring {
  outline: ButtonText dotted 1px
}

fieldset {
  padding: .35em .75em .625em
}

legend {
  box-sizing: border-box;
  color: inherit;
  display: table;
  max-width: 100%;
  padding: 0;
  white-space: normal
}

progress {
  vertical-align: baseline
}

textarea {
  overflow: auto
}

[type=checkbox],
[type=radio] {
  box-sizing: border-box;
  padding: 0
}

[type=number]::-webkit-inner-spin-button,
[type=number]::-webkit-outer-spin-button {
  height: auto
}

[type=search] {
  -webkit-appearance: textfield;
  outline-offset: -2px
}

[type=search]::-webkit-search-decoration {
  -webkit-appearance: none
}

 ::-webkit-file-upload-button {
  -webkit-appearance: button;
  font: inherit
}

summary {
  display: list-item
}

[hidden],
template {
  display: none
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 200;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-ExtraLight.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-ExtraLight.otf.woff') format('woff'), url('../fonts/SourceSansPro-ExtraLight.otf') format('opentype'), url('../fonts/SourceSansPro-ExtraLight.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 300;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Light.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Light.otf.woff') format('woff'), url('../fonts/SourceSansPro-Light.otf') format('opentype'), url('../fonts/SourceSansPro-Light.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 400;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Regular.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Regular.otf.woff') format('woff'), url('../fonts/SourceSansPro-Regular.otf') format('opentype'), url('../fonts/SourceSansPro-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 600;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Semibold.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Semibold.otf.woff') format('woff'), url('../fonts/SourceSansPro-Semibold.otf') format('opentype'), url('../fonts/SourceSansPro-Semibold.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 700;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Bold.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Bold.otf.woff') format('woff'), url('../fonts/SourceSansPro-Bold.otf') format('opentype'), url('../fonts/SourceSansPro-Bold.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 900;
  font-style: normal;
  font-stretch: normal;
  src: url('../fonts/SourceSansPro-Black.ttf.woff2') format('woff2'), url('../fonts/SourceSansPro-Black.otf.woff') format('woff'), url('../fonts/SourceSansPro-Black.otf') format('opentype'), url('../fonts/SourceSansPro-Black.ttf') format('truetype');
}

@font-face {
  font-family: 'Source Sans Pro';
  font-weight: 900;
  font-style: italic;
  font-stretch: normal;
  src: url('WOFF2/TTF/SourceSansPro-BlackIt.ttf.woff2') format('woff2'), url('WOFF/OTF/SourceSansPro-BlackIt.otf.woff') format('woff'), url('OTF/SourceSansPro-BlackIt.otf') format('opentype'), url('TTF/SourceSansPro-BlackIt.ttf') format('truetype');
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: #fff;
  font: normal 14px/24px "Source Sans Pro";
  text-transform: uppercase;
  letter-spacing: 1px;
}

ul,
li,
p,
h1,
h2,
h3,
h4 {
  padding: 0;
  margin: 0;
  list-style: none;
}

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

a {
  text-decoration: none;
}

* {
  box-sizing: border-box;
}

.container {
  max-width: 1180px;
  margin: auto;
  padding: 0 20px;
}

.container-wrap {
  max-width: 1610px;
  margin: auto;
  background-color: #fbfbfb;
}

.header__top {
  padding-top: 25px;
  padding-bottom: 20px;
}

.top-header {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: justify;
  justify-content: space-between;
}

.top-header__text {
  color: #323232;
  font-size: 13px;
  line-height: 12px;
  padding-right: 10px;
}

.top-header__text:hover {
  color: #656565;
}

.top-header__text_bold {
  font-weight: 700;
  cursor: default;
}

.top-header__text_bold:hover {
  color: #323232;
}

.middle-header {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: justify;
  justify-content: space-between;
  padding-top: 30px;
}

.middle-header__col-1 {
  max-width: 300px;
}

.middle-header__col-2 {
  margin-top: -50px;
}

.middle-header__col-3 {
  width: 420px;
}

.login__text {
  font-size: 13px;
  color: #656565;
  background-repeat: no-repeat;
  background-position: left;
  margin-bottom: 15px;
  padding-left: 25px;
  font-weight: 400;
  letter-spacing: 2px;
}

.login__text_white {
  background-color: #e1bc62;
  color: #fff;
  padding: 0 2px;
  font-weight: 600;
}

.login__text_white:hover {
  background-color: #e9ce8d;
}

.login__text_user {
  background-image: url('../img/user-icon.svg');
}

.login__text_phone {
  background-image: url('../img/phone-icon.svg');
  text-transform: capitalize;
}

.login__text_phone .phone-num {
  font-size: 15px;
}

.login__search input {
  width: 100%;
  padding: 15px 15px;
  background-repeat: no-repeat;
  background-image: url('../img/search-icon.svg');
  background-position: 95% 50%;
  border: 1px solid #bebebe;
}

.login__search input::-webkit-input-placeholder {
  text-transform: uppercase;
  color: #989898;
}

.login__search input::-moz-placeholder {
  text-transform: uppercase;
  color: #989898;
}

.login__search input:-ms-input-placeholder {
  text-transform: uppercase;
  color: #989898;
}

.login__search input::-ms-input-placeholder {
  text-transform: uppercase;
  color: #989898;
}

.login__search input::placeholder {
  text-transform: uppercase;
  color: #989898;
}

.sold__item {
  display: -webkit-box;
  display: flex;
}

.sold__item_top {
  font-size: 14px;
  color: #323232;
}

.sold__item_middle {
  border: 1px solid #ccc;
  border-top: 0;
  padding: 15px;
}

.sold__link {
  font-size: 14px;
  color: #323232;
  text-align: center;
  position: relative;
  padding: 15px 0;
}

.sold__link:hover {
  color: #656565;
}

.sold__link_wishlist {
  width: 180px;
  padding-left: 23px;
}

.sold__link_cart {
  -webkit-box-flex: 1;
  flex-grow: 1;
  padding-left: 15px;
}

.sold__link.active {
  border: 1px solid #ccc;
  border-bottom: 0 solid #ccc;
}

.sold__link .icon {
  width: 23px;
  height: 23px;
  background-repeat: no-repeat;
  display: inline-block;
  background-position: center;
  position: absolute;
}

.sold__link .icon_wishlist {
  background-image: url('../img/wishlist.png');
  left: 30px;
}

.sold__link .icon_cart {
  background-image: url('../img/cart-icon.png');
  left: 15px;
}

.sold__link .total-sum {
  color: #cd222a;
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 13px;
}

.sold__link .total-sum_padding {
  padding-left: 57px;
}

.sold__link .amount {
  position: absolute;
  width: 18px;
  height: 18px;
  background-color: #cd222a;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 18px;
  left: 9px;
  top: 9px;
}

.sold__product {
  -webkit-box-flex: 1;
  flex-grow: 1;
  position: relative;
}

.sold__product .delete {
  position: absolute;
  width: 12px;
  height: 12px;
  right: 20px;
  cursor: pointer;
  top: 50%;
  margin-top: -5px;
}

.sold__product .delete:before,
.sold__product .delete:after {
  content: '';
  position: absolute;
  display: block;
  width: 1.5px;
  height: 12px;
  background-color: #ccc;
  right: 50%;
  margin-right: -1px;
  -webkit-transform: rotate(35deg);
  -ms-transform: rotate(35deg);
  transform: rotate(35deg);
}

.sold__product .delete:after {
  -webkit-transform: rotate(-35deg);
  -ms-transform: rotate(-35deg);
  transform: rotate(-35deg);
}

.sold__title,
.sold__price {
  color: #656565;
  text-transform: uppercase;
}

.sold__title {
  font-weight: 700;
  font-size: 12px;
}

.sold__img {
  float: left;
  margin-right: 15px;
}

.sold__price {
  font-weight: 400;
  font-size: 16px;
  line-height: 18px;
}

.sold__btn {
  text-align: center;
  line-height: 16px;
  padding: 11px;
}

.sold__btn_first {
  -webkit-box-flex: 1;
  flex-grow: 1;
  background-color: #383739;
}

.sold__btn_first:hover {
  background-color: #525053;
}

.sold__btn_second {
  width: 180px;
  background-color: #e1bc62;
  position: relative;
}

.sold__btn_second:hover {
  background-color: #e9ce8d;
}

.sold__btn .text {
  color: #fff;
  font-weight: 600;
}

.sold__btn .plus {
  width: 12px;
  height: 12px;
  position: relative;
  display: inline-block;
  margin-right: 8px;
}

.sold__btn .plus:before,
.sold__btn .plus:after {
  content: '';
  position: absolute;
  display: block;
  background-color: #fff;
  height: 12px;
  width: 2px;
  right: 50%;
  margin-right: -0.5px;
}

.sold__btn .plus:after {
  -webkit-transform: rotate(90deg);
  -ms-transform: rotate(90deg);
  transform: rotate(90deg);
}

.sold__btn .checkout {
  background-image: url('../img/checkout-icon.svg');
  position: absolute;
  width: 24px;
  height: 24px;
  background-position: center;
  display: inline-block;
  background-repeat: no-repeat;
  left: 20px;
  top: 50%;
  margin-top: -12px;
}

.nav_margin {
  padding: 20px 0;
  position: relative;
}

.nav_margin:after {
  content: '';
  position: absolute;
  display: block;
  height: 5px;
  background-color: #e1bc62;
  width: 100%;
  bottom: 0;
  left: 0;
}

.nav-list {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
  justify-content: center;
}

.nav-list__item {
  margin-right: 28px;
  margin-left: 28px;
  line-height: 15px;
}

.nav-list__link {
  color: #444444;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
}

.nav-list__link:hover {
  color: #777777;
}

.shop-window {
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  flex-direction: column;
  flex-wrap: wrap;
  -webkit-box-pack: start;
  justify-content: flex-start;
  align-content: flex-start;
  height: 680px;
  margin: -10px;
}

.shop-window_padding20px {
  padding-top: 20px;
}

.shop-window__col {
  margin: 10px;
  overflow: hidden;
  position: relative;
}

.shop-window__col img {
  display: block;
}

.shop-window__col_1 {
  height: 100%;
  width: calc(100% / 12 * 3 - 20px);
}

.shop-window__col_2 {
  height: calc(100% / 12 * 6 - 20px);
  width: calc(100% / 12 * 6 - 20px);
}

.shop-window__col_3 {
  height: calc(100% / 12 * 6 - 20px);
  width: calc(100% / 12 * 3 - 20px);
}

.shop-window__col_4 {
  height: calc(100% / 12 * 6 - 20px);
  width: calc(100% / 12 * 3 - 20px);
}

.shop-window__col_5 {
  background-color: black;
  height: calc(100% / 12 * 6 - 20px);
  width: calc(100% / 12 * 6 - 20px);
  margin-left: calc((100% / 12 * 3 - 10px)*-1);
}

.collections__wrap-img {
  position: relative;
}

.collections__wrap-img:before {
  content: '';
  position: absolute;
  display: block;
  background-color: #fff;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  opacity: 0.4;
}

.collections__wrap-block {
  position: absolute;
  top: 60%;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 1000;
}

.collections__month {
  font-size: 36px;
  color: #000;
  letter-spacing: 2px;
}

.collections__month span {
  display: block;
  font-size: 12px;
  text-transform: capitalize;
  font-weight: 400;
  letter-spacing: 10px;
}

.collections__link {
  display: block;
  margin: auto;
  margin-top: 10px;
  padding: 15px;
  text-align: center;
  background: #e1bc62;
  width: 60%;
  font-size: 14px;
  line-height: 14px;
  text-transform: capitalize;
  color: #fff;
  font-weight: 700;
}

.collections__link:hover {
  background: #e9ce8d;
}

.sale {
  position: relative;
}

.sale__img {
  display: block;
}

.sale__sticker {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  width: 60px;
  height: 38px;
}

.sale__sticker:before {
  content: '';
  position: absolute;
  display: block;
  border-left: 25px solid transparent;
  border-bottom: 25px solid transparent;
  border-right: 25px solid #e1bc62;
  border-top: 25px solid #e1bc62;
  z-index: 200;
  -webkit-transform: rotate(-77deg);
  -ms-transform: rotate(-77deg);
  transform: rotate(-77deg);
  top: -18px;
  left: -1px;
}

.sale__text {
  color: #fff;
  letter-spacing: 5px;
  background-color: #e1bc62;
  position: absolute;
  z-index: 100;
  -webkit-transform: rotate(-32deg);
  -ms-transform: rotate(-32deg);
  transform: rotate(-32deg);
  top: 8px;
  line-height: 12px;
  width: 93px;
  box-shadow: 0 0 4px 1px black;
  text-align: center;
  left: -25px;
  font-size: 12px;
  padding-left: 4px;
}

.block-3__img {
  height: 100%;
}

.block-5__img {
  height: 100%;
}

.arrivals__wrap-img:before {
  content: '';
  position: absolute;
  display: block;
  background-color: #fff;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  opacity: 0.4;
}

.arrivals__wrap-block {
  position: absolute;
  top: 35%;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 1000;
}

.arrivals__text {
  font-size: 32px;
  letter-spacing: 10px;
  font-weight: 100;
  text-align: center;
}

.arrivals__text span {
  font-size: 42px;
  font-weight: 900;
  display: block;
  text-align: center;
  letter-spacing: 1px;
}

.arrivals__link {
  display: block;
  margin: auto;
  margin-top: 10px;
  padding: 15px;
  text-align: center;
  background: #e1bc62;
  width: 60%;
  font-size: 14px;
  line-height: 14px;
  text-transform: capitalize;
  color: #fff;
  font-weight: 700;
}

.arrivals__link:hover {
  background: #e9ce8d;
}

.products_padding85 {
  padding-top: 90px;
}

.products_mod {
  display: -webkit-box;
  display: flex;
  flex-wrap: wrap;
  margin-right: -7px;
  margin-left: -7px;
}

.products__title {
  width: 100%;
  margin-bottom: 55px;
}

.products__item {
  width: calc(100% / 12 * 3 - 14px);
  margin-left: 7px;
  margin-right: 7px;
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  flex-direction: column;
  -webkit-box-align: center;
  align-items: center;
}

.title-link__titles {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
  justify-content: center;
  position: relative;
  margin-bottom: 30px;
}

.title-link__titles:before {
  content: '';
  position: absolute;
  display: block;
  width: 2px;
  height: 100%;
  background: #d6d6d6;
  right: 50%;
  margin-right: -4px;
}

.title-link__title {
  font-size: 48px;
  color: #595959;
  padding-right: 60px;
  line-height: 35px;
  position: relative;
  font-weight: 100;
  -webkit-transition: 1s;
  transition: 1s;
}

.title-link__title:hover .arrow {
  -webkit-transform: rotate(405deg);
  -ms-transform: rotate(405deg);
  transform: rotate(405deg);
}

.title-link__title.active {
  font-weight: 900;
  color: #000;
}

.title-link__title.active:hover {
  cursor: default;
}

.title-link__title.active:hover .arrow {
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

.title-link__title_second {
  margin-left: 15px;
}

.title-link__title .arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  border-right: 1px solid;
  border-bottom: 1px solid;
  right: 30px;
  top: 50%;
  margin-top: -6px;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
  -webkit-transition: 1s;
  transition: 1s;
}

.title-link__advantages {
  text-align: center;
  color: #595959;
  letter-spacing: 2px;
  text-transform: initial;
  font-style: italic;
  line-height: 14px;
}

.product {
  position: relative;
}

.product div,
.product a {
  position: relative;
  z-index: 100;
}

.product:before {
  content: '';
  position: absolute;
  display: block;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
  z-index: 20;
}

.product__images {
  position: relative;
  display: block;
  margin-bottom: 15px;
}

.product__images:before {
  content: '';
  position: absolute;
  display: block;
  background-color: #fff;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  opacity: 0.4;
}

.product__images:after {
  content: '';
  position: absolute;
  display: block;
  width: 44px;
  height: 2px;
  right: 50%;
  margin-right: -22px;
  bottom: -7px;
  background-color: #595959;
}

.product__images.hidden:before {
  opacity: 0;
}

.product__image img {
  display: block;
  width: 100%;
  height: 290px;
}

.product__link-wrap {
  min-height: 17px;
  margin-bottom: 15px;
}

.product__link {
  width: 65px;
  text-align: center;
  color: #fff;
  line-height: 17px;
  font-size: 13px;
  border-radius: 10px;
  display: block;
  letter-spacing: 2px;
  min-height: 16px;
  margin: auto;
  -webkit-transition: 1s;
  transition: 1s;
}

.product__link.visible {
  background-color: #383739;
}

.product__title {
  margin-bottom: 7px;
}

.product__title .text {
  color: #595959;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
}

.product__price {
  text-align: center;
  line-height: 17px;
}

.product__price .old-price,
.product__price .price {
  color: #595959;
  font-weight: 100;
}

.product__price .old-price {
  font-size: 13px;
  text-decoration: line-through;
}

.product__price .price {
  font-size: 16px;
}

.product__frame {
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: transparent;
  z-index: 10 !important;
  margin: -10px;
  -webkit-transition: 0.5s;
  transition: 0.5s;
  border: 3px solid transparent;
}

.product__frame.active {
  background-color: #e1bc62;
  border-color: #000;
}
<div class="container">

  <ul class="products products_mod products_padding85">
    <li class="title-link products__title">
      <div class="title-link__titles">
        <a class="title-link__title active" href="">
                  FEATURED
                  <span class="arrow"></span>
               </a>

        <a class="title-link__title title-link__title_second" href="">
                  ARRIVALS
                  <span class="arrow"></span>
               </a>
      </div>
      <p class="title-link__advantages">"Whoever said money can't buy happiness simply didn't know WHER</p>
    </li>

    <li class="product products__item">
      <a class="product__images" href="#">

        <div class="product__image">
          <img src="http://lorempixel.com/285/300/sports/1" alt="">
        </div>

      </a>
      <div class="product__link-wrap">
        <a class="product__link " href="">

        </a>
      </div>
      <div class="product__title">
        <span class="text">slim pants</span>
      </div>

      <div class="product__price">

        <span class="old-price">$329,00</span>
        <span class="price">$279,00</span>
      </div>
      <div class="product__cart">
        <h3 class="text">ADD TO CART</h3>
      </div>
      <div class="product__wishlist">
        <span class="icon"></span>
        <span class="text"></span>
      </div>
      <div class="product__frame"></div>
    </li>
    <li class="product products__item">
      <a class="product__images" href="#">

        <div class="product__image">
          <img src="http://lorempixel.com/285/300/sports/1" alt="">
        </div>

      </a>
      <div class="product__link-wrap">
        <a class="product__link " href="">

        </a>
      </div>
      <div class="product__title">
        <span class="text">slim pants</span>
      </div>

      <div class="product__price">

        <span class="old-price">$329,00</span>
        <span class="price">$279,00</span>
      </div>
      <div class="product__cart">
        <h3 class="text">ADD TO CART</h3>
      </div>
      <div class="product__wishlist">
        <span class="icon"></span>
        <span class="text"></span>
      </div>
      <div class="product__frame"></div>
    </li>
    <li class="product products__item">
      <a class="product__images" href="#">

        <div class="product__image">
          <img src="http://lorempixel.com/285/300/sports/1" alt="">
        </div>

      </a>
      <div class="product__link-wrap">
        <a class="product__link " href="">

        </a>
      </div>
      <div class="product__title">
        <span class="text">slim pants</span>
      </div>

      <div class="product__price">

        <span class="old-price">$329,00</span>
        <span class="price">$279,00</span>
      </div>
      <div class="product__cart">
        <h3 class="text">ADD TO CART</h3>
      </div>
      <div class="product__wishlist">
        <span class="icon"></span>
        <span class="text"></span>
      </div>
      <div class="product__frame"></div>
    </li>
    <li class="product products__item">
      <a class="product__images" href="#">

        <div class="product__image">
          <img src="http://lorempixel.com/285/300/sports/1" alt="">
        </div>

      </a>
      <div class="product__link-wrap">
        <a class="product__link " href="">

        </a>
      </div>
      <div class="product__title">
        <span class="text">slim pants</span>
      </div>

      <div class="product__price">

        <span class="old-price">$329,00</span>
        <span class="price">$279,00</span>
      </div>
      <div class="product__cart">
        <h3 class="text">ADD TO CART</h3>
      </div>
      <div class="product__wishlist">
        <span class="icon"></span>
        <span class="text"></span>
      </div>
      <div class="product__frame"></div>
    </li>

  </ul>
</div>

Если вам не принципиально, чтобы работало на JQuery, то вот.
2) Можно обойтись без скриптов:
li:hover .product__frame {
   background-color: #e1bc62;
   border-color: #000;
}

li:hover .product__link {
   background-color: #383739;
}

A: Вариант с jQuery:
$('.product')
    .on('mouseover', function (event) {
      $(this).find('.product__link').html('detail').addClass('visible');
      $(this).find('.product__frame').addClass('active');
      $(this).find('.product__images').addClass('hidden');
    })
    .on('mouseout', function (event) {
      $(this).find('.product__link').html('').removeClass('visible');
      $(this).find('.product__frame').removeClass('active');
      $(this).find('.product__images').removeClass('hidden');
 });

codepen


text:
Q: Multiple Databases in Django I've 2 DB in my one Django app. The two DB's are on the same network, ie on LAN. So, I suppose the HOST IP will be different. Wouldnt it be?
As of right now, to test my code, I've provided same HOST but different PORT.
So, my DB settings are as follow:-
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'vms_db',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '8000',
    },
    'users': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'aramex_vms_db',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '8080',
    }
}

When I syncdb it, it returns an error saying:-
django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (111)")

But when I use the same port, it works fine but the tables are made in default DB. I know the migrate command by default works on default DB.
1) But what if I want that there should be different tables for default and different for users,  how will I do that?

A: If you want to migrate your database users:
$ ./manage.py migrate --database=users

As you can see here: https://docs.djangoproject.com/en/dev/topics/db/multi-db/#synchronizing-your-databases
If you want to select your database while you retrieve an entry:
#default dabatase
Author.objects.all()

#custom database
Author.objects.using('DATABASE_NAME').all()

Further information: https://docs.djangoproject.com/en/dev/topics/db/multi-db/#manually-selecting-a-database

redpajama_set_name: RedPajamaStackExchange


text:
Q: Как убрать меню из Win32 окна создаваемого в Visual Studio; Здравствуйте.
Как убрать меню из стандартного приложения Win32, которое создается средой Visual Studio 2010.

Используя стандартную функцию CreateWindow пишу так:
hWnd = CreateWindow(szWindowClass, szTitle, WS_POPUP,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

WS_POPUP - стиль, означающий временное окно, у него не должно быть меню, однако как видно на скрине, окно создается с меню.
Как добиться того, что бы меню не было?

A: Честно говоря лень создавать. Если не ошибаюсь в функции CreateWindow в 9 параметре указывается меню. Замени значение на 0 и меню должно пропасть. Параметр HMENU hMenu.


text:
Q: Does glUniform*fv retains passed buffer? What really happens when I call glUniform2fv?
Does it synchronously copy the passed buffer or is it just accepts the pointer and use that data later? Does it retain the buffer?
In the other words: is it safe to pass locally-created or non-retained buffers in function or it is up to me to keep that buffer alive?
I'm using OpenGL on iOS/Mac using objective-c and/or Swift, I'm afraid GC (ARC) can eat my buffer before it will be send to GPU.

A: It is safe, but the documentation is not clear on this, at least the version found at https://www.opengl.org/sdk/docs/man/html/glUniform.xhtml

They retain the values assigned to them by a call to glUniform until
  the next successful link operation occurs on the program object

A: glUniform does not use any buffer (correct me if I'm wrong).
According to https://www.opengl.org/sdk/docs/man/html/glUniform.xhtml the glUniform call modifies variables in the shader program.
In my opinion you can think the Uniform call as if it was an "=" sign in C , for example a=b;where a is the uniform in the shader program and b is a variable within your program . (Feel from to correct me if my explantion is not appropriate)


text:
Q: Como faço para popular o UsuarioLogado, e usar seus dados para popular a View? MVP é uma coisa nova para mim e venho tendo algumas dificuldades. Gostaria de saber, como eu deveria criar uma classe pra receber os dados do meu usuario logado do banco de dados Firebase para popular a minha View.
Pensei em usar um Singleton, vi em alguns exemplos que ele é uma opção, mas que não é ideal por dificultar a testagem do código, então como eu deviria criar essa classe que preciso de acesso quase que o tempo todo?

A: Minha dica para você é utilizar injeção de dependencias, isso irá deixar o codigo testavel e ao mesmo tempo, poderá ter acesso relativamente facil aos objetos que você quer frequentemente.
As bibliotecas famosas para injeção de dependencias para android são:

*

*Hilt, bem nova, e beem facil de começar, baseada e utiliza componentes do dagger, então pode ficar tão robusta quanto o dagger se precisar.

*Dagger, uma robusta e mais complexa para começar.

*Koin, mais fácil que o Dagger e tão boa quanto, facil de começar e com sintaxe mais "kotlin".


text:
Q: Page not found (404) Raised by: views.product_in_category Good morning. while implementing element_detail
Page not found (404)
Request method: POST
Request URL: http://127.0.0.1:8000/element_detail/
By: zeronine.views.product_in_category
There are no categories matching the given search term. '
An error has occurred. The category continued to show up well, but it's not an error about element_detail, but an error about a category, so I'm confused.
zeronine/urls.py
from django.urls import path, include
from .views import *

app_name = 'zeronine'

urlpatterns = [
    path('', product_in_category, name='product_all'),
    path('<category_slug>/', product_in_category, name='product_in_category'),
    path('<int:id>/<product_slug>/', product_detail, name='product_detail'),
    path('accounts/', include('accounts.urls')),
    path('post/', include('post.urls')),
    path('product/', include('product.urls')),
    path('join/', include('product.urls')),

]

zeronine/detail.html

        <form method="POST" style="margin-left: 110px;" action="{% url 'zeronine:element_detail' %}">

                        옵션

                            <select type="text" class="form-control" name="value_code" id="value_code">
                                {% for value in value_object %}
                                {%if value.product_code == product %}
                                    <option value="{{value.value_code}}">{{value.name}}</option>
                                    {% endif %}
                                {% endfor %}
                            </select>

                {% csrf_token %}
                 {% if not user.is_authenticated %}

                    <button type="submit" style="background:black; border-color:black;" class="btn btn-primary"> 참여하기</button>

                    <button type="submit" style="background:white; color:black; border-color:black;" class="btn btn-primary">찜하기</button>

                  {% else %}

                    <button type="submit" action="{% url 'zeronine:element_detail' %}" style="background:black; border-color:black;" class="btn btn-primary"> 참여하기</button>

                    <button type="submit" style="background:white; color:black; border-color:black;" class="btn btn-primary">찜하기</button>
                  {% endif %}
            </form>
                            </form>

join.urls.py
from django.urls import path
from .views import *

urlpatterns = [
    path('element_detail/', element_detail, name='element_detail'),
    ]

join.views.py
from django.shortcuts import render

# Create your views here.
from zeronine.forms import ElementForm
from zeronine.models import *

def element_detail(request):
    designated = Designated.objects.all()
    element_object = Element.objects.all()
    value_object = Value.objects.all()

    if request.method == "POST":
        form = ElementForm(request.POST)

        if form.is_valid():
            element = Element()
            element.value_code = form.cleaned_data['value_code']
            element.designated_code = designated
            element.save()

    if request.method == "POST":
            join = Join()
            join.product_code = request.GET.get('product_code')
            join.username = request.user
            join.part_date = request.GET.get('part_date')
            join.save()

            return render(request, 'zeronine/list.html')

    else:
        form = ElementForm()

    return render(request, 'zeronine/detail.html', {'form': form,
                                                    'designated': designated,
                                                    'element_object': element_object,
                                                    'value_object': value_object})


text:
Q: A sufficient and necessary condition for $\mathbb{C}(f(x),g(x))=\mathbb{C}(x)$? Let $f=f(x),g=g(x) \in \mathbb{C}[x]$.

Is there a sufficient and necessary condition for $\mathbb{C}(f(x),g(x))=\mathbb{C}(x)$?

This paper is perhaps relevant, although it deals with polynomials in two variables. Here we can also define 'good' or 'bad' field generator $f$ according to the existence of $g \in k[x]$ or $g \in k(x)$. But actually, every $f$ is a bad generator, since taking $g:=\frac{x}{f}$ yields $\mathbb{C}(f,g)=\mathbb{C}(f,\frac{x}{f})=\mathbb{C}(x)$.
See also this question.
Thank you very much!

A: Here goes. Let $\mathbb{C}[f(x),g(x)]\subset A\subset \mathbb{C}[x]$, where $A$ is the integral closure of $\mathbb{C}[f,g]$ in its fraction field. Then it is well known that $A=\mathbb{C}[u(x)]$ for some polynomial $u(x)$. Now, let $c\in\mathbb{C}$ such that the gcd of $p=f(x)-f(c), q= g(x)-g(c)$ is precisely $x-c$. This implies $p,q\in A$ are not relatively prime and so some non-constant polynomial $h(u)$ divides both. Then $h(u(x))$ divides both $p,q$ in $\mathbb{C}[x]$, and so by assumption, $h(u(x))$ must have degree one in $x$. Then, $u$ must also be of degree one in $x$ and thus $A=\mathbb{C}[x]$. Since the fraction fileds of $\mathbb{C}[f,g]$ is the same as that of $A$, we are done.


text:
Q: MIN() and MAX() in Swift and converting Int to CGFloat I'm getting some errors with the following methods:
1) How do I return screenHeight / cellCount as a CGFLoat for the first method?
2) How do I use the equivalent of ObjC's MIN() and MAX() in the second method?
func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
    var cellCount = Int(self.tableView.numberOfRowsInSection(indexPath.section))

    return screenHeight / cellCount as CGFloat
}

// #pragma mark - UIScrollViewDelegate

func scrollViewDidScroll(scrollView: UIScrollView) {
    let height = CGFloat(scrollView.bounds.size.height)
    let position = CGFloat(MAX(scrollView.contentOffset.y, 0.0))

    let percent = CGFloat(MIN(position / height, 1.0))
    blurredImageView.alpha = percent
}

A: 1: You can't downcast from Int to CGFloat. You have to initialize a CGFloat with the Int as input.
return CGFloat(screenHeight) / CGFloat(cellCount)

2: Use the min and max functions defined by the standard library. They're defined as follows:
func min<T : Comparable>(x: T, y: T, rest: T...) -> T
func max<T : Comparable>(x: T, y: T, rest: T...) -> T

Usage is as follows.
let lower = min(17, 42) // 17
let upper = max(17, 42) // 42

A: You can just use min() and max() - they're built-in.
If you wanted to roll your own (why? - maybe to extend it) you would use something like
func myMin <T : Comparable> (a: T, b: T) -> T {
    if a > b {
        return b
    }
    return a
}

A: You need to explicitly convert cellCount to CGFloat, since Swift doesn't do automatic type conversion between integers and floats:
return screenHeight / CGFloat(cellCount)

min and max functions are defined by the standard library.

A: If you're using Swift 3, max() and min() are now called on the sequence (i.e., collection) instead of passing in arguments:

let heights = [5, 6]
let max = heights.max() // -> 6
let min = heights.min() // -> 5


text:
Q: Calculate date persons becomes a certain age I'm trying to calculate the date a person turns 18, taking into account leap years.
One might think that just adding 18 years to a date is enough:
birthDay.AddYears(18);

But if the birthday is February 29, 2000, this leads to february 28, 2018. I believe the correct answer would have to be March 1, 2018.
I found a way to do it, but I wonder if there isn't a simpler way.
birthday.AddDays(-1).AddYears(18).AddDays(1);

I would think an answer to this question would already exist on StackOverflow, but all my searches only turn up questions about calculating age on a specific date.
I don't think my question is a duplicate of Behavior of DateTime.AddYears on leap year as that one only explains why AddYears works as it does. It does not contain code to perform the calculation.
I found a quora article stating that the official date you turn 18 is different in New Sealand from the UK.

A: I suggest hiding the logic (rounding up to 1 Mar instead of rounding down to 28 Feb) into an extension method:
public static partial class DateTimeExtensions {
  public static DateTime AddYearsUp(this DateTime value, int amount) {
    // Business as usual: neither days are leap days or both days are leap days
    if (value.Month != 2 || value.Day != 29 || DateTime.IsLeapYear(value.Year + amount))
      return value.AddYears(amount);

    // We want 29 Feb to be turned into 1 Mar (not 28 Feb)
    return new DateTime(value.Year + amount, 3, 1,
                        value.Hour, value.Minute, value.Second, value.Millisecond);
  }
}

Then use the method implemented:
var result = birthDay.AddYearsUp(18);

Please, notice, that you current logic
birthday.AddDays(-1).AddYears(18).AddDays(1);

is not correct; the counter example is
// 1 Mar 1998
var birthday = new DateTime(1998, 3, 1);

// Expected:  1 Mar 2016
// Actual:   29 Feb 2016
var result = birthday.AddDays(-1).AddYears(18).AddDays(1);


text:
Q: Tasks & Modules - Google API php - Alternatives? I have an application written in php. Until now, it hasn't been easy but it does the job. But now I have a problem: my script might need more than 10 mins to complete.
At the begining I was stuck with the 60 secs limit. Then I learned about "Tasks Push" and now I can make it run for 10 mins straight. I even "split" my code into pieces so every stage can have 10 mins to complete. But now I want even more and I've tried the "modules" approach but I just mess it up and almost cripple my app entireley.
Now I'm back to no-modules, using Tasks, with the code in stages but I'm wondering if there is a way I can run a script (in php) for more than 10 mins. I'm willing to try the "modules" approach again.
Any ideas? suggestions?

A: Manual scaling modules will allow tasks to run for up to 24 hours


text:
Q: Cannot properly parse sql script while trying to parse using TSql100Parser I am using ScriptDom for Parsing a SQL Script. My program is as under
static void Main(string[] args)
        {
            string script = @"
                            SET QUOTED_IDENTIFIER ON
                            GO

                            SET ANSI_NULLS ON
                            GO

                            CREATE PROCEDURE dbo.ws_Device_Update
                            (
                                @ApplicationId uniqueidentifier   ,
                                @OriginalApplicationId uniqueidentifier   ,
                                @DeviceIMEI nvarchar (50)  ,
                                @OriginalDeviceIMEI nvarchar (50)  ,
                                @ModelId int   ,
                                @DeviceName nvarchar (50)  ,
                                @DeviceDescription nvarchar (255)  ,
                                @DeviceState int   ,
                                @IsExpired bit   ,
                                @IsSuspended bit   ,
                                @LastAccessed datetime   ,
                                @ClientSeqNo bigint   ,
                                @ServerSeqNo bigint   ,
                                @ModelCode varchar (50)  ,
                                @PushToken varchar (512)  ,
                                @PushLastAlive datetime   ,
                                @PushLastDead datetime   ,
                                @DeviceType int
                            )

                            AS

                            UPDATE dbo.[ws_Device]
                            SET

                                 [ModelId]              = @ModelId           --Does a device model change with same DeviceIMEI .I doubt it
                                ,[DeviceName]           = @DeviceName        --Does a device name change with same DeviceIMEI .I doubt it
                                ,[DeviceDescription]    = @DeviceDescription --Does a device description change with same DeviceIMEI .I doubt it
                                ,[DeviceState]          = @DeviceState
                                ,[IsExpired]            = @IsExpired
                                ,[IsSuspended]          = @IsSuspended
                                ,[LastAccessed]         = @LastAccessed
                                ,[ClientSeqNo]          = @ClientSeqNo
                                ,[ServerSeqNo]          = @ServerSeqNo
                                ,[ModelCode]            = @ModelCode         --Does a device model code with same DeviceIMEI .I doubt it
                                ,[PushToken]            = @PushToken
                                ,[PushLastAlive]        = @PushLastAlive
                                ,[PushLastDead]         = @PushLastDead
                                ,[DeviceType]           = @DeviceType        --Does a device device type change with same DeviceIMEI .I doubt it
                            WHERE
                                [ApplicationId]         = @OriginalApplicationId
                            AND [DeviceIMEI]            = @OriginalDeviceIMEI
                            ";

            IList<ParseError> parseErrors;
            TSql100Parser tsqlParser = new TSql100Parser(false);
            TSqlFragment fragment;
            using (StringReader stringReader = new StringReader(script))
            {
                fragment = (TSqlFragment)tsqlParser.Parse(stringReader, out parseErrors);
            }
            if (parseErrors.Count > 0)
            {
                Console.WriteLine(@"Errors encountered: ""{0}""", parseErrors[0].Message);
            }

            Console.ReadKey();
        }

Works fine.
But if I don't mention the
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

It fails
Errors encountered: "Incorrect syntax near CREATE."
My question is why it is happening....Without SET QUOTED_IDENTIFIER ON OR  SET ANSI_NULLS ON, it is still a valid  stored procedure.
OR is it mandatory to use those? Is there any way to bypass that?

A: Priyanka the issue is that there is a (invisible) 0xFFFE just before your CREATE PROCEDURE text. You can verify this if you use the keyboard, go to the C character and move the cursor to the left. You will find that to the left of the C the cursor does not seem to advance to the left, unless you press the left arrow key again.
0xFFFE is the byte-order marker used to detect Unicode byte ordering, I suspect this has crept into your code in some way. For now, you can simply delete the hidden character by using the DEL or BackSpace key and it would fix it.
Also in future always pass in true to the constructor of the TSql100Parser class. Quoted Identifier handling is ON by default, so we need to respect that in the parser constructor.

A: Read these two articles:
QUOT.ID: http://msdn.microsoft.com/en-us/library/ms188048.aspx
ANSI: http://msdn.microsoft.com/en-us/library/ms174393.aspxIn your case, probably the lack of this latter one causes the issue as your UPDATE gets NULL(s)


text:
Q: TypeScript flat Array to object tree I implement a UI for better Overview about our LDAP branchs.
For that I want to use Angular Materials Tree. It´s great and very intuitiv to click through all branches.
(https://material.angular.io/components/tree/overview)
What I have:
Array of multiple LDAP paths as a String:
groups = [
     'cn=devops,ou=smallUnit1,ou=unit1,o=group1,c=de',
     'cn=devops,ou=smallUnit1,ou=unit1,o=group2,c=de',
     'cn=devops,ou=smallUnit2,ou=unit1,o=group1,c=de',
     'cn=dev,ou=smallUnit1,ou=unit2,o=group1,c=de',
     'cn=dev,ou=smallUnit1,ou=unit1,o=group2,c=de',
     'cn=ops,ou=smallUnit1,ou=unit1,o=group1,c=de'
]

What I already did:
I convertet this Strings to Array of standalone paths with dependencies.
example for groups[0]:
dependencies = [
   {id: 'c=de',          parent: NULL,            child: 'o=group1'},
   {id: 'o=group1',      parent: 'c=de',          child: 'ou=unit1'},
   {id: 'ou=unit1',      parent: 'o=group1',      child: 'ou=smallUnit1'},
   {id: 'ou=smallUnit1', parent: 'ou=unit1',      child: 'cn=devops'},
   {id: 'cn=devops',     parent: 'ou=smallUnit1', child: NULL}

]

What I need:
I need an Object in which all keys are paths of our LDAP:
{
   c=de: {
       o=group1: {
          ou=unit1: {
             ou=smallUnit1: {
                cn=devops: {},
                cn=ops: {}
             }
             ou=smallUnit2: {
                cn=devops: {}
             }
          },
          ou=unit2: {
             ou=smallUnit1: {
                cn=dev: {}
             }
          }
       },
       o=group2: {
          ou=unit1: {
             ou=smallUnit1: {
                cn=devops: {},
                cn=dev: {}
             }
          }
       }
   }
}

I already tried to use methods like that:
Build tree array from flat array in javascript
But this algorithmus use push function to add the new branches to an arraykey. I need that the key is an object with more keys.

A: You could use directly groups, because all information in the reversed order are present, and dependencies is not.
Basically you need to

*

*iterate groups

*split strings of groups

*take the values from the right side as key for an object and return for every step the inner object.

var groups = ['cn=devops,ou=smallUnit1,ou=unit1,o=group1,c=de', 'cn=devops,ou=smallUnit1,ou=unit1,o=group2,c=de', 'cn=devops,ou=smallUnit2,ou=unit1,o=group1,c=de', 'cn=dev,ou=smallUnit1,ou=unit2,o=group1,c=de', 'cn=dev,ou=smallUnit1,ou=unit1,o=group2,c=de', 'cn=ops,ou=smallUnit1,ou=unit1,o=group1,c=de'],
    tree = groups.reduce((object, string) => {
        string
            .split(',')
            .reduceRight((o, k) => o[k] = o[k] || {}, object);
        return object;
    }, {});

console.log(tree);
.as-console-wrapper { max-height: 100% !important; top: 0; }

A: Seems to me that this should do the trick (given your current example data) :

const dependencies = [
   {id: 'c=de',          parent: null,            child: 'o=group1'},
   {id: 'o=group1',      parent: 'c=de',          child: 'ou=unit1'},
   {id: 'ou=unit1',      parent: 'o=group1',      child: 'ou=smallUnit1'},
   {id: 'ou=smallUnit1', parent: 'ou=unit1',      child: 'cn=devops'},
   {id: 'cn=devops',     parent: 'ou=smallUnit1', child: null}
];

let transformed = {};
let tracker = transformed;

dependencies.forEach(d => {
  tracker[d.id] = {};
  tracker = tracker[d.id];
});

console.log(transformed);


text:
Q: Error compiling CSS asset (Compass + Sass + Heroku) I have a site running on Heroku using Compass with Saas an is working fine (compiling assets when pushing to Heroku seems to be fine).
I added a new folder inside assets to namespace other styling, like this
/app/assets/stylesheets/site/site1.css
/app/assets/stylesheets/site/site2.css
/app/assets/stylesheets/site/common/base.css.saas
/app/assets/stylesheets/site/site/site1.css.saas
/app/assets/stylesheets/site/site/site2.css.saas
...

The problem is when I visit a page that use site1.css styling I get the following error
Error compiling CSS asset
Sass::SyntaxError: File to import not found or unreadable: ../compass/css3/text-shadow.
Load path: /app
  (in /app/app/assets/stylesheets/site/common/base.css.sass)

  /app/app/assets/stylesheets/site/common/base.css.sass)

The line that the error refers is this
/app/assets/stylesheets/site/common/base.css.sass
@import "../compass/css3/text-shadow"

I tried both "../compass/css3/text-shadow" and "compass/css3/text-shadow". In both cases I got the same error.
Any idea how to solve this?

A: Solved.
I needed to specify on production.rb file the additional files to compile
config.assets.precompile +=
  Dir["#{Rails.root}/app/assets/stylesheets/site/site/*.*"].collect {|s| "site/" + File.basename(s).gsub(/.scss|.sass/, '') }

Now is working fine.


text:
Q: Make a listview programmatically selectable only I have a Listview in a Fragment, and when I click an item a new Fragment is shown.
The problem is that for few milliseconds i can see the item selected by the touch. Is there a way to make these Listview programmatically selectable only? For example when I return to the Fragment and something connected is running (i already know how to select an item in Java, i just need to know how to disable touch clicks).
The item is colored with a selector and the Listviews are set to choice mode single.

A: One way to do it would be to  implement the ontouchListener() of the fragment, and rewrite the onTouch() method with a simple:
return false
to consume the event.

A: You can achieve this quite easily. The two ways that are on top of my head are :

*

*Disable touch on the list.

*Put your ListView in a RelativeLayout (rootLayout) in the RelativeLayout(rootLayout) first item should be your ListView and the second can be another RelativeLayout(coverLyt) with height and width set as match_parent and clickable set to true. This will make the coverLyt take the touch events instead of your ListView. When you want the listView touch events to work set coverLyt's visibility to gone and visible when vice versa.


text:
Q: Using SqlCommand with SP and without SP Parameteres but just Values in C# Hi it's possible to use the SQLCommand to work with Stored Procedures but without the need of specify the name of each parameter?
We have always to have the names of SP variables in some collection (like array of strings) to work with the SP?
The common use is this:
sqlComm.Parameters.Add("@name_SP_variable", "some_value");

What i mean if it's possible to do something like this:
sqlComm.Parameters.Add("some_value");

If we just send the right number of parameters and in the right order, can't we just put the values without the name of the variables of the SP?

A: Take a look at SqlCommand.DeriveParameters(). This post has an example usage.


text:
Q: Count the words for each country in a textfile via RDD I am trying to write a program to count the word for each country in a textfile via RDD approach.
Sample Data:
India, It is having 1.5 Billion population
India, It is prospering in IT and manufacturing
India, It has lot of natural mineral resources
US, It's global economic hub
US, It outsources IT work to India
US, It's global economic hub
US, It's global economic hub

For example, for "India" - How many times all words count like how many times "It" is repeating?
Result should be looking like this.
India, (It,3) ,(is,2)

...and so on. Same as for US as well.
Since I am using Databricks Notebook, so all other spark session and context is not required, please find the below approach.
val textRdd:RDD[String] = sc.textFile("/FileStore/tables/Data1")

val Rdd2 = textRdd.map(rec => rec.split(","))

val Rdd3 = Rdd2.map(rec => (rec(0),rec(1).split(" "))).collect()

def func(str1:String, arr1:Array[String]):(String,String) = {

  return (str1,arr1(_))

}

Note : Data1 is having data as mentioned above.
Can anyone please help on above?

A: For each pair (Country, word), count can be peformed, and then groupped by country:
// such format: ((India,is),2)
val countryWordCountRDD = textRdd
  .map(rec => rec.split(","))
  .flatMap(r => r.last.trim.split(" ").map(w => (r.head, w)))
  .map((_, 1))
  .reduceByKey((a, b) => a + b)

val result = countryWordCountRDD.map({ case ((country, word), counter) => (country, (word, counter)) })
    .groupByKey()


text:
Q: VBA Macro to delete unchecked rows using marlett check I don't really have much of a background in VBA, but I'm trying to create a macro  where, on the push of a button all rows that do not have a check mark in them in a certain range are deleted. I browsed some forums, and learned about a "marlett" check, where the character "a" in that font is displayed as a check mark. Here is the code I have to generate the "marlett check" automatically when clicking a cell in the A column in the appropriate range:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Target.Cells.Count > 1 Then Exit Sub
        If Not Intersect(Target, Range("A10:A111")) Is Nothing Then
            Target.Font.Name = "Marlett"
                If Target = vbNullString Then
                    Target = "a"
                Else
                    Target = vbNullString
                End If
        End If

End Sub

I then have another macro (assigned to a button) that actually deletes the rows without a check mark in the "A" column when the button is pressed:
Sub delete_rows()

Dim c As Range

On Error Resume Next
For Each c in Range("A10:A111")
    If c.Value <> "a" Then
        c.EntireRow.Delete
    End If
Next c

End Sub

Everything works, but the only problem is that I have to press the button multiple times before all of the unchecked rows are deleted!! It seems like my loop is not working properly -- can anyone please help??
Thanks!

A: I think this may be due to how you're deleting the rows, you might be skipping a row after every delete.
You might want to change your for-each for a regular for loop. so you can control the index you'r working on. see this answer or the other answers to the question to see how to do it.
Heres a modified version that should suit your (possible) problem.
Sub Main()
    Dim Row As Long
    Dim Sheet As Worksheet
    Row = 10
    Set Sheet = Worksheets("Sheet1")
    Application.ScreenUpdating = False
    Do
        If Sheet.Cells(Row, 1).Value = "a" Then
            'Sheet.Rows(Row).Delete xlShiftUp
            Row = Row + 1
        Else
            'Row = Row + 1
            Sheet.Rows(Row).Delete xlShiftUp
        End If
    Loop While Row <= 111
    Application.ScreenUpdating = True
End Sub

Update
Try the edit I've made to the if block, bit of a guess. Will look at it when I have excel.
It does go into an infinite loop regardless of the suggested change.
The problem was when it got near the end of your data it continually found empty rows (as theres no more data!) so it kept deleting them.
The code below should work though.
Sub Main()
    Dim Row As Long: Row = 10
    Dim Count As Long: Count = 0
    Dim Sheet As Worksheet
    Set Sheet = Worksheets("Sheet1")
    Application.ScreenUpdating = False
    Do
        If Sheet.Cells(Row, 1).Value = "a" Then
            Row = Row + 1
        Else
            Count = Count + 1
            Sheet.Rows(Row).Delete xlShiftUp
        End If
    Loop While Row <= 111 And Row + Count <= 111
    Application.ScreenUpdating = True
End Sub


text:
Q: Calculate an integral with $\sin$? How can I calculate the following integral?
$$
\int \left[ \sin((x+x_0)T)\times\sin((x-x_0)T) \right]^{2n} \, \mathrm{d}x
$$
where $x_0$ and $T$ are constants.
Please help, thank you for your help in advance.

A: By the Briggs' formulas,
$$\sin((x+x_0)T)\cdot\sin((x-x_0)T) = \frac{1}{2}\left(\cos(2x_0T)-\cos(2xT)\right),\tag{1}$$
hence, by the binomial theorem:
$$\begin{eqnarray*}\int\left[\sin((x+x_0)T)\cdot\sin((x-x_0)T)\right]^{2n}dx\\ = \frac{1}{4^n}\sum_{j=0}^{2n}\binom{2n}{j}(-1)^j\cos^{2n-j}(2x_0 T)\int \cos^j(2Tx)\,dx\end{eqnarray*}\tag{2}$$
In order to compute the innermost integral, we can use the binomial theorem again:
$$\cos^j(2Tx) = \frac{1}{2^j}\left(e^{2Tix}+e^{-2Tix}\right)^j,$$
$$\begin{eqnarray*}\cos^j(2Tx) &=& \frac{1}{2^j}\sum_{k=0}^j\binom{j}{k} e^{2T(j-2k)ix}\\&=&\frac{2}{2^j}\sum_{k<j/2}\binom{j}{k}\cos(2T(j-2k)x)+\left\{\begin{array}{rc}0&\text{if j is odd}\\\frac{1}{2^j}\binom{j}{j/2}&\text{if j is even}\end{array}\right.\end{eqnarray*}\tag{3}$$
so, integrating:
$$\int\cos^j(2Tx)\,dx\\=\frac{2}{2^j}\sum_{k<j/2}\binom{j}{k}\frac{\sin(2T(j-2k)x)}{2T(j-2k)}+\left\{\begin{array}{rc}0&\text{if j is odd}\\\frac{1}{2^j}\binom{j}{j/2}x&\text{if j is even.}\end{array}\right.\tag{4}$$
As the last step, plug $(4)$ into $(2)$.

A: You can convert the sinusoidal function to exponential function. Then it is much easier to do the indefinite integral.


text:
Q: best way to import external javascript with typescript Currently I have 2 different ways in case I want to load in external code into my typescript file.
If i refer to another typescript file I have to write:
import object = require('./path/to/the/internal/module');

but if I am loading code from an existing js file, I have to do it like that:
/// <reference path="./types/angular/angular.d.ts" />
///<amd-dependency path="angular"/>
var angular:ng.IAngularStatic = require('angular');

is there no way to make these two things look the same? So that i can for instance do something like that:
/// <reference path="./types/angular/angular.d.ts" />
import angular = require('angular');

btw do you recommend me to load the external things like angular, jquery,... via requirejs or globally on its own script tag?

A: Just declare it as an external module
/// <reference path="./types/angular/angular.d.ts" />
declare module 'angular'{
    var angular:ng.IAngularStatic;
    export = angular;
}

// now you can do:
import angular = require('angular');


text:
Q: Exercise 1(a), Section 3.6 of Hoffman's Linear Algebra
Let $n$ be a positive integer and $F$ a field. Let $W$ be the set of all vectors $(x_1,…,x_n)\in F^n$ such that $x_1+…+x_n=0_F$.
(a) Prove that $W^0$ consist of all linear functional $f$ of the form $f((x_1,…,x_n))=c\cdot \sum_{j=1}^nx_j$.

My attempt: $W=\{(x_1,…,x_n)\in F^n|x_1+…+x_n=0_F\}$. Let $f\in W^0\leq (F^n)^*$. Then $f\in (F^n)^*$$=L(F^n,F)$ such that $f(\alpha)=0_F$, $\forall \alpha \in W$. Suppose $\{e_1,…,e_n\}$ is standard basis of $F^n$. It's easy to check $e_1,…,e_n\notin W$. Let $y=(y_1,…,y_n)\in F^n$. Then $f(y)$ $=f(\sum_{i=1}^n y_i\cdot e_i)$ $=\sum_{i=1}^n y_i\cdot f(e_i)$. We claim $f(e_i)=f(e_{i+1})$, $\forall i\in J_{n-1}$. Fix $i\in J_{n-1}$. Let $z=(z_1,…,z_n)$ such that $z_i=1_F$,  $z_{i+1}=-1_F$ and $z_j=0_F$, if $j\neq i,i+1$. So $z\in W$. Then $f(z)$ $=\sum_{j=1}^nz_j\cdot f(e_j)$ $=z_i\cdot f(e_i)+z_{i+1}\cdot f(e_{i+1})$ $=f(e_i)-f(e_{i+1})$ $=0_F$. So $f(e_i)=f(e_{i+1})$. Since $i$ was arbitrary, $f(e_i)=f(e_{i+1})$, $\forall i\in J_{n-1}$. Thus $f(e_i)=c$, $\forall i\in J_n$. Hence $f(y)$ $= \sum_{i=1}^n y_i\cdot f(e_i)$ $= \sum_{i=1}^n y_i\cdot c$ $=c\cdot (\sum_{i=1}^n y_i)$, $\forall y\in F^n$. Is my proof correct?


text:
Q: XNA, alpha testing, stencil buffer and two different projections My question is about using the stencil buffer from another projection as a mask in another projection. I'm not sure how to approach this, so I'll go ahead and lay down some code:
spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, AlwaysStencilState, null, alphaEffect2, Camera.Projection);

// Draw stuff used as a stencil in Camera.Projection space

spriteBatch.End();

spriteBatch.Begin(SpriteSortMode.Immediate, null, SamplerState.PointClamp, EqualStencilState, null, null);

// Draw a background behind

spriteBatch.End();

Alright, so this works if I take the Camera.Projection out of the first equation and render to the screen coordinate space. However, this does NOT work with the Camera projection. My understanding is that the rendering is simply done to the stencil buffer "far far away" compared to the latter draw calls which take place in screen space.
How can I use the stencil of the first operation as a mask for the second one?

A: Alrighty. I found out that I could in fact just use the original effect's projection (0,0,width,height) and set the effect's World matrix to correspond the camera's projection matrix and everything started magically working.


text:
Q: Image from DB in Reporting Services Essentially my problem at a basic level is I cannot get my images to display in SSRS. I get the little box with an 'x' in it. These images are being stored in a SQL db from a web app that I've developed and have control over... getting handled by a web service I also have control over.
There are multiple spots I wonder if I have gone wrong:
On the client I use the javascript FileReader API to instantly render a thumbnail of an uploaded image for display to the user. var reader = new FileReader();
After calling reader.readAsDataURL(file); I put the data into a variable imageURL = reader.result and do some string operations to remove data:image/jpeg;base64, from the (base64 encoded) file data string, then eventually pass this variable to the server using a SOAP envelope.
So, on the server the image data is received by my web service (just a .asmx/not WCF) as a string datatype and then eventually inserted into the database as a SQL VARCHAR(MAX).
In reporting services I drop in an image control and set the image source to "database", the field to my photo field from my dataset and the MIME type to jpeg...which is all appropriate I believe.
So... I believe I am doing nothing wrong in SSRS but perhaps I am doing something wrong on the client in terms of how I'm sending the data?  OR Perhaps I am choosing to store my image data incorrectly. I do have access to the server machine, so maybe saving the images in the file system is what I need to do, but even still my current method seems like it should work.
Please let me know if I need to provide further information.

A: To solve your problem you need to change your database field to be either:

*

*pre-SQL 2012 - image data type

*SQL 2012 - varbinary(max) as image data type has been depreciated

You'll also need to change your web service to upload a byte stream rather than a string.
Even if you're using SQL 2008 or 2008R2 I'd recommend you use the varbinary data type for future proofing of your database model.
To create a test data source for an SSRS report use the following SQL to generate a table entitled ImageTest. You'll need to supply the file path to an image which will be uploaded into the table.
CREATE TABLE ImageTest (
  image_data VARBINARY(MAX));

INSERT INTO ImageTest (image_data)
SELECT image_data
FROM OPENROWSET(
        BULK N'<location of an image file>',
        SINGLE_BLOB) AS ImageSource(image_data);

To try out the table in SSRS create a new report with

*

*dataset pointing to the table ImageTest

*add an image control to the report and point its image source to the column image_data

When you preview the report you should see the report using your image stored in the database.


text:
Q: WCF: Is there a way to remove ExtensionData field? I just started using WCF and I already came to a project-altering issue. I created a service and put in reference in a webservice, but the every field in the webservice xml file comes with an ExtensionData field.
Example:
removed dead ImageShack link
I don't want this. I need it to be only:
removed dead ImageShack link
Is there a way to remove this field? Some different kind of serialization?

A: Most likely, your DataContract classes will be implementing the IExtensibleDataObject interface, right? That's responsible for the ExtensionData field - just remove that interface, and you should be able to remove the ExtensionData fields, too, from your DataContracts.
Marc

A: Setting the property to null prevent it to appear in the resulting xml :
foreach(var elem in arrayOfElements)
{
    elem.ExtensionData = null;
}

A: ExtensionData is used to maintain compatibility across services that may share contracts of different versions.  It can be safely ignored when passing messages.
You may be able to get rid of it by using something other than the DataContract serializer (im thinking old school [Serializable]), but i could be wrong.

A: The ExtensionData is actually a feature that must be built into the type to enable round-tripping. It is always emitted by the DataContractSerializer. One possible way of suppressing this field is using the older XmlSerializer by decorating your service contract interface with the XmlSerializerFormatAttribute.

A: Not answering the question, but maybe this helps...
From MSDN http://msdn.microsoft.com/en-us/library/ms731083.aspx:
The round-tripping feature may be turned off, either by setting ignoreExtensionDataObject to true in the DataContractSerializer constructor or by setting the IgnoreExtensionDataObject property to true on the ServiceBehaviorAttribute. When this feature is off, the deserializer will not populate the ExtensionData property, and the serializer will not emit the contents of the property.

A: If your issue is in an assertion of a [TestMethod] you can use http://www.fluentassertions.com to exclude every ExtensionData properties from your assertions.
Eg.
objToCheck.ShouldBeEquivalentTo(expectedObj, options => options.Excluding(o => o.ExtensionData));

A:
Your class should not inherit IExtensibleDataObject.

Please refer to the description of the Round-tripping below:
The Round-tripping occurs when data is transferred from a new version to an old version and transferred to the new version of the data contract. Bypass ensures that no data is lost. Turning off bypass makes the type ahead compatible with any future changes supported by the contract version model.
To enable trip-tripping for a particular type, the type should execute the

IExtensibleDataObject

interface.
The user interface contains an ExtensionData (ExtensionDataObject) attribute. The property stores any information from future versions of the data contract that is unknown to the current version.

A: decorate your ServiceImplementation with [ServiceBehavior(IgnoreExtensionDataObject=true)]
[ServiceBehavior(IgnoreExtensionDataObject=true)]
public class Service : IService {}


text:
Q: Smoothing a dataset I have a dataset, named data as follows:
data = Transpose[{Table[i, {i, 1, 10, 0.1}],
    N[Table[Log[i] + RandomReal[0.5], {i, 1, 10, 0.1}]]}];

I need to smooth the data using FFTFilters. I can do this in OrginLab software and the results look like the following:
smooth = {{1, 0.55687}, {1.1, 0.57505}, {1.2, 0.59645}, {1.3, 0.62119}, {1.4, 0.64932},
  {1.5, 0.68081}, {1.6, 0.71555}, {1.7, 0.75331}, {1.8, 0.7938}, {1.9, 0.83666},
  {2, 0.88145}, {2.1, 0.92768}, {2.2, 0.97487}, {2.3, 1.02248}, {2.4, 1.07002},
  {2.5, 1.11701}, {2.6, 1.16303}, {2.7, 1.20772}, {2.8, 1.25078}, {2.9, 1.29202},
  {3, 1.3313}, {3.1, 1.36857}, {3.2, 1.40386}, {3.3, 1.43727}, {3.4, 1.46894},
  {3.5, 1.49905}, {3.6, 1.52781}, {3.7, 1.55543}, {3.8, 1.58213}, {3.9, 1.6081},
  {4, 1.6335}, {4.1, 1.65846}, {4.2, 1.68308}, {4.3, 1.70741}, {4.4, 1.73147},
  {4.5, 1.75526}, {4.6, 1.77875}, {4.7, 1.80188}, {4.8, 1.82461}, {4.9, 1.84689},
  {5, 1.86868}, {5.1, 1.88997}, {5.2, 1.91075}, {5.3, 1.93106}, {5.4, 1.95092},
  {5.5, 1.97041}, {5.6, 1.98959}, {5.7, 2.00855}, {5.8, 2.02737}, {5.9, 2.04612},
  {6, 2.06485}, {6.1, 2.08359}, {6.2, 2.10235}, {6.3, 2.12111}, {6.4, 2.13982},
  {6.5, 2.15839}, {6.6, 2.17672}, {6.7, 2.19468}, {6.8, 2.21216}, {6.9, 2.229},
  {7, 2.24507}, {7.1, 2.26026}, {7.2, 2.27446}, {7.3, 2.2876}, {7.4, 2.29962},
  {7.5, 2.31049}, {7.6, 2.32023}, {7.7, 2.32886}, {7.8, 2.33644}, {7.9, 2.34304},
  {8, 2.34873}, {8.1, 2.3536}, {8.2, 2.35774}, {8.3, 2.36123}, {8.4, 2.36416},
  {8.5, 2.36661}, {8.6, 2.36864}, {8.7, 2.37032}, {8.8, 2.37175}, {8.9, 2.37299},
  {9, 2.37417}, {9.1, 2.3754}, {9.2, 2.37684}, {9.3, 2.37869}, {9.4, 2.38116},
  {9.5, 2.38452}, {9.6, 2.38904}, {9.7, 2.39505}, {9.8, 2.40287}, {9.9, 2.41283},
  {10, 2.42525}};

ListPlot[{data, smooth}, Joined -> {False, True}]

Now I have tried to do it in Mathematica to obtain the similar result as got by OriginLab, I did the following operations:
InverseFourier[LowpassFilter[Fourier[Transpose[data][[2]]], 4]];

But I was not able to smooth the above dataset.
So, please help to me to get rid of this.
Thanks in advance

A: You just need to apply the filter on the data itself.
SeedRandom[1111];
data = N[Table[Log[i] + RandomReal[0.5], {i, 1, 10, 0.1}]];
smooth = LowpassFilter[data, 1];
ListPlot[{data, smooth}, PlotStyle -> {Red, Blue}, Joined -> {False, True}]

By adjusting the cutoff frequency, you get better smoothing

Here is a Manipulate:

SeedRandom[1111];
data = N[Table[Log[i] + RandomReal[0.5], {i, 1, 10, 0.1}]];
Manipulate[
 smooth = LowpassFilter[data, wc];
 ListPlot[{data, smooth}, PlotStyle -> {Red, Blue}, Joined -> {False, True}],
 {{wc, 1, "Cut off frequency?"}, 0.01, 2, .01, Appearance -> "Labeled"},
 TrackedSymbols :> {wc}
 ]


text:
Q: ASP.NET WebService how to disable CBC Mode in TLS1.2 i´m builing a WebService and want it to be as secure as possible. I have tested the suporrted Ciphers via NMape. The result was this:
| ssl-enum-ciphers:
|   TLSv1.2:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp384r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
|       TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (dh 2048) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (secp384r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (ecdh_x25519) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp384r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (ecdh_x25519) - A
|       TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A
|       TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|     compressors:
|       NULL
|     cipher preference: server
|_  least strength: A

Now i want to disable als Ciphers that include CBC Mode. How do i do this?
If the Server would be running on Linux i could create a new ciphersuite but on Windows i have no clue.


text:
Q: How to get textbox values on aspx page load Guys I have two pages GridviewWithJquery.aspx and Ekle.aspx.
In the first file when I click the Ekle button, I load Ekle.aspx into the div (with id="content").
After that I tried to get the textbox value located in Ekle.aspx.
I can't get the value with normal syntax ( $("#ekle_gonder").click(function){...}; ) and it didn't enter the click function nor get the textbox values.
How can I get that values?
Below is my code:
GridviewWithJquery.aspx:

<form id="form1" runat="server">

        <asp:GridView ID="gw1" runat="server" AutoGenerateColumns="false" RowStyle-BackColor="#A1DCF2"
            HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White">
            <Columns>
                <asp:BoundField ItemStyle-Width="150px" DataField="Id" HeaderText="Id" />
                <asp:BoundField ItemStyle-Width="150px" DataField="Name" HeaderText="Name" />
                <asp:BoundField ItemStyle-Width="150px" DataField="Surname" HeaderText="Surname" />
                <asp:BoundField ItemStyle-Width="150px" DataField="Sex" HeaderText="Sex" />
                <asp:BoundField ItemStyle-Width="150px" DataField="Email" HeaderText="Email" />
                <asp:BoundField ItemStyle-Width="150px" DataField="City" HeaderText="City" />
                <asp:BoundField ItemStyle-Width="150px" DataField="Age" HeaderText="Age" />
            </Columns>
        </asp:GridView>

        <asp:Table ID="Table1" runat="server">
            <asp:TableRow>
                <asp:TableCell>
                    <input type="button" id="ekle_button" value="Ekle" />
                    <input type="button" id="sil_button" value="Sil" />
                    <input type="button" id="guncelle_button" value="Guncelle" />
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>

Please enter a valid id number.Id should include only numbers.

Please enter a valid name.Name should include only characters, not numbers.

Please enter a valid surname.Surname should include only characters, not numbers.

Please enter a valid email address.Email format should be xxxxx@xxxxx.xxx

Please enter a valid city.City name should include only characters, not numbers

Please enter a valid age number.Age should be include only numbers.

Name can not include numeric values.

Id contains only numbers.

Name can not be empty and can not be include numeric values.

Surname can not be empty and can not include numeric values.

Email format should be like xxxxxx@xxxx.com

City can not be empty and can not be include numeric values.

Age contains only numbers

</form>

Below is ekle.js:
$(document).ready(function () {

var result = 1;
var id, name, surname, email, city, age;

$("#ekle_gonder").click(function () {

    var gender = document.getElementById('<%= ddl1.ClientID%>');
    var gender2 = gender.options[gender.selectedIndex].value;
    check();
    var obj = {};
    obj.Id = id;
    obj.Name = name;
    obj.Surname = surname;
    obj.Sex = gender2;
    obj.Email = email;
    obj.City = city;
    obj.Age = age;

    if (result == 1) {
        $.ajax({
            type: "post",
            url: "GridviewWithJquery.aspx/ekle_func",
            contentType: "application/json;charset:utf-8",
            data: JSON.stringify(obj),
            dataType: "json",
            success: onSuccess,
            error: function (xhr, status, error) {
                alert("no");
                var err = eval("(" + xhr.responseText + ")");
                alert(err.Message);
            }
        });
    }

});

function check() {

    var mailregex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
    var textregex = /^[A-Za-z çğıöşü]{1,25}$/;
    var numregex = /(^\d+$)/;

    id = $("#txt1").val();
    name = $("#txt2").val();
    surname = $("#txt3").val();
    email = $("#txt5").val();
    city = $("#txt6").val();
    age = $("#txt7").val();

    if ((numregex.test(parseInt(id)) == false) || (parseInt(id) < 0)) {
        open_error_box("#ekle_id_error", "#txt1");
    }
    if ((name == '') || (textregex.test(name) == false)) {
        open_error_box("#ekle_name_error", "#txt2");
    }
    if ((surname == '') || (textregex.test(surname) == false)) {
        open_error_box("#ekle_surname_error", "#txt3");
    }
    if ((email == '') || (mailregex.test(email) == false)) {
        open_error_box("#ekle_email_error", "#txt5");
    }
    if ((city == '') || (textregex.test(city) == false)) {
        open_error_box("#ekle_city_error", "#txt6");
    }
    if ((numregex.test(parseInt(age)) == false) || (parseInt(age) < 0) || (parseInt(age) > 100)) {
        open_error_box("#ekle_age_error", "#txt7");
    }
    return result;
}

function open_error_box(error_name, name) {
    $(error_name).dialog("open");
    $(name).val('');
    result = 0;
}

function onSuccess() {

    $("#txt1").val('');
    $("#txt2").val('');
    $("#txt3").val('');
    $("#txt4").val('');
    $("#txt5").val('');
    $("#txt6").val('');
    $("#txt7").val('');
}

$(function () {
    $("#ekle").dialog();

    $("#ekle_id_error ,#ekle_name_error, #ekle_surname_error, #ekle_email_error, #ekle_city_error, #ekle_age_error").dialog(
    {
        autoOpen: false,
        buttons: [{
            text: "OK",
            click: function () { $(this).dialog("close"); }
        }]
    });
})
});

I'm stucked for a couple of hours.
Please show me a way to get the loaded item's value in GridviewWithJquery.aspx page?

A:
I can't get the value with normal syntax (
  $("#ekle_gonder").click(function){...}; ) and it didn't enter the
  click function nor get the textbox values.

Thats because you are referencing the wrong id.
In your HTML you got the following for the button.
<input type="button" id="ekle_button" value="Ekle" />
Notice the id being ekle_button.
On your JS you are attempting to bind on $("#ekle_gonder").click(function () {
When it should be:
$("#ekle_button").click(function () {


text:
Q: how to get avd name of running android emulators in command line? adb devices only give the emulator id. like
List of devices attached
emulator-5554   device

But in eclipse 'Android Device Choose' the avd name(e.g, 2.3) is listed. How to get the info in command line?

Thanks


text:
Q: How can I disable the native fullscreen video button from controls in Firefox and IE? To disable the HTML5 video fullscreen button in Chrome/Safari, this CSS works but not in FF/IE:
video::-webkit-media-controls-fullscreen-button {
        display: none;
    }

I found it in this thread where there is this fiddle that hides the fullscreen button in all browsers.
I duplicated that fiddle in a CodePen and the results are different. The button is hidden in Chrome/Safari but is showing in FF/IE.
I missed something but I'm not sure what.

video::-webkit-media-controls-fullscreen-button {
    display: none;
}
video::-webkit-media-controls-play-button {
   background: red;
}
video::-webkit-media-controls-play-button {}
video::-webkit-media-controls-timeline {}
video::-webkit-media-controls-current-time-display{}
video::-webkit-media-controls-time-remaining-display {}
video::-webkit-media-controls-time-remaining-display {}
video::-webkit-media-controls-mute-button {}
video::-webkit-media-controls-toggle-closed-captions-button {}
video::-webkit-media-controls-volume-slider {}
<video width="400" height="260" controls="">
 <source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4" />
 <source src="http://clips.vorwaerts-gmbh.de/VfE.webm" type="video/webm" />
 <source src="http://clips.vorwaerts-gmbh.de/VfE.ogv" type="video/ogg" />
</video>

A: This is because codepen adds an allowfullscreen attribute on the iframe containing the pen's document, while jsfiddle doesn't.
So a solution for your problem could be to wrap your video in an iframe without this attribute :
frame.contentDocument.body.innerHTML = '<video src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" controls></video>';

<iframe id="frame" width="100%" height="100%" src="about:blank" frameborder="0"></iframe>

Forked codepen : http://codepen.io/anon/pen/ONyELm


text:
Q: PHP PDO INSERT WHERE NOT EXISTS statement not working I have very strange error with insert query to MySQL throught PDO.
I want insert record in table if this record doesnt exists in this table yet.
$query = "INSERT INTO Phrases (KeyText)
            SELECT * FROM (SELECT :key_text) as tmp WHERE NOT EXISTS (SELECT 1 FROM Phrases WHERE KeyText = :key_text)";

    try
    {
        $preparedStatement = $db->prepare($query);
        foreach ($phrases as $phrase)
        {
            $preparedStatement->execute(array(':key_text' => $phrase));
            echo "-";
        }
    }
    catch(PDOException $e)
    {
        echo $e->getMessage();
    }

It throws exeption: Call to a member function execute() on a non-object.
I dont understand where is my error in SQL command. Other pieces of code is correct because when I changed SQL command to other (for example: SELECT :key_text as kt) it works correctly.
Thanks for answers.
UPDATE:
The error is:
[0] => HY000
[1] => 1096
[2] => No tables used
How can I make correct SQL command for MySQL?
Variant with
INSERT INTO Phrases (KeyText)
SELECT :key_text WHERE NOT EXISTS (SELECT 1 FROM Phrases WHERE KeyText = :key_text)

doesnt work in MySQL too.
UPDATE 2:
INSERT INTO Phrases (KeyText)
SELECT :key_text FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM Phrases WHERE KeyText = :key_text)

This query with DUAL table works!

A: Your prepare call is failing, and you've simply assumed it succeeded.
Try
    $preparedStatement = $db->prepare($query) or die($db->errorInfo());

to catch the error.

A: your update2 should work.
ALTERNATIVE:
have unique or primary key on field KeyText
ALTER TABLE `Phrases` ADD UNIQUE INDEX (`KeyText`);

and then use query:
INSERT IGNORE INTO Phrases (KeyText) VALUES (:key_text);

Regarding no changes being recorder please check that you have autocommit on or do commit

A: Sounds like the prepare failed, hence you're attempting to call execute on an invalid object (not a prepared statement object like you're expecting). Check that the return value of prepare is in fact a PDOStatement object and not FALSE

A: INSERT INTO Phrases (KeyText)
    SELECT :key_text
WHERE NOT EXISTS (SELECT * FROM Phrases WHERE KeyText = :key_text)

SQL Server - How to insert a record and make sure it is unique

A: wrong:
insert into table
  select * from (select 1 a, 2 b ) t
  where not exists(select 1 from t2 where t2.c =2)

right:
insert into table
  select * from (select 1 a, 2 b union select 1 a, 2 b) t
  where not exists(select 1 from t2 where t2.c =2)


text:
Q: Firestore query on multiple fields I have a collection
created_at: 28 January 2023 at 14:41:04 UTC+5
id: "e44a154f-b0cb-4ef6-bc27-af37f178b46c"
message: "1 Orders has been uploaded successfully"
read: true
writer: "16315bd844e95c5926a92bda9"

I want to write a query for getting all the records form the notifications collections which are orderBy created_at and where writer === "16315bd844e95c5926a92bda9"
I have tried this query
const ref = collection(db, "notifications")
query(
  ref,
  where("writer", "==", '16315bd844e95c5926a92bda9'),
  orderBy('created_at', 'desc'),
  limit(5)
)

but it does not showing any data.
But when i delete the orderBy part its filtering the collection

A: The query in your question needs a composite index, which (unlike single-field indexes) you need to add yourself.
If you (catch errors and) check the log output, you'll find an error message about a missing index, which included a link to the Firebase console where you can create the index with a single click.


text:
Q: Move git history of deleted file which was actually renamed Git. How can I move history of deleted and pushed file to current file in branch.
I've migrated project to typescript but some files were not marked as git-moved but deleted and then new added, there are several commits and pushes so now I have properly migrated project but some migrated files miss their history.

A: *

*Create a new branch from a commit just before the migration started.

*Perform the migration steps again, using git properly this time.

*Cherry-pick the commits you want on top, from the old branch to the new.

*Reset the old branch to match the new.

*Force push (assuming you have already pushed the old one).

*Tell any collaborators that their next pull will be painful.


text:
Q: How to revert Saints Row 4 to an older version against Steam's wishes? Saints Row 4 released a patch (to include the workshop only) for Windows only recently and broke cross OS multiplayer. We never hit "turn off automatic updates" because we didn't expect over a month of neglect.
I know Steam doesn't allow reverting explicitly, even though they have the old files available. It also forces updates upon you when launching the game unless in offline mode.
Is there a way to install the older version of Saints Row 4, get it to launch on Steam without updating, and play together?


text:
Q: How do I parse this correctly with spirit? My situation: I'm new to Spirit, I have to use VC6 and am thus using Spirit 1.6.4.
I have a line that looks like this:
//The Description;DESCRIPTION;;

I want to put the text DESCRIPTION in a string if the line starts with //The Description;.
I have something that works but looks not that elegant to me:
vector<char> vDescription; // std::string doesn't work due to missing ::clear() in VC6's STL implementation
if(parse(chars,
    // Begin grammar
    (
       as_lower_d["//the description;"]
    >> (+~ch_p(';'))[assign(vDescription)]
    ),
    // End grammar
    space_p).hit)
{
    const string desc(vDescription.begin(), vDescription.end());
}

I would much more like to assign all printable characters up to the next ';' but the following won't work because parse(...).hit == false
parse(chars,
        // Begin grammar
        (
           as_lower_d["//the description;"]
        >> (+print_p)[assign(vDescription)]
        >> ';'
        ),
        // End grammar
        space_p).hit)

How do I make it hit?

A: You're not getting a hit because ';' is matched by print_p.  Try this:
parse(chars,
    // Begin grammar
    (
       as_lower_d["//the description;"]
    >> (+(print_p-';'))[assign(vDescription)]
    >> ';'
    ),
    // End grammar
    space_p).hit)

A: You might try using confix_p:
confix_p(as_lower_d["//the description;"],
         (+print_p)[assign(vDescription)],
         ch_p(';')
        )

It should be equivalent to Fred's response.
The reason your code fails is because print_p is greedy. The +print_p parser will consume characters until it encounters the end of the input or a non-printable character. Semicolon is printable, so print_p claims it. Your input gets exhausted, the variable is assigned, and the match fails — there's nothing left for the last semicolon of your parser to match.
Fred's answer constructs a new parser, (print_p - ';'), which matches everything print_p does, except for semicolons. "Match everything except X, and then match X" is a common pattern, so confix_p is provided as a shortcut for constructing that kind of parser. The documentation suggests using it for parsing C- or Pascal-style comments, but that's not required.
For your code to work, Spirit would need to recognize that the greedy print_p matched too much and then backtrack to allow matching less. But although Spirit will backtrack, it won't backtrack to the "middle" of what a sub-parser would otherwise greedily match. It will backtrack to the next "choice point," but your grammar doesn't have any. See Exhaustive backtracking and greedy RD in the Spirit documentation.


text:
Q: Second order ODE with cubic term -- explicit solution Is there an explicit solution to the differential equation
$$
f''(x)-f'(x)-f(x)^3 =0.
$$

A: Maple doesn't find an "explicit" solution either, but there is a "reduction" to first order: if $t = f(x)$ and $s = f'(x)$, then
$$ s \dfrac{ds}{dt} - s = t^3$$
and we can recover $x$ from
$$ x = \int \dfrac{dt}{s} $$
Of course the constant $f(x) = 0$ is a solution.


text:
Q: The limit passes under the sign of integral I have$f:[a,b)\times[c,d]\rightarrow\mathbb{R}, $ (a) $\lim_{y\to y_0} f(x,y)=l(x)$ uniform with respect to $x$ on any compact included in $[a,b) $ and (b) $\int_{a}^{b-0} f(x,y) dx$ is uniform convergent with respect to $y$ on a neighborhood of $y_0$. Then:$\int_a^{b-0}l(x)dx$ is convergent and $\lim_{y\to y_0}\int_a^{b-0}f(x,y)dx= \int_a^{b-0}\lim{y\to y_0}f(x,y)dx  $
    //I tried to prove it://
Let $\epsilon >0$. from (a) i have: $\exists\delta_\epsilon>0 $ such that $ \forall x\in[a,b) $ and $\forall y \in [c,d] $ with $|y-y_0|<\delta_\epsilon $=>$ |f(x,y)-l(x)|<\epsilon$ now if we put it all under the sign of the integral=>$\int_a^{b-0} |f(x,y)-l(x)|<\int_a^{b-0}\epsilon$ and this show:
$\lim_{y\to y_0}\int_a^{b-0}f(x,y)dx= \int_a^{b-0}\lim{y\to y_0}f(x,y)dx  $
but i don't used (b) and i feel this is wrong can you help me with a proof please?


text:
Q: How do check if user is a valid LDAP user OR a AD user on our domain to access a method? The first part is done using the MVC Authorize tag on the method
Now I need a way to also let user on our AD domain access. So the first thing I have done is created a custom authorization.. The code below shows what I am trying to do.. How do I do it? Or is it a simple addition to my config perhaps?
  public class AuthorizeUserAttribute : AuthorizeAttribute
{
    public string AccessLevel { get; set; }

    protected override bool AuthorizeCore(HttpContextBase httpContext)
    {
        var isAuthorized = base.AuthorizeCore(httpContext);

        //act as normal
        if (isAuthorized)
        {
            return true;
        }
        //check in AD member
        else
        {
            //Some code to check if the user who put the URL in the browser is a AD user on our domain????
            //return true
            //else
            return false;
        }
    }
}


text:
Q: Django rest upload and read excel file I am new to django-rest and want to ask, if there is a simple way to upload an xlsx file and read the data from it with django rest and angular2. I would like to have the possibility to read the file from specific row.
Any help is appreciated. Thank you.


text:
Q: How to compile OpenCV with Boost::Python? I'm trying to compile OpenCV in C++ with boost::python but I keep getting a linker error that I can't quite resolve.
Here is the code below.
cascade_handler.cpp
#include <iostream>

#include <boost/python.hpp>

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/ocl/ocl.hpp>

#include "cascade_handler.h"

using namespace std;
using namespace boost::python;

void CascadeHandler::cascade_classifier_cpu(const string *cascade_file, std::vector<cv::Rect>& objects, double scale_factor, int min_neighbors){
    /*cv::Mat image;
    cv::CascadeClassifier cascade_classifier;

    cascade_classifier.load(*cascade_file);
    cascade_classifier.detectMultiScale(image, objects, scale_factor, min_neighbors, 0 | CASCADE_SCALE_IMAGE, Size(20, 20));
    */
}

void CascadeHandler::cascade_classifier_gpu(const string *cascade_file, std::vector<cv::Rect>& objects, double scale_factor, int min_neighbors){
    /*Mat image;
    cv::CascadeClassifier cascade_classifier;
    */
}

void CascadeHandler::handle(const string cascade_file, std::vector<cv::Rect>& objects, double scale_factor, int min_neighbors)
{

    CascadeHandler cascade_handler;
    cv::CascadeClassifier cascade_classifier;
    //ocl::Context context;

    /*
    if (!cascade_classifier.load(cascade_file)){
        cout << "[!] Error: You must load a Cascade file\n";
    }
    if (objects.empty()){
    }
    if (scale_factor == 0){
        cout << "[!] Error: Unacceptable Scale Factor\n";
    }
    if (min_neighbors == 0){
        cout << "[!] Error: Unacceptable Minimum Neighbors\n";
    }

    if (context.ndevices()){
        cascade_handler.cascade_classifier_gpu(&cascade_file, objects, scale_factor, min_neighbors);
    }
    else if (!context.ndevices()){
        cascade_handler.cascade_classifier_cpu(&cascade_file, objects, scale_factor, min_neighbors);
    }
    */
}

void cascade_handler_wrapper(const string cascade_file, std::vector<cv::Rect>& objects,
                            double scale_factor, int min_neighbors){
    CascadeHandler cascade_handler;
    cascade_handler.handle(cascade_file, objects, scale_factor, min_neighbors);
}

BOOST_PYTHON_MODULE(cascade_handler){
    def("handle", cascade_handler_wrapper);
}

The Header file
#ifndef _CASCADE_HANDLER
#define _CASCADE_HANDLER

#include <iostream>

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/ocl/ocl.hpp>

using namespace std;

class CascadeHandler
{
public:
    void cascade_classifier_cpu(const string *cascade_file, std::vector<cv::Rect>& objects, double scale_factor, int min_neighbors);
    void cascade_classifier_gpu(const string *cascade_file, std::vector<cv::Rect>& objects, double scale_factor, int min_neighbors);
    void handle(const string cascade_file, std::vector<cv::Rect>& objects, double scale_factor, int min_neighbors);
};

#endif

The Makefile
CPP = g++
CPPFLAGS = -g -Wall -std=c++11

INCLUDES = -I /usr/local/include
LDFLAGS = -L /usr/local/lib
ARCH := $$(getconf LONG_BIT)

CUDA_PATH = /opt/cuda
CUDA_LDFLAGS = -L$(CUDA_PATH)/lib$(ARCH)
CUDA_INCLUDES = -I$(CUDA_PATH)/include

OPENCV_LDFLAGS = $(CUDA_LDFLAGS)
OPENCV_LIBS = $$(pkg-config --libs opencv)
OPENCV_INCLUDES = $$(pkg-config --cflags opencv) $(CUDA_INCLUDES)

PYTHON_VER = 2
ifeq ($(PYTHON_VER), 2)
  BOOST_LIBS = -lboost_python
else
  BOOST_LIBS = -lboost_python$(PYTHON_VER)
endif
PYTHON_LIBS = $$(pkg-config --libs python$(PYTHON_VER))
PYTHON_INCLUDES = $$(pkg-config --cflags python$(PYTHON_VER))

TARGET = cascade_handler

all: $(TARGET).so

$(TARGET).so: $(TARGET).o
    $(CPP) -shared  -Wl,--export-dynamic $(LDFLAGS) \
    $(OPENCV_LIBS) $(BOOST_LIBS) $(PYTHON_LIBS) \
    $(TARGET).o -o $(TARGET).so

$(TARGET).o: $(TARGET).cpp
    $(CPP) $(CPPFLAGS) $(INCLUDES) $(OPENCV_INCLUDES) $(PYTHON_INCLUDES) \
    -fPIC -c $(TARGET).cpp

clean:
    rm -f *.o *.so

And the Output
g++ -shared  -Wl,--export-dynamic -L /usr/local/lib \
    $(pkg-config --libs opencv) -lboost_python $(pkg-config --libs python2) \
    cascade_handler.o -o cascade_handler.so
ld: unknown option: --export-dynamic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [cascade_handler.so] Error 1

The linker error is the thing I can't quite fix. I wanted to have everything compile on a Makefile because I couldn't find a way to compile OpenCV with the setup.py you normally use when using boost::python. I've also read that some people have been using numpy to wrap their code in and then compile that way, but I was wondering if this method may also work? I also have most of the code commented out because I just wanted to test if it would compile by just have the class cv::CascadeClassifier cascade_classifier;


text:
Q: OAuth Auth Code Flow and SSO Initiated by API Provider For this flow, the user (resource owner) starts in the UI of the API Provider (resource server). The aim is to transfer the user to an oauth client UI where the client app will be able to call APIs in the originating resource server. Note the client app is likely to be closely affiliated with the API Provider (e.g. a cloud service that has the same owner as the API Provider). An option is to send the user to the  client which then initiates the usual auth code flow process, but it seems that this could be streamlined by just redirecting to the redirect_uri from the resource server to begin with. Probably best shown by a comparison of the two flow:
Standard OIDC OAuth SSO-type flow:
1) User in client UI.
2) Client directs user to API Provider (auth server).
3) User log-in in to auth server.
4) Authorize client app (/authorize).
5) Redirect to client providing auth code to redirect_uri for client.
6) Client uses auth code to obtain access_token and id_token (/token).
Abbreviated flow:
1) User is in API Provider UI.
2) User does activity which requires handoff to client.
3) Authorize client app (/authorize).
3) Redirect to client providing auth code to redirect_uri for client.
5) Client uses auth code to obtain access_token and id_token. (/token)
Note steps 3 - 5 in abbreviated flow correspond to steps 4 - 6 in standard flow. Since the user starts in the API+Identity Provider, it seems unnecessary to send user to third party so that they can start the flow.
I am wondering what pitfalls there are with the abbreviated flow - for example, there is no state parameter from the client, but the process is started by the API Provider, so I am not sure that there needs to be. Is there a more suitable flow to use than the abbreviated flow described above to hand off to a client app?