text:
Q: Whole web page is being destroyed by a horizontal scroll bar.... can't do anything except to wait I am developing a webpage but a horizontal scroll bar is present in the page. I want to remove it but can not. I have been into web development recently and most of web pages I made for practice faced the same problem.
I expect the following part of code to be faulty

.heading::before{border: 2px solid chocolate;
content: "";
height: 100vh;
background: url(....) no-repeat center ;
width: 100vw;
position: absolute;
top: 0px;
left: 0px;
z-index: -1; }

*{
    margin: 0px;
    padding: 0px;
}
nav{
    position: sticky;
    top: 0px;
    left:0px;
    margin: 0px 0px 10px 0px;
    padding: 5px 5px;
    background-color: #15191f;
}
.heading{
    height: 90vh;

}
.heading::before{
    border: 2px solid chocolate;
    content: "";
    height: 100vh;
    background: url() no-repeat center ;
    width: 100vw;
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: -1;
}
.flex{
    display: flex;
}
.flex-row{
    flex-direction: row;
}
.flex-column{
    flex-direction: column;
}
.wrap{
    flex-wrap: wrap;
}
.al-cen{
    align-items: center;
}
.ju-cen{
    justify-content: center;
}
nav a{

    text-decoration: none;
    background-color: #15191f;
    color: #e3ecf3;
    padding: 4px 10px;
    border: 2px;
    border-radius: 10px;

}
nav a:hover{
    color: #15191f;
    background-color: #e3ecf3;
}

#li1{
    margin-left: 50px;
}
#a1{
    margin: 0px 4px;
}
#a2{
    margin: 0px 4px;
}
#a3{
    margin: 0px 4px;
}
#a4{
    margin: 0px 4px;
}
nav ul li{
    list-style: none;
}
#logo{
    width: 5vw;
    border: 2px ;
    border-radius:100mm;

}
/* -------------------------------------------------------------------- */
div ul{
    margin: 0px 40px;
}
body{
    font-family:Verdana, Geneva, Tahoma, sans-serif;
    font-size: 1.5vw;
    background-color: #e3ecf3;
}
div{
    margin: 20px 15px;
}
ol li{
    margin: 0px 40px;
}

.block{
    display:block;
}
.inline-block{
    display: inline-block;
}
.border-red{
    border: 3.5px solid red;
    border-radius: 12px;
}
.border-green{
    border: 3.5px solid green;
    border-radius: 5px;
}
.border-blue{
    border: 3.5px solid blue;
    border-radius: 5px;
}
.line-height{
    line-height: 8vh;

}

ol{
    border: 2px solid blue;
    border-radius: 5px;
    text-align: center;
    /* display: inline-block; */
    margin: 4px 0px;
    width:300px
}
.text-cen{
    text-align: center;
}
ol li{
    margin-left: 40px;
}
input{
    display: block;
}
option{
    background-color:#15191f;
    color:#e3ecf3;
    height: 50px;
    font-size: 1.1rem;
    border-radius: 5px;
}
select{
    width: 85px;
    background-color:#15191f;
    color:#e3ecf3;
    height:30px;
    border: 2px solid #15191f;
    border-radius: 6px;
}
.button{
    height: 25px;
    width: 25px;
    /* border: 2px solid #15191f; */
    border-radius: 100px;
    /* background-color: #15191f; */
}
/* .button: */
.checkbox{
    /* background-color: #15191f; */
    height: 25px;
    width: 25px;
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>All in One</title>
    <link rel="stylesheet" href="../CSS/home.css">

Home

About Us

Our Services

Contact Us

All in ONE Website

This Website aims to include all that has been learnt and keep a record of
            it for future usage.

                <\b>This Bold<\b>
            Lorem ipsum dolor sit amet consectetur, adipisicing elit.

                <\br> Has been used here and here<\br>

             modi molestias omnis voluptate alias unde voluptates provident hic voluptatibus ipsum deleniti
            itaque
            delectus et expedita quisquam, non soluta, harum consequuntur sapiente rem quaerat. Repellendus, impedit.

OL type 1

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type A

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type a

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type I

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type i

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

This is a Table

                    Heading-1
                    Heading-2
                    Heading-3
                    Heading-4
                    Heading-5

                    Row-1-Colum-1
                    Row-1-Colum-2
                    Row-1-Colum-3
                    Row-1-Colum-4
                    Row-1-Colum-5

                    Row-2-Column-1
                    Row-2-Column-2
                    Row-2-Column-3
                    Row-2-Column-4
                    Row-2-Column-5

                    Row-3-Column-1
                    Row-3-Column-2
                    Row-3-Column-3
                    Row-3-Column-4
                    Row-3-Column-5

FORMS

Below are some types of input we can ask on forms.Include a NAME in input tags

We will make input tag a block element to make go to next line and make the code look clean.
            Before it was inline so elements crammmed over each other.We can add value="" to show that thing.

            The diff between value and placeholder is that the placeholder gets removed whan an item is entered, wheras
            when we enter an item at place of value, it concencates in the value. Placeholder is Background, value is
            not.
            @gmail.com is value below in email. Remaining are Placeholder

        <form action="#">
            Button <input class="button" type="button" placeholder="Placeholder">
            Checkbox<input type="checkbox" class="checkbox" placeholder="Placeholder">
            Color<input type="color" placeholder="Placeholder">
            Date<input type="date" placeholder="Placeholder">
            Datetime<input type="datetime" placeholder="Placeholder">
            Datetime-local<input type="datetime-local" placeholder="Placeholder">
Just Testing

            Email<input type="email" value="@gmail.com" placeholder="Placeholder">
            File<input type="file" placeholder="Placeholder">
            Hidden<input type="hidden" placeholder="Placeholder">
            Image<input type="image" placeholder="Placeholder">
            Month<input type="month" placeholder="Placeholder">
            Number<input type="number" placeholder="Placeholder">
            Password<input type="password" placeholder="Placeholder">
            Radio<input type="radio" placeholder="Placeholder">
            Range<input type="range" placeholder="Placeholder">
            Reset<input type="reset" placeholder="Placeholder">
            Search<input type="search" placeholder="Placeholder">
            Submit<input type="submit" placeholder="Placeholder">
            Tel<input type="tel" placeholder="Placeholder">
            Text<input type="text" placeholder="Placeholder">
            Time<input type="time" placeholder="Placeholder">
            Url<input type="url" placeholder="Placeholder">
            Week<input type="week" placeholder="Placeholder">

            Select from a dropdown <select>
                <option value="Option-1-Val">Option-1</option>
                <option value="Option-2-Val">Option-2</option>
                <option value="Option-3-Val">Option-3</option>
                <option value="Option-4-Val">Option-4</option>
                <option value="Option-5-Val">Option-5</option>
            </select>

        </form>

We use entities for displaying some character

        <

        >

        £

        ©

        ⇛

        ½

A dropdown button which shows whatever is written in summary and when clicked reveals what is written in detail tag.

            I have keys but no doors. I have space but no room. You can enter but you can't leave. What am i?
            A Keyboard.

Now i will use a time tag

We will be celebrating new year on <time datetime="2022-12-12">December 12</time> in my house.

Specifically width: 100vw , if I remove this line the scrollbar disappears but so does the image.
width:auto also makes the picture disappears.

*

*I want to display a background picture using this code (picture's address in url). If I remove this code the horizontal scroll bar disappears. Using a border shows that it is indeed the problem. How can I hide scroll bar while displaying an image on whole screen, no matter the size. (I mean no part of screen should be left out.)
Most of the answers out there suggest to remove 100vw and 100% width but that removes the picture

If possible suggest other ways which will allow me to display image on full screen without causing any problems to the aesthetics. The picture should be in background and for a specific tag only, not whole webpage.

A: You need to set box-sizing specifically for pseudo elements.

*, *::before, *::after{
    margin: 0px;
    padding: 0px;
    box-sizing: border-box;
}
nav{
    position: sticky;
    top: 0px;
    left:0px;
    margin: 0px 0px 10px 0px;
    padding: 5px 5px;
    background-color: #15191f;
}
.heading{
    height: 90vh;

}
.heading::before{
    border: 2px solid chocolate;
    content: "";
    height: 100vh;
    background: url() no-repeat center ;
    width: 100vw;
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: -1;
}
.flex{
    display: flex;
}
.flex-row{
    flex-direction: row;
}
.flex-column{
    flex-direction: column;
}
.wrap{
    flex-wrap: wrap;
}
.al-cen{
    align-items: center;
}
.ju-cen{
    justify-content: center;
}
nav a{

    text-decoration: none;
    background-color: #15191f;
    color: #e3ecf3;
    padding: 4px 10px;
    border: 2px;
    border-radius: 10px;

}
nav a:hover{
    color: #15191f;
    background-color: #e3ecf3;
}

#li1{
    margin-left: 50px;
}
#a1{
    margin: 0px 4px;
}
#a2{
    margin: 0px 4px;
}
#a3{
    margin: 0px 4px;
}
#a4{
    margin: 0px 4px;
}
nav ul li{
    list-style: none;
}
#logo{
    width: 5vw;
    border: 2px ;
    border-radius:100mm;

}
/* -------------------------------------------------------------------- */
div ul{
    margin: 0px 40px;
}
body{
    font-family:Verdana, Geneva, Tahoma, sans-serif;
    font-size: 1.5vw;
    background-color: #e3ecf3;
}
div{
    margin: 20px 15px;
}
ol li{
    margin: 0px 40px;
}

.block{
    display:block;
}
.inline-block{
    display: inline-block;
}
.border-red{
    border: 3.5px solid red;
    border-radius: 12px;
}
.border-green{
    border: 3.5px solid green;
    border-radius: 5px;
}
.border-blue{
    border: 3.5px solid blue;
    border-radius: 5px;
}
.line-height{
    line-height: 8vh;

}

ol{
    border: 2px solid blue;
    border-radius: 5px;
    text-align: center;
    /* display: inline-block; */
    margin: 4px 0px;
    width:300px
}
.text-cen{
    text-align: center;
}
ol li{
    margin-left: 40px;
}
input{
    display: block;
}
option{
    background-color:#15191f;
    color:#e3ecf3;
    height: 50px;
    font-size: 1.1rem;
    border-radius: 5px;
}
select{
    width: 85px;
    background-color:#15191f;
    color:#e3ecf3;
    height:30px;
    border: 2px solid #15191f;
    border-radius: 6px;
}
.button{
    height: 25px;
    width: 25px;
    /* border: 2px solid #15191f; */
    border-radius: 100px;
    /* background-color: #15191f; */
}
/* .button: */
.checkbox{
    /* background-color: #15191f; */
    height: 25px;
    width: 25px;
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>All in One</title>
    <link rel="stylesheet" href="../CSS/home.css">

Home

About Us

Our Services

Contact Us

All in ONE Website

This Website aims to include all that has been learnt and keep a record of
            it for future usage.

                <\b>This Bold<\b>
            Lorem ipsum dolor sit amet consectetur, adipisicing elit.

                <\br> Has been used here and here<\br>

             modi molestias omnis voluptate alias unde voluptates provident hic voluptatibus ipsum deleniti
            itaque
            delectus et expedita quisquam, non soluta, harum consequuntur sapiente rem quaerat. Repellendus, impedit.

OL type 1

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type A

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type a

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type I

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type i

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

This is a Table

                    Heading-1
                    Heading-2
                    Heading-3
                    Heading-4
                    Heading-5

                    Row-1-Colum-1
                    Row-1-Colum-2
                    Row-1-Colum-3
                    Row-1-Colum-4
                    Row-1-Colum-5

                    Row-2-Column-1
                    Row-2-Column-2
                    Row-2-Column-3
                    Row-2-Column-4
                    Row-2-Column-5

                    Row-3-Column-1
                    Row-3-Column-2
                    Row-3-Column-3
                    Row-3-Column-4
                    Row-3-Column-5

FORMS

Below are some types of input we can ask on forms.Include a NAME in input tags

We will make input tag a block element to make go to next line and make the code look clean.
            Before it was inline so elements crammmed over each other.We can add value="" to show that thing.

            The diff between value and placeholder is that the placeholder gets removed whan an item is entered, wheras
            when we enter an item at place of value, it concencates in the value. Placeholder is Background, value is
            not.
            @gmail.com is value below in email. Remaining are Placeholder

        <form action="#">
            Button <input class="button" type="button" placeholder="Placeholder">
            Checkbox<input type="checkbox" class="checkbox" placeholder="Placeholder">
            Color<input type="color" placeholder="Placeholder">
            Date<input type="date" placeholder="Placeholder">
            Datetime<input type="datetime" placeholder="Placeholder">
            Datetime-local<input type="datetime-local" placeholder="Placeholder">
Just Testing

            Email<input type="email" value="@gmail.com" placeholder="Placeholder">
            File<input type="file" placeholder="Placeholder">
            Hidden<input type="hidden" placeholder="Placeholder">
            Image<input type="image" placeholder="Placeholder">
            Month<input type="month" placeholder="Placeholder">
            Number<input type="number" placeholder="Placeholder">
            Password<input type="password" placeholder="Placeholder">
            Radio<input type="radio" placeholder="Placeholder">
            Range<input type="range" placeholder="Placeholder">
            Reset<input type="reset" placeholder="Placeholder">
            Search<input type="search" placeholder="Placeholder">
            Submit<input type="submit" placeholder="Placeholder">
            Tel<input type="tel" placeholder="Placeholder">
            Text<input type="text" placeholder="Placeholder">
            Time<input type="time" placeholder="Placeholder">
            Url<input type="url" placeholder="Placeholder">
            Week<input type="week" placeholder="Placeholder">

            Select from a dropdown <select>
                <option value="Option-1-Val">Option-1</option>
                <option value="Option-2-Val">Option-2</option>
                <option value="Option-3-Val">Option-3</option>
                <option value="Option-4-Val">Option-4</option>
                <option value="Option-5-Val">Option-5</option>
            </select>

        </form>

We use entities for displaying some character

        <

        >

        £

        ©

        ⇛

        ½

A dropdown button which shows whatever is written in summary and when clicked reveals what is written in detail tag.

            I have keys but no doors. I have space but no room. You can enter but you can't leave. What am i?
            A Keyboard.

Now i will use a time tag

We will be celebrating new year on <time datetime="2022-12-12">December 12</time> in my house.

A: On the pseudo element I added box-sizing: border-box and changed the width to 100% instead of 100vw.
box-sizing: border-box
This changes which box is used when declaring absolute widths. When we set this to border-box, it means that the border is placed inside of the declared width, not adding to it.
i.e. I have a 100px wide box with 2px border, I want the border to be included in that 100px, not added to it.
width: 100%
Percent widths are relative to the width of the container, whereas viewport are relative to the viewport. 100% means take up all the width of the container I'm in, 100vw means take up all of the viewport width (including the scrollbar).

* {
  margin: 0px;
  padding: 0px;
}

nav {
  position: sticky;
  top: 0px;
  left: 0px;
  margin: 0px 0px 10px 0px;
  padding: 5px 5px;
  background-color: #15191f;
}

.heading {
  height: 90vh;
}

.heading::before {
  box-sizing: border-box;
  border: 2px solid chocolate;
  content: "";
  height: 100vh;
  background: url() no-repeat center;
  width: 100%;
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: -1;
}

.flex {
  display: flex;
}

.flex-row {
  flex-direction: row;
}

.flex-column {
  flex-direction: column;
}

.wrap {
  flex-wrap: wrap;
}

.al-cen {
  align-items: center;
}

.ju-cen {
  justify-content: center;
}

nav a {
  text-decoration: none;
  background-color: #15191f;
  color: #e3ecf3;
  padding: 4px 10px;
  border: 2px;
  border-radius: 10px;
}

nav a:hover {
  color: #15191f;
  background-color: #e3ecf3;
}

#li1 {
  margin-left: 50px;
}

#a1 {
  margin: 0px 4px;
}

#a2 {
  margin: 0px 4px;
}

#a3 {
  margin: 0px 4px;
}

#a4 {
  margin: 0px 4px;
}

nav ul li {
  list-style: none;
}

#logo {
  width: 5vw;
  border: 2px;
  border-radius: 100mm;
}

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

div ul {
  margin: 0px 40px;
}

body {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 1.5vw;
  background-color: #e3ecf3;
}

div {
  margin: 20px 15px;
}

ol li {
  margin: 0px 40px;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.border-red {
  border: 3.5px solid red;
  border-radius: 12px;
}

.border-green {
  border: 3.5px solid green;
  border-radius: 5px;
}

.border-blue {
  border: 3.5px solid blue;
  border-radius: 5px;
}

.line-height {
  line-height: 8vh;
}

ol {
  border: 2px solid blue;
  border-radius: 5px;
  text-align: center;
  /* display: inline-block; */
  margin: 4px 0px;
  width: 300px
}

.text-cen {
  text-align: center;
}

ol li {
  margin-left: 40px;
}

input {
  display: block;
}

option {
  background-color: #15191f;
  color: #e3ecf3;
  height: 50px;
  font-size: 1.1rem;
  border-radius: 5px;
}

select {
  width: 85px;
  background-color: #15191f;
  color: #e3ecf3;
  height: 30px;
  border: 2px solid #15191f;
  border-radius: 6px;
}

.button {
  height: 25px;
  width: 25px;
  /* border: 2px solid #15191f; */
  border-radius: 100px;
  /* background-color: #15191f; */
}

/* .button: */

.checkbox {
  /* background-color: #15191f; */
  height: 25px;
  width: 25px;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>All in One</title>
  <link rel="stylesheet" href="../CSS/home.css">

Home

About Us

Our Services

Contact Us

All in ONE Website

This Website aims to include all that has been learnt and keep a record of it for future usage.

                <\b>This Bold<\b>
            Lorem ipsum dolor sit amet consectetur, adipisicing elit.

                <\br> Has been used here and here<\br>

             modi molestias omnis voluptate alias unde voluptates provident hic voluptatibus ipsum deleniti itaque delectus et expedita quisquam, non soluta, harum consequuntur sapiente rem quaerat. Repellendus, impedit.

OL type 1

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type A

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type a

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type I

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

OL type i

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet.

This is a Table

          Heading-1
          Heading-2
          Heading-3
          Heading-4
          Heading-5

          Row-1-Colum-1
          Row-1-Colum-2
          Row-1-Colum-3
          Row-1-Colum-4
          Row-1-Colum-5

          Row-2-Column-1
          Row-2-Column-2
          Row-2-Column-3
          Row-2-Column-4
          Row-2-Column-5

          Row-3-Column-1
          Row-3-Column-2
          Row-3-Column-3
          Row-3-Column-4
          Row-3-Column-5

FORMS

Below are some types of input we can ask on forms.Include a NAME in input tags

We will make input tag a block element to make go to next line and make the code look clean. Before it was inline so elements crammmed over each other.We can add value="" to show that thing.
 The diff between value and placeholder is that the placeholder
      gets removed whan an item is entered, wheras when we enter an item at place of value, it concencates in the value. Placeholder is Background, value is not. @gmail.com is value below in email. Remaining are Placeholder

    <form action="#">
      Button <input class="button" type="button" placeholder="Placeholder"> Checkbox
      <input type="checkbox" class="checkbox" placeholder="Placeholder"> Color
      <input type="color" placeholder="Placeholder"> Date
      <input type="date" placeholder="Placeholder"> Datetime
      <input type="datetime" placeholder="Placeholder"> Datetime-local
      <input type="datetime-local" placeholder="Placeholder">

Just Testing

      Email<input type="email" value="@gmail.com" placeholder="Placeholder"> File
      <input type="file" placeholder="Placeholder"> Hidden
      <input type="hidden" placeholder="Placeholder"> Image
      <input type="image" placeholder="Placeholder"> Month
      <input type="month" placeholder="Placeholder"> Number
      <input type="number" placeholder="Placeholder"> Password
      <input type="password" placeholder="Placeholder"> Radio
      <input type="radio" placeholder="Placeholder"> Range
      <input type="range" placeholder="Placeholder"> Reset
      <input type="reset" placeholder="Placeholder"> Search
      <input type="search" placeholder="Placeholder"> Submit
      <input type="submit" placeholder="Placeholder"> Tel
      <input type="tel" placeholder="Placeholder"> Text
      <input type="text" placeholder="Placeholder"> Time
      <input type="time" placeholder="Placeholder"> Url
      <input type="url" placeholder="Placeholder"> Week
      <input type="week" placeholder="Placeholder"> Select from a dropdown
      <select>
        <option value="Option-1-Val">Option-1</option>
        <option value="Option-2-Val">Option-2</option>
        <option value="Option-3-Val">Option-3</option>
        <option value="Option-4-Val">Option-4</option>
        <option value="Option-5-Val">Option-5</option>
      </select>

    </form>

We use entities for displaying some character

    <

    >

    £

    ©

    ⇛

    ½

A dropdown button which shows whatever is written in summary and when clicked reveals what is written in detail tag.

      I have keys but no doors. I have space but no room. You can enter but you can't leave. What am i?
      A Keyboard.

Now i will use a time tag

We will be celebrating new year on <time datetime="2022-12-12">December 12</time> in my house.

A: In main tag of your website you should give width 100%:
width : 100%;

if you set 100vw your browser take overflow-x as well as your vertical scrollbar width.


text:
Q: Module not found: Can't resolve 'apexcharts/dist/apexcharts.common' apex chart module not found Failed to compile
./node_modules/react-apexcharts/dist/react-apexcharts.min.js
Module not found: Can't resolve 'apexcharts/dist/apexcharts.common' in

'Z:\React\misc-examples\node_modules\react-apexcharts\dist'

This error occurred during the build time and cannot be dismissed.

A: by this command "npm install --save react-apexcharts apexcharts"
my problem solved.

A: yarn add --save react-apexcharts apexcharts

redpajama_set_name: RedPajamaStackExchange


text:
Q: On time-evolution of a quantum state Suppose I have a quantum system governed by a time-independent Hamiltonian $H$. Its eigenvectors $\{|\varphi_n\rangle\}_{n\in\mathbb{N}}$ form a complete orthonormal set (or basis) for the Hilbert space $\mathscr{H}$ hosting the state $|\psi\rangle$ of the system.
If ${\displaystyle \left|\psi (t)\right\rangle }$  is a state at time $t$, then
$${\displaystyle H\left|\psi (t)\right\rangle =i\hbar {\partial \over \partial t}\left|\psi (t)\right\rangle .}$$
The eigenvectors of $H$ at a given time $t_0$ are $\{|\varphi_n\rangle\}_{n\in\mathbb{N}}$ (assuming discrete, non-degenerate spectrum). Then
$$
|\varphi_n(t)\rangle = \exp\left(-\frac{i}{\hbar}E_nt\right)|\varphi_n\rangle \qquad \forall\;t>t_0
$$
Since $\{|\varphi_n\rangle\}_{n\in\mathbb{N}}$ form a complete orthonormal set (or basis) for the Hilbert space $\mathscr{H}$
any state $|\psi(t_0)\rangle \in \mathscr{H}$ at the time $t_0$ can be expressed as
$$
|\psi(t_0)\rangle= \sum_{n\in\mathbb{N}}c_n|\varphi_n\rangle
\qquad \operatorname{at} \ t=t_0$$
What will the general expression for $|\psi(t)\rangle$ at time $t>t_0$ be?
Well, evidently $\{|\varphi_n(t)\rangle\}_{n\in\mathbb{N}}$ is still a basis for $\mathscr{H}$, at any time $t$. Therefore
$$
|\psi(t)\rangle= \sum_{n\in\mathbb{N}}c_n(t)|\varphi_n(t)\rangle
\qquad \operatorname{at} \ t>t_0$$
But actually what turns out is slightly different
$$
|\psi(t)\rangle= \sum_{n\in\mathbb{N}}c_n\exp\left(-\frac{i}{\hbar}E_n t\right)|\varphi_n\rangle
\qquad \operatorname{at} \ t>t_0$$
In other words $c_n(t)=c_n$. Why do the coefficients remain the same?

A: Write
$$
\vert\Psi(t)\rangle= \sum_n c_n(t)e^{-iE_nt/\hbar}\vert\varphi_n\rangle
$$
with $H\vert\varphi_n\rangle=E_n\vert\varphi_n\rangle$.  Insert this into the
TDSE:
$$
i\hbar\sum_n \dot{c}_n(t)e^{-iE_nt/\hbar}\vert\varphi_n\rangle
+i\hbar \sum_n  \frac{-iE_n}{\hbar}c_n(t)e^{-iE_nt/\hbar}\vert\varphi_n\rangle
= \sum_n c_n(t) E_n e^{-iE_nt/\hbar}\vert\varphi_n\rangle\, ,
$$
where $\dot{c}_m(t)=\frac{d}{dt}c_m(t)$ and where $H\vert\varphi_n\rangle=E_n\vert\varphi_n\rangle$ has been used.
Close with $\langle\varphi_m\vert$ and use orthogonality:
$$
i\hbar\dot{c}_m(t)e^{-iE_mt/\hbar}
+i\hbar   \frac{-iE_m}{\hbar}c_m(t)e^{-iE_mt/\hbar}
= c_m(t) E_m e^{-iE_mt/\hbar}\, .
$$
The terms in $c_m(t)$ cancel out and you're left with
$$
i\hbar\dot{c}_m(t)e^{-iE_mt/\hbar}=0
$$
which implies $c_m$ is constant.


text:
Q: Javascript: Can you check if an object has a key which contains another key Take the below object
var obj = {
    hello: 1,
    helloWorld: 2
}

Is it possible, knowing only that obj.hello exists, to check if another key contains the same word?
I do not need to know what the other key is, only that one exists.

A: Yes you can do that,

var obj = {
  hello: 1,
  helloWorld: 2
}
let exist = Object.keys(obj).filter(key => key.includes('hello') && key !== 'hello').length > 0;

console.log(exist);

A: You can do this by using the Object.keys, and filtering it.

var obj = {
    hello: 1,
    helloWorld: 2,
    anotherKey: 3
}

var keysWithHello = Object.keys(obj).filter(x => x.includes("hello"));

console.log(keysWithHello.length ? "Object has keys with hello" : "No keys with hello")


text:
Q: Time stamp array that loops and creates differences of values inside based on their index Currently, I am working with the following;
timer = np.hstack(np.arange(100).reshape(100, 1))

def delta(timestamps):
   """Accrual periods"""
   for i in range(timestamps):
     dtimes_1 = timestamps[i] - timestamps[i - 1]
     dtimes_2 = timestamps[i + 1] - timestamps[i - 1]
   return(dtimes_1, dtimes_2)

What I am trying to achieve is a function which receives the timer vector as the timestamps input and will difference their values in two ways; 1. as Ti - Ti-1 and 2. as Ti+1 - Ti-1.
In the timer variable I have placed the numbers 100 and 1 but realistically, these numbers will be determined by user input effects on preceding functions and outputs (mostly on how many iterations and the length of time-steps).
In this particular example, if timer were to equal [0], [1], [2], [3], I would hope that dtimes_1 would return three values: [0], [1], [1] and that dtimes_2 would return [0], [2], [2], etc.

A: If d1[i] == T[i+1] - T[i] and d2[i] == T[i+2] - T[i] is enough, you can do this:
import numpy as np

def delta(timestamps):
    """Accrual periods"""
    dtimes_1 = timestamps[1:] - timestamps[:-1]
    dtimes_2 = timestamps[2:] - timestamps[:-2]
    return dtimes_1, dtimes_2

timer = np.array([1, 2, 4, 8]).reshape(4, 1)
d1, d2 = delta(timer)

print(timer)
print(d1)
print(d2)

Output:
[[1]
 [2]
 [4]
 [8]]

[[1]
 [2]
 [4]]

[[3]
 [6]]

If you really want to have it with the exact arithmetic you asked for, consider this:
def delta(timestamps):
    """Accrual periods"""
    dtimes_1 = np.vstack((None, timestamps[1:] - timestamps[:-1]))
    dtimes_2 = np.vstack((None, timestamps[2:] - timestamps[:-2], None))
    return dtimes_1, dtimes_2

Output:
[[1]
 [2]
 [4]
 [8]]

[[None]
 [1]
 [2]
 [4]]

[[None]
 [3]
 [6]
 [None]]

Here I used None as the fill value, but you can also use zero or something else.


text:
Q: Perl: Frequency of words and a top ten list of the words Im working on making a perl script work, and beware I'm rather new to this..
Here's is what im trying to achieve: making a script that takes a .txt file and counts each word in the file. And when it's counted the words makes a list if the top 10 words in the file displaying how many times each word i counted.
well here's what ive got so far, ive been able to make the script count the words and how many times they appear. Now i need to make the top ten list and I don't really know where and how to do it. This is a homework assignment so I don't want/expect you to solve it for me, just give me some pointers in where to begin.
Thank you for helping (in advance)

Updated 15 oct
ok, it's sorting everything great but..
As it is now it's just printing everything in one line. I need it to print it like this:
4 word
3 next word
2 next word
Well you get it..

I think i've got it...i think :P

......................................
#! /usr/bin/perl

use utf8;

print ("Vilken fil?\n");
my $filen = @ARGV ? shift(@ARGV) : <STDIN>;
chomp $filen;

my %freq;

open my $DATA, $filen or die "Hittade inte den filen!";

while(<$DATA>) {

    s/[;:()".,!?]/ /gio;
    foreach $word(split(' ', lc $_)) {
    $freq{$word}++;
     }
}

@listing = (sort { $freq{$b} <=> $freq{$a} } keys %freq)[0..9];
foreach my $word (@listing )
    { print $freq{$word}." $word\n"; };

A: Look at docs for the Perl sort function:
http://perldoc.perl.org/functions/sort.html
It has a form that lets you specify a block of code to define the ordering of elements. You can use this to order your list by frequency rather than by the word's alphabetical ordering.
The docs include this example:
# this sorts the %age hash by value instead of key
# using an in-line function
@eldest = sort { $age{$b} <=> $age{$a} } keys %age;

You should be able to adapt this pattern to your own problem.
Probably the most efficient way to get the top ten list is to keep track of the top ten as you go: each time you compute a count, check if it belongs in the top ten, and if so then insert it in the correct place, potentially knocking off the bottom item on the list. That way, you only need to track the ordering of ten words at a time regardless of how big the dictionary is. I don't know if you need this extra efficiency, though.
By the way, I have seen this kind of question in several job interviews, so it's a good thing to have a handle on.

A: Building on Nate's answer, you can extract the top 10 elements, by using a slice:

@eldest = ( sort { $age{$b} <=> $age{$a} } keys %age)[0..9];

A: Ha, by the time I finished reading your problem description I knew it was some kind of homework assignment!  :)
For the next step, you have to scan through your %count hash and determine which words have the most occurrences.
The most naive way would be to scan through the list 10 times; each time, find the one with the highest count and store it in a top-ten list, then remove it from %count (or set it to 0 would also work).
If you want to get more ambitious, you could implement a sort function that sorts the %count entries, and then the 10 highest will be right together.
My Perl is rusty, but the Perl lib might even have some sort functions for you.  In general, it's definitely worth your time to skim through a library reference to familiarize yourself on what's available.


text:
Q: Secondary bar with chart.js I am trying to make a chart as in the following image using Chart.js. The blue and red graphics are stacked and the black chart outline is a secondary axis graphic that lies behind them all.

All I could do is the chart below.

Here is my code:

<script>
  var poteData = { myData };

  var poteOptions = {
    legend: {display: false},
    responsive: true,
    tooltips: {
      mode: 'index',
      intersect: false
    },
    scales: {
      xAxes: [{
        stacked: true,
        gridLines: {
          display: false
        },
        ticks: {
          beginAtZero: true
        }
      }],

      yAxes: [{
        stacked: true,
        gridLines: {
          display: false
        },
        ticks: {
          beginAtZero: true
        }
      }]
    }
  }

  window.onload = function() {
    var ctx = document.getElementById('canvas').getContext('2d');
    window.myBar = new Chart(ctx, {
      type: 'bar',
      data: poteData,
      options: poteOptions
    });
  };
</script>

A: You can achieve a similar style by styling the bars and adding a second axis. Refer to the annotations in the below snippet:

var poteData = {
  //myData
  labels: ['a', 'b'],
  datasets: [{
    data: [1, 2],
    backgroundColor: 'red',
    borderColor: 'transparent',
    borderWidth: 15
  }, {
    data: [3, 4],
    backgroundColor: 'blue',
    borderColor: 'transparent',
    borderWidth: 15
  }, {
    data: [10, 11],
    backgroundColor: 'transparent', // style this bar appropriately.
    borderColor: 'black', // style this bar appropriately.
    borderWidth: 5,// style this bar appropriately.
    yAxisID: 'right' // assign this bar to the second y-axis.
  }]
};

var poteOptions = {
  legend: {
    display: false
  },
  responsive: true,
  tooltips: {
    mode: 'index',
    intersect: false
  },
  scales: {
    xAxes: [{
      stacked: true,
      gridLines: {
        display: false
      },
      ticks: {
        beginAtZero: true
      }
    }],
    yAxes: [{
      stacked: true,
      gridLines: {
        display: false
      },
      ticks: {
        beginAtZero: true
      }
    }, {
      id: 'right', // create a second y-axis called 'right'.
      position: 'right', // draw it to the right side of the chart.
      gridLines: {
        display: false
      },
      ticks: {
        beginAtZero: true
      }
    }]
  }
}

//window.onload = function() {
var ctx = document.getElementById('canvas').getContext('2d');
window.myBar = new Chart(ctx, {
  type: 'bar',
  data: poteData,
  options: poteOptions
});
//};
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script>
<canvas id="canvas"></canvas>


text:
Q: OAuth2::Error, invalid_request: redirect_uri does not match application configuration I'm working on a rails app that authenticates using Bungie OAuth using this gem. My configurations in initializers/devise.rb are as follows:
config.omniauth :bungie, ENV['CLIENT_ID'], ENV['CLIENT_SECRET'], ENV['X_API_KEY'], ENV['REDIRECT_URL']

Bungie's developer portal requires a redirect URL with HTTPS, so I've pushed my application to Heroku and used a redirect to force authentication back to localhost for testing. Using this method, everything works fine. However, when I push the app to production, the response back to my application from Bungie fails with OAuth2::Error, invalid_request: redirect_uri does not match application configuration. The redirect_url is the exact same thing in both my application's env variables and on Bungie's development portal.
Seeing as it's in production, I'm limited to the logs that I can see. I've tried tracking the requests in the network tab of the dev tools in my browser, but everything looks as it should.
I've tried working with the developer of the bungie-oauth2 gem, but we have not been able to come to a resolution (and his prod apps work fine with it).
Is there anything that might cause the redirect_url to differ once in Heroku?
As requested, here is my route for omniauth:
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }

Output from rake routes:
 users_sign_out GET      /users/sign_out(.:format)             devise/sessions#destroy
          new_user_session GET      /users/sign_in(.:format)              devise/sessions#new
              user_session POST     /users/sign_in(.:format)              devise/sessions#create
      destroy_user_session DELETE   /users/sign_out(.:format)             devise/sessions#destroy
user_bungie_omniauth_authorize GET|POST /users/auth/bungie(.:format)          users/omniauth_callbacks#passthru
user_bungie_omniauth_callback GET|POST /users/auth/bungie/callback(.:format) users/omniauth_callbacks#bungie
         new_user_password GET      /users/password/new(.:format)         devise/passwords#new
        edit_user_password GET      /users/password/edit(.:format)        devise/passwords#edit
             user_password PATCH    /users/password(.:format)             devise/passwords#update
                           PUT      /users/password(.:format)             devise/passwords#update
                           POST     /users/password(.:format)             devise/passwords#create
  cancel_user_registration GET      /users/cancel(.:format)               devise/registrations#cancel
     new_user_registration GET      /users/sign_up(.:format)              devise/registrations#new
    edit_user_registration GET      /users/edit(.:format)                 devise/registrations#edit
         user_registration PATCH    /users(.:format)                      devise/registrations#update
                           PUT      /users(.:format)                      devise/registrations#update
                           DELETE   /users(.:format)                      devise/registrations#destroy
                           POST     /users(.:format)                      devise/registrations#create

and my controller:
def bungie
  @user = User.from_omniauth(request.env["omniauth.auth"])

  if @user.persisted?
    @user.remember_me = true
    sign_in_and_redirect @user, :event => :authentication
  else
    session["devise.bungie_data"] = request.env["omniauth.auth"]
    redirect_to root_path
  end
end

Full source can be found at https://github.com/destiny-aviato/destinder.

A: Encoding of redirect_uri param in your auth request to bungie jumps out:
https%25253A%25252F%25252Fdestinder.herokuapp.com%25252Fusers%25252Fauth%25252Fbungie%25252Fcallback

To read it in plain, I had to decode it thrice. Normally params are encoded just once
URI.decode(URI.decode(URI.decode("https%25253A%25252F%25252Fdestinder.herokuapp.com%25252Fusers%25252Fauth%25252Fbungie%25252Fcallback")))

Not sure if this is what causing the issue. Can you check how many times request_uri gets encoded when you hit it from local. If it's less than 3, then during heroku deployment your request_uri gets encoded one extra time.
To get request_uri for local, logout from bungie, click on "Sign in with bungie" on your local. The url in browser would have request_uri.

A: replace redirect url of your Heroku application in credential


text:
Q: Ruby Error: wrong number of arguments (1 for 0) (ArgumentError) I am run this code but I am getting an error.
code here :-
class Text
    def post(success, error)
        if authenticate?(@user, @password)
            success.call
        else
            erro.call
        end
    end
end
text = Text.new('Ruby Bits!')
success = ->{ puts "Sent!"}
error = ->{ raise 'Auth error'}
text.post(success,error)

Please tell us. How to solve this problem?

A: Look closely at which line number the ArgumentError is raised from (in your case, line 25).
You are passing one argument to the Text#initialize, but have not defined a version of initialize that takes one argument.
Try this instead (calling the default, zero argument Text constructor):
class Text
    def post(success, error)
        if authenticate?(@user, @password)
            success.call
        else
            error.call
        end
    end
end
text = Text.new
success = ->{ puts "Sent!"}
error = ->{ raise 'Auth error'}
text.post(success, error)

Or define initialize with one argument:
class Text
    def initialize(your_meaningful_argument)
         # do stuff
    end

    def post(success, error)
        if authenticate?(@user, @password)
            success.call
        else
            error.call
        end
    end
end


text:
Q: Will an asynchronus-Ajax request be completed if I instantly reload or close my page after it's being sent to the server? For example if I do this request with jQuery's Ajax:
$(document).ready(function() {
    $('#some_button').click(function() {
        $.ajax({
            url: '/some/request',
            type: 'POST',
            data: [{my: 'dummy', data: 'lata'}],
            dataType: 'json',
            async: true,
        });

        window.location.href = '/my/parent/location';
    });
});

So I'm interested:

Will my action be completed on the server nevermind if I'm refreshing the page just right after the initial request is sent?

A: Ajax is synchronous.. So it will be immediately redirected irrespective of the Request..
You can call that in the success callback of your Ajax Request instead..
$(document).ready(function() {
    $('#some_button').click(function() {
        $.ajax({
            url: '/some/request',
            type: 'POST',
            data: {my: 'dummy', data: 'lata'},
            dataType: 'json',
            success : function() {
                window.location.href = '/my/parent/location';
            }
        });

    });
});


text:
Q: Impact of multi-word instruction What would be the impact on fetch and decode instructions if instead of encoding one word in an instruction, there were multiple words being encoded?
I know that if instead the words were encoding 64 bits, 128 bits, that the decode and fetch instructions would be slowed down. I think of another impact that this would have though.


text:
Q: How do I execute an arbitrary script in the context of my Django project? Sometimes I want to execute a file in the context of my Django project, just as if I were using the shell, but with the convenience of using a text editor.  This is mainly to try something out, or quickly prototype some functionality before putting it into a view, test, recurring task, or management command.
I know I can stick these lines at the top of my .py file and it'll run in the Django context:
import sys
sys.path.append('/location/of/projet')
from django.core.management import setup_environ
import settings
setup_environ(settings)

I thought it'd be easier to make a management command that takes on argument, a python module to run, and executes it in the Django environment.   Here's the 'runmodule' command I wrote:
from django.core.management.base import BaseCommand, CommandError

class Command(BaseCommand):
    help = "Runs an arbitrary module, in the Django environment, for quick prototyping of code that's too big for the shell."

    def handle(self, *args, **options):
        if not args:
            return
        module_name = args[0]

        try:
            __import__(module_name)
        except ImportError:
            print("Unable to import module %s.  Check that is within Django's PYTHONPATH" % (module_name))

This looks like it works -- I can stick some code in a module, and pass it as an argument to this command, and it'll get executed, e.g.
python manage.py runmodule myapp.trysomethingout

which will execute myapp/trysomethingout.py.  Is this the best way to do this?

A: The best way to execute a script with the correct django context is to set the DJANGO_SETTINGS_MODULE environment variable to your settings module (and appropriate PYTHONPATH if needed).  In windows this usually means executing:
set DJANGO_SETTINGS_MODULE=setting

and in bash :
export DJANGO_SETTINGS_MODULE=setting

You can now import your models etc.
see: https://docs.djangoproject.com/en/dev/topics/settings/#designating-the-settings .
Note that in order to import the settings module, one should use from django.conf import settings.  This takes into account the DJANGO_SETTINGS_MODULE instead of automatically using settings.py .

A: Here's the simplest solution:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

import django
django.setup()

Be sure to include this at the top of your python file, before importing any of your models.
Alternatively, you could use the solution pointed out by @beyondfloatingpoint:
import os, sys

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
sys.path.append("mysite")
os.chdir("mysite")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

A: Best solution is provided in this article.
Hints: Make sure you are using correct path to settings module, in my case, I missed nested dirs named the same way. The best way to avoid my mistake is to use something like this template to start with.


text:
Q: Class two has no member v error I am new to C++ and I have a problem.I am trying to make to classes mutual friend,and accessing different members in one from the other one.I can't figure out what is that I do wrong.Here is what I have so far:
#ifndef HA_H_
#define HA_H_
#include"Ha2.h"
using namespace std;
class two;
class one{
public:
    int tip;
    int timp;
    one(int t) :tip(t){}
    friend class two;
};

#endif /* HA_H_ */

The second header:
#ifndef HA2_H_
#define HA2_H_
#include"Ha.h"
#include<vector>
class one;
class two{
public:
    vector<one> v;
   vector<int> x;
   inline void create_x(vector<one> v){
     // vector<one>::iterator it=v.begin();
      int i;
      for(i=0;i<v.size();i++){
          x.push_back(v.at(i).tip);
      }

   }

    friend class one;
};

#endif /* HA2_H_ */

And the main:
#include<vector>
#include<iostream>
#include"Ha.h"
#include"Ha2.h"
int main()
{
one o(3);
two x;
x.v.push_back(o);

x.create_x(x.v);
cout<< x.x.back();
}

And I get several errors like:
class two has no member named 'v'
Any advice?Thank you.

A: main.cpp includes "Ha.h", which, before using namespace std;, includes "Ha2.h". Then, class two is defined, which declares v as a vector<one> without qualifying vector in the std namespace.
There is no need to include "Ha2.h" in "Ha.h", remove that, then qualify vector.

A: *

*Forward declarations are used when the class definition has pointers or references. And neither of the class definitions has them and so forward declarations are unnecessary.

*Also the headers has both forward declarations and it's corresponding header inclusion which voids the whole purpose of forward declarations.

*Include the headers and also the using directive in the source files.

*As of now, the program has no methods to test the purpose of friend and so this should at least make the program compile.

Ha.h header :
#ifndef HA_H_
#define HA_H_

    class two ;  // No pointers or references of two in one.
                 // So, remove it and place when you actually have
                 // a method taking reference of two.
    class one{
        public:
           int tip;
           int timp;
           one(int t) :tip(t){}
           friend class two;
    };

#endif /* HA_H_ */

Ha.cpp
#include "Ha2.h"  // Place this only when have a method accessing
                  // members of two. Else this is unnecessary.

#include "Ha.h"
using namespace std ;

Ha2.h
#ifndef HA2_H_
#define HA2_H_

    class one ;    // No pointers or references of one in two.
                   // So, remove it and place when you actually have
                   // a method taking reference of one.
    class two{
        public:
           vector<one> v;
           vector<int> x;
           inline void create_x(vector<one> v)
           {
               // vector<one>::iterator it=v.begin();
               int i;
               for(i=0;i<v.size();i++)
               {
                   x.push_back(v.at(i).tip);
               }
           }

    friend class one;
    };

#endif /* HA2_H_ */

Ha2.cpp
#include <vector>
#include "Ha.h"    // Place this only when have a method accessing
                   // members of two. Else this is unnecessary.

#include "Ha2.h"

using namespace std ;

// .....

main.cpp
#include <vector>  // Definitely need this because in the current unit, Ha2.h is
                  // included which has a data type of vector<int>

#include <iostream>

#include"Ha.h"
#include"Ha2.h"

using namespace std ; // vector and the other standard definitions are specified
                      // in std namespace
int main()
{
    one o(3);
    two x;
    x.v.push_back(o);

    x.create_x(x.v);
    cout<< x.x.back();
}

With the above modifications, you should get rid of errors. If any new errors pop up, post the exact error messages in your question.

A: Another alternative to remove the circular dependency is to make a separate header file, like decl.h or whatever you want it to be, and inside of that simply put the following lines:
#ifndef DECL_H_
#define DECL_H_

class one;
class two;

#endif DECL_H_

Then in Ha.h and Ha2.h remove the #include "Ha.h" and #include "Ha2.h" lines and replace them with #include "decl.h".  Also remove the class one; and class two; declarations in Ha.h and Ha2.h, but keep the definitions of each respective class.
Now you won't have Ha.h depending on Ha2.h and vice versa.
Hope this helps,
Jason


text:
Q: Reacts JS stops running I have the code below

const secondsToString = (seconds) => {
  seconds = parseInt(seconds)
  let numdays = Math.floor(seconds / 86400);
  let numhours = Math.floor((seconds % 86400) / 3600);
  let numminutes = Math.floor(((seconds % 86400) % 3600) / 60);
  let numseconds = ((seconds % 86400) % 3600) % 60;
  if (numdays !== 0) {
    return numdays + "d " + numhours + "h " + numminutes + "m " + numseconds + "s";
  } else if (numhours !== 0) {
    return numhours + "h " + numminutes + "m " + numseconds + "s";
  } else if (numminutes !== 0){
    return numminutes + "m " + numseconds + "s";
  } else {
    return numseconds + "s";
  }
}

//more functions
const difference = (start) => {
  const startAt = Date.parse(start);
  const now   = Date.parse(new Date());
  var seconds = parseInt((now - startAt)/1000);
  return secondsToString(seconds)
};
//more functions

// in render
 modalToggle()}>{difference(item.startsAt)}

}
normally when I access this page the the td keeps updating and time keeps growing, but today sometimes it will for 30 seconds, and then it stops, sometimes it only runs once then stops.
It appears all javascript on the page stops.
I have websocket listeners, but new data doesn't appear unless I refresh or click on something.
What's strange is there were no changes to this and it stopped. The api appears to be fine as well,the logs don't show anything dropping

A: At least a temporary answer for me is to do

  const [seconds, setSeconds] = useState(0);

  useEffect(() => {
    const interval = setInterval(() => {
      setSeconds(seconds => seconds + 1);
    }, 1000);
    return () => clearInterval(interval);
  }, []);

// in return

        {seconds} Woah.... You found me... I am the keeper of time. No one updates the time without me. If I am not here
        THE WORLD IS DOOMED!


text:
Q: Memória dinâmica com ponteiros em c++ Olá, eu estou a começar a usar memória dinâmica em c++, mas deparei-me com um problema. Quando eu faço new CHAR_INFO[3], diz

cannot convert 'CHAR_INFO* {aka _CHAR_INFO*}' to 'int*' in assignment

e ainda dá erro nesta linha de código: new std::thread(Func), dizendo

cannot convert 'mingw_stdthread::thread*' to 'int*' in assignment

o que esta mensagens de erro significam? Não posso usar threads nem variáveis do tipo CHAR_INFO em apontadores?
EDIT1:
Este é o código completo do que está a dar erro:
int *BUFFER = NULL;
BUFFER = new CHAR_INFO[3];
delete []BUFFER;

E também este código
int *BUFFER = NULL;
BUFFER = new std::thread(Func);
delete []BUFFER;

A função é do tipo void, sem argumentos.
Se eu colocar este código separado num ficheiro dá-me o mesmo erro.


text:
Q: How to load initial store data through meta tag before redux sagas are complete? Currently, I'm running into a situation where a server rendered page is loaded prior to sagas completing which populate the store. However, elements such as links are dependent on the store in order to fire an action. e.g. login link would need to change that state of the application to show a modal, but doesn't have access to the store data yet. I would like to load the initial store immediately through a meta tag. How can I achieve this?

A: It's not clear what you actually need. If i understand you right, you just need to wait when all sagas are done then render markup on the server. You can achieve this by wrapping server side sagas in saga-wrapper and then run it through middleware API:
sagaMiddleware.run().done.then(...) <- regular Promise


text:
Q: wsdl2java code generation for lists of custom objects I would like to know if the tool "wsdl2java" (Axis2) is able to generate stubs that support getting list of custom ojects.
For instance, if I have a WS that have the following method:
public List<Device> getDevices(){
//...
}

Where Device is a custom class...
This tool can do that?

A: I changed the return data type of my Web Service to an array because of that:
http://www.ibm.com/developerworks/webservices/library/ws-tip-coding/index.html
And I had to do some changes (some namespaces) to the generated stub (I used ADB)...
I changed that because it was giving me an ADBException: Unexpected subelement ...


text:
Q: applicationShouldTerminate: not called when system restarts I have to run some code when the app is about to terminate. applicationShouldTerminate: runs when quit is selected from the menu or when I press Cmd Q but not when I restart the mac.
Is there a way to force applicationShouldTerminate when a user tries to restart the mac? Or is it another function being called in this scenario?

A: Your app might have Sudden Termination enabled.

macOS 10.6 and later includes a mechanism that allows the system to log out or shut down more quickly by, whenever possible, killing applications instead of requesting that they quit themselves.

...

Debugging tip
You can determine the value of the sudden termination using the following LLDB command.
print (long)[[NSClassFromString(@"NSProcessInfo") processInfo] _suddenTerminationDisablingCount]


text:
Q: Grab data from a text file in PHP I coded a script in C# which has the ability to grab data from a specific string in a text file, for example:
Program grabs the description of a chosen badge:

badge_desc_BADGEID=This is the data that's going to get grabbed

Although I am not sure how to go about doing this in PHP, because I want it to be able to grab the description of the chosen badge ID. In C# it's the method of replacing, splitting and then replacing the string again, but I'm not sure how to do this in PHP, like I've stated.
All help is appreciated!

A: You want something like an ini file?
Php have a function to parse ini files, the problem is that you can't save.
http://www.php.net/manual/es/function.parse-ini-file.php
Anyway, take a look to Config_Lite pear package that can handle and save ini like files.


text:
Q: Converting HYPERLINK() - to text with an underlying link Suppose I have a column with many (hundreds) of rows, each with a HYPERLINK formula, e.g.
=HYPERLINK("https://npiregistry.cms.hhs.gov/registry/provider-view/99999", "99999")

How can I convert all into a cells that contain the text - but with an underlying link (as in with CTRL-K), e.g., 99999
Thanks!

A: After further investigation, the problem is not the security setting of the Excel for Mac but the hyperlink formula was composed with 2 cell references; the display text, and the link.
The VBA function to insert / replace a hyperlinked to a cell is as of the following.
ActiveSheet.Hyperlinks.Add Anchor:=current_range, Address:=address_string, TextToDisplay:=display_string

In your situation, you have to replace current_range, address_string, and display_string in the VBA syntax.
In my above example, since we are using a For loop to loop through all the cells in selection, you can leave it as current_range.
For the address_string, and display_string, you will feed the function with the cell location of those two on your spreadhseet. Since your spreadsheet has the address string stored in two separate columns, you want to reference to the column by either using the familiar cell reference format, Range("$C" & current_range.row) format, or use the offset method, which involve in counting the index of the column. Example, current_range.offset(0, -10).value. The -10 in the offset is how many column you want to move left from your current_range.
Note, it is important to add the .value at the back of your cell reference so it's getting the data (String) stored in the cell instead of the potential formula in the cell.

A: Create this macro.
Sub convert_hyperlink_formula_to_hyperlink_cell()
Dim address_string As String, display_string As String
Dim current_range As Range

For Each current_range In Selection
    address_string = Mid(current_range.Formula, 13, InStr(1, current_range.Formula, ",") - 14)
    display_string = current_range.value
    ActiveSheet.Hyperlinks.Add Anchor:=current_range, Address:=address_string, TextToDisplay:=display_string
Next current_range
End Sub

Select the range of your Hyperlink formulas then run the macro. That should convert the hyperlink formulas to actual hyperlinked cells.
Please try this sample file.
Convert Hyperlink Sample File.xlsm
I have made a copy of your posted formula, and pasted a few lines in the sample file. The macro is already setup in the Excel file for your to test.


text:
Q: Trying to get my home button image directly to the left of my logout button I can not get my home button image directly to the left of my logout button. I have changing the css all over. I also tried adding breaks and extra lines but that always gives an unexpected result. This is my HTML code.

Add a New Subdiv file

             Logout

This is my css code.
.HomeButton {
    text-decoration:none;
    float:right;
    display:inline-block;
}
.LogoutButton {
    text-align:center;
    width: 10%;
    float:right;
    background-color:#ffec64;
    border:2px solid #ffaa22;
    display:inline-block;
    cursor:pointer;
    color:#333333;
    font-family:Arial;
    font-size:22px;
    font-weight:bold;
    padding:.01% .1%;
    text-decoration:none;
}

A: Change the order of anchor tags in the html.
try

Add a New Subdiv file
    Logout

Snippet:

.HomeButton {
  text-decoration: none;
  float: right;
  display: inline-block;
}
.LogoutButton {
  text-align: center;
  width: 10%;
  float: right;
  background-color: #ffec64;
  border: 2px solid #ffaa22;
  display: inline-block;
  cursor: pointer;
  color: #333333;
  font-family: Arial;
  font-size: 22px;
  font-weight: bold;
  padding: .01% .1%;
  text-decoration: none;
}

Add a New Subdiv file
             Logout

A: Umm you need what you said you need just change your html like this

Add a New Subdiv file   Logout


text:
Q: Typescript ReconnectingWebSocket fails to call constructor When I attempt to create a new ReconnectingWebSocket I get the following:
reconnecting_websocket_1.default is not a constructor
The typescript code is:
import ReconnectingWebSocket, { Options } from 'reconnecting-websocket';

export class RealtimeClient {

    private reconnectingWebSocket: ReconnectingWebSocket

    constructor(private url: string, private dispatch: IDispatcher) {}

    public connect() {
        const wsOptions: Options = {
            minReconnectionDelay: 1000,
            reconnectionDelayGrowFactor: 1.0,
            connectionTimeout: 2000,
        }
        this.reconnectingWebSocket = new ReconnectingWebSocket(this.url, [], wsOptions)
        this.reconnectingWebSocket.onmessage = this.onMessage
    }

    /* ... */
}

At runtime, the resulting javascript in chrome dev tools shows that reconnecting_websocket_1 is the ReconnectingWebSocket class as expected, however default is undefined, which I believe is the root cause of the failure.
this.reconnectingWebSocket = new reconnecting_websocket_1.default(this.url, [], wsOptions);
this.reconnectingWebSocket.onmessage = this.onMessage;

NB:

*

*I am compiling to ES5 javascript (via tsconfig.json target).

*I have a non-dev dependency on reconnecting-websocket
    "reconnecting-websocket": "^4.0.0-rc5"

A: Add compiler option esModuleInterop to your tsconfig.json.
You might also want to look at socket.io-client, which is slightly bigger, but not abandoned 3 years ago.


text:
Q: How to give background into context menu items In one of my Android projects, I am creating a context menu from a menu folder inside res. It is as below.
<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/help"
    android:title="Help" />
  <item android:id="@+id/keyboard"
    android:title="Keyboard" />
  <item android:id="@+id/exit"
    android:title="Exit" />
</menu>

But I want an image to the background of every item. How can I do this?

A: Try this:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/help"
    android:title="Help"
    android:icon="@drawable/ic_1/>
  <item android:id="@+id/keyboard"
    android:title="Keyboard"
    android:icon="@drawable/ic_2" />
  <item android:id="@+id/exit"
    android:title="Exit"
    android:icon="@drawable/ic_3/>
</menu>

A: Use styles in your app. Then you can change a default style of Widget.ListView. Note this also  changed a style of dialogs with ListView. More details see in this answer.


text:
Q: Real Analysis fundamental theorems of Calculus contradiction? Evaluate: $\frac{d}{dx} \int_{0}^{x} x^3t^3dt.$
Solution: $\frac{d}{dx} \int_{0}^{x} x^3t^3dt = \frac{7x^6}{4}.$
Proof:
Consider the function's $F:[a,b] \rightarrow \mathbb{R}$ and $f:[a,b] \rightarrow \mathbb{R}$, define: $F(t) = \frac{1}{4}x^3t^4 + c$ and $f(t) = x^3t^3.$ Observe that by proposition 4.7 F is differentiable on (a,b) and $F'(t) = x^3t^3 = f(t)$ for all x in $(a,b).$ Moreover by the polynomial property (proposition 2.17): F is continuous on [a,b] and f is continuous on [a,b], so by theorem 3.14 we know f is bounded and by theorem 6.18 f is integrable. We satisfy the criteria in the first fundamental theorem of calculus (theorem 6.22) hence:
$\frac{d}{dx} \int_{0}^{x} x^3t^3dt = \frac{d}{dx} [F(x) - F(0)] = \frac{d}{dx} \frac{1}{4}x^7 = \frac{7}{4}x^6.$
But by the second fundamental theorem of calculus (theorem 6.29):
$\frac{d}{dx} \int_{0}^{x} x^3t^3dt = f(x) = x^6 \neq F'(x) = \frac{7}{4}x^6$. Contradiction. WHY!?
(Textbook: Advanced Calculus - Patrick M. Fitzpatrick, Chapter 6.6)
Edit
Thank you everyone for your help, I managed to figure it out from all of the advice!

A: When $f$ depends on $x$ and $t$ one has
\begin{equation}
\frac{d}{d x}\int_0^x f(x, t) d t = f(x, x) + \int_0^x\frac{\partial f}{\partial x}(x, t) d t
\end{equation}
In your case it gives
\begin{equation}
\frac{d }{d x}\int_0^x x^3 t^3 d t
= x^6 + \int_0^x 3 x^2 t^3 dt
\end{equation}
which is different from $x^6$.

A: It should be noted that the Leibniz Integral Rule deals with integrals like the one in question.
In the current example the integral takes the following form (with a slight generalization).
\begin{align}
\frac{d}{dx} \, \int_{0}^{x} (x \, t)^n \, dt &= (x \, x)^n \, \frac{d}{dx}(x) - (x \cdot 0)^n \, \frac{d}{dx}(0) + \int_{0}^{x} \left[ \frac{d}{dx}(x \, t)^n \right] \, dt \\
&= x^{2n} + n \, x^{n-1} \, \int_{0}^{x} t^{n} \, dt \\
&= x^{2 n} + n \, x^{n-1} \cdot \frac{x^{n+1}}{n+1} \\
&= \frac{2 n + 1}{n+1} \, x^{2 n}.
\end{align}
A straight forward evaluation takes the form
\begin{align}
\frac{d}{dx} \, \int_{0}^{x} (x \, t)^n \, dt &= \frac{d}{dx} \, \left( \frac{x^{2 n + 1}}{n+1} \right) = \frac{2n+1}{n+1} \, x^{2n}.
\end{align}
By using a corollary of the Fundamental Theorem of Calculus, namely,
$$ \int_{a}^{b} f(t) \, dt = F(b) - F(a), $$
where $F(x)$ is the anti-derivative of $f(x)$, then
\begin{align}
\frac{d}{dx} \, \int_{0}^{x} (x \, t)^n \, dt &= \frac{d}{dx} \, \left[ x^n \, (F(x) - F(0) ) \right] \\
&= \frac{d}{dx} \, \left[ x^n \, \left(\frac{x^{n+1}}{n+1} - \frac{0^{n+1}}{n+1}\right) \right] \\
&= \frac{d}{dx} \, \left( \frac{x^{2n+1}}{n+1}\right) \\
&= \frac{2n+1}{n+1} \, x^{2n}.
\end{align}
Each of these views yields the same result.


text:
Q: Decreasing values of operations in compcost increase gedscore? I'm afraid I'm running across the following:
Method 1:
proc sql;
create table as
...
compged(a.plan_id, b.plan_id,&maxscore.,'iL') as gedscore
from view_a a, view_b b
where a.state = b.state and calculated gedscore < &maxscore.
order by calculated gedscore;

This works, it's all fine and dandy, but I would like to adjust my results slightly with compcost. So I adopt Method 2:
proc sql;
create view tempview as select
...
from view_a a, view_b b
where a.state = b.state;
quit;
data modified_gedscore
set tempview;
if _N_ = 1 then call compcost('delete=',10,'truncate=',10);
gedscore = compged(el_plan, clms_plan,&maxscore.,'iL');
if gedscore < &maxscore.;
run;

There's a bit more to it, but I've tried to isolate the relevant bits. I have tried to decrease the cost of the operations delete and truncate (it makes sense given the data I'm working with and what I'm trying to accomplish). My expected result would be due to delete and truncate operations having a lower cost, more observations would have a gedscore < &maxscore. However, I'm afraid I am seeing the following: the call compcost is actually dramatically decreasing the number of observations I see. Do I have a basic misunderstanding as to how call compcost works? If the above is incorrect, how would I adjust compged to have deletion of characters be more likely to fall under the maxscore threshold?
Edit: Also, I understand that the different structuring of the two methods would raise the possibility of something other than call compcost causing the unexpected results, but if I simply comment out the call compcost line I get results equivalent to that in Method 1. So, nope.
Edit2: sample data. First observation is equivalent (0). Second yields higher gedscore under method 2 than method 1, even though the compcost of delete and truncate has been lowered, with no other changes.
data sample_data;
input state1 $ plan1 $ plan2 $;
datalines;
ID DENTAL DENTAL
GA GBHC GBCH
;

Edit3: I think I may have found the problem. It appears that the default compged costs (here) are different from the default compcost costs (here). When compcost is called, all operations not specified are set to the compcost defaults, which are usually higher. If anybody feels like confirming, feel free.
Thanks for your help

A: The issue is that COMPGED is not using the SWAP cost, but instead only using DELETE and INSERT (the latter of which costs 100).  That's because of how CALL COMPCOST works; for some reason (that makes little sense to me), CALL COMPCOST's default values are not equal to COMPGED's default values - and it inserts a default value into every other operation that you do not specify.
In order to make this work, it looks like you'll have to specify a value for everything that you want it to use, in particular, APPEND, BLANK, PUNCTUATION, SINGLE, SWAP, and TRUNCATE (the latter of which you do specify already).  From the doc, as of 9.2, the defaults were 50,10,30,20,20,10 for COMPGED for those.
In your example:
data sample_data;
input state1 $ plan1 $ plan2 $;
call compcost('del=',10,'truncate=',10,'swap=',20);
compged_1 = compged(plan1,plan2,'il');
put compged_1=;
datalines;
ID DENTAL DENTAL
GA GBHC GBCH
;
run;

Now returns 20 instead of 110.


text:
Q: CSS animation circle-triangle-square I'm toying around with CSS animations for fun. My limited experience is getting in the way.
The script below transforms a circle to triangle to an square and reverses. The animation between circle and triangle however has a slight bug. I expect it has something to do with the border but I can't seem to fix it. (I have no background in programming..:))
Could someone give me a push in the right direction?
.triangle {
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent;
  animation-name: testframe;
  animation-duration: 4s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

@keyframes testframe {
/*circle*/
  0% {
    width: 100px;
    height: 100px;
    background-color: #6980fe;
    border-radius: 50%;
  }
/*trianle*/
  50% {
    width: 0;
    height: 0;
    border: 0 solid transparent;
    border-right-width: 50px;
    border-left-width: 50px;
    border-bottom: 100px solid #6980fe;
    background-color: transparent;
  }
/*square*/
  100% {
    width: 100px;
    height: 100px;
    background-color: #6980fe;
  }
}

A: for to fix this slight bug, you shoud to include this property in triangle animation:
"border-radius: 0;"
like this:
...

/*trianle*/
50% {
   width: 0;
   height: 0;
   border: 0 solid transparent;
   border-radius: 0;
   border-right-width: 50px;
   border-left-width: 50px;
   border-bottom: 100px solid #6980fe;
   background-color: transparent;
}

...

I hope help you.


text:
Q: Proof that a function is bijective if and only if it is both surjective and injective I am given the usual definitions for surjectivity and injectivity, but I am introduced with an alternative formulation of bijectivity:

Suppose $X$ and $Y$ are sets and $f:X\rightarrow Y$ a mapping. This mapping is said to be bijective if $\exists g:Y\rightarrow X$ such that $\forall x\in X,\ y\in Y$, $f(g(y))=y$ and $g(f(x))=x$.

I have to proof that in this sense, bijectivity is equivalent to simultaneous injectivity and surjectivity. Now from bijectivity, I found it quite easy to prove the other two conditions. The other way around, however, poses some difficulty. My proof:

Suppose $f:X\rightarrow Y$ is surjective and injective. I define the function $g:Y\rightarrow X$ by $g(y)=x\Longleftrightarrow f(x)=y$. Surjectivity of $f$ implies $\forall y\in Y\ \exists x\in X$ such that $f(x)=y$, thus $f(g(y))=y$. Now suppose $x,z\in X$ and $f(x)=f(z)$. Along with the definition of $g$ this implies $g(f(z))=x$. From injectivity follows $x=z$, thus $g(f(x))=x$.

First of all, initially, I have not shown that $g$ is well-defined. I am not sure how to actually prove this, or if it is even necessary here. However, using surjectivity of $f$ is it easy to see that $g$ maps every value of $Y$. Can I conclude from this that the function is well-defined, or is there more to say on the matter? I suppose I would also have to show that $g$ cannot take on two different values of $x$ for the same $y$. Also, suppose I have proven that $g$ is indeed well-defined, is my proof as presented above correct? Thank you for your help!
EDIT:
From a discussion in the comments of an answer, I have come to realise that perhaps I have misused the term "well-defined". Since I don't really understand the formal definition, I will re-state a part of my question as follows: can I directly use $g$ as defined above, or do I have to prove that it is "okay" to use it? I'm really not sure how to say this anymore... intuitively, I would say that "okay" means that the definition itself does not produce any inconsistencies. If it is necessary to prove something about it prior to using it, what is it?

A: By definition a function $f:X\to Y$ is a subset of $X\times Y=\{\langle x,y\rangle\mid x\in X\wedge y\in Y\}$ such that for every $x\in X$ there is a unique $y\in Y$ such that $\langle x,y\rangle\in f$.
Now define $g:=\{\langle y,x\rangle\mid \langle x,y\rangle\in f\}\subseteq Y\times X$.
On base of injectivity and surjectivity of $f$ we will prove that $g$ is a function, i.e. that for every $y\in Y$ there is a unique $x\in X$ with $\langle y,x\rangle\in g$ or equivalently $\langle x,y\rangle\in f$.
Let $y\in Y$.
The surjectivity of $f$ guarantees that some $x\in X$ exists with $\langle x,y\rangle\in f$.
The injectivity of $f$ guarantees that this $x$ is unique, and proved is now that $g$ is indeed a function.
It remains to check whether we have indeed $f(g(y))=y$ for every $y\in Y$ and $g(f(x))=x$ for every $x\in X$.
For $y\in Y$ the following statements are equivalent:

*

*$f(g(y))=y$

*$\langle g(y),y\rangle\in f$

*$\exists z[z=g(y)\wedge\langle z,y\rangle\in f]$

*$\exists z[\langle y,z\rangle\in g\wedge\langle z,y\rangle\in f]$

*$\exists z[\langle y,z\rangle\in g\wedge\langle y,z\rangle\in g]$

*$\exists z[\langle y,z\rangle\in g]$

And it is obvious that the last statement is true because $g$ is a function on $Y$.
For $x\in X$ the following statements are equivalent:

*

*$g(f(x))=x$

*$\langle f(x),x\rangle\in g$

*$\exists z[z=f(x)\wedge\langle z,x\rangle\in g]$

*$\exists z[\langle x,z\rangle\in f\wedge\langle z,x\rangle\in g]$

*$\exists z[\langle x,z\rangle\in f\wedge\langle x,z\rangle\in f]$

*$\exists z[\langle x,z\rangle\in f]$

And it is obvious that the last statement is true because $f$ is a function on $X$.

A: You're on the right track. If $f$ is not surjective, then $g$ cannot be defined on $Y$, since $f(g(y))$ is not defined if $y\notin\operatorname{rng}(f)$. As for injectivity, what can you say about $g(f(x))$ and $g(f(x'))$, when can they be equal?
In both cases, if $f$ is not an injective and surjective function, then $g$ is not well-defined. But since we are given that $g$ is a well-defined function, this would be impossible.


text:
Q: Sending OpenCV image (or bitmap) from Service to Activity (SurfaceView) I'm developing an Android application that installs a service that does some
continuously and costly processing (it leverages OpenCV to grab camera images
and does some processing on it). I want my activity to connect to and disconnect
from the service to do other things on the device and to view the processing
(mainly for debugging but I can see other use cases as well).
Problem is I'm not sure how to design this application - I'm also fairly new to Android programming.
Since its a performance critical application I guess I cannot pass bitmaps from
the service to the activity so I guess I want to couple the SurfaceView to the
service as soon as the activity gets to the foreground.
Something like below - note: its not a complete example, it just shows the flow
public class MainActivity extends Activity {
    private OpenCVCameraService mService;
    private SurfaceView mSurfaceView;
    @Override
    public void onCreate() {
        // show UI
        // start mService with mSurfaceView
    }
}

public class OpenCVCameraService extends Service {
    private Processing mProcessing;
    private SurfaceView mSurfaceView;
    @Override
    public void onCreate() {
        // setup OpenCV camera stuff
        // init mProcessing with mSurfaceView
    }
}

public class Processing extends Thread {
    private VideoCapture mCamera;
    private SurfaceView mSurfaceView;   // maybe just the SurfaceHolder
    Processing(VideoCapture camera, SurfaceView surfaceView) {
        mCamera = camera;
        mSurfaceView = surfaceView;
    }
    @Override
    public void run() {
        mCamera.grab();
        mCamera.retrieve(...);
        // process retrieved images
        // image to bitmap
        // What now, how to get bitmap to MainActivity? Passing using intent is a performace hit I guess
        // maybe something like if (mSurfaceView != null) { Canvas canvas = mSurfaceView.lockSurface(); ... }
    }
}

How would you design such application? Is there anything else I need to consider?

A: Ok, this is how I've done it: I've set the SurfaceView to either the correct view (if app is running) and to null if not (i.e. paused) in the onServiceConnected/onServiceDisconnected of MainActivity. In the service I check whether the view exists or not. It is not the nicest decoupling but it works and as far as I can tell right now the performance is Ok.


text:
Q: create multiple folder in jsp and some checking I need a little help here in this situation:

*

*I want to create a folder than i want to check is the folder for the current  date (folder name YYYYMMDD) is exist in the destination folder.

*If the date folder is not exist, create the folder.

*After the date folder is ready, perform handling on the  sub folder for window 1,2,3,4, and 5.

Need Help. Thank you


text:
Q: ListView in Django Assistance OK, so I have just done a rather extensive Django tutorial online and wanted to dive into my first project to see how I would go.
I started off alright and then hit a pretty big road block that I am trying to overcome with no luck, so if you guys could help I will be forever in your debt!
So the project itself is simply making a website for a few of my mates where we can login and view some stats on bets we have with each other.
What I have done so far:
I created two models in models.py with the following code:
   from django.db import models

    # Create your models here.

    class Team(models.Model):
        team_name = models.CharField(max_length=500, unique=True)
        wins = models.PositiveIntegerField()
        losses = models.PositiveIntegerField()

    class Predictions(models.Model):
        combined_teams = models.CharField(max_length=800)
        player_name = models.CharField(max_length=200, primary_key=True)
        predicted_wins = models.PositiveIntegerField()

        def __str__ (self):
            return self.player_name

I created a login screen, this is the first screen the user will come to (not relevant for the question)
I created a static folder with some css styling for a couple of the pages and made some minor changes to the settings files.
I then went on to setup my views.py file and a couple of urls.py files too, as follows:
###VIEWS.PY####

from django.shortcuts import render
from django.views.generic import TemplateView, ListView
from django.contrib.auth.mixins import LoginRequiredMixin
from .models import Predictions, Team

class WelcomeView(LoginRequiredMixin,TemplateView):
    template_name = 'merchbet/welcome.html'

class HomeView(LoginRequiredMixin, TemplateView):
    template_name = 'merchbet/home.html'

class PredictionListView(LoginRequiredMixin, ListView):
    model = Predictions

    def get_queryset(self):
        return Predictions.objects.order_by('-player_name')

class GalleryView(LoginRequiredMixin,TemplateView):
    template_name = 'merchbet/gallery.html'

URLS.PY
from django.contrib import admin
from django.urls import path,include
from django.contrib.auth.urls import views

urlpatterns = [
    path('', views.LoginView.as_view(), name='login'),
    path('account/profile/', include('merchbet.urls')),
    path('admin/', admin.site.urls),
]

URLS.PY### IN MY APP FOLDER
from django.urls import path
from . import views

app_name = 'merchbet'

urlpatterns = [
    path('', views.WelcomeView.as_view(), name='welcome'),
    path('home/', views.HomeView.as_view(), name='home'),
    path('predictions/', views.PredictionListView.as_view(), name='prediction_list'),
    path('gallery/', views.GalleryView.as_view(), name='gallery')

I then executed the following script, so that I could load up my friends "predictions" for our NBA bets this season with the following program:
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE','mysite.settings')

import django
django.setup()

from merchbet.models import Predictions, Team

predictions = ['Burger', 'Houston Rockets and Oklahoma City Thunder', 101,
    'Buzz','Houston Rockets and Boston Celtics', 115, 'Kimon', 'Sacramento Kings and Atlanta Hawks', 44,
    'Muller','Utah Jazz and Boston Celtics', 118, 'Barlow', 'Los Angeles Lakers and Milwaukee Bucks', 102,
    'Larter','Golden State Warriors and Atlanta Hawks', 83, 'Hume', 'Los Andeles Lakers and Philadelphia 76ers',
    104]

def add_predictions():

    for index, entry in enumerate(predictions):

        if index < len(predictions)-2:

            if (type(predictions[index+2]) == type(1)):

                player_name = predictions[index]
                combined_teams = predictions[index+1]
                predicted_wins = predictions[index+2]

                preds = Predictions.objects.get_or_create(player_name=player_name,combined_teams=combined_teams,predicted_wins=predicted_wins)[0]

if __name__ == '__main__':
    print("Populating the databases...Please Wait")
    add_predictions()
    print('Populating Complete')

The above worked fine and I can see in my Django Admin view of the site that there are 7 objects of the Predictions class all named after the "player_name" variable as it is the primary key:
So after all of this I am trying to simply use a for loop in an html document, that will help to print out the "player_name" and then I can show the "combined_teams" and "predicted_wins" but I just can not get it to work.
{% for prediction in prediction_list %}

{{ prediction.player_name }}

{% endfor %}

I have put a heap of effort into this post, so I am hoping some genius out there can lend a hand!
edit: I know the colour of the text is white, it is against a black background, so that isn't an issue :-)
Thanks!

A: You need to use object_list instead of prediction_list for merchbet/prediction_list.html, like this:
{% for prediction in object_list %}

{{ prediction.player_name }}

{% endfor %}

For more details, please check the documentation.


text:
Q: Jquery Data Table 1.9.0 not working with POST method I am using jquery datatable version 1.9.0 with Asp.net but when i change  'sServerMethod' as 'POST' rather than sending POST request its sending GET request and because of that Sensitive information is being visible. I am doing this because i don`t want to send Sensitive information using Get Request as it can be track. You can check below code and let me know where i am doing mistake.

        var csrfField = $("#__CSRFTOKEN").val();
        var oTable = $('.reportTable.rmaqueue').dataTable({
            'bSortable': true,
            "bDestroy": true,
            'iDisplayLength': 10,
            'iDisplayStart': 0,
            'bProcessing': true,
            'bServerSide': true,
            "bFilter": false,
            'sPaginationType': "full_numbers",
            "bStateSave": false,
            "bSort": true,
            'sServerMethod': 'POST',
            'fnServerParams': function (aoData) {
                aoData.push({ "name": "__CSRFTOKEN", "value": csrfField });
            },
            "aoColumns": [
                            null, null, null, null, null, null, null, null,
                            {
                                "bSearchable": false,
                                "bSortable": false,
                                "fnRender": function (oObj) {
                                    return "Edit";
                                }
                            },
                            {
                                "bVisible": false
                            }
            ],
            'sAjaxSource': urlHandler,
});

Can anyone help me why its not working with 1.9.0 version.


text:
Q: Are other classes accessing the webdriver instance correctly when extending testbase class? See Java NullPointerException Error I am getting this error when running the below selenium scripts using TestNG with Selenium Grid. I'm extending the testbase class to access the WebDriver, but I'm not sure if each class is getting the WebDriver instance correctly since I'm getting a NullPointerException? The tests scrolls to the first item to click and doesn't click it. I'm new to Java, please advise. I am wondering if I'm understanding inheritance and initiation of objects correctly.
Thanks for your help.
java.lang.NullPointerException

A: Use this code:
public class WatchTV {

    WebDriver driver;
    int waitseconds = 60;

    public WatchTV(WebDriver driver){
        this.driver = driver;
    }

    By watchtvlink = By.linkText("Watch TV »");

    public WebElement WatchTVLink()
    {
        WebDriverWait wait =  new WebDriverWait(driver, waitseconds);
        wait.until(ExpectedConditions.elementToBeClickable(watchtvlink));
        return driver.findElement(watchtvlink);
    }

}

The explanation is here: https://sqa.stackexchange.com/a/20199/17159 in your own question


text:
Q: Importing CSV database with null character as empty strings I have hundreds of csv files and each one have lots of null characters in it. It is like that because the some of the cells must be empty. But when I try to import this into MySQL workbench using import wizard i keep getting the same error: "Unhandled exception: line contains NULL byte".
What I would like to do was to:
a) be able to import these database without the error from above
b) converting all null cells as empty strings.
Since there are hundreds of csv files like this one, each around 300mb, replacing the characters before importing doesn't seems to be a quick viable option.
Is there a way to force MySQL Workbench to accept the files with the null character in it?
I have googled many answers, none of which seems to be applicable to this case.
Many thanks

A:
Since MySQL Workbench version 8.0.16 (released on 04/25/2019) there has been an additional option for uploading .csv file -- "null and NULL word as SQL keyword".
When selecting this option as NO, the NULL expression without quotes in .csv file (,NULL, rather than ,"NULL",) will auto-fill empty if your field default value is empty.
I hope this answer could solve other people's similar problem :)


text:
Q: Is it is possible through Email Rules to Move received Emails from Inbox into Folders I have 2000+ messages in inbox now i wish to move into folders using rules without drag and drop? So is there any way to move received mails which is already read from inbox to appropriate folders based on senders email address by using Email Rules in MS Outlook 2007 & Outlook web app(Outlook web mail).....?
If any other ways are exists please mention those or share appropriate link..Thanks in advance

A: you can use outlook rules to achieve it.
file-> Manage Rules and Alerts -> New Rule -> Move message from someone to folder
notice that you will have to check the checkbox:
 "run this rule now on messages allready in Inbox"
on the last screen.
it will apply this rule as you requested.
good luck
http://www.imageupload.co.uk/images/2014/09/29/outlook2.png

A: Outlook 2007 has inbuilt feature called as Rules and Alerts to enable you to just do that.
Create a rule from scratch
To create a rule by choosing your own conditions, actions, and exceptions, do the following:

*

*In the Navigation Pane, click Mail.

*On the Tools menu, click Rules and Alerts.

*Click New Rule.

*Under Start from a blank rule, select either Check messages when they arrive or Check messages after sending, and then click Next.

*Under Step 1: Select condition(s), select the conditions that you want the messages to meet for the rule to apply.
Under Step 2: Edit the rule description, click an underlined value if you have not done so already, and then click Next.
Under Step 1: Select action(s), select the action that you want the rule to take when the specified conditions are met.
Under Step 2: Edit the rule description, click an underlined value if you have not done so already, and then click Next.
Under Step 1: Select exception(s), select any exceptions to the rule, and then click Next.
6.To finish creating the rule, enter a name for the rule, and then select any other options that you want.

*If you want to run this rule on messages that already are in one of your folders, select the Run this rule now on messages already in "folder" check box.

*To apply this rule to all your e-mail accounts and the Inbox associated with each account, select the Create this rule on all accounts check box.

*Click Finish.


text:
Q: Insert Statement Returns ORA-01427 Error While Trying To Insert From Multiple Tables I have this table F_Flight which I am trying to insert into from 3 different tables. The first, fourth and fifth columns are from the same, and the second and third columns from different tables. When I execute the code, I get a "single-row subquery returns more than one row" error.
insert when 1 = 1 then into F_Flight (planeid, groupid, dateid, flightduration, kmsflown) values
(planeid, (select b.groupid from BridgeTable b where exists (select p.p1id from pilotkeylookup p where b.pilotid = p.p1id)),
(select dd.id from D_Date dd where exists (select p.launchtime from PilotKeyLookup p where dd."Date" = p.launchtime)),
flightduration, kmsflown) select * from PilotKeyLookup p;

A: Your subqueries get multiple rows back, which is what the error message says. There is no correlation between the various bits of data and subqueries you're trying to insert into a single row.
This can be done as a much simpler insert...select with joins, something like:
insert into f_flight (planeid, groupid, dateid, flightduration, kmsflown)
select pkl.planeid, bt.groupid, dd.id, pkl.flightduration, pkl.kmsflown
from pilotkeylookup pkl
join bridgetable bt on bt.pilotid = pkl.p1id
join d_date dd on dd."Date" = pkl.launchtime;

This joins the main PilotKeyLookup table to the other two on the keys you used in your subqueries.
Storing an ID value instead of an actual date is unusual, and if launchtime has a time component - which seems likely from the name - and your d_date entries are just dates (i.e. all with time at midnight) then you won't find matches; you might need to do:
join d_date dd on dd."Date" = trunc(pkl.launchtime);

It also seems like this could be a view, as you're storing duplicate data - everything in f_flight could, obviously, be found from the other tables.


text:
Q: junk chars in mapped drive url to access WebDAV store I came across a strange problem. I m using WebDAV to access files over the network and using windows explorer to map a drive to the webDav URL.
In some windows client systems when I try accessing the file store the WebDAV server is receiving junk character with the URL and the search / get fails to produce any output.
Have anyone faced a similar issue and is there any solution for it.
OS : Oracle Enterprise Linux
WebDAV is deployed as a web application on a weblogic 11g server.
Client: windows 7 SP1

A: It seems to be a multi locale keyboard issue.
UPDATE:
It is because of a McAfee endpoint encryption on the client machine. Was able to reproduce it after applying the encryption.


text:
Q: How to create and maintain infinite number of database connections in Nodejs Similar to tools like Retool, I'm looking to create a tool where developers can connect their own databases and query.
At the moment, to connect and query the respective database, I do the following:

*

*Establish a connection to the DB given the credentials save

*Query

*Destroy the connection

This is unfortunately slow and takes about 1.5-2s to finish.
Another alternative is to save the connection in memory and reuse it when needed.
Thoughts on how to solve this?


text:
Q: What is the purpose of idle and break characters in USART? I'm currently writing some code to implement USART on an STM32F4 microcontroller and was wondering how to effectively use the idle and break characters. Do they serve a special purpose or is their use application-specific?

A: The use of IDLE and BREAK is mostly related to synchronous communications (although you could use both concepts in asynchronous mode as well).
Because  there is a continuous bitstream flowing on the line in synchronous mode, there is no way to send nothing - To be able to do that, the IDLE pattern (normally all ones) is often used. It simply means there is no data on the line.
The BREAK pattern (normally all zeroes) is often used to signal an out-of-band notification in synchronous protocols - For example as a start-of-packet signature.
The exact use of IDLE and BREAK is up to the low-level line protocol.