text:
Q: Trouble editing color to bootstrap mobile friendly Nav-bar I am trying to edit my sites Mobile Friendly nav-bar but when i try edit it's CSS color it changes color to the regular nav-bar scrolling effect. I am trying to figure out how to edit change to colors to just the Mobile Friendly nav-bar only, Would anybody have any idea how that would be possible?
you can view the website: Nav-bar Problem
and also view it from it's mobile size to get a better idea of what i am trying to do.
HTML:
html,
body {
background-color: #ccc;
width: 100%;
height: 100%;
}

body {
font-family: Merriweather,'Helvetica Neue',Arial,sans-serif;
}

hr {
max-width: 50px;
border-color: #f05f40;
border-width: 3px;
    border-top: 0px;
}

hr.light {
border-color: #fff;
}

a {
color: #fff;
-webkit-transition: all .35s;
-moz-transition: all .35s;
transition: all .35s;
}

a:hover,
a:focus {
color: #eb3812;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Yellowtail', 'cursive';
}

p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
    color: #fff;
}

.bg-primary {
        opacity: 1;
    top: 0px;
    box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 5px 0px;
    background: linear-gradient(rgba(231, 90, 144, 0.6) 0%, rgba(227, 89, 143, 0.81) 44%, rgb(221, 129, 164) 100%);
}

.bg-dark {
    color: #fff;
    background-color: #222;
}

.text-faded {
    color: rgba(255,255,255,.7);
}

section {
    padding: 100px 0;
    opacity: 1;
    top: 0px;
    box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 5px 0px;
    background: linear-gradient(rgb(70, 70, 90) 0%, rgb(70, 70, 90) 44%, rgb(127, 129, 136) 100%);

}

aside {
    padding: 50px 0;
}

.no-padding {
    padding: 0;
}

.overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-color:  rgba(8, 13, 21, 0.3);
    opacity: .5;
}

.navbar-default {

    font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;

    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;
}

.navbar-default .navbar-header .navbar-brand {
    text-transform: uppercase;
    font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
    font-weight: 700;
    color: #fff;
}

.navbar-default .navbar-header .navbar-brand:hover,
.navbar-default .navbar-header .navbar-brand:focus {
    color: #eb3812;
}

.navbar-default .nav > li>a,
.navbar-default .nav>li>a:focus {
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 700;
    color: #222;
}

.navbar-default .nav > li>a:hover,
.navbar-default .nav>li>a:focus:hover {
    color: #f05f40;
}

.navbar-default .nav > li.active>a,
.navbar-default .nav>li.active>a:focus {
    color: #fff!important;
    background-color: transparent;
}

.navbar-default .navbar-toggle .icon-bar {
    background-color: #FFF;
}

.navbar-default .nav > li.active>a:hover,
.navbar-default .nav>li.active>a:focus:hover {
    background-color: transparent;
}

.collapse navbar-collapse a{
    background: #ccc;
}

@media(min-width:768px) {
    .navbar-default {
        border-color: rgba(255,255,255,.3);
        background-color: transparent;
    }

    .navbar-default .navbar-header .navbar-brand {
        color: #fff;
     font-family: 'Sacramento', cursive;
        font-size: 30px;
        text-transform: none;
    }

    .navbar-default .navbar-header .navbar-brand:hover,
    .navbar-default .navbar-header .navbar-brand:focus {
        color: #fff;
    }

    .navbar-default .nav > li>a,
    .navbar-default .nav>li>a:focus {
        color: rgba(255,255,255,.7);
    }

    .navbar-default .nav > li>a:hover,
    .navbar-default .nav>li>a:focus:hover {
        color: #fff;
    }

    .navbar-default.affix {
    border-color: rgba(34,34,34,.05);
    opacity: 1;
    top: 0px;
    box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 5px 0px;
    background: linear-gradient(rgb(231, 90, 144) 0%, rgb(227, 89, 143) 44%, rgba(238, 64, 131, 0.760784) 100%);
    }

    .navbar-default.affix .navbar-header .navbar-brand {
        font-size: 22px;
        color: #fff;
    }

    .navbar-default.affix .navbar-header .navbar-brand:hover,
    .navbar-default.affix .navbar-header .navbar-brand:focus {
        color: #46465A;
    }

  .navbar-default.affix .nav > li>a, .navbar-default.affix .nav>li>a:focus {
    color: #46465A;
}

    .navbar-default.affix .nav > li>a:hover,
    .navbar-default.affix .nav>li>a:focus:hover {
        color: #fff;
    }
}

header {
    position: relative;
    width: 100%;
    min-height: auto;
    text-align: center;
    color: #fff;
    background-image: url(../img/header.jpg);
    background-position: center;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    background-size: cover;
    -o-background-size: cover;
}

header .header-content {
    position: relative;
    width: 100%;
    padding: 100px 15px;
    text-align: center;
}

header .header-content .header-content-inner h1 {
    margin-top: 0;
    margin-bottom: 0;
    text-transform: uppercase;
    font-weight: 700;
}

header .header-content .header-content-inner hr {
    margin: 30px auto;
}

header .header-content .header-content-inner p {
    margin-bottom: 50px;
    font-size: 16px;
    font-weight: 300;
    color: rgba(255,255,255,.7);
}

@media(min-width:768px) {
    header {
        min-height: 100%;
    }

    header .header-content {
        position: absolute;
        top: 50%;
        padding: 0 50px;
        -webkit-transform: translateY(-50%);
        -ms-transform: translateY(-50%);
        transform: translateY(-50%);
    }

    header .header-content .header-content-inner {
        margin-right: auto;
        margin-left: auto;
        max-width: 1000px;
    }

    header .header-content .header-content-inner p {
        margin-right: auto;
        margin-left: auto;
        max-width: 80%;
        font-size: 18px;
    }
}

.section-heading {
    margin-top: 0;
    color: #fff;
}

.service-box {
    margin: 50px auto 0;
    max-width: 400px;
}

@media(min-width:992px) {
    .service-box {
        margin: 20px auto 0;
    }
}

.service-box p {
    margin-bottom: 0;
}

.portfolio-box {
    display: block;
    position: relative;
    margin: 0 auto;
    max-width: 650px;

}

.portfolio-box .portfolio-box-caption {
    display: block;
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    color: #fff;
    opacity: 0;
    background: rgba(216, 27, 100, 0.51);
    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;

}

.portfolio-box .portfolio-box-caption .portfolio-box-caption-content {
    position: absolute;
    top: 50%;
    width: 100%;
    text-align: center;
    transform: translateY(-50%);
}

.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category,
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
    padding: 0 15px;
    font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
}

.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category {
    text-transform: uppercase;
    font-size: 14px;
    font-weight: 600;
}

.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
    font-size: 18px;
}

.portfolio-box:hover .portfolio-box-caption {
    opacity: 1;
}

@media(min-width:768px) {
    .portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category {
        font-size: 16px;
    }

    .portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
        font-size: 22px;
    }
}

.call-to-action h2 {
    margin: 0 auto 20px;
}

.text-primary {
    color: #f05f40;
}

.no-gutter > [class*=col-] {
    padding-right: 0;
    padding-left: 0;
}

.btn-default {
    border-color: #fff;
    color: #222;
    background-color: #fff;
    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;
}

.btn-default:hover,
.btn-default:focus,
.btn-default.focus,
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
    border-color: #ededed;
    color: #222;
    background-color: #f2f2f2;
}

.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
    background-image: none;
}

.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
    border-color: #fff;
    background-color: #fff;
}

.btn-default .badge {
    color: #fff;
    background-color: #222;
}

.btn-primary {
    border-color: #f05f40;
    color: #fff;
    background-color: #f05f40;
    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary.focus,
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
    border-color: #ed431f;
    color: #fff;
    background-color: #ee4b28;
}

.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
    background-image: none;
}

.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
    border-color: #f05f40;
    background-color: #f05f40;
}

.btn-primary .badge {
    color: #f05f40;
    background-color: #fff;
}

.btn {
    border: 0;
    border-radius: 300px;
    text-transform: uppercase;
    font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
    font-weight: 700;
}

.btn-xl {
    padding: 15px 30px;
}

::-moz-selection {
    text-shadow: none;
    color: #fff;
    background: #222;
}

::selection {
    text-shadow: none;
    color: #fff;
    background: #222;
}

img::selection {
    color: #fff;
    background: 0 0;
}

img::-moz-selection {
    color: #fff;
    background: 0 0;
}

body {
    webkit-tap-highlight-color: #222;
}

.fa-phone:before {
    content: "\f095";
    color: #fff;
  }

.fa-envelope-o:before {
    content: "\f003";
    color: #fff;
  }

CSS:
html,
body {
    background-color: #ccc;
    width: 100%;
    height: 100%;
}

body {
    font-family: Merriweather,'Helvetica Neue',Arial,sans-serif;
}

hr {
    max-width: 50px;
    border-color: #f05f40;
    border-width: 3px;
        border-top: 0px;
}

hr.light {
    border-color: #fff;
}

a {
    color: #fff;
    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;
}

a:hover,
a:focus {
    color: #eb3812;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Yellowtail', 'cursive';
}

p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
    color: #fff;
}

.bg-primary {
        opacity: 1;
    top: 0px;
    box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 5px 0px;
    background: linear-gradient(rgba(231, 90, 144, 0.6) 0%, rgba(227, 89, 143, 0.81) 44%, rgb(221, 129, 164) 100%);
}

.bg-dark {
    color: #fff;
    background-color: #222;
}

.text-faded {
    color: rgba(255,255,255,.7);
}

section {
    padding: 100px 0;
    opacity: 1;
    top: 0px;
    box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 5px 0px;
    background: linear-gradient(rgb(70, 70, 90) 0%, rgb(70, 70, 90) 44%, rgb(127, 129, 136) 100%);

}

aside {
    padding: 50px 0;
}

.no-padding {
    padding: 0;
}

.overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-color:  rgba(8, 13, 21, 0.3);
    opacity: .5;
}

.navbar-default {

    font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;

    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;
}

.navbar-default .navbar-header .navbar-brand {
    text-transform: uppercase;
    font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
    font-weight: 700;
    color: #fff;
}

.navbar-default .navbar-header .navbar-brand:hover,
.navbar-default .navbar-header .navbar-brand:focus {
    color: #eb3812;
}

.navbar-default .nav > li>a,
.navbar-default .nav>li>a:focus {
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 700;
    color: #222;
}

.navbar-default .nav > li>a:hover,
.navbar-default .nav>li>a:focus:hover {
    color: #f05f40;
}

.navbar-default .nav > li.active>a,
.navbar-default .nav>li.active>a:focus {
    color: #fff!important;
    background-color: transparent;
}

.navbar-default .navbar-toggle .icon-bar {
    background-color: #FFF;
}

.navbar-default .nav > li.active>a:hover,
.navbar-default .nav>li.active>a:focus:hover {
    background-color: transparent;
}

.collapse navbar-collapse a{
    background: #ccc;
}

@media(min-width:768px) {
    .navbar-default {
        border-color: rgba(255,255,255,.3);
        background-color: transparent;
    }

    .navbar-default .navbar-header .navbar-brand {
        color: #fff;
     font-family: 'Sacramento', cursive;
        font-size: 30px;
        text-transform: none;
    }

    .navbar-default .navbar-header .navbar-brand:hover,
    .navbar-default .navbar-header .navbar-brand:focus {
        color: #fff;
    }

    .navbar-default .nav > li>a,
    .navbar-default .nav>li>a:focus {
        color: rgba(255,255,255,.7);
    }

    .navbar-default .nav > li>a:hover,
    .navbar-default .nav>li>a:focus:hover {
        color: #fff;
    }

    .navbar-default.affix {
    border-color: rgba(34,34,34,.05);
    opacity: 1;
    top: 0px;
    box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 5px 0px;
    background: linear-gradient(rgb(231, 90, 144) 0%, rgb(227, 89, 143) 44%, rgba(238, 64, 131, 0.760784) 100%);
    }

    .navbar-default.affix .navbar-header .navbar-brand {
        font-size: 22px;
        color: #fff;
    }

    .navbar-default.affix .navbar-header .navbar-brand:hover,
    .navbar-default.affix .navbar-header .navbar-brand:focus {
        color: #46465A;
    }

  .navbar-default.affix .nav > li>a, .navbar-default.affix .nav>li>a:focus {
    color: #46465A;
}

    .navbar-default.affix .nav > li>a:hover,
    .navbar-default.affix .nav>li>a:focus:hover {
        color: #fff;
    }
}

header {
    position: relative;
    width: 100%;
    min-height: auto;
    text-align: center;
    color: #fff;
    background-image: url(../img/header.jpg);
    background-position: center;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    background-size: cover;
    -o-background-size: cover;
}

header .header-content {
    position: relative;
    width: 100%;
    padding: 100px 15px;
    text-align: center;
}

header .header-content .header-content-inner h1 {
    margin-top: 0;
    margin-bottom: 0;
    text-transform: uppercase;
    font-weight: 700;
}

header .header-content .header-content-inner hr {
    margin: 30px auto;
}

header .header-content .header-content-inner p {
    margin-bottom: 50px;
    font-size: 16px;
    font-weight: 300;
    color: rgba(255,255,255,.7);
}

@media(min-width:768px) {
    header {
        min-height: 100%;
    }

    header .header-content {
        position: absolute;
        top: 50%;
        padding: 0 50px;
        -webkit-transform: translateY(-50%);
        -ms-transform: translateY(-50%);
        transform: translateY(-50%);
    }

    header .header-content .header-content-inner {
        margin-right: auto;
        margin-left: auto;
        max-width: 1000px;
    }

    header .header-content .header-content-inner p {
        margin-right: auto;
        margin-left: auto;
        max-width: 80%;
        font-size: 18px;
    }
}

.section-heading {
    margin-top: 0;
    color: #fff;
}

.service-box {
    margin: 50px auto 0;
    max-width: 400px;
}

@media(min-width:992px) {
    .service-box {
        margin: 20px auto 0;
    }
}

.service-box p {
    margin-bottom: 0;
}

.portfolio-box {
    display: block;
    position: relative;
    margin: 0 auto;
    max-width: 650px;

}

.portfolio-box .portfolio-box-caption {
    display: block;
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    color: #fff;
    opacity: 0;
    background: rgba(216, 27, 100, 0.51);
    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;

}

.portfolio-box .portfolio-box-caption .portfolio-box-caption-content {
    position: absolute;
    top: 50%;
    width: 100%;
    text-align: center;
    transform: translateY(-50%);
}

.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category,
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
    padding: 0 15px;
    font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
}

.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category {
    text-transform: uppercase;
    font-size: 14px;
    font-weight: 600;
}

.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
    font-size: 18px;
}

.portfolio-box:hover .portfolio-box-caption {
    opacity: 1;
}

@media(min-width:768px) {
    .portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category {
        font-size: 16px;
    }

    .portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
        font-size: 22px;
    }
}

.call-to-action h2 {
    margin: 0 auto 20px;
}

.text-primary {
    color: #f05f40;
}

.no-gutter > [class*=col-] {
    padding-right: 0;
    padding-left: 0;
}

.btn-default {
    border-color: #fff;
    color: #222;
    background-color: #fff;
    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;
}

.btn-default:hover,
.btn-default:focus,
.btn-default.focus,
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
    border-color: #ededed;
    color: #222;
    background-color: #f2f2f2;
}

.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
    background-image: none;
}

.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
    border-color: #fff;
    background-color: #fff;
}

.btn-default .badge {
    color: #fff;
    background-color: #222;
}

.btn-primary {
    border-color: #f05f40;
    color: #fff;
    background-color: #f05f40;
    -webkit-transition: all .35s;
    -moz-transition: all .35s;
    transition: all .35s;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary.focus,
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
    border-color: #ed431f;
    color: #fff;
    background-color: #ee4b28;
}

.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
    background-image: none;
}

.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
    border-color: #f05f40;
    background-color: #f05f40;
}

.btn-primary .badge {
    color: #f05f40;
    background-color: #fff;
}

.btn {
    border: 0;
    border-radius: 300px;
    text-transform: uppercase;
    font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
    font-weight: 700;
}

.btn-xl {
    padding: 15px 30px;
}

::-moz-selection {
    text-shadow: none;
    color: #fff;
    background: #222;
}

::selection {
    text-shadow: none;
    color: #fff;
    background: #222;
}

img::selection {
    color: #fff;
    background: 0 0;
}

img::-moz-selection {
    color: #fff;
    background: 0 0;
}

body {
    webkit-tap-highlight-color: #222;
}

.fa-phone:before {
    content: "\f095";
    color: #fff;
}

.fa-envelope-o:before {
    content: "\f003";
    color: #fff;
}

Thank you!

A: Since your CSS is bundled I'm not sure what file this property is in but changing the background-color with the snippet below allowed me to only change mobile:
.navbar-default {
    background-color: #f8f8f8;
    border-color: #e7e7e7;
}

Changed to:
.navbar-default {
        background-color: green;
        border-color: #e7e7e7;
    }


text:
Q: Oldest laptop to have App Store My sons have iBook G4 laptops and are wanting to upgrade to a Mac that has App Store and iTunes so they can manage their iPods. Can someone please tell me what is the oldest laptop to have those capabilities?

A: The first appearance of the Mac App Store was 10.6.6 Snow Leopard.
Any Intel-based Mac will accommodate Snow Leopard. A list of Intel-based Macs can be found here and at Apple's detailed system build versions for Intel Macs. So the original MacBook Pro from February 2006 would be the oldest portable that can run the Mac App Store.
Depending on which iOS device they have, you might need Lion or even Mountain Lion to run a version of iTunes for some newer devices like the iPad mini or iPhone 5.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Возможно ли реализовать наследование двух SomeExeption1\2 классов от MyExeption класса? Создал два класса:

*

*SomeExeption1

*SomeExeption2

которые наследуют класс MyExeption.
Можно ли реализовать программу в таком ключе:
public class MyExeption : Exception
    {
        public MyException(string message) : base(message)
        { }
    }

class SomeException1\2 : MyException
    {
        public SomeException1\2(string message) : base(message)
        { }
    }

Если нет, не могли бы подксазать, как это реализовать, важно чтобы SomeException1\2 были наследниками MyException.

A: public class MyException : Exception
{
    public MyException(string message) : base(message) { }
}
class SomeExceptionFirst : MyException
{
    public SomeExceptionFirst(string message) : base(message) { }
}
class SomeExceptionSecond : MyException
{
    public SomeExceptionSecond(string message) : base(message) { }
}

throw new SomeExceptionFirst("first"); //Submission#0+SomeExceptionFirst: first
throw new SomeExceptionSecond("second"); //Submission#1+SomeExceptionSecond: second


text:
Q: c++ formating error with cstrings when using tolower Hi so I am trying to take a cstring and make it lowercase, but when I am printing the cstring at the end I am getting a weird format box where some of the letters should be. Do anyone have any ideas?
#include <string>
#include <iostream>
#include <string.h>

using namespace std;

int main ()
{
    int i=0;
    char* str="TEST";
    char c;
    char* cstr = new char[strlen(str) + 1];
    while (str[i])
    {
        c = str[i];
        c = tolower(c);
        strcat(cstr, &c);
        i++;
    }

    cout << cstr << endl;
    return 0;
}

A: The problem is that you are calling strcat incorrectly. The second parameter is not a null-terminated string.
You really don't need to call strcat at all. Just write directly to the output string:
Try:
  while (str[i])
  {
    c = str[i];
    c = tolower(c);
    cstr[i] = c;
        i++;
  }
  cstr[i] = 0;

or, equivalently:
while(str[i])
{
  cstr[i] = tolower(str[i]);
  i++;
}
cstr[i] = 0;

A: strcat expects a null-terminated char*, so by giving the address of a local char you are invoking undefined behavior.
Additionally, new char[std::strlen(str) + 1] does not initialize the array to 0s, meaning cstr won't be properly null-terminated either; adding () to the new[] causes the array to be value-initialized.
Try this instead:
#include <cstddef>
#include <cctype>
#include <cstring>
#include <ostream>
#include <iostream>

int main()
{
    char const* str = "TEST";
    char c[2] = { };
    char* cstr = new char[std::strlen(str) + 1]();
    std::size_t i = 0;
    while (str[i])
    {
        c[0] = static_cast<char>(std::tolower(str[i++]));
        std::strcat(cstr, c);
    }
    std::cout << cstr << std::endl;
    delete [] cstr;
}

A: The second argument of strcat is supposed to be a null terminated string, not the address of a single character. strcat isn't appropriate for this use.
int main ()
{
    const char* str="TEST";
    char* cstr = new char[strlen(str) + 1];
    cstr[strlen(str)] = 0;
    for (int i = 0; str[i]; ++i) {
        cstr[i] = tolower(str[i]);
    }
    cout << cstr << endl;
}

A: #include <cstddef>
#include <cctype>
#include <cstring>
#include <ostream>
#include <iostream>

#include <string>

int main()
{
    std::string str = "TEST";
    std::string cstr;

    for (std::string::const_iterator it = str.begin(); it!= str.end(); ++it)
        cstr.push_back(tolower(*it));

    std::cout << cstr << std::endl;
}

Or even shorter:
#include <algorithm>
#include <iterator>

...
    std::transform(str.begin(), str.end(), std::back_inserter(cstr), tolower);


text:
Q: Приоритет операций Не могу понять одну странность с приоритетом операторов в C++
void mass(int* der, int* a)
{
cout << der << endl; //der = 0009D870
*der = 5;
cout << der << endl; //der = 0009D870
*(der++) = 9; //тут проблема
cout << der << endl; //der = 0009D874 (инкрементируется также и при записи *++der)
}
void main()
{
int* der = new int[2];
der[0] = 3;
der[1] = 3;
mass(der, &der[1]);
cout « der[0] « '\n' « der[1];
}

Если записать так: *(der++), то сначала происходит разыменование, а потом инкремент, несмотря на скобки. Значение элемента der[0] меняется на 5, а потом на 9.
Если записать так: *++der, то происходит сначала инкремент, потом разыменование, значение элемента массива der[0] меняется на 5, а der[1] на 9.
Почему так происходит?

A: Приоритет операций в языках С и С++ не имеет прямого отношения к порядку их выполнения. Приоритет операций описывает лишь группировку между операторами и операндами во внешне неоднозначных случаях, т.е. отвечает на вопрос о том, какой оператор относится к какому оператору.
(Формально в С и С++ нет никакого "приоритета операций", а есть только грамматика, которая и задает такую группировку. Так называемый приоритет операций - это лишь упрощенный и более удобный способ запоминания этой группировки.)
Вы также наделяете термин выполняется некоей атомарностью, которой у него на самом нет. У каждого оператора, у каждого подвыражения в С и С++ обычно есть результат и потенциально есть побочные эффекты. Вычисление результата оператора (value computation) - это одна часть процесса выполнения оператора, а материализация его побочных эффектов - это другая часть процесса его выполнения. Эти части выполняются в общем случае независимо друг от друга, в совершено разные моменты времени. То есть выполнение оператора в полном объеме может быть "размазано" по всему процессу вычисления полного выражения.

Если записать так: *(der++), то сначала происходит разыменование, а потом инкремент, несмотря на скобки.

Здесь написана какая-то ерунда. Никакого "сначала происходит разыменование" тут нет и быть не может.
Из-за скобок никакой внешней неоднозначности тут нет: ++ относится к der, а * относится к результату ++. Сначала вычисляется именно результат ++. Так как это постфиксный ++, его результатом должно быть старое значение der. Что вы и наблюдаете.
И совершенно не важно, произошло ли уже изменение значения переменной der в момент применения оператора *. Может произошло, а может нет. Главное, что ++ в качестве результата вернул старое значение и именно старое значение попало на вход оператору *. Это все, что вас должно беспокоить: * применяется к старому значению der. Всякие "сначала" и "потом" вас беспокоить не должны вообще.
Скобки тут ни на что не влияют. Их можно убрать и тогда для правильного понимания внешне неоднозначного выражения придется применить приоритеты. Так как постфиксные операторы всегда обладают бОльшим приоритетом, чем префиксные, выражение *der++ разбирается как *(der++).

Если записать так: *++der, то происходит сначала инкремент, потом разыменование

В этом выражении неоднозначности нет и приоритеты никакой роли не играют вообще. ++ относится к der, а * применен к результату ++.
Опять же, важно тут не то, что выполняется первым, а что вторым, а только то, что результат префиксного ++ - это новое значение der. То есть * должен применяться к увеличенному на 1 значению der.
Здесь, кстати, языки С и С++ формально ведут себя по-разному. Язык С++ гарантирует, что когда оператор * получает на вход увеличенное значение der, сама переменная der тоже уже получила новое значение. А вот язык С такого не гарантирует: оператор * тоже получает на вход увеличенное значение der, но вот было ли к этому моменту уже выполнена модификация самой перменной der - не оговаривается.

A: int a[3]{};
int* der = a;  //der содержит адрес первого элемента массива
int* p = der++;

указатель p тоже содержит  адрес первого элемента, но  der уже(сразу после выражения) указывает на второй элемент
int* q = ++p;

q указывает на второй элемент, т.е. q == der , так что тут скобки роли не играют, дело в результате постфиксного и префиксного инкремента


text:
Q: Neural Network cannot learn a simple function I am trying to train a simple neural network for regression, where the underlying function is a quadratic. Training data is generated by this underlying function, and I am just trying to get a network to learn this function.
This underlying function is $y = (x - 0.5)^2$, and I have generated 100 samples with $x$ from 0.0 to 1.0. Then, I train the network to take $x$ as input, and regress to the corresponding $y$. Training is done in batches, until the training loss converges.
However, my network cannot learn this function, even though it is very simple. These graphs show what is going on:

The top graph is the training data (one circle per datum), showing the underlying quadratic function. The second graph is the final network's predictions with the same inputs as the training data (i.e. 100 samples with $x$ from 0.0 to 1.0). The third graph overlays these two, and the fourth graph shows the training loss over time.
It is clear that the network is not learning the underlying function, and seems to be fitting a linear function to the best of its ability. However, my network has two hidden layers, with non-linear ReLU activations, and so should certainly be able to learn a quadratic function.
Here is the code for setting up and training the network:
# Create the neural  network
model = Sequential()
model.add(Dense(16, input_shape=(1,)))
model.add(Activation('relu'))
model.add(Dense(16, input_shape=(1,)))
model.add(Activation('relu'))
model.add(Dense(1))
sgd = SGD(lr=0.001)
model.compile(loss='mean_squared_error', optimizer=sgd)

# Create the training data
inputs = np.zeros((100, 1), dtype=np.float32)
targets = np.zeros((100, 1), dtype=np.float32)
for i in range(100):
    inputs[i] = 0.01 * i
    targets[i, 0] = np.power((inputs[i] - 0.5), 2)

# Training loop
while True:
    # Perform one weight update
    loss = model.train_on_batch(inputs, targets)

A: The problem is the activation function.
Note, the output is linear. So it shows the activation function (non-linear) part is not working well. Note, relu is $f(x)=\max (0,x)$, it is linear on $x>0$.
Instead of using relu using sigmoid or tanh may fix the problem.


text:
Q: Append List Item Count jQuery I am using this to populate a list depending on the values of multiple select boxes:
$(document).ready(function() {
    $("select").change(function() { // <-- bind change event handler to the drop downs
        var sel = "";
        $(".option-select option:selected").each(function() { // <-- then iterate each time it changes
            if ($(this).index() !== 0) { // <-- only if not default
                sel += "
" + $(this).text() + "
";
            }
            $("ul.result ul").empty().append(sel); //<-- empty() to remove old list and update with new list
        });
    });
});

However, I cannot figure out how to print the number of options added to the list, or number of select boxes with a value chosen. I need to tell the user how many options they have chosen along with displaying those options like I already have. I  have found how to count the number of items in a list using:
var count = $("ul li").length;

But cannot figure out how to print this count.

A: Could done this way
    $(document).ready(function() {
    $("select").change(function() { // <-- bind change event handler to the drop downs
        var sel = "";
        var counter = 0;
        $(".option-select option:selected").each(function() { // <-- then iterate each time it changes
            if ($(this).index() !== 0) { // <-- only if not default
            {
                sel += "
" + $(this).text() + "
";
                counter++;
            }
            }
            $("ul.result ul").empty().append(sel); //<-- empty() to remove old list and update with new list
        });
    });

//The Number of Option's Added
counter;

or just convertenter code here sel to Jquery
$(sel).length;

A: I would make an element and put the value in there, something like this:

You have  options

A: May be you want something like this
$(document).ready(function() {
    $("select").change(function() {
        var list=$(this).children(':selected').not($(this).children()[0]);
        $('#result, #count').empty();
        if(list.length){
            list.each(function(){
                $('

').val($(this).val()).text($(this).text())
                .appendTo($('#result'));
                $('#count').html(list.length);
            });
        }
    });
});

DEMO.


text:
Q: Link attachment images to specific woocommerce products? is it possible to link attachment images, added through media, to specific products in wordpress/woocommerce?
each product has a featured image but on the home page i want to display a select few which show a different image.
is there a way to pull in a specific attachment image to a product?

A: Yes you can.. Go to media library and click edit image you want to add link. In that editing section you can find a option called link to where you can add link of the woocommerce product.


text:
Q: iOS - find out a view's constraints at runtime How do I find an object's TRUE frame at runtime when using Autolayout + Constraints?
I have a UIButton constrained to the screen's upper right-hand corner.
But when I log out this Button's frame at runtime (in viewDidLoad) I'm told its x value is 500 - which of course isn't accurate (if it were, the button would be way off screen.)
But since I'm using Constraints, the button is not offscreen, its tucked nicely in the upper right-hand corner, the way it should be.
So I'm trying to find out what its true x value is.
*Ultimately what I'm trying to achieve is this: the user needs to be able to drag this object away, and at some point the App needs to animate the object back to its original position.
Any suggestions on how to do this?

A: You have to NSLog the frame not in the viewDidLoad but viewDidLayoutSubviews. Autolayout does not layout subviews to fit to the screen in viewDidLoad.

A: Try logging the constraints in the method viewDidAppear().


text:
Q: VirtualBox 4.12 Shared clipboard not working in Ubuntu14.04 My Shared clipboard has stopped working all of a sudden after a dist-upgrade. I tried re installing guest additions but it doesn't seem to work. I've checked that "Bidirectional clipboard" was enabled.

A: Started working after running: sudo apt-get install virtualbox-guest-dkms and enabling bidirectional shared clipboard.

A: Background:
I run Windows 7 64 bit, Linux inside Virtual Box v4.3.16 r95972.  After building a new
3.17 kernel on one of my VM's the guest additions in general stopped working (this
included both Cut&Paste and the window resizing).
Summary:
I found I needed the later version of virtual box guest additions from Oracle, loaded
as an .iso file, and another utility called parcellite.  My cut and paste is a two step
operation.
Attempted fixes:
I tried removing and reinstalling various guest additions (iso, dkms, x11) using the
apt-get remove and apt-get install all to no avail.  Then I noticed that I had
problems reading the virtual CD (VERR_PDM_MEDIA_LOCKED) where I had originally loaded
another version of the guest additions from Oracle.
It turned out that the guest additions from Oracle were 4.3.16 (see this via modinfo
vboxguest) and the versions from apt-get were 4.3.10.  However in order to re-install
the later version from the .iso file I had to find a way around the CD mount problem.
What finally worked for me was to make sure that all CD's were unmounted from all of my
VM's using the 'Devices -> CD/DVD Devices -> remove disk' selection and then to mount
the .iso file via the VirtualBox Manager via the Settings -> Storage -> IDE Controller
"CD icon".  When I selected the .iso file from the VirtualBox Manger its installation
window popped up in my VM, but trying to access this file from the VM always failed.
Once this installation finished I power cycled the VM and the guest additions worked
again.
Cut and Paste still seems to have an issue that I had worked around before.  The work
around is to install parcellite (Ubuntu software center or apt-get).  This is a
clipboard manager that creates an icon in the top right where you can access the
clipboard for cut and paste.  Using the left and right mouse buttons to select text in
an xterm window cuts to a different buffer than the clipboard (I read online) which is
why it does not seem to work between machines.
So to cut and paste to Windows from a Linux xterm I do a multi step process:
- first select the text using left and right mouse clicks,
- then open parcellite and select History, which opens an Editing Clipboard window.
- Use the mouse middle mouse button to paste into this clipboard.
- Then select the text (again!) using the mouse, after doing the right click here you get a pop-up selection where you select 'Copy'.
- Now when you paste into a Windows area the text you 'Copy' selected appears.
Hope this helps!
- Jon Shapiro

A: Mine wasn't working too, Windows 7 64bit running Ubuntu 10.04. Running the following commands on the guest machine solved for me:
sudo VBoxClient-all stop
sudo VBoxClient-all start

A: *

*In VirtualBox Menu Devices -> "Insert Guest Additions CD image…"

*Follow all prompts and accept all installs

*Reboot

This worked for me with Windows 10 Host and Ubuntu 16.04 Guest.

A: I've had same issue.
1) Enabling bidirectional shared clipboard
 2) Type following commands:
sudo apt-get update
sudo apt-get install virtualbox-*
sudo shutdown -r now


text:
Q: QTreeWidget: How to change sizeHint dynamically? I have a QTreeWidget where the TopLevelIteps are replaced by a custom widget. Said widget have its maximum and minimum Heights animated with a QStateMachine.
QTreeWidget (GIF):

Custom Widget Animation (GIF):

The problem is that the rows will not adjust its height to fit the custom widget when it expands:
Row height fixed size (GIF):

Causing overlap between the widget items instead of pushing each other away like this:
The results that I'm after (GIF):

I tried using setSizeHint() on the top level item to but it creates a big empty space between items/widgets:
Using setSizeHint()(GIF):

I'm thinking that maybe I have to implement sizeHint() but I'm not really sure what to put there. Or is there a better approach to this problem?
I would really appreciate some hints.
Example code:
# Custom Widget
class ExpandableFrame(QFrame):

    def __init__(self):
        QFrame.__init__(self)

        # Default Properties
        self.setFixedSize(200,50)
        self.setStyleSheet('background-color: #2e4076; border: 2px solid black; border-radius: 10px;')

        # Setup expand button
        self.expandToggle = QToolButton()
        self.expandToggle.setText('[]')
        self.expandToggle.setMaximumSize(10,20)
        self.expandToggle.setCursor(Qt.PointingHandCursor)

        # Setup layout
        layout = QHBoxLayout()
        layout.setAlignment(Qt.AlignRight)
        layout.addWidget(self.expandToggle)
        self.setLayout(layout)

        self.expandArea()

    # Animates minimumHeight and maximumHeight
    def expandArea(self):

        heigth = self.height()
        newHeigth = 100

        machine = QStateMachine(self)

        state1 = QState()
        state1.assignProperty(self, b'minimumHeight', heigth)
        state1.assignProperty(self, b'maximumHeight', heigth)

        state2 = QState()
        state2.assignProperty(self, b'minimumHeight', newHeigth)
        state2.assignProperty(self, b'maximumHeight', newHeigth)

        # Create animations
        expandAnim = QPropertyAnimation(self, 'minimumHeight')
        closeAnim = QPropertyAnimation(self, 'maximumHeight')
        expandAnim.setDuration(125)
        closeAnim.setDuration(125)
        expandAnim.setEasingCurve(QEasingCurve.Linear)

        # Create event transitions
        eventTransition1 = QEventTransition(self.expandToggle, QEvent.MouseButtonPress)
        eventTransition1.setTargetState(state2)
        eventTransition1.addAnimation(expandAnim)
        state1.addTransition(eventTransition1)

        eventTransition2 = QEventTransition(self.expandToggle, QEvent.MouseButtonPress)
        eventTransition2.setTargetState(state1)
        eventTransition2.addAnimation(closeAnim)
        state2.addTransition(eventTransition2)

        # Add the states to the machine
        machine.addState(state1)
        machine.addState(state2)
        machine.setInitialState(state1)
        machine.start()

# Tree Widget
class CustomTree(QTreeWidget):

    customWidget = []

    def __init__(self, parent=None):
        QTreeWidget.__init__(self, parent)

        # Create top level items
        itemCount = 3
        for element in range(itemCount):
            topLevelItem = QTreeWidgetItem()
            self.addTopLevelItem(topLevelItem)

            # Replace the top level items with the expandable custom widget:
            # Get the Model Index to each item
            modelIndex = self.indexFromItem(topLevelItem, 0)

            # Create the ExpandableFrame widgets for all the top level items
            self.customWidget.append(ExpandableFrame())

            # Set the widget to each top level item based on its index
            self.setIndexWidget(modelIndex, self.customWidget[element])

            # Create more items and add them as children of the top level items
            for x in range(itemCount):
                child = QTreeWidgetItem()
                child.setText(0,'Child')
                topLevelItem.addChild(child)

This is how the example looks:
Minimal Code Example running:

A: One solution could be to emit the sizeHintChanged signal of the item delegate of your view every time the size of any of the widgets is changed. This tells the view that the position of the items should be updated. To achieve this you could override the resizeEvent of ExpandableFrame and emit a custom signal, e.g.
class ExpandableFrame(QFrame):
    resized = pyqtSignal(QVariant)

    def resizeEvent(self, event):
        self.resized.emit(self.height())
        super().resizeEvent(event)

In CustomTree, you can then connect ExpandableFrame.resized to the sizeHintChanged signal of the delegate of the custom tree by overriding setIndexWidget, e.g.
class CustomTree(QTreeWidget):
    ...

    def setIndexWidget(self, index, widget):
        super().setIndexWidget(index, widget)
        if isinstance(widget, ExpandableFrame):
            widget.resized.connect(lambda: self.itemDelegate().sizeHintChanged.emit(index))

Screen capture:

The disadvantage of this approach is that you would need to update the connections if the the widgets are moved or replaced.


text:
Q: How to install zenmap on Fedora I'm trying to install Zenmap after installing Nmap however it's not quite working. I tried just the regular terminal command dnf install zenmap however it tells me that they're unable to find a match.
I then went to the official website to download the RPM file and tried using the command 'rpm -i filename.rpm' which told me I needed to download PyGTK which I did and it worked. However, now when I try to run zenmap, it shows me
File "/usr/bin/zenmap", line 182
except ImportError, e:
SyntaxError: invalid syntax
When I try launching zenmap from the search, it shows Zenmap GUI port Scanner but when I try clicking on it, there's a brief flash on my screen and then it's gone. I tried looking for solutions but there's only 2 when I search and neither of them has an answer to it.
I'm using Fedora 31 with KDE Plasma.

A: Check the python version in the system. zenmap fails with python3, try using python2.7 instead of python3.


text:
Q: How do I get IP Addres in Python Is there any way to get the IP address in pure python (not Django)?
I found the code bellow, but i do not have a Request object.
def get_client_ip(request):
    x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
    if x_forwarded_for:
        ip = x_forwarded_for.split(',')[-1].strip()
    else:
        ip = request.META.get('REMOTE_ADDR')
    return ip

A: If you're talking about your local machine a quick google search found this:
Finding local IP addresses using Python's stdlib

A: It sounds like you are saying that you have a socket object that is the result of an earlier accept call.  If so, that socket object will have a getpeername attribute:
result = descriptor.getpeername()

If it's an IP socket the result will be the (hostaddr, port) pair.

A: You can get the local IP adress using the socket module
>>> import socket
>>> socket.gethostbyname(socket.gethostname())


text:
Q: How to stop a innerHtml table repeating itself over and over and over again? I have made an array with objects that get there info from three different user variables, however on one of these there are many sub variables that i don't want it to repeat itself every time the user presses the select button(which updates the table) instead i want it to just add onto (or take away) from the sections that it already has in the table. thanks(if you need the variable code let me know) please help!! i really need a solution!!
//creating array
var gProducts = new Array();
var gTotalCost = 0;

// Adding Products to array gProducts
    function addProduct
{
var product = new Object();
product.name = name;
product.cost = cost;
gProducts.push(product);
gTotalCost += parseInt(cost)
}

 //Getting products from array, use of for in loop setting new table rows in blank var for each array item
function renderProducts()
{
var HTMLadd = ""

for (var i in gProducts)
{
if( gProducts[i].cost > 0){
    HTMLadd = HTMLadd +
    "
"+
    "" + gProducts[i].name +
    "	"+
    "€" + gProducts[i].cost +
    "	"+
    "
";
    }
    else
    {
    }
}
document.getElementById('tableRow').innerHTML = HTMLadd;

}

A: In the loop you always iterate through the whole gProducts, hence the values already placed to the table are doubled every time you execute the function.
This example uses some methods in HTMLTableElement to create new rows and cells. It also has a counter (index) holding the starting position of each iteration.
var index = 0; // Counter for holding the current position in gProducts

function renderProducts () {
    var n, row, cell, span;
    for (n = index; n < gProducts.length; n++) { // Start looping from the first new index in gProducts
        if (gProducts[n].cost > 0) {
            row = table.insertRow(-1); // Inserts a row to the end of table
            cell = row.insertCell(-1); // Inserts a cell to the end of the newly-created row
            cell.className = 'tableSettings00'; // Sets class for the cell
            cell.id = 'tableRow' + index; // Sets an unique id for the cell
            cell.innerHTML = gProducts[n].name; // Sets the content for the cell
            cell = row.insertCell(-1); // Create another cell to row
            cell.className = 'tableSettings';
            cell.id = 'tableRowPart' + index;
            cell.innerHTML = '€';
            span = document.createElement('span'); // Creates an empty span element
            span.id = 'tableRow2part' + index; // Sets an unique id for span
            span.appendChild(document.createTextNode(gProducts[n].cost)); // Appends some text to the span
            cell.appendChild(span); // Appends the span to the cell
        }
    }
    index = n; // Sets counter equal to the length of gProducts
}

A live demo at jsFiddle.
As a sidenote, personally I prefer not to use ids for elements within a table. If ids are needed, you probably have constructed your table incorrectly, or the data is not suitable being shown in a table.
You can use indices and table.rows and rows.cells collections to find cells, and if some elements has to be searched for from a cell, use firstElementChild and nextElementSibling properties of a cell to find them.


text:
Q: Is "demo" understood in all languages? The word "demo" is widely used in the information technology field as "demonstration" in many languages.
Many applications are distributed in a "demo" form before users purchase them.
I would like to know if it is a universal word that is actually understood in nearly all languages, especially among people that own a mobile device like tablets and smartphones.
(The above mentioned word is one of those english words that are internationally recognized as standard so an expert could know about it)

A: Keep in mind that demo means different things to different fields of expertise. In the home remodeling industry, for example, it usually means "demolish". (Apparently, this meaning is also used by gamers when battling online foes.)
According to the excellent Online Etymology Dictionary, the word "demo" was made popular by the music industry, but didn't start out that way. It was a different kind of demonstration...

Music recording given out for promotional purposes, 1963. The word was
  used earlier to mean "a public political demonstration" (1936).

And here's an example from HGTV.com using demo to mean "demolition":

Everybody likes demolition. Or maybe I should say everybody likes the
  idea of demolition. On the surface, demo is blunt-force fun, uses
  gross motor skills and delivers almost instant gratification. How cool
  is that!


text:
Q: Telerik Themes not working in a WPF application I have seen some similar questions but all of the answers are the same and aren't working for myself,
I am trying to use Telerik themes in a WPF/VB.net application but the themes do not set and I am unsure why,
I've tried using the following code below to achieve what I am trying to do:
StyleManager.ApplicationTheme = New VistaTheme()
StyleManager.SetTheme(rad_button, New VistaTheme)

(I am using VistaTheme as an example, I have tried the code with all of the available themes)
Any help or advice would be appriciated (even in c#)!

A: You need to call after  change style InitializeComponent() method.
StyleManager.ApplicationTheme = New VistaTheme()
StyleManager.SetTheme(rad_button, New VistaTheme)
InitializeComponent()


text:
Q: Convert sql to Zend_Table How can I convert this:
SELECT latitude, longitude, SQRT(
    POW(69.1 * (latitude - [startlat]), 2) +
    POW(69.1 * ([startlng] - longitude) * COS(latitude / 57.3), 2)) AS distance
FROM TableName HAVING distance < 25 ORDER BY distance;

to Zend_Table.
I have two keys, lat and long in the database and I want to get the data which is close to the user,the query works provided by the first user which converted it yo Zend_Table but if I have data from people which are in the same city it doesn't return any data, I guess the query needs to be improved, to also show results for a bigger distance
$this->select()->from(array('c' => 'content'))......

I have noe idea how to do this,  can you guys help me?
//LE
$data2->setIntegrityCheck(FALSE)
        ->from(array('c' => 'content'), array('location', 'id', 'user_id', 'date', 'attachment', 'content','lat','long'))
        ->columns(array(
            'distance'  => "SQRT(POW(69.1 * (lat - {$location['lat']}), 2) + POW(69.1 * ({$location['long']} - long) * COS(lat / 57.3), 2))"
        ))
        ->having('distance < ?', 25)

It looks like the query is wrong for finding users close to you, this one should do the trick
ASIN(
SQRT( POWER(SIN((@orig_lat -
abs(
dest.lat)) * pi()/180 / 2),2) + COS(@orig_lat * pi()/180 ) * COS(
abs
(dest.lat) *  pi()/180) * POWER(SIN((@orig_lon – dest.lon) *  pi()/180 / 2), 2) ))

as distance

A: Tested with ZF 1.12.4-dev, PHP 5.3.26, MySQL 5.6.13
Zend_Db_Table::setDefaultAdapter($adapter);
$table = new Zend_Db_Table("TableName");

$startLat = 39.0;
$startLng = 122.0;

$select = $table->select()
    ->from($table, array("latitude", "longitude",
        "distance" => "SQRT(
            POW(69.1 * (latitude - $startLat), 2) +
            POW(69.1 * ($startLng - longitude) * COS(latitude / 57.3), 2))"))
    ->having("`distance` < ?", 25)
    ->order("distance");

$rowset = $table->fetchAll($select);

print_r($rowset->toArray());

Tested with ZF 2.2.5-dev, PHP 5.3.26, MySQL 5.6.13
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql\Select;
use Zend\Db\Sql\Expression;

$table = new TableGateway("TableName", $adapter);

$startLat = 39.0;
$startLng = 122.0;

$rowset = $table->select(
    function (Select $select) {
        global $startLat, $startLng;
        $select->columns(
            array(
                "latitude",
                "longitude",
                "distance" => new Expression("SQRT(
                    POW(69.1 * (latitude - ?), 2) +
                    POW(69.1 * (? - longitude) * COS(latitude / 57.3), 2))",
                    array($startLat, $startLng))
                )
            );
        $select->having->lessThan("distance", 25);
        $select->order("distance");
    }
);

print_r($rowset->toArray());

Test data and test SQL query (without PHP):
use test;

drop table if exists TableName;

create table TableName (
    id int auto_increment primary key,
    latitude numeric(9,4) NOT NULL,
    longitude numeric(9,4) NOT NULL,
    key (latitude,longitude)
);

insert into TableName (latitude, longitude) values
(10.0, 10.0),
(20.0, 20.0),
(30.0, 30.0),
(40.0, 40.0),
(50.0, 50.0),
(60.0, 60.0),
(70.0, 70.0),
(39.2, 122.2);

set @startlat = 39.0;
set @startlng = 122.0;

SELECT latitude, longitude, SQRT(
        POW(69.1 * (latitude - @startlat), 2) +
        POW(69.1 * (@startlng - longitude) * COS(latitude / 57.3), 2)) AS distance
FROM TableName
HAVING distance < 25
ORDER BY distance;

Output of SQL test:
$ mysql -E < 19057187.sql
*************************** 1. row ***************************
 latitude: 39.2000
longitude: 122.2000
 distance: 17.484284526375415

Output of PHP test:
$ php 19057187.php
Array
(
    [0] => Array
        (
            [latitude] => 39.2000
            [longitude] => 122.2000
            [distance] => 17.484284526375415
        )

)
Array
(
    [0] => Array
        (
            [latitude] => 39.2000
            [longitude] => 122.2000
            [distance] => 17.48428452637566
        )

)

A: $db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select();
$select->from('TableName', array('latitude', 'longitude'));
$select->columns(array(
    'distance'  => "SQRT(POW(69.1 * (latitude - {$startLat}), 2) + POW(69.1 * ({$startLong} - longitude) * COS(latitude / 57.3), 2))"
));
$select->having('distance < ?', 25);
$select->order('distance ASC');


text:
Q: go mod tidy with golang1.13 cannot load package When use golang 1.13 with go mod tidy with proxy https://goproxy.cn. I always get the following error:
cannot load github.com/astaxie/beego: module github.com/astaxie/beego:
Get https://goproxy.cn/github.com/astaxie/beego/@v/list:
http: server gave HTTP response to HTTPS client

What is the root cause? Configure or else?


text:
Q: Not Able to fetch table in Oracle Database after creating a table using JPA hibernate I am trying to connect Oracle Database 12c using spring boot, and creating a table using JPA hibernate and code is running fine also in postman get and post working fine(request is hitting and tables are created). now when I am chekcing tables in my oracle database 12c I am getting output as table does not exist.
here is my database connection file
    ## Database Properties
    #spring.datasource.url = jdbc:mysql://localhost:3306/detail?useSSL=false
    spring.datasource.url= jdbc:oracle:thin:@<IP>:1521/<pdb database service name>
    spring.datasource.username=sys as sysdba
    spring.datasource.password=Welcome1
    spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
    ## Hibernate Properties
    # The SQL dialect makes Hibernate generate better SQL for the chosen database
    spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect
    # Hibernate ddl auto (create, create-drop, validate, update)
    spring.jpa.hibernate.ddl-auto=update
    server.port=8081
    spring.jpa.show-sql=true

This is my Output after executing the code
    2020-01-31 16:06:40.916  WARN 7724 --- [  restartedMain] o.s.boot.StartupInfoLogger               : InetAddress.getLocalHost().getHostName() took 5006 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).
    2020-01-31 16:06:45.927  INFO 7724 --- [  restartedMain] com.example.DemoApplication              : Starting DemoApplication on Kirtis-Mac.local with PID 7724 (/Users/kirtijain/Downloads/demo/target/classes started by kirtijain in /Users/kirtijain/Downloads/demo)
    2020-01-31 16:06:45.927  INFO 7724 --- [  restartedMain] com.example.DemoApplication              : No active profile set, falling back to default profiles: default
    2020-01-31 16:06:46.341  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
    2020-01-31 16:06:46.342  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
    2020-01-31 16:06:46.351  INFO 7724 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data JDBC - Could not safely identify store assignment for repository candidate interface com.example.repository.UserRepository. If you want this repository to be a JDBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table.
    2020-01-31 16:06:46.351  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 8ms. Found 0 JDBC repository interfaces.
    2020-01-31 16:06:46.358  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
    2020-01-31 16:06:46.359  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-01-31 16:06:46.365  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 6ms. Found 1 JPA repository interfaces.
    2020-01-31 16:06:46.506  INFO 7724 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$9bd21857] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2020-01-31 16:06:46.511  INFO 7724 --- [  restartedMain] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
    2020-01-31 16:06:46.523  INFO 7724 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2020-01-31 16:06:47.870  INFO 7724 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
    2020-01-31 16:06:47.872  INFO 7724 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
    2020-01-31 16:06:47.873  INFO 7724 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.30]
    2020-01-31 16:06:47.950  INFO 7724 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2020-01-31 16:06:47.950  INFO 7724 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2016 ms
    2020-01-31 16:06:48.059  INFO 7724 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-01-31 16:06:48.076  INFO 7724 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-3 - Starting...
    2020-01-31 16:06:48.077  WARN 7724 --- [  restartedMain] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was not found, trying direct instantiation.
    2020-01-31 16:06:53.326  INFO 7724 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-3 - Start completed.
    2020-01-31 16:06:53.326  INFO 7724 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
    Hibernate: create table test_table (id number(19,0) generated as identity, created_by varchar2(50 char) not null, created_date timestamp, email_address varchar2(255 char) not null, first_name varchar2(255 char) not null, last_modified_by varchar2(50 char), last_modified_date timestamp, last_name varchar2(255 char) not null, primary key (id))
    2020-01-31 16:07:02.689  INFO 7724 --- [  restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-01-31 16:07:02.690  INFO 7724 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-01-31 16:07:02.699  INFO 7724 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
    2020-01-31 16:07:02.876  WARN 7724 --- [  restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
    2020-01-31 16:07:02.956  INFO 7724 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
    2020-01-31 16:07:03.142  INFO 7724 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
    2020-01-31 16:07:03.142  INFO 7724 --- [  restartedMain] com.example.DemoApplication              : Started DemoApplication in 32.29 seconds (JVM running for 753.748)
    2020-01-31 16:07:03.144  INFO 7724 --- [  restartedMain] .ConditionEvaluationDeltaLoggingListener : Condition evaluation unchanged
    spring started

Result in Oracle Database

A: the tables are there so you probably connect to the wrong schema. You can see the schema where you are with
show user

You can find out where the table is querying the data dictionary with
select table_name, owner from all_tables where table_name = 'test_table';

One advice: it is a bad practise to connect as sys as sysdba from the application.
You should create a new schema (i.e. TEST) and connect with those credentials: aside the security aspects (your application cannot change everything in the database) you create by default tables (and any other object) in the designated Oracle schema.


text:
Q: Filtering out data for sql android I have a strings that contains c++ codes.
these codes might contain a single or double inverted quotes and many such thing,
I want to filter out these characters before executing the sql to insert this into the SQLite Database (Android) so, what java code should i run to do that without disturbing/distorting the c++ code, so that when i read the sql database the code should be as before.

A: You could filter (replace with nothing) when extracting the data using SQL.
e.g. such a query could be :-
SELECT replace(replace(col1,'''',''),'"','') FROM cpluspluscode;

*

*where the respective column is col1 and the table is cpluspluscode.

The following is an example showing how this works:-
DROP TABLE IF EXISTS cpluspluscode;
CREATE TABLE IF NOT EXISTS cpluspluscode (col1 TEXT);
INSERT INTO cpluspluscode VALUES('''mytext'' "other text"');
SELECT * FROM cpluspluscode;
SELECT replace(replace(col1,'''',''),'"','') AS filtered FROM cpluspluscode;

The results from the above are :-
Without filtering :-

Filtered :-

*

*The above takes advantage of the SQLite replace core function replace(X,Y,Z)
Unicode
If you wanted the to do the above using unicode then you could use :-
SELECT replace(replace(col1,char(0034),''),char(39),'') AS filtered FROM cpluspluscode;

*

*This utilises the SQLite char core function (see link above).

*The unicode core function can be used to find the unicode for a character (again see link above).

Android Example
Assuming a subclass of SQLiteOpenHelper is DatabaseHelper and this creates the table as per :-
public static final String TABLE_CPLUSPLUSCODE = "cpluspluscode";
public static final String COLUMN1 = "col1";

.........

@Override
public void onCreate(SQLiteDatabase db) {
    String crtcpp = "CREATE TABLE IF NOT EXISTS " + TABLE_CPLUSPLUSCODE + "(" +
            COLUMN1 + " TEXT" +
            ")";
    db.execSQL(crtcpp);
}

And DatabaseHelper includes the methods :-
public long cppInsert(String value) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues cv = new ContentValues();
    cv.put(COLUMN1,value);
    return db.insert(TABLE_CPLUSPLUSCODE,null,cv);
}

public Cursor getFiltered() {
    SQLiteDatabase db = this.getWritableDatabase();
    String[] columns = new String[]{"replace(replace(" + COLUMN1 + ",'''',''),'\"','') AS " + COLUMN1};
    return db.query(TABLE_CPLUSPLUSCODE,columns,null,null,null,null,null);
}

public Cursor getUnfiltered() {
    SQLiteDatabase db = this.getWritableDatabase();
    return db.query(TABLE_CPLUSPLUSCODE,null,null,null,null, null, null);
}

Then using the following (in an Activity) :-
    DatabaseHelper mDBHlp = new DatabaseHelper(this);

    mDBHlp.cppInsert("''mydata'' \" other data\"");
    Cursor csr1 = mDBHlp.getUnfiltered();
    while (csr1.moveToNext()) {
        Log.d("CSR1DATA",csr1.getString(csr1.getColumnIndex(DatabaseHelper.COLUMN1)));
    }
    csr1.close();
    Cursor csr2 = mDBHlp.getFiltered();
    while (csr2.moveToNext()) {
        Log.d("CSR2DATA",csr2.getString(csr2.getColumnIndex(DatabaseHelper.COLUMN1)));
    }

Results in :-
09-05 04:39:14.003 3471-3471/so52115977.so52115977 D/CSR1DATA: ''mydata'' " other data"
09-05 04:39:14.003 3471-3471/so52115977.so52115977 D/CSR2DATA: mydata  other data

i.e. the second line is filtered accordingly.


text:
Q: pass Json object to google charts API $(document).ready(function () {
$.ajax({
  type: 'GET',
  url: 'api/v1/readings',
  data: { get_param: 'readings' },
  dataType: 'json',
  success: function (data) {
       google.charts.load('current', {'packages':['corechart']});
       google.charts.setOnLoadCallback(drawChart);

       var readings = data.readings;

       function drawChart() {
         var chartdata = new google.visualization.DataTable();
           chartdata.addColumn('datetime', 'Time of Day');
           chartdata.addColumn('number', 'Glucose Value');
           chartdata.addRows([

             readings.forEach(function(item){
               let date = new Date(item.time);
               { [[`Date(${date.getYear()}, ${date.getMonth()}, ${date.getDate()})`], item.glucose_value]}
             })
           ]);

So Im trying to pass a datestring from JSON readings to google charts api but im receiving a an error for every row must be a null or array.
the doc https://developers.google.com/chart/interactive/docs/datesandtimes#datestring states that dates must be passed in quotes so how do i pass my Date variable into the the string in order to parse it into a datetime object for the chart?

A: Your passing it as a object : {}
Take out the object notation and pass as [ [] ]


text:
Q: Show that membership in language is undecidable By providing a reduction from the HALTING problem to REACHABLE-CODE, prove that REACHABLE-CODE is undecidable.
REACHABLE-CODE is defined like this:
INSTANCE: A source code S, a number n of a line in S. QUESTION: Is there an input I for S such that the run of S on I will reach the code on line n?

A: Equivalently, consider the set of all unary partial recursive functions $f_x$ with Gödel number $x$, where $f_x(y)=0$ for each $y$ in the domain of $f_x$. The corresponding set of Gödel numbers is a proper subset of the set of natural numbers and so the set is undecidable by the Thm of Rice.

A: Okay, consider the set $C=\{x\in\mathbb N_0\mid \phi_x=c_0\}$, where $\phi_x$ is the unary partial recursive function with Gödel number $x$ and $c_0$ is the unary zero-function.
Claim that $C$ is undecidable.
Indeed, define $f:\mathbb N_0^2\rightarrow\mathbb N_0$ by $f(x,y)=0$ if $x\in\rm{dom}\;\phi_x$, and $f(x,y)$ undefined otherwise. This function is partial recursive, since it can be written as $f(x,y)= 0\cdot\phi_x(x)$ (or  use the universal function for unary partial recursive functions; i.e. let $\psi$ be a universal function for monadic partial recursive functions, i.e., $\psi$ is partial recursive with $\psi(x,y)=\phi_x(y)$ for all $x,y$. Then $f(x,y)=0\cdot\psi(x,x)$). By the smn theorem, there is a unary computable (prim. rec.) function $s$ such that $f(x,y)=\phi_{s(x)}(y)$.
Now consider two cases:
First, let $x\in{\rm dom}\;\phi_x$. Then $f(x,y)=0$ for all $y$. Thus $\phi_{s(x)}(y) = c_0(y)$ for all $y$ and so $s(x)\in C$.
Second, let $x\not\in{\rm dom}\;\phi_x$. Then $f(x,y)$ is undefined for all $y$. Thus $\phi_{s(x)}(y)$ is undefined for all $y$ and so $s(x)\not\in C$.
Consequently, the computable function $s$ yields a reduction of the undecidable set $H'=\{x\in\mathbb N_0\mid x\in{\rm dom}\;\phi_x\}$ to the set $C$.
Note that the set $H'$ is a subset of the ''halting problem'' $H=\{(x,y)\mid y\in{\rm dom}\;\phi_x\}$.

A: Suppose membership of $A$ were decidable. Consider the program $B_2$ that loops on every input. We can now check if a given program $B_1$ halts on some given input $y$ by modifying it to $B'_1$ which behaves as follows:

On input $x$: If $x \neq y$ then loop else simulate $B_1$ on input y$

We have that $(B'_1,B_2) \notin A$ if and only if $B_1$ halts on input $y$. So if we could check membership of $A$, the Halting Problem would be decidable.


text:
Q: Как работать с SAXParser ? У меня есть такой XML Документ
<campaign id = '1'>
<numberOfHits> 1000 </numberOfHits>
<Region>
    <id> region1 </id>
    <id> region2 </id>
</Region>
<budget> 500 </budget>
<intervalOfTime> 5 </intervalOfTime>
<Site>
    <siteId> 1 </siteId>
</Site>
</campaign>

Мне нужно его распарсить и внести данные в объект типа Campaign
public class Campaign {

    private int compaignId;
    private Target target;
    private int numberOfHits;
    private double budget;
    private Period intervalOfTime;
    private ArrayList<Site> sites;

    //-----===== getter и setter всех полей ====-----
}

А вот класс регион:
    public class Region {
static enum region{
    region1("1"),
    region2("2"),
    region3("3"),
    region4("4"),
    region5("5"),
    region6("6"),
    region7("7"),
    region8("8"),
    region9("9"),
    regoin10("10");

    private String value;

    region(String value) {
        this.value = value;
    }
    public String toString() {
        return value;
    }
}

}
Начал писать SAXParser и столкнулся с несовпадением типов:
if (thisElement.equals("region")) {
   doc.setNumberOfHits(new String(ch, start, length));
}

Как мне сделать так, чтобы после парсинга у меня был ArrayList<Region>?
A: Преобразовать строку в int:
try {
    iValue = Integer.parseInt(sValue);
}
catch (NumberFormatException ex) {
    System.out.println("Ошибка!");
}


text:
Q: Printing elements stored in hash of a hash final HashMap<Integer, HashMap<Integer, Integer[]>> teams;
   teams= new HashMap<Integer, HashMap<Integer, Integer[]>>();

    teams.put(1,new HashMap<Integer, Integer[]>(){{
        put(2,new Integer[] { 1,0});}});
        System.out.println(teams.get(1).get(2));

I am trying to implement hash of hashes in java. I need to print integer array being stored in hash of a hash. Any help in this regard would be appreciated.

A: Your code is correct (I only re-indented here), and I added the call to the Arrays.toString method in your println call.
final HashMap<Integer, HashMap<Integer, Integer[]>> teams;
teams = new HashMap<Integer, HashMap<Integer, Integer[]>>();

teams.put(1, new HashMap<Integer, Integer[]>() {
  {
    put(2, new Integer[] { 1, 0 });
  }
});
System.out.println(Arrays.toString(teams.get(1).get(2)));

A: Note:  code  teams.get(1).get(2) returns type of Integer[].
teams.get(1) will get a HashMap, in the example, its key is 2 and its value is an Integer Array (Integer[]) with elements [1,0]
teams.get(1).get(2) returns values, whose type is Integer[].
You CAN NOT print its value via  System.out.println(teams.get(1).get(2)) directly because toString is not implemented.
There are 2 ways for you to print the element in array as follows:
1 you can print element in array using its index,
like
     System.out.println(teams.get(1).get(2)[0]);//print 1
     System.out.println(teams.get(1).get(2)[1]);//Print 0

OR
2 Use Arrays.toString menthod to print all the elements in array,
like
     System.out.println(Arrays.toString(teams.get(1).get(2)));//Print [1,0]


text:
Q: Eloquent Showing pivot for some weird reason building this model with Eloquent is hiding the Pivot that I am requiring explicitly in the relation (This Model is called Match):
public function scorers()
{
    return $this->belongsToMany(
        Player::class,
        'match_players',
        'match_id'
    )->withPivot(
        'goals'
    )->where(
        'goals', '>', 0
    );
}

public function scopeComplete($query)
{
    return $query->with(
        'homeTeam',
        'awayTeam',
        'scorers'
    );
}

The problem is the json result of scorers is as follows
"scorers": [
  {
    "id": 196,
    "name": "Tino",
    "surname": "Heck",
    "age": 24
  },...

And is hiding the pivot (goals) team_id and goals which should appear on each object inside a nested object called pivot, did anyone came across some problem like this? I cat find anything around here. Something like
"scorers": [
  {
    "id": 196,
    "name": "Tino",
    "surname": "Heck",
    "age": 24,
    "pivot": {
      "goals": 3
    }
  },...

Db structure is
Match
- id
- ..
Players
- id
- ...
MatchPlayer
- player_id
- match_id
- goals

The result inside scorers is correct, so I get the actual player where goals > 0, but not the pivot I am looking for
Thanks in advance.

A: Silly me, I found the error, the problem was that Iwas hiding pivots on Player Model :(
So the lesson here is the $hidden array property that counts is the one on the relation model rather than the one on the Parent (Match in this case)


text:
Q: Broken mount point with crazy status I used to mount via sshfs onto this mount point named vismac on a RedHat linux.
But something is broken, and ls -l results in the following mess of question marks and dashes:
drwxrwxr-x  9 user_me grp_me   4096 Jan 20 11:43 temp
?---------  ? ?       ?           ?            ? vismac

I have no clue what's going on. Any ideas?
mount shows:
sshfs#vismac.my.domain.com: on /home/memming/vismac type fuse (rw,nosuid,nodev,max_read=65536,user=memming)

A: Well, sshfs must have choked. I forced with sudo umount and it's all fine now.


text:
Q: can I trigger click event onload I am having anchor tag in my page. I like to trigger click event onload . Which means I wanna open this page "http://XXXXX.com" with new tab. Because I don't wanna popup blockers. Is there anyway to do this?
anchor attrs are given bellow
id="add_redirect"
href="http://XXXXX.com"
target="_blank"

A: Try adding the following code in the page load
document.getElementById('add_redirect').click();

A: Using JQuery you can do that pretty easy. The earlier posted solution also work of course.
$(document).ready(function(){
 $("#add_redirect").trigger('click');
});

TRY DEMO

A: If your goal is to bypass pop-up blockers on page load, triggering the click event synthetically probably won't work. Browsers are smart enough to know when a click is user-generated vs. when you've called the click function on the DOM element (on those browsers were that even works). Examples: http://jsbin.com/avibi3/3, http://jsbin.com/avibi3/4
Using jQuery's trigger mechanism certainly won't do it, because it doesn't really trigger a click event at all; it just fires the handlers that jQuery hooked up (edit: and, apparently, ones defined via an onclick attribute — see Sukhi's answer — but not ones attached via addEventListener). If that's what you want to do, Sukhi's answer shows you how, although I always say: If you want code to be run from two different places, put it in a function, and call that function from two different places (rather than putting it in a click handler and then simulating a click just to run the code). There are valid use cases for trigger (mostly relating to integrating with third-party scripts), but for running your own code from two different places, it's a symptom of a design problem.

A: Yeah, you can use a click event called onLoad(). Just use the setTimeout() method in jquery. It will call a click function without clicking it. Here is an example:
$("document").ready(function() {
    setTimeout(function() {
        $("#add_redirect").trigger('click');
    },10);
});

This will work for you when the page start to load and the time delay is 10ms which is negligible.
Syntax has been corrected.


text:
Q: PHP/Laravel - Function empty on variable but if I return the method has data inside foreach foreach($parcels as $parcel):
        $length  = $helper->convertToCM($parcel->length, $parcel->distance->name);
        $width   = $helper->convertToCM($parcel->width, $parcel->distance->name);
        $height  = $helper->convertToCM($parcel->height, $parcel->distance->name);
        $weight  = $helper->convertToKG($parcel->weight, $parcel->mass->name);

        return array(
            "length"        => $length,
            "width"         => $width,
            "height"        => $height,
            "weight"        => $weight,
            "distance_unit" => env('SHIPPO_DISTANCE_UNIT'),
            "mass_unit"     => env('SHIPPO_MASS_UNIT')
        );

result
{
 "length": {},
 "width": {},
 "height": {},
 "weight": {},
 "distance_unit": "cm",
 "mass_unit": "kg"
}

But if I do (inside the foreach)
return $length

I get the expected result... Must be something stupid but I'm not seeing what

A: The problem was that the method is returning an object instead of a value, just had json_decode it.


text:
Q: What's the maximum number of partition per table I can/should have in MySql 8? I have around 1T (1,000,000,000) records of products belong to 500,000 accounts. Each product record have the account_id and since I always query within a single account context (there are no cross-account queries) I thought of creating a partition per account to improve performance.

*

*Is it even possible to create 500,000 list partitions in mysql8?

*Will it required changing in the number of open files the process required?

*If it is possible, is there a reason for me not to go this path?

A: The maximum number of partitions allowed in MySQL 8 for InnoDB tables is 8192 (from https://dev.mysql.com/doc/refman/8.0/en/partitioning-limitations.html). This includes subpartitions.
In general, partitions do not on their own improve performance, but there are a some scenarios where they can help:

*

*Secondary indexes are local to the partition, so if you for example bulk insert data one partition at a time (or in order), it makes it more likely the secondary indexes fit into the buffer pool which can improve insert performance.

*For partition pruning. This can for example mean that MySQL effectively uses two indexes for the same table without doing an index merge.

*Managing logical grouped data such as moving all data that belongs to one partition to another table (for example to move it to another MySQL instance) or to delete all data in a partition.

One thing to be aware of if you have many partitions for a table is that by default each partition gets each own tablespace file (.ibd file). So if you have 8192 partitions, the table will end up using 8192 files.

A:
each query always contain where account_id == ???

Then every index, including the PRIMARY KEY, should start with account_id and partitioning will not help performance.
Period.  Full stop.  End of discussion.
But, if you want to discuss further, please provide SHOW CREATE TABLE (with or without partitioning) and the important SELECTs.
How do you INSERT rows fast enough to go past a billion rows?  I assume some sort of batch loading?  If practical, sort the data by the PRIMARY KEY before feeding them to INSERT or LOAD DATA.  Otherwise, you will have caching problems.  It sounds like the data is about a terabyte??  How big is innodb_buffer_pool_size?


text:
Q: Group policy ExtensionInstallForcelist. Extension is not being installed when hosting from local server There was a similar question here
ExtensionInstallForcelist
1 = pgdgchoanjdbkbbigcnlkfoflffhiheh;http://chrome.local.store:84/updates
Windows 10, member of Domain.
When I specify https://clients2.google.com/service/update2/crx, works fine. Switching to my host doesn't work.
My server http://chrome.local.store:84/updates returns XML document:

<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
  <app appid='pgdgchoanjdbkbbigcnlkfoflffhiheh'>
    <updatecheck codebase='http://chrome.local.store:84/extensionContent' version='0.1' />
  </app>
</gupdate>

And http://chrome.local.store:84/extensionContent returns file with MIME: application/x-chrome-extension and file name = Extension.crx.
Thank you in advance for any clue.

A: The issue solved with help from chromium forum guys. Many thanks to them.
The solution is to maintain proper extension ID noted from local Chrome extension panel, not from Chrome Store as I mistakenly did.


text:
Q: The compiler failed with error code 128 I have a windows 2003 server running IIS 6.
IIS has roughly 120 sites running on it.
I have had the "The compiler failed with error code 128" with one specific site this morning, tried creating its own Application Pool, restarted the site, can seem to get anything to work.
There is no virus protection program running on the server and I would prefer to not have to run anything on the server.

A: SOLVED: Fixed with a full server restart. Though I am still unaware of how this originally occurred.


text:
Q: ElasticSearch Java API AggregationBuilder filter/global "name" param causes malformed JSON I was trying to build a simple aggregation query using elasticsearch java API(version 5.5.0), but the "name" param taken by the filter / global methods of the AggregationBuilder causes a malformed JSON.
For example, I tried the first example here...
Here's the relevant code section:
AggregationBuilder builder =
  AggregationBuilders
  .global("agg")
  .subAggregation(AggregationBuilders.terms("genders").field("gender"));

Search search = new Search.Builder(builder.toString())
            .addIndex(INDEX_NAME)
            .addType(TYPE_NAME)
            .setParameter(Parameters.SIZE,0).build();

    JestClient jestClient = getJestClient();

    try {
        SearchResult result = jestClient.execute(search);
        System.out.println(result.getJsonString());
    } catch (IOException e) {
        e.printStackTrace();
    }

This produces the following error message:
{
"error": {
"root_cause": [
  {
    "type": "parse_exception",
    "reason": "Failed to derive xcontent"
  }
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
  {
    "shard": 0,
    "index": "index_name",
    "node": "UEjNVXkIQRSBCOpyqcq2dw",
    "reason": {
      "type": "parse_exception",
      "reason": "Failed to derive xcontent"
    }
  }
]
},
"status": 400
}

While debugging and watching the builder's value, I see it builds the follwing malformed JSON (Please mind the first element("agg") which comes from the "name" param of the "global" method):
"agg"{
  "global" : { },
  "aggregations" : {
    "genders" : {
      "terms" : {
        "field" : "gender",
        "size" : 10,
        "min_doc_count" : 1,
        "shard_min_doc_count" : 0,
        "show_term_doc_count_error" : false,
        "order" : [
          {
            "_count" : "desc"
          },
          {
            "_term" : "asc"
          }
        ]
      }
    }
  }
}

Any ideas ?

A: Using the simplest example, according to the documentation, (here and here), modifying your code slightly like the below:
AggregationBuilder builder = AggregationBuilders.global("agg").subAggregation(AggregationBuilders.terms("genders").field("gender"));
SearchResponse response = client.prepareSearch(INDEX_NAME).setTypes(TYPE_NAME).setSize(0).addAggregation(builder).get();
//Global aggResult = response.getAggregations().get("agg"); //Global result can be used to retrieve values from the aggregation directly
System.out.println(response);

The code above (after initialization of the client) works correctly so there is definitely no issue with the AggregationBuilder from the java API.
Actually I don't understand why you wouldn't use the SearchResponse class as it is omnipresent through all the examples in the documentation.
Edit: Given that link, I believe your issue comes from how you create your search query, because you only use the aggregation, giving the output you show in your post, whereas the full query (which seems needed by the Jest client) should be like:
{
  "size" : 0,
  "aggregations" : {
    "agg" : {
      "global" : { },
      "aggregations" : {
        "genders" : {
          "terms" : {
            "field" : "gender",
            "size" : 10,
            "min_doc_count" : 1,
            "shard_min_doc_count" : 0,
            "show_term_doc_count_error" : false,
            "order" : [
              {
                "_count" : "desc"
              },
              {
                "_term" : "asc"
              }
            ]
          }
        }
      }
    }
  }
}

Another edit: Actually one workaround is to use the transport client to build the query, then inject it into the search through the JEST API, like below:
AggregationBuilder builder = AggregationBuilders.global("agg")
                .subAggregation(AggregationBuilders.terms("genders")
                        .field("gender"));
SearchRequestBuilder queryBuilder= client2.prepareSearch(INDEX_NAME)
        .setTypes(TYPE_NAME).setSize(0).addAggregation(builder); //client2 is a client initialized with the transport client
Search search = new Search.Builder(queryBuilder.toString()).addIndex("_all").addType("*").build();
SearchResult res = client.execute(search);
//          System.out.println(res.toString());
System.out.println(res.getJsonString());

P.S: I am also using the 5.5.0 version of the Elasticsearch client API.


text:
Q: I have a line multiple line equation. Now I want to draw those lines on image using MATLAB? I have the following two lines:
y = m1*x + c1 ;
y= m2*x +c2 ;

Now I want to draw those lines in an image in MATLAB?

A: This is a really basic question, and I am sure you should be able to look at Matlab help manual to solve.
You want to first create a vector of discrete number of samples, and then plug the vector into your equations to generate the vector y, and then plot.
Something like:
x=1:0.01:100; %//Adjust accordingly for higher/lower resolution
y1=m1.*x+c1 %//Note the . product, since you are dealing with a vector x
y2=m2.*x+c2 %//Use the same x here, since you want both lines on the same graph.

figure
plot(x,y1,'r') %//plot y1 in red
hold on         %//Allows to plot in same figure
plot(x,y2,'b') %//plot y2 in blue

A: I presume m1, m2, c1 and c2 are constants. You can use the plot command to create plots.
m1=1; % Set them to some value so the code works
m2=2;
c1=1;
c2=2;
x = 1:0.1:10; % Define a range of x values to plot over
y1 = m1*x + c1 ;
y2= m2*x +c2 ;
figure; % Open figure
hold on
plot(x,y1,'r') % Make the actual plot.
plot(x,y2,'b')


text:
Q: removing text inside of parentheses in sql then insert that text to different table? I have a column in MS-SQL that contain addresses the users added some additional information pertaining to the address in parentheses. sometimes it is at the end of the address sometimes it is in the middle. I need to remove that text is there a way to remove the text inside the parentheses and then insert it into another table?
for example the text would be
58795 North Test Drive (Main Office)

or it could look like this
450 South green Avenue (Green Ave. Office)  Suite 200

A: Assuming exactly one open paren, and exactly one closing paren, then a simple solution exists. I use T1 for the original table name, and T2 for the new table.
BEGIN TRANSACTION

INSERT INTO T2
SELECT ID, SUBSTRING([Address], CHARINDEX('(', [Address]) + 1, CHARINDEX(')', [Address]) - CHARINDEX('(', [Address]) - 1)
FROM T1
WHERE CHARINDEX('(', [Address]) > 0
AND CHARINDEX(')', [Address]) > 0

UPDATE T1
SET [Address] = SUBSTRING([Address], 0, CHARINDEX('(', [Address]))
              + SUBSTRING([Address], CHARINDEX(')', [Address]) + 1, LEN([Address]))

--Check your results
COMMIT TRANSACTION

A: I Figured it out.
SELECT Replace(Stuff(CONVERT(VARCHAR (max), metavalue), 1, Charindex('(',    CONVERT(VARCHAR     (max), metavalue)), ''), ')', '')
FROM   metavalues mv
WHERE  mv.subfield = 3007


text:
Q: Inclusion about solution of inequality Lets consider the following inequality form this question:
$$|y^2-y-2|\geq 4 + |y^2+y-2|+|y+4|+|y|$$
User Did said that:
$$ |y^2-y-2|=|4+(y^2+y-2)-(y+4)-y|.$$
Using the triangular inequality implies:
$$ |y^2-y-2|\leq 4 + |y^2+y-2|+|y+4|+|y|.$$
User Did then concludes:

... the only way the desired inequality can hold is when it is an equality
  and every term involved has the same sign.

My question: The first part about the equality I can comprehend. But why should all terms that are involved have the same sign?


text:
Q: How to create Fastlane Action to return filtered git commits I need to create my own Fastlane action to return git commit messages with custom filter.
This is git code:
git log $(git describe --tags --abbrev=0)..HEAD --no-merges --invert-grep --grep="\[Gitlab\ CI\]" --pretty=format:"%ad - %an, %s" --date=short

I need Fastlane action to return output of that.
I tried to find some tutorials online how to create it, but I cannot find any helpful info for me.

A: I am not sure what you are trying to do, but have you seen this ...
https://docs.fastlane.tools/actions/changelog_from_git_commits/

A: Use changelog property in your lane:
changelog = git log $(git describe --tags --abbrev=0)..HEAD --no-merges --invert-grep --grep="\[Gitlab\ CI\]" --pretty=format:"%ad - %an, %s" --date=short

3 ways to provide notes - the second one is the solution


text:
Q: Android Loader Application Not Responding I'm getting an ANR in my android application and i can't find the problem. Using Strict Mode i get this exception:
StrictMode policy violation; ~duration=2 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1107)
        at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1034)
        at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:835)
        at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:836)
        at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
        at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:143)
        at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:133)
        at android.database.CursorWrapper.getCount(CursorWrapper.java:57)
        at android.support.v4.widget.CursorAdapter.getCount(CursorAdapter.java:202)
        at com.nhaarman.listviewanimations.BaseAdapterDecorator.getCount(BaseAdapterDecorator.java:69)
        at android.widget.AdapterView$AdapterDataSetObserver.onChanged(AdapterView.java:801)
        at android.widget.AbsListView$AdapterDataSetObserver.onChanged(AbsListView.java:5958)
        at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
        at android.widget.BaseAdapter.notifyDataSetChanged(BaseAdapter.java:50)
        at android.support.v4.widget.CursorAdapter$MyDataSetObserver.onChanged(CursorAdapter.java:473)
        at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
        at android.database.AbstractCursor.requery(AbstractCursor.java:137)
        at android.database.sqlite.SQLiteCursor.requery(SQLiteCursor.java:225)
        at android.database.CursorWrapper.requery(CursorWrapper.java:186)
        at android.support.v4.widget.CursorAdapter.onContentChanged(CursorAdapter.java:449)
        at android.support.v4.widget.CursorAdapter$ChangeObserver.onChange(CursorAdapter.java:465)
        at android.database.ContentObserver.onChange(ContentObserver.java:129)
        at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:180)
        at android.os.Handler.handleCallback(Handler.java:725)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5041)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
        at dalvik.system.NativeStart.main(Native Method)

The application does the following:

*

*Start an Intent Service and grabs some feeds.

*Persist the feeds to a DB through a content provider.

*The fragment, has a loader that gets notified when the write happens

*The loader reads the new data, passes it to a cursor adapter and shows it.

However when the read happens, sometimes i get an ANR, from what i understand from the stack trace, the cursor requery the database, and i get an ANR if it takes too long, however i though Loaders did the operations async. I don't know how to solve this problem.
I initialize the adapter with the "auto-query" flag set to false it that matters.
Using android 4.4

A: You need to do the database transactions on a background thread. You're doing it on the main thread, hence the strict mode error. You could use an AsyncTask and do the transaction in the doInBackground() method.

A: If you use cursor adapter, make sure that you don't pass autoRequery flag to it in the constructor. If you pass true, Cursor.requery() will be called by the adapter, what is wrong, because this call will be triggered in UI thread. Also in a parallel thread, CursorLoader will be selecting data. So, if you will remove autoRequery flag from the CursorAdapter, the problem shuld gone. I dnon't know why this constructor wasn't deprecated but we have what we have.


text:
Q: Shiny page title and image My UI code is the following:
ui <- navbarPage(
theme = shinytheme("paper"),
title = div(img(src="ballerlablogo.png", style="margin-top: -14px;", height = 50)),

...

)

which works well, but then the title on webpage tab looks like this:

is there a way to have the page title be "Baller Lab" without getting rid of the image in the navbar or adding the "baller lab" text in the navbar?
Here is a link to the site: BallerLab.us

A: With fluidPage you can use tags$head to modify the title on the webpage tab
library(shiny)
library(shinythemes)
ui <- fluidPage(
  theme = shinytheme("paper"),
  tags$head(HTML("<title>Baller Lab</title>")), #Without company logo
  #tags$head(HTML("<title>Baller Lab</title> <link rel='icon' type='image/gif/png' href='ballerlablogo.png'>")), #WIth company logo
  navbarPage(title = div(img(src="ballerlablogo.png", style="margin-top: -14px;", height = 50))))

server <- function(input, output, session) {}

shinyApp(ui, server)