text:
Q: Removing white gap on html body Practically I got the page layout for this project setup. There is a big white gap after the last div cardsaccepted. It's a big empty gap that it makes scrolling down. I believe it could possibly be a margin issue but can't identified on where. Any idea on how to remove this big gap without affecting the layout. Here's the code

body {
  background: rgba(117, 112, 112, 0.06);
}

.main-container {
  width: 960px;
  margin: auto;
  position: relative;
  background-color: white;
}

.headercontainer {
  margin-top: 20px;
  background-color: #ddf5ce;
}

.topfiller {
  background-image: url("../Images/Aztec2white.jpg");
  background-repeat: repeat-x;
}

img.RestLogo {
  position: relative;
  left: 7px;
}

.btmfiller {
  background-image: url("../Images/Aztec2white.jpg");
  background-repeat: repeat-x;
  margin-bottom: -5px;
}

.pic-filler {
  margin-top: -25px;
}

#pic-filler {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#mainMotto {
  font-family: 'Rock Salt', cursive;
  color: rgba(11, 123, 40, 0.86);
  font-size: 110%;
  letter-spacing: -1.5px;
  position: absolute;
  top: 35px;
  left: 290px;
}

.headercontact p {
  display: block;
  position: absolute;
  top: 30px;
  left: 780px;
  line-height: 60%;
  font-family: 'Frank Ruhl Libre', sans-serif;
  font-size: 87%;
  color: brown;
}

.headercontact span {
  font-weight: bold;
  font-size: 130%;
}

.headercontact a {
  text-decoration: none;
  font-family: 'Frank Ruhl Libre', sans-serif;
  color: #921f0c;
}

.headerschedule {
  display: block;
  position: absolute;
  left: 325px;
  top: 120px;
}

.headerschedule p {
  line-height: 70%;
  font-size: 20px;
  color: #0B3504;
  font-size: 95%;
  font-weight: 600;
}

/*social media icons*/

.socialmedia {
  position: absolute;
  top: 145px;
  left: 800px;
  letter-spacing: 2px;
}

.socialmedia a {
  display: inline-block;
}

/*Navigation Menu*/

.navigationbar {
  margin: 0px;
  border-top: 1px solid rgba(106, 180, 83, 0.82);
}

.navigationbar ul {
  margin-top: 0;
  margin-bottom: 0;
  text-align: center;
}

.navigationbar li {
  display: inline-block;
  margin-top: 10px;
  list-style: none;
  margin-right: 15px;
  padding: 10px 15px;
  font-family: 'Indie Flower', cursive;
  font-size: 120%;
  text-transform: uppercase;
  background-color: #e0ecd2;
  border: 2px solid rgba(106, 180, 83, 0.82);
  border-radius: 16px;
}

.navigationbar a {
  display: block;
  color: #928c1e;
  text-decoration: none;
}

nav li:hover {
  background: #d0edaf;
}

@media screen and (max-width: 700px) {
  .navigationbar li {
    width: 50%;
  }
}

/*End of Navigation Menu*/

/*Body content*/

.bodytxtcontent {
  padding-left: 20px;
  padding-right: 20px;
  text-align: justify;
}

.body-paragraph {
  max-width: 100%;
  background-repeat: no-repeat;
  background-size: 100%;
  font-family: 'Cormorant Upright', serif;
  font-size: 150%;
  line-height: 130%;
  color: rgba(38, 150, 44, 0.9);
  font-weight: bold;
}

.bodyimg {
  max-width: 45%;
  box-sizing: border-box;
  float: right;
  margin: 7px 0 0 15px;
}

/*Not showing next to body-paragraph*/

#cantinapic {
  max-width: 100%;
  height: auto;
}

/*end of body content*/

/*Table content*/

.tablecontainer {
  background-image: url(../Images/Tacos-de-Barbacoa1.png);
  background-repeat: no-repeat;
  background-size: cover;
}

table {
  border-spacing: 0;
  border-collapse: collapse;
  margin-top: 25px;
  width: 100%;
}

table td {
  padding: 10px;
  border: 2px solid green;
  font-size: 18px;
  color: #11100f;
  text-align: center;
}

tr .items-header {
  font-weight: bold;
  text-align: right;
  font-size: 22px;
  padding: 10px;
}

/*End of Table content*/

/*Contact Us*/

form {
  background-color: #efe9e9;
  padding-top: 15px;
  padding-left: 15px;
  padding-bottom: 15px;
  border-radius: 7px;
}

.First-Half {
  width: 60%;
  float: left;
  margin-top: 30px;
}

.First-Half h2 {
  color: #2f2fa5;
  text-align: center;
  margin-right: 20px;
}

address {
  line-height: 75%;
  font-size: 20px;
  text-align: center;
}

.First-Half p {
  text-align: center;
  font-size: 20px;
  font-style: italic;
}

.First-Half a {
  text-decoration: none;
  margin-left: 12em;
  font-size: 17px;
  font-style: italic;
}

iframe {
  margin-top: 10px;
  margin-left: 5em;
  box-shadow: 10px 10px 5px #aaaaaa;
  border-radius: 5px;
}

table .table-schedule td {
  text-align: left;
  border: none;
}

.days {
  width: 25%;
  font-weight: bolder;
}

.time {
  width: 75%;
}

.Second-Half {
  width: 35%;
  float: left;
  margin-top: 30px;
}

.Second-Half h3 {
  color: #443c3e;
  line-height: 87%;
}

label {
  font-family: 'Frank Ruhl Libre', sans-serif;
}

.hidden-label {
  position: absolute;
  height: 0;
  width: 0;
  overflow: hidden;
  visibility: hidden;
}

input[type="text"],
input[type="tel"],
input[type="email"] {
  display: block;
  box-sizing: border-box;
  margin: 10px;
  padding: 10px 10px;
  font-family: 'Frank Ruhl Libre', sans-serif;
  font-size: 100%;
  border: 1px solid #CDCDCD;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus {
  border: 1px solid #CDCDCD;
  box-shadow: inset 2px 2px 2px rgba(0, 0, 0, .15);
}

input[type="submit"] {
  display: block;
  width: 60%;
  box-sizing: border-box;
  margin: 10px;
  padding-top: 7px;
  padding-bottom: 7px;
  background-color: #9b8181;
  border: 1px solid #9b8181;
  border-radius: 3px;
  font-family: 'Frank Ruhl Libre', sans-serif;
  font-size: 100%;
}

input[type="submit"]:focus,
input[type="submit"]:hover {
  border: 1px solid #CDCDCD;
  background-color: rgba(155, 129, 129, 0.84)
}

textarea {
  display: block;
  box-sizing: border-box;
  margin: 10px;
  border: 1px solid #CDCDCD;
  border-radius: 3px;
}

textarea:focus {
  border: 1px solid #CDCDCD;
  box-shadow: inset 2px 2px 2px rgba(0, 0, 0, .15);
}

/*End of Contact Us*/

/*footer section*/

#footer {
  width: 960px;
  margin-top: 100%;
  padding: 5px;
  text-align: center;
  font-size: 18px;
  background-color: #e6f9da;
}

.cardsaccepted {
  width: 725px;
  margin: 10px 15px;
}

#copyright {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  color: #9c9898;
}

#cards-accepted {
  max-width: 35%;
  height: auto;
}

.cards-paragraph p {
  font-family: 'Frank Ruhl Libre', sans-serif;
  font-size: 85%;
  font-weight: bold;
}
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Taqueria El Perico Loco</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="https://fonts.googleapis.com/css?family=Frank+Ruhl+Libre" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Rock+Salt" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Cormorant+Upright" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Indie+Flower" rel="stylesheet">
  <link href="CSS/style.css" rel="stylesheet">

Authentic Mexican Food with Tradition

Come visit us at

          150 Coronado Ave

          Daly City, CA 94051

          650.758.1000

          info@elpericoloco.com

Sundays thru Thursdays: 11am - 11pm

          Fridays & Saturdays: 11am to midnight

Home

Menu

Contact

Growing up in La Estancia de Los Lopez, Nayarit Mexico and being the oldest of seven, I gravitate to one of the family businesses. My father's love of butchering and breaking down carcass, turn into a taco stand in front of our house. Being my
          father's apprentice, I would rush home from school to cook all our meats and learn his cooking skills. Although, I loved learning new cooking skills the best part of it, was spending one on one time with my father.

As I spent more and more time in the kitchen, I began to realize how much flavor meant to me. I found myself many times creating new recipes that one day I dreamed of putting out in my restaurant. A dream that for many years seemed surreal, until
          I meet my wife who helped develop the menu that has made us who we are today in the restaurant industry.

We started in 1999 as a street vendor on East 14th and 42nd in Oakland and progressively brought our Mexican flavors to our home town in San Leandro in 2007.

We proudly accept this cards. No Minimum!

       ©All Rights Reserved 2016

A: just remove margin-top: 100% from #footer.
why do you need that margin anyway?

A: Your footer has a margin-top: 100%, which causes the empty space. Remove that and the space will be gone.
I guess you want something like
#footer {
  position: fixed;
  bottom: 0;
}

or similar.

A: An easy way to debug a display issue like this is:

*

*load the page

*right click on any element

*display the STYLES in the inspection window (google for how if you don't know what that means)

*display the web page window and the inspection window at the same time, side by side

*arrow up and down the html elements in the inspection window, expanding them so you can get in to the level you need to. The html
window will colorize to show where your focus is.

*when the 'wrong' display is 'lit up', look back at the inspection window and examine the css there to figure out what the problem is.

A: You might want to reset some margin effects. https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing
You may set the footer in fixed or absolute position down the bottom . Off the flow, you need to add some space (padding or margin) to the last element to avoid footer overlap it.
example:

body {
  background: rgba(117, 112, 112, 0.06);
  margin:0
}

.main-container {
  width: 960px;
  margin: auto;
  position: relative;
  background-color: white;
  padding-top:20px;
}

.headercontainer {
  /*margin-top: 20px;*/
  background-color: #ddf5ce;
}

.topfiller {
  background-image: url("../Images/Aztec2white.jpg");
  background-repeat: repeat-x;
}

img.RestLogo {
  position: relative;
  left: 7px;
}

.btmfiller {
  background-image: url("../Images/Aztec2white.jpg");
  background-repeat: repeat-x;
  margin-bottom: -5px;
}

.pic-filler {
  margin-top: -25px;
}

#pic-filler {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#mainMotto {
  font-family: 'Rock Salt', cursive;
  color: rgba(11, 123, 40, 0.86);
  font-size: 110%;
  letter-spacing: -1.5px;
  position: absolute;
  top: 35px;
  left: 290px;
  margin:0
}

.headercontact p {
  display: block;
  position: absolute;
  top: 30px;
  left: 780px;
  line-height: 60%;
  font-family: 'Frank Ruhl Libre', sans-serif;
  font-size: 87%;
  color: brown;
}

.headercontact span {
  font-weight: bold;
  font-size: 130%;
}

.headercontact a {
  text-decoration: none;
  font-family: 'Frank Ruhl Libre', sans-serif;
  color: #921f0c;
}

.headerschedule {
  display: block;
  position: absolute;
  left: 325px;
  top: 120px;
}

.headerschedule p {
  line-height: 70%;
  font-size: 20px;
  color: #0B3504;
  font-size: 95%;
  font-weight: 600;
}

/*social media icons*/

.socialmedia {
  position: absolute;
  top: 145px;
  left: 800px;
  letter-spacing: 2px;
}

.socialmedia a {
  display: inline-block;
}

/*Navigation Menu*/

.navigationbar {
  margin: 0px;
  border-top: 1px solid rgba(106, 180, 83, 0.82);
}

.navigationbar ul {
  margin-top: 0;
  margin-bottom: 0;
  text-align: center;
}

.navigationbar li {
  display: inline-block;
  margin-top: 10px;
  list-style: none;
  margin-right: 15px;
  padding: 10px 15px;
  font-family: 'Indie Flower', cursive;
  font-size: 120%;
  text-transform: uppercase;
  background-color: #e0ecd2;
  border: 2px solid rgba(106, 180, 83, 0.82);
  border-radius: 16px;
}

.navigationbar a {
  display: block;
  color: #928c1e;
  text-decoration: none;
}

nav li:hover {
  background: #d0edaf;
}

@media screen and (max-width: 700px) {
  .navigationbar li {
    width: 50%;
  }
}

/*End of Navigation Menu*/

/*Body content*/

.bodytxtcontent {
  padding-left: 20px;
  padding-right: 20px;
  text-align: justify;
}

.body-paragraph {
  max-width: 100%;
  background-repeat: no-repeat;
  background-size: 100%;
  font-family: 'Cormorant Upright', serif;
  font-size: 150%;
  line-height: 130%;
  color: rgba(38, 150, 44, 0.9);
  font-weight: bold;
}

.bodyimg {
  max-width: 45%;
  box-sizing: border-box;
  float: right;
  margin: 7px 0 0 15px;
}

/*Not showing next to body-paragraph*/

#cantinapic {
  max-width: 100%;
  height: auto;
}

/*end of body content*/

/*Table content*/

.tablecontainer {
  background-image: url(../Images/Tacos-de-Barbacoa1.png);
  background-repeat: no-repeat;
  background-size: cover;
}

table {
  border-spacing: 0;
  border-collapse: collapse;
  margin-top: 25px;
  width: 100%;
}

table td {
  padding: 10px;
  border: 2px solid green;
  font-size: 18px;
  color: #11100f;
  text-align: center;
}

tr .items-header {
  font-weight: bold;
  text-align: right;
  font-size: 22px;
  padding: 10px;
}

/*End of Table content*/

/*Contact Us*/

form {
  background-color: #efe9e9;
  padding-top: 15px;
  padding-left: 15px;
  padding-bottom: 15px;
  border-radius: 7px;
}

.First-Half {
  width: 60%;
  float: left;
  margin-top: 30px;
}

.First-Half h2 {
  color: #2f2fa5;
  text-align: center;
  margin-right: 20px;
}

address {
  line-height: 75%;
  font-size: 20px;
  text-align: center;
}

.First-Half p {
  text-align: center;
  font-size: 20px;
  font-style: italic;
}

.First-Half a {
  text-decoration: none;
  margin-left: 12em;
  font-size: 17px;
  font-style: italic;
}

iframe {
  margin-top: 10px;
  margin-left: 5em;
  box-shadow: 10px 10px 5px #aaaaaa;
  border-radius: 5px;
}

table .table-schedule td {
  text-align: left;
  border: none;
}

.days {
  width: 25%;
  font-weight: bolder;
}

.time {
  width: 75%;
}

.Second-Half {
  width: 35%;
  float: left;
  margin-top: 30px;
}

.Second-Half h3 {
  color: #443c3e;
  line-height: 87%;
}

label {
  font-family: 'Frank Ruhl Libre', sans-serif;
}

.hidden-label {
  position: absolute;
  height: 0;
  width: 0;
  overflow: hidden;
  visibility: hidden;
}

input[type="text"],
input[type="tel"],
input[type="email"] {
  display: block;
  box-sizing: border-box;
  margin: 10px;
  padding: 10px 10px;
  font-family: 'Frank Ruhl Libre', sans-serif;
  font-size: 100%;
  border: 1px solid #CDCDCD;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus {
  border: 1px solid #CDCDCD;
  box-shadow: inset 2px 2px 2px rgba(0, 0, 0, .15);
}

input[type="submit"] {
  display: block;
  width: 60%;
  box-sizing: border-box;
  margin: 10px;
  padding-top: 7px;
  padding-bottom: 7px;
  background-color: #9b8181;
  border: 1px solid #9b8181;
  border-radius: 3px;
  font-family: 'Frank Ruhl Libre', sans-serif;
  font-size: 100%;
}

input[type="submit"]:focus,
input[type="submit"]:hover {
  border: 1px solid #CDCDCD;
  background-color: rgba(155, 129, 129, 0.84)
}

textarea {
  display: block;
  box-sizing: border-box;
  margin: 10px;
  border: 1px solid #CDCDCD;
  border-radius: 3px;
}

textarea:focus {
  border: 1px solid #CDCDCD;
  box-shadow: inset 2px 2px 2px rgba(0, 0, 0, .15);
}

/*End of Contact Us*/

/*footer section*/

#footer {
  position:fixed;
  width: 960px;
  /*margin-top: 100%;*/
  bottom:0;
  padding: 5px;
  text-align: center;
  font-size: 18px;
  background-color: #e6f9da;
}

.cardsaccepted {
  width: 725px;
  margin: 10px 15px 50px;
}

#copyright {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  color: #9c9898;
}

#cards-accepted {
  max-width: 35%;
  height: auto;
}

.cards-paragraph p {
  font-family: 'Frank Ruhl Libre', sans-serif;
  font-size: 85%;
  font-weight: bold;
}
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Taqueria El Perico Loco</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="https://fonts.googleapis.com/css?family=Frank+Ruhl+Libre" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Rock+Salt" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Cormorant+Upright" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Indie+Flower" rel="stylesheet">
  <link href="CSS/style.css" rel="stylesheet">

Authentic Mexican Food with Tradition

Come visit us at

          150 Coronado Ave

          Daly City, CA 94051

          650.758.1000

          info@elpericoloco.com

Sundays thru Thursdays: 11am - 11pm

          Fridays & Saturdays: 11am to midnight

Home

Menu

Contact

Growing up in La Estancia de Los Lopez, Nayarit Mexico and being the oldest of seven, I gravitate to one of the family businesses. My father's love of butchering and breaking down carcass, turn into a taco stand in front of our house. Being my
          father's apprentice, I would rush home from school to cook all our meats and learn his cooking skills. Although, I loved learning new cooking skills the best part of it, was spending one on one time with my father.

As I spent more and more time in the kitchen, I began to realize how much flavor meant to me. I found myself many times creating new recipes that one day I dreamed of putting out in my restaurant. A dream that for many years seemed surreal, until
          I meet my wife who helped develop the menu that has made us who we are today in the restaurant industry.

We started in 1999 as a street vendor on East 14th and 42nd in Oakland and progressively brought our Mexican flavors to our home town in San Leandro in 2007.

We proudly accept this cards. No Minimum!

       ©All Rights Reserved 2016


text:
Q: Cinema 4D .obj files do not import correctly I have a parser written in ActionScript for importing .obj files.  I then render them in Molehill, which is awesome.  So far, I can import what I think are standard .obj files with vertices in the x, y, z order or the z, x, y order.  However, any .obj file exported from Cinema 4D just fails.
A tetrahedron, for example, doesn't even render a z component (the .obj file has indices with proper z-depth!).  A simple cube is missing half of the triangle faces.  I heard that Cinema 4D exports in the x, z, y order and so I tried to account for that as well, but no luck.  And really, the vertex order shouldn't result in missing polygons anyway.
Has anyone imported Cinema 4D meshes from .obj files?  Is there some special trick?  Does Cinema 4D just ingnore the Wavefront .obj standards?  Thanks in advance for any help.
Update:
I believe the culprit is that the index data for the polygons is in a set of 4 instead of 3.  For example, I want this: 1/1 2/2 3/3 but not this: 1/1 2/2 3/3 4/4.  The Cinema 4D exports .obj files as the latter.  Anyway to address this problem on either the parsing end or the Cinema 4D exporting end?
Update2:
Now the index data is the way I want it, but still I cannot render properly.  The following is for a regular tetrahedron.  When I attempt to render it, only two of the four faces appear:
# WaveFront *.obj file (generated by CINEMA 4D)
g __
v -70.571068 -100 122.232675
v 141.142136 -100 0
v 0 100 0
v -70.571068 -100 -122.232675
vt 0.666667 0 0
vt 0.5 0.5 0
vt 0 0 0
vt 1 0 0
vt 0 0.5 0
vt 0.333333 1 0
vt 1 1 0
vt 0.666667 1 0
vt 0.333333 0 0
vt 0.75 0.933013 0
f 4/10 2/5 1/2
f 1/1 3/8 4/9
f 2/4 3/7 1/1
f 4/9 3/6 2/3

Is there anything odd about the above conent?  (It would help if I had an .obj file exported from another standard 3D software of the same tetrahedron)

A: I'm not sure how you're drawing the mesh using Molehill, but it's fairly easy to triangulate the mesh before exporting to .obj by using Functions > Triangulate.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Cannot assign requested address with golang and net/http packages I have this server in golang :
package main

import (
    "fmt"
    "net/http"
 )

func hello(w http.ResponseWriter, r *http.Request) {
    w.WriteHeader(204)
    fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])

    w.Header().Set("Connection", "close")

    fmt.Println(r.Close)
}

func main() {

    http.HandleFunc("/", hello)
    http.ListenAndServe(":8080", nil)
}

Then I wanted to try to quickly benchmark how it can handle requests whit this python script:
import requests

payload = "test"

while True:
    r = requests.post("http://127.0.0.1:8080/test", data = payload)
    r.connection.close()

After multiple loops it cannot assign new ports. I deduce that my server doesn't close connection (or my client).
How should I manage connection from server side?

A: You're running out of ports.
Since you're setting w.Header().Set("Connection", "close") each request is going to take a new connection entirely. If you don't want to use up ports, re-use the connections.
In your client, you're closing entire connection pool, which also will use up more resources. Call r.close() to return the connection to the pool and it will be reused if possible. Even though the response is small, it's still good practice to ensure the client consumes the entire response body. If the server can't flush its send buffers, it won't be able to efficiently handle the connections either, and it may take longer to close them.


text:
Q: how to read the json data in multidimensional response How to parse the below data in node I want to read value by key like special_price =10.0000 & cost=20.0000
   [
   {
      "attributeCode":"description",
      "value":"
The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.
\r\n
\r\n
Dual top handles.
\r\n
Adjustable shoulder strap.
\r\n
Full-length zipper.
\r\n
L 29\" x W 13\" x H 11\".
\r\n
"
   },
   {
      "attributeCode":"special_price",
      "value":"10.0000"
   },
   {
      "attributeCode":"special_from_date",
      "value":"2016-12-20 00:00:00"
   },
   {
      "attributeCode":"cost",
      "value":"20.0000"
   },
]

A: If you want to parse to the object
var responseArr = [
   {
      "attributeCode":"description",
      "value":"
The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.
\r\n
\r\n
Dual top handles.
\r\n
Adjustable shoulder strap.
\r\n
Full-length zipper.
\r\n
L 29\" x W 13\" x H 11\".
\r\n
"
   },
   {
      "attributeCode":"special_price",
      "value":"10.0000"
   },
   {
      "attributeCode":"special_from_date",
      "value":"2016-12-20 00:00:00"
   },
   {
      "attributeCode":"cost",
      "value":"20.0000"
   },
]

var responseObj = responseArr.reduce(function(obj, elm){
  obj[elm.attributeCode] = elm.value;
  return obj;
}, {})

console.log(responseObj) // Object {description: "
The sporty Joust Duffle Bag can't be beat - not…per.

L 29" x W 13" x H 11".

", special_price: "10.0000", special_from_date: "2016-12-20 00:00:00", cost: "20.0000"}

then you can responseObj.special_price or responseObj.cost.
And dont forget to parseFloat.

A: Hope it helps you.
function parse(data, attribute){
    for(var index in data){
       if(data[index]["attributeCode"] == attribute)
          return data[index]["value"];
    }
    return null;
}

e.g.
var body=[
  {
     "attributeCode":"description",
     "value":"
The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.
\r\n
\r\n
Dual top handles.
\r\n
Adjustable shoulder strap.
\r\n
Full-length zipper.
\r\n
L 29\" x W 13\" x H 11\".
\r\n
"
  },
  {
     "attributeCode":"special_price",
     "value":"10.0000"
  },
  {
     "attributeCode":"special_from_date",
     "value":"2016-12-20 00:00:00"
  },
  {
     "attributeCode":"cost",
     "value":"20.0000"
  },
];

console.log(parse(body, "special_price"));  //10.000


text:
Q: Does there exist a triple point map? It is known that for every continuous map $M:S^1\to \mathbb{R}$ there are infinite double points.also by borsuk-ulam theorem this is true for each map $N:S^n\to \mathbb{R}^n, n\in \mathbb{N}$.
A question arising here concerns finding k-manifold $X$ which each map $S:X \to \mathbb{R}^k$ has a triple point.
A: Does there exist such $X$? if yes then how it would be figure out?
B: Does there exist a minimal $X$? (means the number of triple points of a map $S:X \to \mathbb{R}^k$ be minimum among all $S$ and all $X$.)
Note: a function $f:X\to Y$ have a double/triple point if for a point $p\in Y$ the preimage $f^{-1}(p)$ consist of at least 2/3 points in $X$.


text:
Q: How to run angular code snippet in Ionic framework So I have this simple code in angular that works on jsfiddle as you can see by pressing Run code snippet:

function ContactController($scope) {
    $scope.contact = 0;

    $scope.add = function() {
        $scope.contact += 1;
    }
}

    <button ng-click="add()">Add</button>

{{ contact }}

But when I try to use it in my Ionic app, it doesn't work. This is my complete index.html file:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <button ng-click="add()">Add</button>

 {{ contact }}

Can anyone please tell me what I need to include in index.html in order for angular to work?

A: yes you need to initialize your app. in your app.js file you should see
angular.module('starter', ['ionic'])

so in your index.html you have ng-app=""
that needs to say
ng-app="starter"

You're html should look like this:

    <button ng-click="add()">Add</button>

 {{ contact }}

right now nothing is being bootstrapped and angular is not being attached to the page.


text:
Q: Given tangents from A and C, find minimum length of AC Let $ H $ be the intersection point of the heights of the acute-angled triangle $ ABC $. From points $ A $ and $ C $, tangents $ AK $ and $ CT $ are drawn to the circle drawn on the segment $ BH $ as on the diameter. Let $ 15 $ and $ 19 $ be the lengths of these tangents. What is the square of smallest possible $ AC $ side length?
It can be easy for me if it is with value. As It is an acute triangle, can't find the way. Please help me with a solution to go with this type in the future.
My Simple Answer:
$AK^2 + AC^2 = CT^2$
$15^2 + AC^2 = 19^2$
$AC^2 = 361 - 225$
$AC^2 = 136$

A:
Let the feet of perpendiculars from point $A$, $B$ and $C$ on the respective opposite sides be $D$, $E$ and $F$ respectively. The circle with diameter $BH$ will pass through points $D$ and $F$. Let the tangents from $A$ and $C$ to this circle be $AS$ and $CT$ respectively.
Considering the power of points $A$ and $C$ with respect to this circle gives,
$AS^{2}=AF\cdot AB$
$CT^{2}=CD\cdot BC$
Now, observe that, $CD\cdot BC=CE\cdot AC$ because $\triangle ACD\sim \triangle BCE$. Similarly, $AF\cdot AB=AE\cdot AC$ because $\triangle CAF\sim \triangle BAE$.
$\Rightarrow AS^{2}=AF\cdot AB=AE\cdot AC$ and similarly $CT^{2}=CE\cdot AC$.
Adding these two equations gives,
$AC^{2}=\boxed {AS^{2}+CT^{2}}$
Now plugging in the lengths of the tangents will give the value of $AC^{2}$.


text:
Q: Why is it that the login isn't secured through HTTPS? Firefox recently added an information dialog, which tells us, when login data could be compromised (because it is sent over plain HTTP). Why is it that so many websites are secured through SSL, but they let out the login process? Are those things that much different? If SSL already works, why not also use it for the login process? How could this have become a problem in the first place? I mean, it takes some work to set up SSL for a backend-application, but isn't it free to link it to the login too? Are there pitfalls or something when you do that?

A: There is no reason to left out the login from https. Quite the opposite.
If the login page use https but the form has an http target, even if that target redirects to https, it's insecure and the browser will probably display a warning. There is no reason to not change the target to directly use https.
And, the only secure configuration is to use https on all the webpages, with HSTS. Any other configuration makes https webpages vulnerable to MitM/SSLStrip attacks.


text:
Q: This for loop when I was trying to make a luck-based code has an error, how to fix? In my code, I am trying to make a luck-based code that I can test my luck.
But here, it says I have an error on my 'For', and it was pointing at the ':'
Please explain why, any help is appreciated
Here, I was doing my For loop
    for (count > 69420):
        num = random.randint(0,5000)
        print(num)
        if num == 69:
            root.mainloop()

In this line, it was saying error, so I was not able to run the code
    for (count > 69420):

A: The expression for (count > 69420): is not valid in a for loop. You need an iterator and an iterable.

*

*If you want to count to 69420 and execute it once for each count,
write: for count in range(69420):

*If you want to only execute it if count is higher, write: if count > 69420:

*If you want to only execute it while count is higher, write: while count > 69420: and
don't forget to change the value of count within the loop or it
will be infinite.

Also, there is no reason why you should make root.mainloop() conditional to chance. What exactly is your logic, there?


text:
Q: how do I access a radiobutton inside a ListBoxItem in windows phone 7 Please review the code for the ListBox I am using
<ListBox Name="listBoxDefaultAcc" HorizontalAlignment="Left" VerticalAlignment="Top" Width="450" Height="410">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Height="60" Width="450">
                            <RadioButton Content="{Binding}" GroupName="defaultAcc" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Width="450" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

Now I want to access the content property of the RadioButton from codebehind.
The ListBoxItems are getting filled dynamically from the codebehind with the following code:
listBoxDefaultAcc.ItemsSource = from acc in db.Table<Accounts>()
                                        select acc.accName;

Please help me out with this.

A: You can use the VisualTreeHelper and drill down to the control.  This is not recommended though.
Better is to only bind to the properties of the controls in you datatemplate and then retrieve the values by getting the binded values.   Technically in this case, if you would want to change the content of the radiobutton then you would need to change the item in the itemssource
Can you explain what you are trying to archieve by getting the content of the radiobutton?
Edit**********
  <ListBox Name="listBoxDefaultAcc" HorizontalAlignment="Left" VerticalAlignment="Top" Width="450" Height="410">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Height="60" Width="450">
                            <RadioButton Content="{Binding Name}" IsChecked="{Binding Selected, Mode=TwoWay}" GroupName="defaultAcc" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Width="450" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>

public partial class Home : Page
{
    public Home()
    {
        InitializeComponent();
        var items = new List<SomeClass>();
        items.Add(new SomeClass() {Name = "a"});
        items.Add(new SomeClass() {Name = "b"});
        items.Add(new SomeClass() {Name = "c"});

        listBoxDefaultAcc.ItemsSource = items;
    }

    // Executes when the user navigates to this page.
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
    }

    private void testButton_Click(object sender, RoutedEventArgs e)
    {
        var items = (List<SomeClass>)listBoxDefaultAcc.ItemsSource;
        var selectedItem = items.Where(x => x.Selected).FirstOrDefault();
    }

    class SomeClass
    {
        public string Name { get; set; }
        public bool Selected { get; set; }
    }
}

A: You should be using DataBinding. You should bind Content to a property, that represents content, of an object, you are setting as item.
This way, you dont have to care about ListBoxes or Templates or anything. You are simply manipulating objects, and theese changes get reflected in the GUI.


text:
Q: Can I set a minimal time required between clicks for a double-click? This might be a bit of a weird question and usually easily solvable, but company restrictions prevent me from doing this the easy way, so please bear with me.
In my office work-space I've been assigned a mouse to work with. This mouse unfortunately is slightly defective. Defective enough to be highly annoying but not defective enough to pass for a replacement. The main problem is:
Sometimes when I single-click, the mouse sends 2 clicks in a row, resulting in a double-click
This is highly annoying, for example it has caused me to close 2 windows instead of just the one I want multiple times. And as a programmer, when I want to place the cursor at a specific point in my code I accidentally select the whole line and start overwriting what I made before.
Of course I've consulted Microsoft's Knowledge Base for this. Step 1:

Verify your clicking method: Make sure that you are performing a true single physical click. A single-click occurs when you press and release a mouse button one time.

Well... Microsoft doesn't take my complaint very serious it seems. The article basically ends with me having to turn the mouse off and on again.
So I tried messing with the double-click speed settings in windows. But the only thing it really changes is the maximum delay between clicks for it to register a double-click. This doesn't solve my problem at all because the speed at witch these inputs are send are close to a few millisecond. And I still want to actually double-click when I want to.
I can only see 2 options that would fix my dilemma (and I prefer the latter):

*

*Physically break the mouse - If my mouse literally doesn't work anymore, I can get a replacement, hopefully by the end of this day, probably by the end of the week.

*Find a way to force a time delay between clicks to register as a double-click - the problem is caused by inputs that are being send a few milliseconds in a row. A human is pretty much physically restricted to having a clicking delay of about 100 milliseconds, if I can somehow filter out these false positives by enforcing a - let's say - 50 millisecond delay required before I can click again for a double click, that would solve my problem. In theory.


text:
Q: Picklist value change throwing error In a pick list, there are three status fields
 1. Open
 2. In-Progress
 3. Closed
Only Owner is able to change the status from In-progress to Closed.
When other user changes it should throw an error.Others can only change the status from Open to In-progress.
How to obtain this using simple formula.Please help

A: Use a validation rule to check values
AND(
  ISPICKVAL(PRIORVALUE(Status__c),'InProgress'),
  ISPICKVAL(Status__c,'Closed'),
  $User.id != OwnerId
)

Basically is says
If the previous value was InProgress and is changing to Closed then if the Current User is not the owner evaluate to true and throw validation error
From your question

Only Owner can change the status from In progress to Closed

it sounds like it was OK to change from open to closed...
If only owner can change to closed

Others can only change the status from Open to In progress

then use this
AND(
  ISPICKVAL(Status__c,'Closed'),
  $User.id != OwnerId
)


text:
Q: What is a quick way I can add simple authentication to a few ASP.NET MVC routes, without implementing the whole Membership provider jazz? I've created a demo website for my boss and one of the requirements is I need to add some simple authentication to his 3 admin views/routes.
What is the simplest, quickest way I can do this without implementing a whole membership provider?  I honestly don't even care if the user/pass is hardcoded on the server side, I just need it so they can't access those 3 views without having authenticated in some way.

A: I would go this route.
Add this to your web.config (could omit the SHA1 and use a plain text password if you want):
<authentication mode="Forms">
  <forms loginUrl="~/admin" timeout="2880">
      <credentials passwordFormat="SHA1">
        <user name="admin" password="4f3fc98f8d95160377022c5011d781b9188c7d46"/>
      </credentials>
  </forms>
</authentication>

Create a simple view for username and password and in the action method that receives the username and password go with this...
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult LogOn(string username, string password)
{
    if (FormsAuthentication.Authenticate(username, password))
    {
        FormsAuthentication.SetAuthCookie(username, false);
        return RedirectToAction("Index", "Home");
    }
    else
    {
        ViewData["LastLoginFailed"] = true;
        return View();
    }
}

FormsAuthentication.Authenticate() automatically checks the username and password against the credentials node we created earlier. If it matches it creates your auth cookie with a "Remember Me" value of false and redirects you to the index view of your home controller. If it doesn't match it returns to the login page with ViewData["LastLoginFailed"] set to true so you can handle that in your view.
PS - Now that you have an easy way of authorizing don't forget to put the [Authorize] filter over the actions or controllers you want to protect.

A: easiest would be to select the menu [project] followed by [ASP.NET Configuration] in Visual Studio.
It'll set up a membership db for you.  then add a couple of roles and users in the configuration manager that pops up.
that's it!  Then simply decorate your actions/controllers with [Authorise] and check for some rights based on the user name.  <= hard coded for the demo


text:
Q: In-app billing developer payload argument? I've Googled this concept six ways from Sunday and I feel like I can't find a straight answer on it. The official Google docs say it isn't meant for security, but then a bunch of answers I find seem to imply otherwise, etc.
From the docs:

The fifth argument contains a 'developer payload' string that you can
  use to send supplemental information about an order (it can be an
  empty string). If you specify a string value, Google Play returns this
  string along with the purchase response. Subsequently, when you make
  queries about this purchase, Google Play returns this string together
  with the purchase details.
Caution: Don't use the developerPayload field for security validation
  purposes. This field isn't always available when completing tasks
  related to In-app Billing. For more information about security best
  practices, see the In-app Billing Security and Design guide.

From the official Google test project:
/** Verifies the developer payload of a purchase. */
boolean verifyDeveloperPayload(Purchase p) {
    String payload = p.getDeveloperPayload();

    /*
     * TODO: verify that the developer payload of the purchase is correct. It will be
     * the same one that you sent when initiating the purchase.
     *
     * WARNING: Locally generating a random string when starting a purchase and
     * verifying it here might seem like a good approach, but this will fail in the
     * case where the user purchases an item on one device and then uses your app on
     * a different device, because on the other device you will not have access to the
     * random string you originally generated.
     *
     * So a good developer payload has these characteristics:
     *
     * 1. If two different users purchase an item, the payload is different between them,
     *    so that one user's purchase can't be replayed to another user.
     *
     * 2. The payload must be such that you can verify it even when the app wasn't the
     *    one who initiated the purchase flow (so that items purchased by the user on
     *    one device work on other devices owned by the user).
     *
     * Using your own server to store and verify developer payloads across app
     * installations is recommended.
     */

    return true;
}

I have absolutely no idea what this means. If I don't have my own server, should I just be using a blank string? How am I supposed to differentiate users and purchases and devices?
None of this is clear to me and this code / the official docs offer no real clarification, and most of the online answers are similarly sparse.
Can anyone just lay it out: What should I be sending as my developer payload argument?

A: At least you have security reason to generate random string: two the same purchases with different developerPayload always will have different purchase data and signatures.
String developerPayload = UUID.randomUUID().toString();

If you don't process answers on your server, you don't have any reasons to remember and check this string (see warning at google test).

A: The last point in the remarks of Google's code seems helpful

Using your own server to store and verify developer payloads across app
  installations is recommended.

If you have a server you could have a getRandomString endpoint, which the server creates and adds to the list of available random strings associated with the user account.
When the string is returned to the client, this can be used as the developer payload.
Then when it comes to verifying the purchase token on the server you can get the payload and check it against the list of available random strings on the server.
However, I'm not sure if this adds any security as such. And I don't see how this helps "across app installations." Because for managed products, regardless of the app installation, you can't buy multiple managed products. They have to be consumed before they can be purchased again...
Did you solve your problem in the end. I would be interested to know what you did in the end as I'm facing the same problem, only I have a server back end.


text:
Q: Tukey Test in Linear Regression Model Development I am not able to interpret properly the Tukey Test results from a linear regression model i have built. The Tukey Test for the model i believe is to test is the model is linear. Please correct me if i am wrong. We get this Tukey result from residualPlots command in R.
From the Tukey Test, all the variable have a p-value that are non-significant (p>0.05) but the Tukey Test for the entire model is significant (p=000). How can i make the Tukey Test non- significant for the entire model.
Please let me know the approach i need to use to make the tukey test non-significant for the entire model. And also the R codes that will help me here. Thanks.
The data is ordinal survey data. Most of the questions are scaled from 1 to 5. However, i am treating them to be continuous to build an overall model. There are a few variables that are binary 1/0. In total there are 18 independent variables, and three additional transformed variables (i.e. squared).  The sample size is ~2000 observations.


text:
Q: Pass native array as managed array from C++/CLI I have 3rd party lib that controls camera.
It is written in C++ and I want to consume it from C#. The lib grabs image as byte*.
There are some ways to pass this to C#.

*

*Pass byte* directly to C# with unsafe statement. In this case, C# code can't change image size like crop operation.

*Use Marshal.Copy to create managed byte array and pass it. This gives flexibility to C#, but there is overhead and additional memory usage.

So, my question is:
Is there a way to convert byte* to managed byte[] without copy? Because managed byte array with fixed statement is "blittable", I think there can be "reverse direction" method.
Any help is appreciated, thank you.


text:
Q: why this error occurs in modelsim for me? Variable 'V' written by continuous and procedural assignments
Variable 'F' written by continuous and procedural assignments.
my code is:
   module ALU(input signed [7:0] A,B ,input [2:0] sel ,input Si,input Ci ,output logic signed [15:0] F ,output logic N,Z,V,Eq);
always @(A,B,sel) begin
    F=15'b 0;
    N=1'b 0;
    Z=1'b 0;
    V=1'b 0;

    case(sel)
    3'b 000:begin F=A+B+Ci; end
    3'b 001:F=A+(~B+1);
      3'b 010:F=A<<1;
      3'b 011:F=A>>>1;
      3'b 100:begin F=A>>1; F[7]=Si; end
      3'b 101:begin F=A<<1; F[0]=Si; end
      3'b 110:F=A*1.5;
      3'b 111:F=A*B;
    endcase
end
assign V=(A[7]==B[7]&&F[7]!=A[7])?1'b1:1'b0;
assign F[15:8]=(V)?((A[7]==1)?8'b11111111:8'b00000000):((F[7]==1)?8'b11111111:8'b00000000);

endmodule

A: The problem is that in the always block, you are making procedural (variable type) assignments. However, you are also making a coninuous assignment towards the end of the module.
You might try to refactor the continuous assignment in to the always block so that you only have procedural assignment.

A: The issue is that you are using both a continuous assignment (assign F = ...) and a procedural assignment (in the always block) which is not allowed in the language.
I am guessing that in this case you might refactor the code only to use procedural assignment.
The point is specified in 10.3.2 of IEEE1800-2012. You will see a reference to 'procedural continuous assignment in 10.6, but this is best avoided due to possible future deprecation.


text:
Q: Element Binding in Element Binding in SAPUI5 I'm using element binding in XML to get data from an OData service in the controller:
{myModel2>/oData/ProdOrdSet('123456789')/Gmein}

The whole thing should now work with dynamic numbers instead of 123456789.
I started with the following approach:
{myModel2>/oData/ProdOrdSet('{myModelLD>/Aufnr}')/Gmein}

So another JSON Model and another element in the first. Unfortunately this did not work, kindly help?

A: Try to get the ID in a local variable and form the binding path to bind. Instead of this
{myModel2>/oData/ProdOrdSet('{myModelLD>/Aufnr}')/Gmein}

try binding as below:
var id = getModel("myModelLD").getProperty("/Aufnr");
var sPath = "myModel2>/oData/ProdOrdSet('"+id+"')/Gmein";
this.getView().bindElement(sPath);


text:
Q: Conditional Validation on Different Pages - Rails A quick Rails question that I would love your guys' help on. Been looking around for the answer and everything out there seems a bit on the more complex side for what I think is the solution. I have two pages that use a model (User) and a form on each page which updates a different attribute when saved.

*

*One updates their password details (validation is for presence of password)

*One updates their quiz's response (validation is for 300 max characters)
How can I do conditional validation so that when I submit the form, validations appear on their respective pages? Do I need two separate actions? How do I link these actions to the form submit?
Here is the generic update action and the form:
Users controller
def update
  @user = User.find(params[:id])
  if @user.update_attributes(params[:user])
    flash[:success] = "All is updated"
    sign_in @user
    redirect_to @user
  else
    render 'edit'
  end
end

Form

Linked-In Optimization

<%= form_for(@user) do |form| %>

<%= form.label :linkedin, 'Please copy and paste your Linked-In profile here (575  chars max.)' %>

<%= form.text_area :linkedin %>

  <%= form.submit 'Save' %>

<% end %>

A: To simplify things, use two separate controller actions.
To link your form submit to the new paths, do this
<%= form_for(@user, :url => update_password_user_path(@user)) do |f| %>

If you've added the necessary validations in your model, the error messages will appear on your respective forms.


text:
Q: Ubuntu 16.04, installing updates returned an error code (1) I was doing routine update && upgrade procedure on Ubuntu 16.04 and it wanted to upgrade some multimedia codec libraries

I confirmed the upgrade as seen in the picture above. Then the upgrade process returned error code (1) and couldn't finish upgrading.

Now I am getting this unmet dependency thing when I try to do anything related to upgrade.
The following packages have unmet dependencies:
 libavcodec-extra57 : Depends: libx265-102 (>= 2.2) but it is not installed
 x265 : Depends: libx265-102 (>= 2.2) but it is not installed
        Depends: libx265-102 (< 2.3) but it is not installed
E: Unmet dependencies. Try using -f.

I am concerned. Is it possible to revert to the state before I try to upgrade?

A: I have solved my issue by following dpkg overwrite
Specifically I entered:
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libx265-102_2.2-1~16.04.york0_amd64.deb

A: Let's try to clear up the 'partial' error first. Be very careful with these commands:
sudo rm -vf /var/lib/apt/lists/partial/*  # Remove files in 'partial'
sudo rm -vf /var/lib/apt/lists/*  # Remove package lists in 'lists'
sudo apt-get update

If you are still getting a 'status' error, try restoring a backup copy of the file:
sudo mv /var/lib/dpkg/status /var/lib/dpkg/status.0715
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
sudo apt-get update


text:
Q: on duplicate key update works in my local wordpress but not in another site I created a table to hold meta data about a custom taxonomy and everything works fine in my local instance (created with ampps) of wordpress when I go to insert using ON DUPLICATE KEY UPDATE it finds the row with the unique key group_id and does the update instead of the insert.
however, when I moved this code to my dev instance (instance which is live on the internet on a subdomain) ON DUPLICATE KEY UPDATE creates duplicates. no code has changed.
at this point i'm stumped. is there a mysql version limitation for ON DUPLICATE KEY UPDATE?
are there plugins that can disrupt the default behavior of  ON DUPLICATE KEY UPDATE on a global scale?
UPDATE: this code is what I'm using to create my table
function create_prg_team_grouping_table(){
global $wpdb;

//create the name of the table including the wordpress prefix (wp_ etc)
$search_table = $wpdb->prefix . "prg_team_grouping";
//$wpdb->show_errors();

//check if there are any tables of that name already
if($wpdb->get_var("show tables like '$search_table'") !== $search_table)
{
    //create your sql
    $sql =  "CREATE TABLE ". $search_table . " (
                  stat_id mediumint(12) NOT NULL AUTO_INCREMENT,
                  use_in_grouping text,
                  group_name text,
                  group_id mediumint(12) NOT NULL,
                  group_order mediumint(9),
                  UNIQUE KEY (stat_id,group_id));";
}

//include the wordpress db functions
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($sql);

//register the new table with the wpdb object
if (!isset($wpdb->prg_team_grouping))
{
    $wpdb->prg_team_grouping = $search_table;
    //add the shortcut so you can use $wpdb->prg_team_grouping
    $wpdb->tables[] = str_replace($wpdb->prefix, '', $search_table);
}
}

//add to front and backend inits
add_action('after_switch_theme', 'create_prg_team_grouping_table');

A: I'd double-check that your index is unique / primary.  That is, make sure you have a unique constraint on the value that should be triggering the update.
If the only difference is in the database, chances are the schema is incomplete.
MySQL INSERT IGNORE / ON DUPLICATE KEY UPDATE not detecting duplicates


text:
Q: Cache scene in Three.js PIXI.js has Container#cacheAsBitmap which causes the container to "render" itself to an image, save that, render the image instead of its children and when a child is added or removed or updated, the cache is updated.
What's the alternative for Three.js (but instead of an image it would be a mesh)?

A: I may not be understanding your question properly, but your reply to Sabee's answer was helpful.  It sounds like you're looking to either merge multiple geometries into a single mesh or implement a form of model instancing, with the goal of reducing draw calls.
There is more than one way to accomplish this, depending on your requirements.  You can merge multiple geometries into a single geometry object, and provide either one material or an array of materials (where each index corresponds to one of the merged geometries).  You can also use GPU-accelerated instancing to achieve a similar effect with only a single copy of the geometry.
I'll refer to Dusan Bosnjak's excellent Medium series on instancing, which starts here: https://medium.com/@pailhead011/instancing-with-three-js-36b4b62bc127
As well, here are the three.js examples regarding instancing: https://threejs.org/examples/?q=instanc#webgl_buffergeometry_instancing_dynamic

A: Pixi.js is a 2D javascript library, using WebGL to render the images(frames) into html5 canvas. Three.js allows the creation of Graphical Processing Unit (GPU)-accelerated 3D animations using WebGL.
The browser cannot store rendered 3D frames, this work allows the GPU Accelerated Render Cache, which depends on what hardware's they run. Helpful post understanding what's going on behind the scenes.
But you can cahce your assets in browser like images, json objects of 3D models and etc.
In Three.js Cache class is a global object, used by assets loaders (TextureLoader, ImageLoader, AudioLoader ...), by default is disabled (false). To enable it you can set THREE.Cache.enabled = true ;
I think by default the browser should cache the textures for performance reasons, but if you want to be sure simply enable the cache by force code it in Three.js. Also the creator of Three.js answered this question.


text:
Q: Can I make a image validator like TextFormField when button click? I'm trying to make a upload page like this:

And I want the image / video have a validator like the TextFormField Error or give a toast that the image is empty and can't be uploaded


text:
Q: Uses of destructor = delete; Consider the following class:
struct S { ~S() = delete; };

Shortly and for the purpose of the question: I cannot create instances of S like S s{}; for I could not destroy them.
As mentioned in the comments, I can still create an instance by doing S *s = new S;, but I cannot delete it as well.
Therefore, the only use I can see for a deleted destructor is something like this:
struct S {
    ~S() = delete;
    static void f() { }
};

int main() {
    S::f();
}

That is, define a class that exposes only a bunch of static functions and forbid any attempt to create an instance of that class.
What are the other uses (if any) of a deleted destructor?

A: There are two plausible use cases. First (as some comments note) it could be acceptable to dynamically allocate objects, fail to delete them and allow the operating system to clean up at the end of the program.
Alternatively (and even more bizarre) you could allocate a buffer and create an object in it and then delete the buffer to recover the place but never prompt an attempt to call the destructor.
#include <iostream>

struct S {
    const char* mx;

    const char* getx(){return mx;}

    S(const char* px) : mx(px) {}
    ~S() = delete;
};

int main() {
    char *buffer=new char[sizeof(S)];
    S *s=new(buffer) S("not deleting this...");//Constructs an object of type S in the buffer.
    //Code that uses s...
    std::cout<<s->getx()<<std::endl;

    delete[] buffer;//release memory without requiring destructor call...
    return 0;
}

None of these seems like a good idea except in specialist circumstances. If the automatically created destructor would do nothing (because the destructor of all members is trivial) then the compiler will create a no-effect destructor.
If the automatically created destructor would do something non-trivial you very likely compromise the validity of your program by failing to execute its semantics.
Letting a program leave main() and allowing the environment to 'clean-up' is a valid technique but best avoided unless constraints make it strictly necessary. At best it's a great way to mask genuine memory leaks!
I suspect the feature is present for completeness with the ability to delete other automatically generated members.
I would love to see a real practical use of this capability.
There is the notion of a static class (with no constructors) and so logically requiring no destructor. But such classes are more appropriately implemented as a namespace have no (good) place in modern C++ unless templated.

A: Creating an instance of an object with new and never deleting it is the safest way to implement a C++ Singleton, because it avoids any and all order-of-destruction issues. A typical example of this problem would be a "Logging" Singleton which is being accessed in the destructor of another Singleton class. Alexandrescu once devoted an entire section in his classical "Modern C++ Design" book on ways to cope with order-of-destruction issues in Singleton implementations.
A deleted destructor is nice to have so that even the Singleton class itself cannot accidentally delete the instance. It also prevents crazy usage like delete &SingletonClass::Instance() (if Instance() returns a reference, as it should; there is no reason for it to return a pointer).
At the end of the day, nothing of this is really noteworthy, though. And of course, you shouldn't use Singletons in the first place anyway.

A: If you have an object which should never, ever be deleted or stored on the stack (automatic storage), or stored as part of another object, =delete will prevent all of these.
struct Handle {
  ~Handle()=delete;
};

struct Data {
  std::array<char,1024> buffer;
};

struct Bundle: Handle {
  Data data;
};

using bundle_storage = std::aligned_storage_t<sizeof(Bundle), alignof(Bundle)>;

std::size_t bundle_count = 0;
std::array< bundle_storage, 1000 > global_bundles;

Handle* get_bundle() {
  return new ((void*)global_bundles[bundle_count++]) Bundle();
}
void return_bundle( Handle* h ) {
  Assert( h == (void*)global_bundles[bundle_count-1] );
  --bundle_count;
}
char get_char( Handle const* h, std::size_t i ) {
  return static_cast<Bundle*>(h).data[i];
}
void set_char( Handle const* h, std::size_t i, char c ) {
  static_cast<Bundle*>(h).data[i] = c;
}

Here we have opaque Handles which may not be declared on the stack nor dynamically allocated.  We have a system to get them from a known array.
I believe nothing above is undefined behavior; failing to destroy a Bundle is acceptable, as is creating a new one in its place.
And the interface doesn't have to expose how Bundle works.  Just an opaque Handle.
Now this technique can be useful if other parts of the code need to know that all Handles are in that specific buffer, or their lifetime is tracked in specific ways.  Possibly this could also be handled with private constructors and friend factory functions.

A: one scenario could be the prevention of wrong deallocation:
#include <stdlib.h>

struct S {
    ~S() = delete;
};

int main() {

    S* obj= (S*) malloc(sizeof(S));

    // correct
    free(obj);

    // error
    delete obj;

    return 0;

}

this is very rudimentary, but applies to any special allocation/deallocation-process (e.g. a factory)
a more 'c++'-style example
struct data {
    //...
};

struct data_protected {
    ~data_protected() = delete;
    data d;
};

struct data_factory {

    ~data_factory() {
        for (data* d : data_container) {
            // this is safe, because no one can call 'delete' on d
            delete d;
        }
    }

    data_protected* createData() {
        data* d = new data();
        data_container.push_back(d);
        return (data_protected*)d;
    }

    std::vector<data*> data_container;
};

A: Why mark a destructor as delete?
To prevent the destructor from being invoked, of course ;)
What are the use cases?
I can see at least 3 different uses:

*

*The class should never be instantiated; in this case I would also expect a deleted default constructor.

*An instance of this class should be leaked; for example, a logging singleton instance

*An instance of this class can only be created and disposed off by a specific mechanism; this could notably occur when using FFI

To illustrate the latter point, imagine a C interface:
struct Handle { /**/ };

Handle* xyz_create();
void xyz_dispose(Handle*);

In C++, you would want to wrap it in a unique_ptr to automate the release, but what if you accidentally write: unique_ptr<Handle>? It's a run-time disaster!
So instead, you can tweak the class definition:
struct Handle { /**/ ~Handle() = delete; };

and then the compiler will choke on unique_ptr<Handle> forcing you to correctly use unique_ptr<Handle, xyz_dispose> instead.


text:
Q: Zlib Inflate data from http packet I'm trying to use zlib's inflate to decompress some data I received from an http packet.
The packet is as follows:

The packet, itself, says that it's encoded with gzip, so I think it should work. However, when I run the data through the inflate function, I get "invalid block type". To be clear, I'm only passing in the highlighted portion of the packet to the inflate function. What am I missing?
Here is the code I'm using to decompress the data:
int Decompress(const u_char* strStreamIn, int nStreamInLen, u_char* strStreamOut)
{
  int ret = -1;
  int err = -1;

  z_stream strm  = {0};
  strm.total_in  = strm.avail_in  = nStreamInLen;
  strm.total_out = strm.avail_out = nStreamInLen * 6;
  strm.next_in   = (Bytef*) strStreamIn;
  strm.next_out  = (Bytef*) strStreamOut;
  strm.zalloc    = Z_NULL;
  strm.zfree     = Z_NULL;
  strm.opaque    = Z_NULL;

  err = inflateInit2(&strm, -MAX_WBITS);
  if (err == Z_OK) {
    err = inflate(&strm, Z_FINISH);
    if (err == Z_STREAM_END) {
      ret = strm.total_out;
    }
    else {
      inflateEnd(&strm);
      return err;
    }
  }
  else {
    inflateEnd(&strm);
    return err;
  }
  inflateEnd(&strm);
  return ret;
}

A: Yes, you need to use inflateInit2() with the second parameter as 31 to request gzip decompression.  If you are feeding it the 1f 8b 08 00 ..., then you won't get "unknown header flags set".  That must not be what you're doing.
By the way, it does nothing to set total_in and total_out where you do, since they are set to zero by inflateInit[2]().  Setting them to the values you did in an effective location, e.g. after inflateInit, makes no sense either.
Setting avail_out to six times the input size is a guess, and won't always be sufficient.  If it's not sufficient, then you'll get an error with Z_FINISH.  You should be using a loop to call inflate() as many times as needed to process the input and produce the output.
I recommend that you read zlib.h, and then read how to use zlib.


text:
Q: AFOpenFlow Image Sizes on iPad I have an iPad application with an AFOpenFlowView implemented in it. In my nib file, I made the OpenFlowView the width of the ipad (768 pixels) and made it the proper height, however, for some reason my images are showing up with the sides cut off. I'm trying to get the images to fit the width of the screen (they're all 768 width) in portrait mode. I was able to do this on the iPhone version (I made the images with a width of 320) and it worked fine. Any help on getting these images to fit the width of the screen and not get their sides cut off would be much appreciated!
PS I've tried making the openflow width exceed the bounds of the ipad (in the nib file) to see if the sides would show, and it did not work.

A: I played around with the values in the AFOpenFlowConstants.h file.
These settings worked OK for me but you can tweak them further:
    #define COVER_SPACING 80
    #define CENTER_COVER_OFFSET 140
    #define SIDE_COVER_ANGLE .15
    #define SIDE_COVER_ZPOSITION -40


text:
Q: When creating an electron wrapper what is the right way to watch for notifications? I am working with electron and various websites such as trello and inbox. I would like to add native notifications (which functionally i have working) however i need to know what the correct approach is to watch the site for notifications.
Do I ask the user to authenticate twice (once to login and again for the api if the site has one) or do i need to find something in the window object to watch?
Plenty of electron apps seem to be able to do this but i've had no luck hunting through github repos.
Any help or direction would be very much appreciated!

A:
i need to know what the correct approach is to watch the site for notifications.

Check out trello webhooks


text:
Q: Woocommerce REST API conditional JSON I'm using Woocommerce REST API V3 and I want to get a custom JSON callback that is based on a specific element's meta_data (has badge / doesn't have).
If the element has id:14425 - return 1 (it has a badge).
If the element has id:Select badge - return 0 (doesn't have).
This is how metadata looks (I printed it on page just to see the values structure):
[my_product_badge] => Array ( [0] => a:1:{s:2:"id";s:5:"14425";}
Code in wc-api-products.php file (I deleted most of unrelated piece of codes to make it easier to read) :
    private function get_product_data( $product ) {
    $prices_precision = wc_get_price_decimals();
    return array(
        'has_badge' => metadata_exists( 'post', $product->id, 'my_product_badge' ) ? (int) get_post_meta( $product->id, 'my_product_badge', ['id'] && is_numeric , true ) : 0,
    );
}</code>

The results I get back in JSON are not based on the rule of is numeric
Any ideas?


text:
Q: LTSpice .STEP trace colours When I use the .STEP directive in LTSpice to produce a range of plots using different component values, sometimes it displays each step in a different colour and other times it doesn't.
What is the trick to get the multi colour display?

A: I found it.  If the trace is in a pane on its own, you get the multi colour effect. If it shares the pane with other traces, you don't.
Example of .step directive, parameter C from 200p to 2000p in 200p steps.
.step param C 200p 2000p 200p
.op
Component (capacitor) has a value of {C}


text:
Q: Pass data from component to service via observables I need to send info from component A, to Service, work it there, and then send it to component B. A and B are siblings. I need component A to trigger this, to get a desired result on component B.
Im trying to use an observable with rxjs to achieve this (I dont know if that's the best way or practice to do so)
Currently my component A look like this:
import { Observable } from "rxjs/Rx"
import { of, Subscription } from 'rxjs';
import { SoporteService    } from '../soporte/services/soporte.service';

public constructor( public _observable: Subscription, (...)

let observable = of (id_estado)
this._observable = observable.subscribe( (x:number) => {
} )

I was able to tie this together following some guides, even though Im not sure at all how Im supposed to recieve the data on the service, or why Im not using .next
When I save the previous component I get
Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[Component A]

How can I send data like this?

A: With the current code you're trying to inject an observable as a dependency. Instead you should inject your service into both components A and B and provide a method in the service that component A calls and an Observable or an EventEmitter that component B can subscribe to.
Something like this;
Mediator service
@Injectable({
    providedIn: 'root'
})
export class MyService {

    public eventEmitter: EventEmitter<any> = new EventEmitter<any>();

    public methodThatCompnentACanCall(someValue: string) {
        this.eventEmitter.emit(someValue);
    }
}

constructor for both component A and B
public constructor(private mediator: MyService)
You may want to do a search for "the mediator pattern" for more info..


text:
Q: How can i access variables outside a for loop in perl I want to access $hash_element->{'test_plan'} and $hash_element->{'build'} outside the for loop
my $hash_element;
for $hash_element (@bats) {
    my $dbh = DBI->connect( $dsn, $BAT_DB_user, $BAT_DB_password );
    my ( @plan_id, @plan_run );
    @plan_id = $dbh->selectrow_array(
               "select id from plan where name='$hash_element->{'test_plan'}'");
}

$emailsubject = "BAT - " . $hash_element->{'test_plan'} . " on " . $hash_element->{'build'} . " done.";

A: First, please learn how to use placeholders and bind variables in SQL.
Second, what values do you expect "outside the loop"?  You've gone through the entire list of @bats.  What do you think would be in there after that's all done?

A: It depends on what exactly you want to do - there's no obvious value for a loop variable outside of its loop. Do you want to access the LAST element of @bats? FIRST element? Some element satisfying a particular condition?
For the last element, simply do:
my $hash_element_last;
for my $hash_element (@bats) {
    # whatever logic
    $hash_element_last = $hash_element;
}
my $emailsubject = "BAT - " . $hash_element_last->{'test_plan'};

For some other element, you also stash it inside of a separate value:
my $hash_element_remembered;
for my $hash_element (@bats) {
    # whatever logic
    # Use for the first element
    $hash_element_remembered = $hash_element unless defined $hash_element_remembered;
    # Use for the "special" element
    $hash_element_remembered = $hash_element if (some_special_logic)
}
my $emailsubject = "BAT - " . $hash_element_remembered->{'test_plan'};

Please note that for first/last, your can of course simply use $bats[0] and $bats[-1] without specially remembering the loop element inside the loop (assuming you don't want "the last element seen in the loop which may exit via last prior to finishing looping).


text:
Q: why can't I go for intent instead of pending intent? I am a newbie to android and when I was searching the code for sending an sms I found he used a pending intent and started learnign about it, I studied that it is used by 3rd party applications to start intents and also it takes action in the future but I didn't understand exactly how these work? Anyway in future whenever a pending intent gets called it calls an intent so instead why don't we directly go for intent?
I hope the question is clear so if possible please give me examples of working with intents and pending intents please dont't explain me the definitions again....

A:
why can't I go for intent instead of pending intent?

the reason you need to provide PendingIntent and not Intent:
1) let's assume you gave another application an Intent in order that that application would use it somehow (for instance - the systems notification manager is another application).   now think about it - how this application will know if this intent intended for starting Activity or intended to start Service or sending brodcast? answer: it can't!  you might think that it can know based on the class parameter, but don't forget that it's possible also to start implicit Activities/Services!!!
conclusion : the other application can't know what exactly to to with this Intent without knowing what it intends for.   that's why when creating PendingIntent you create it using the getBroadcast() or getActivity() or getService() methods.
that's one of the things PendingIntent is all about: encapsulating Intent + what to do with it.
2) let's assume that after a while you want to provide to that application another Intent .  now, there are 2 options:

*

*the new Intent should replace the previous one you provided

*the new intent should not replace the previous one..

how will the receiving application will know which one from the two?
answer: pending intent's helds and created by the system, and by providing pending intent that filter equal to another and same request code - will replace automatically previous one and not create new one.
3) let's assume that the reference to the intent was held and created directly by your application, and not by the system (as I wrote in '2').    now imagine this scenario:
3.1) your application created intent object
3.2) your application provided reference to that intent object to another applciation
3.3) your application process stopped from some reason
3.4) WTF should happend?   reference to your application object held by another application???   that's a mess for the GC.  the system could not free your process memory allocations because of that!
that's the second reason behind the scene pending intents instances held only by the system, and not by your specific application.
if it's not enough - and there is also the issue of security...
I'm not going to write you usage example, since any google search for PendingIntent turorial would results with tones of good examples, and anyway - the code would be different for a specific use case...

A: The main difference is even if the owning application's process of PendingIntent is killed, the PendingIntent itself will remain usable from other processes.
If the creating application later re-retrieves the same kind of PendingIntent, it will receive a PendingIntent representing the same, if that its still valid, and also can call cancel() to remove it(actually the previous one).


text:
Q: How to Hibernate Just Current Session in Windows If we hibernate a PC, it writes everything to hard disk for all users. However I need it only for one user. In other words other users should be able to use the PC. When we lock the current session or switch to other user, first user will continue to use RAM & internet in the background. In this case second user has a slow PC, because first user has a lot of big programs. Also first user does not want to close & reopen programs for each logging in.
Shutting down the PC effects all users but logging off effects just current user. So if we say shutting down is global, logging off is local version of it. Similarly hibernating effects all users but what is its local version? Shortly how can I hibernate just current user in Windows but others?
PS. I think solution requires to write a program or script but stackoverflow marked this question as off topic then removed the question.

A: There's no such feature in Windows. You can only hibernate the whole system.
When switching users, the background sessions (applications) are run with lower priority. However those applications still use the system resources.
Depending on the nature of the application and its features, the background applications can be swapped out to free memory. For example, Notepad with an opened text file could be swapped out almost completely to the paging file thus making room for active user applications. On the other hand, an archiver or media encoder application would still use more system resources as it processes data.

Windows 8 implements something similar to hibernation with regards to the modern (Metro) UI applications. When you do not use an application for an extended time, it gets stopped completely and frees almost all resources it used. And when you return to the application, it gets re-started, therefore it takes more time.
Modern UI applications are stopped this way when you switch user sessions.

A: You could achieve what you want with a VM.
Lets say you have a work account and a personal one.
Launch another copy of windows in VMware player for work and tell it to automatically suspend when closing (incase of a restart shutdown). When it suspends it effectively "Hibernates" and frees up ALL the resources you were using.
Pros of using a VM
It will pretty much run as fast as native windows if let it have access to 80% of your resources.
Then when you finish work just close VMware and let it suspend to disk and free up 100% of what your work session used.
When its time to work again, run the VM and it will return exactly as you left it with all your applications open.
If say its a family using the one computer you can set the host machine up with a barebones user account that does nothing but present the option to pick a VM.
User picks their VM that is locked with their own password. Their entire environment is contained and nothing they do can affect anyone else or stop the computer working properly.
You can only run a single VM at a time (with the free version) but this may actually work in your favor. For someone else to login they have to suspend whoever left their VM open before opening their own, thereby ensuring everyone has access to the majority of the resources available on the computer when they do stuff.
Cant share applications.
This is listed as a CON but is a pro as well since, no-one is going to break your favorite app but updating it system wide.
Cons of VMs and some work arounds
Time consuming to setup initially.
Have to install windows and applications for every user. You could however setup one VM, then clone it for the others and just rename the user account and change the password.
Wasted resources with the overhead of running a VM.
The HOST OS will probably be idling with 4gB of ram used that your VM just cant have. You can trim that down to 2GB or even lower by turning off background processes and service.
Uses a LOT of disk space.
Each VM will probably need 50GB and potentially a lot more each VM wants to install big applications and games.
You could just put ALL users on the same VM if you only care about yourself.  Make them share resources and have the ability to get it all back just when you want it.
No public user folders.
You can share files between users tho, every VM can be setup to mount the HOST computers public user folder.
Cant share applications.
Everyone will have to have their own copy installed using more disk space.
Sharing a steam games library will work to dramatically cut down on disk usage but most normally applications wont play nice with shared workspace.
Alternatives to VMWare that have other advantages
If Graphics performance for the VM users is not important, then using VirtualBox will also give you the ability to restore a VM other points in time if your children break something and you just cant be bothered fixing it.
This one would also let you run multiple VM's at once.
(FYI Paid versions of VMware will probably give you the same features).
Windows Hyper-V is a build in VMware solution in windows that would also let you run many VM's at the same time.
It also has dynamic resource allocation AFAIK so your VMs can chare with the host instead of straight up claiming X amount of ram. It can take more when needed and give it back later. AFAIK (I have not tried this).
Alternative to VM's entirely.
Buy more ram .
RAM usually the biggest bottle neck when leaving user accounts running. The ram gets full and it needs to start using the system disk a lot as a substitute making everything slow to a crawl.
Upgrade to 32GB or even 64 and you can probably just leave everything open without any issues.
It costs money but will save you all that time wasted on VMs and opens up the computers capabilities even further.
FYI: I have 32gb and I can leave 5 game launchers running, a plex server, a ton of docker containers and a LOT of browser tabs open in up to three browser, and still often have few GB of ram left over. This is enough to let a AAA game title open up, or even play with Virtual machines. They may require more than what's left available but that little bit of flex allows time for the resources to reallocate accordingly.


text:
Q: Applications of the Little and Great Theorems of Picard I have completed the two famous theorems of Picard, presenting their proofs in a graduate course of Complex Analysis, but I have not managed to discover a good number interesting applications.
List of applications (rather straight-forward though):

*

*If a meromorphic function on $\mathbb C$ misses three values, then it is constant.

*The equation $f^3+g^3=1$ has non-trivial meromorphic in $\mathbb C$ solutions
only if $n\le 3$.

*If $f$ is entire and one-to-one, then it is linear.

*If $f,g$ are entire and $g'=f(g)$, then $f$ is linear or $g$ is constant.
Could you provide any interesting applications of these theorem?

A: An interesting consequence is that if $X = \mathbf{P}^1(\mathbb C)-\{p_1, \dots, p_n\}$ is the Riemann sphere with $n$ punctures, then $\widetilde X$, the universal covering space of $X$, is the upper-half plane for $n\geq 3$. Indeed, $\widetilde X$ must be simply-connected, and by Riemann's theorem it is either $\mathbf{P^1}(\mathbb C)$, $\mathbb C$, or the upper-half plane $\mathfrak h$. It cannot be $\mathbf{P^1}(\mathbb C)$ because $X$ is not compact; it cannot be $\mathbb C$ by Picard's theorem; therefore it is $\mathfrak h$.
Corollary: For each $n \geq 3$, $\text{PSL}_2(\mathbb R)$ contains a copy of $F_n$, the free group on $n$ generators (and therefore also for $n=2$).
Indeed this follows from the theory of covering spaces; the group of deck transformation of $\widetilde X \to X$ is $\pi_1(X)\cong F_n$. On the other hand, $\text{Aut}(\mathfrak h) \cong \text{PSL}_2(\mathbb R)$.

A: In general, a Holomorphic map from $\mathbb C\to \mathbb C $ does not have a fixed point. But using the Little Picard theorem, we can prove that even though $f$ does not have a fixed point, $f\circ f$ does have a fixed point until unless $f$ is translation function.
More precisely, the statement is as follows:
Theorem: Let $f: \mathbb{C} \rightarrow \mathbb{C}$ be holomorphic. Then $f \circ f: \mathbb{C} \rightarrow \mathbb{C}$ always has a fixed point unless $f$ is a translation $z \mapsto z+b, b \neq 0$.
Proof. Suppose $f \circ f$ has no fixed points. Then $f$ also has no fixed points (if it has then that also fixed point of $f \circ f$), and it follows that $$g(z):=\left.\frac{f(f(z))-z} {f(z)-z}\right. $$ is entire function. This function omits the values $0$ and $1$ ( If it does then that implies flex point) ; hence, by Picard, there exists a $c \in \mathbb{C} \backslash\{0,1\}$ with
$$
f(f(z))-z=c(f(z)-z), \quad z \in \mathbb{C}
$$
By differentiation and rearranging terms gives $$f^{\prime}(z)\left[f^{\prime}(f(z))-c\right]=1-c .$$ Since $c \neq 1$ (if equals to 1 then it implies fixed point), $f^{\prime}$ has no zeros and $f^{\prime}(f(z))$ is never equal to $c$. Thus $f^{\prime} \circ f$ omits the values 0 and $c \neq 0$ by Picard, $f^{\prime} \circ f$ is therefore constant. It follows that $f^{\prime}=$ constant, hence that $f(z)=a z+b .$ Since $f$ has no fixed points, $a=1$ and $b \neq 0$
So we have proved that when $f\circ f$ has no fixed point, then $f$ is translation.


text:
Q: Why can't a class val parameter be call-by-name? I'm trying to use a class to aggregate as a single interface a bunch of proxies for API functions. A couple of these are nullary functions, but I don't want the act of including them in the class constructor to trigger the API calls. My solution right now is to wrap the call in a literal nullary function new myClass(() => apiCall) and then calling the member function explicitly. This isn't all that bad, but I'm wondering if there's a technical reason I can't just use a call-by-name parameter to pass lazy reference to the method?
Example:
scala> class MyClass(val apiCall: => String)
<console>:1: error: `val' parameters may not be call-by-name
       class MyClass(val apiCall: => String)

Edit I should have specified that my question is why a class can't have a val parameter. Added an example.

A: A class can very well have call-by-name parameters, as long as they are not val or var:
> scala
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55).
Type in expressions to have them evaluated.
Type :help for more information.

scala> class Foo(f: => Unit) {
     |   def run(): Unit = f
     | }
defined class Foo

scala> new Foo(println("hello"))
res0: Foo = Foo@5da6b8c6

scala> res0.run()
hello

The reason a val or var parameter cannot be by-name is simply that a class field cannot be by-name, no more than local variable, for that matter. So the following is invalid:
scala> class FooInvalid(val v: => Unit) {
<console>:1: error: `val' parameters may not be call-by-name
       class FooInvalid(val v: => Unit) {
                               ^

However, it is possible to have a by-name parameter that is assigned, as a function to a val field, like this (but then you have to use () as call site):
scala> class FooVal(v0: => Unit) {
     |   val v: () => Unit = () => v0
     | }
defined class FooVal

scala> new FooVal(println("hello"))
res2: FooVal = FooVal@75c145bc

scala> res2.v
res3: () => Unit = <function0>

scala> res2.v()
hello

Finally, instead of defining v as a val of type () => Unit, you can define it as def of type Unit. And then you get the behavior you probably wanted in the first place:
scala> class FooDef(v0: => Unit) {
     |   def v: Unit = v0
     | }
defined class FooDef

scala> new FooDef(println("hello"))
res5: FooDef = FooDef@2e04a041

scala> res5.v
hello

One could argue that the compiler should do this transformation itself, but that would not be consistent with the semantics that a val must be stable (e.g., with a stable value you can import x._ its members, which you cannot do with an unstable value) since a def (even without ()) is a not a stable value. Best to leave this small rewriting to the user rather than introduce a very weird unsoundness.


text:
Q: Using a packaged linked via npm link in create-react-app leads to webpack error: module has no exports I am developing a React hook locally, and trying to test it in an adjacent create-react-app project (under folder example/). However, importing said linked module results in the following errors:
Attempted import error: 'usePleaseStay' is not exported from 'react-use-please-stay' (imported as 'usePleaseStay').
ERROR in ./src/App.tsx 10:2-15
export 'usePleaseStay' (imported as 'usePleaseStay') was not found in 'react-use-please-stay' (module has no exports)

ERROR in ./src/App.tsx 14:10-23
export 'usePleaseStay' (imported as 'usePleaseStay') was not found in 'react-use-please-stay' (module has no exports)

My App.tsx:
import React from 'react';
import { usePleaseStay } from 'react-use-please-stay';

function App() {
  usePleaseStay(["Title One!", "Title Two!", "Title Three?!?"]);
  return (
    <></>
  );
}

export default App;

The file I'm brought to when I cmd+click react-use-please-stay:
export { usePleaseStay } from './hooks/usePleaseStay';

This is as expected, correctly the dist/index.d.ts file from my hook's source code. Clearly, there is an export there!
Output of npm ls --location=global --depth=0 --link=true:
react-use-please-stay@1.0.0 -> ./../../../../../projects/react-use-please-stay

What in the world is going on here? Is this the classic issue of create-react-app obfuscating too many webpack decisions from us?
Any assistance is greatly appreciated.

A: Ah, figured it out. Was just a one liner. I was packaging my module to Common JS. This doesn't play nicely with create-react-app's Webpack config. I resolve the issue by changing my rollup.config.js from:
import typescript from '@rollup/plugin-typescript';
import pkg from './package.json' assert { type: "json" };

export default {
  input: 'src/index.ts',
  output: {
    file: pkg.main,
    format: 'cjs',
    sourcemap: true,
    strict: false,
  },
  plugins: [typescript()],
  external: ['react']
};

to:
import typescript from '@rollup/plugin-typescript';
import pkg from './package.json' assert { type: "json" };

export default {
  input: 'src/index.ts',
  output: {
    file: pkg.main,
    format: 'module',
    sourcemap: true,
    strict: false,
  },
  plugins: [typescript()],
  external: ['react']
};

Just changing format: 'cjs' to format: 'module'


text:
Q: Changing response.statuscode for ajax requests raise error "Server cannot set status after HTTP headers have been sent" I am working in an MVC project where user roles, and permissions for each of the action methods are stored in the database. What I want to achieve is to use the authorize filter feature in mvc by overriding AuthorizeAttribute. This way I can register my custom authorize filter globally.
Here is what I am trying to do, following this method. I am following this article to handle ajax requests.
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
     //Custom permission checking logic
     return false;//no permission for all methods-Just for testing
}

public override void OnAuthorization(AuthorizationContext filterContext)
{
    base.OnAuthorization(filterContext);
    CheckIfUserIsAuthenticated(filterContext);}
}

private void CheckIfUserIsAuthenticated(AuthorizationContext filterContext)
{
    // If Result is null, we're OK: the user is authenticated and authorized.
    if (filterContext.Result == null)
        return;

    var httpContext = filterContext.HttpContext;
    var request = httpContext.Request;
    var response = httpContext.Response;

    var user = httpContext.User;
    // If here, you're getting an HTTP 401 status code. In particular,
    // filterContext.Result is of HttpUnauthorizedResult type. Check Ajax here.

    if (request.IsAjaxRequest())
    {
        if (user.Identity.IsAuthenticated == false)
            response.StatusCode = (int)HttpStatusCode.Unauthorized;//401
        else
            response.StatusCode = (int)HttpStatusCode.Forbidden;//403

        response.SuppressFormsAuthenticationRedirect = true;

        response.End();// This line is causing the problems

        return;
    }

    if (user.Identity.IsAuthenticated)
    {
        //Redirect to customerror page
    }
}

The issue is when I am calling a method using ajax post, my custom exception filter is catching an error saying "Server cannot set status after HTTP headers have been sent "
 If I remove response.End(), I am getting a 401 response in the ajax error handler method instead of 403.
 I tried
 HttpContext.Current.ApplicationInstance.CompleteRequest()

instead of response.end, but then also I am getting 401 error
Is there anyway to avoid this exception?
Update
I am using this general error handler method in javascript to catch all ajax request errors ( I need correct status code for response):
 function ajaxFailed(xhr, textstatus, errorthrown) {
    debugger;
    if (textstatus == "error") {
        if (xhr.status == 401) {
            window.location = "/Account/Login";
        }
        if (xhr.status == 403) {
            $("#divoutput").html("you don't have permission.");
        }
    }
    if (xhr.status == 500) {
        $("#divoutput").append("<br/> internal servererror." + xhr.responseText);
    }
}

Update 2:
My Current Solution:
   Check the Exception.Message property of the raised exception in my custom exception handler filter and ignore it if the message is :"Server cannot set status after HTTP headers have been sent ".
I know this is an inefficient method, but I have no other solution yet. Waiting for a good solution :)

A: Try to change the order of the handling the request:
public override void OnAuthorization(AuthorizationContext filterContext)
{
    CheckIfUserIsAuthenticated(filterContext);}
    base.OnAuthorization(filterContext);
}

Update:
The article you've linked says that you have to handle other event handler method HandleUnauthorizedRequest:
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)

Not the OnAuthorization as you did.
Update #2:
Try to use the buffering output with
Response.BufferOutput = true;

so your server is prevented to send the headers back to the client.


text:
Q: composer-playground is throwing error I followed the steps given in the link:
https://hyperledger.github.io/composer/installing/development-tools.html
when i executed the command "composer-playground" i am getting the below error
events.js:183
      throw er; // Unhandled 'error' event
Error: listen EADDRINUSE   :::8080
Please note i have closed all the browsers before running this command.
Thanks,
Smitha

A: You have another server on your machine listening in port 8080. You can start playground on a different port using the -p or --port option. For example composer-playground -p 8090 will start composer playground listening on port 8090. You then will need to specify that port on the url in your browser, for example http://localhost:8090


text:
Q: how to flip a bit at a specific position in an integer in any language I have an integer n, and I want to flip its kth bit (from the lowest) in its binary representation. How can I do it?
For example, if I have n=0b01101 and k=2, then the result is 0b01001=9
Any language is fine. Thank you.

A: Left-shift the number 1 the number of digits you need, and then XOR the number.
JavaScript:
var num = 6, k = 2;
num = num ^ (1 << k);

What is happening:
num = 0b01101 XOR (0b00001 << 2)
num = 0b01101 XOR 0b00100
num = 0b01001

A: To flip one or more bits, use binary XOR. In your case, the appropriate XOR mask is 1 shifted k bits to the left.
In Python:
In [58]: 0b01101 ^ (1 << 2)
Out[58]: 9

The expression:
n ^ (1 << k)

is valid in C, Java, Python and a few other languages (provided the variables are appropriately defined).

A: In c you just do this to toggle it:
n ^= 1 << k;

but there are other ways of doing it like:
n |= ( 1 << k);

This shifts bit k to 1
Now if you want to flip the bit you can do an if statement with a unary and to see how you need to flip it
number = pow(2,k)
if((number & n) != number)
    //this means that it's a 0 at position k
    n |= ( 1 << k);
else
    //this means that it's a 1 at position k
    n &= ( 0 << k);

A: Here's how you'd do it in C:
n ^ (1 << k)

A: (for googlers) here is how you can do it in VB6 without shifting
'flips a bit to the opposite of its current value
'1 based, left to right
Function FlipBit(ByVal FlipByte As Byte, ByVal bPosition As Byte) As Byte
    FlipBit = FlipByte Xor (2 ^ (8 - bPosition))
End Function

'example
 MyByte = 255
'mybyte is now "11111111"
 MyByte = FlipBit(MyByte,2)
'mybyte is now "10111111"


text:
Q: JavaScript requestFullscreen not working in Edge I'm trying to make a video (or anything else) go into a fullscreen mode in the Edge browser through JavaScript. But I can't get it to work. In Chrome everything works as expected.
I tried all steps in the js command line tool. The correct html video element is fetched with the line document.getElementById("video_player");. Then I tried to enter the command video.requestFullscreen();, but it's not doing anything. Not even an error :(
I have activated the fullscreen API in the about: flags settings and I've turned off all browser extension.
The HTML video element is not inside an
EDIT:
This is my full code. The js file is loaded at the end of the HTML document. As you can see it's not doing much right now.
console.log("Running");

var video = document.getElementById("video_player");

FullScreenStart();

function FullScreenStart(){
    console.log("AutoFullScreen started");

    console.log(video);

    if (video.requestFullscreen) {
        video.requestFullscreen();
    } else if (video.mozRequestFullScreen) {
        video.mozRequestFullScreen();
    } else if (video.webkitRequestFullscreen) {
        video.webkitRequestFullscreen();
    } else if (video.msRequestFullscreen) {
        video.msRequestFullscreen();
    }
}

function FullScreenOn(){
    console.log("FullScreen activated");
}

function FullScreenOff(){
    console.log("FullScreen deactivated");
}

document.onwebkitfullscreenchange = function(evt) {

    if(document.webkitIsFullScreen){
        FullScreenOn();
    } else {
        FullScreenOff();
    }
};

Please, can somebody help me to get this to work? I've wasted two days on this problem now.

A: I made a test with your above posted code.
I find that your code will not work in any browser, If you call the fullscreen api using code.
I am not sure, how it works on chrome as you said in original post.
If you refer the documentation than you can find information below.

Note: This method must be called while responding to a user interaction or a device orientation change; otherwise it will fail.

Reference:
Element.requestFullscreen()
As said in the documentation, Method get failed in both Chrome and Edge if I call it from code but it works if user try to call it using button click.
Example code:

<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">

Fullscreen with JavaScript

Click on the button to open the video in fullscreen mode.

<button onclick="openFullscreen();">Open Video in Fullscreen Mode</button>

Tip: Press the "Esc" key to exit full screen.

<video width="100%" controls id="myvideo">
  <source src="rain.mp4" type="video/mp4">
  <source src="rain.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

Note: Internet Explorer 10 and earlier does not support fullscreen mode.

Reference:
HTML DOM requestFullscreen() Method
It was done intentionally, Because if it get work from code than so many sites starts showing pop ups without asking permission from user. Which can be annoying for user.