问:
How to configure Jenkins to run Python scripts?
I started learning Jenkins using Python 3. Trying to run file.py in Jenkins with Docker.
Jenkins cannot find the exact directory despite the fact that I have specified the exact path to the file in the variable.

The method with variables did not help. I also failed using the Python plugin.
The only solution I see on the net is to create variables and select the Windows command in the build:

SET PATH = %your_path_name% python your_file_location\filename.py

It didn't help either.
Here is part of what the console outputs:

```<code>FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.\<init\>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)

Caused: java.io.IOException: Cannot run program "cmd" (in directory "/var/jenkins_home/workspace/wqw"): error=2, No such file or directory
</code>```

I know that you can pull the script from GitHub, but I want to understand why the problem appeared and how to solve it?

UPDATE: I chose the shell command 'PATH=$Path1' and the build was successful. However, this only points to the correct directory and does not check the code itself in the file?

```<code>Started by user USER
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/dede
[dede] $ /bin/sh -xe /tmp/jenkins4966087103275671986.sh
+ PATH=C:\Users\USER\PycharmProjects\pytest\test_demo.py
Finished: SUCCESS
</code>```

Body:
I started learning Jenkins using Python 3. Trying to run file.py in Jenkins with Docker.
Jenkins cannot find the exact directory despite the fact that I have specified the exact path to the file in the variable.

The method with variables did not help. I also failed using the Python plugin.
The only solution I see on the net is to create variables and select the Windows command in the build:

SET PATH = %your_path_name% python your_file_location\filename.py

It didn't help either.
Here is part of what the console outputs:

FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.\<init\>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)

Caused: java.io.IOException: Cannot run program "cmd" (in directory "/var/jenkins_home/workspace/wqw"): error=2, No such file or directory

I know that you can pull the script from GitHub, but I want to understand why the problem appeared and how to solve it?

UPDATE: I chose the shell command 'PATH=$Path1' and the build was successful. However, this only points to the correct directory and does not check the code itself in the file?

Started by user USER
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/dede
[dede] $ /bin/sh -xe /tmp/jenkins4966087103275671986.sh
+ PATH=C:\Users\USER\PycharmProjects\pytest\test_demo.py
Finished: SUCCESS


来源: stackexchange

问:
Clickable (tap) toggle for touch devices when hover/focus/active doesn't work?
I have a couple of 'fun' UI pieces I'm looking at which basically reveal more options when you hover over an icon. This works fine and as expected but obviously on mobile it doesn't behave as well.

Oddly the left most (with S/M/L/XL) does open on 'tap' but is difficult to close. Where as the icon based version doesn't open at all, even though it uses the same approach - maybe to do with the z-index changing?

Even if the icons are expanded on mobile it's difficult to close. So I wondered if using a Javascript toggle just for touch devices would be a best practice approach? Or is there a simpler solution I'm missing?

I tried the following Javascript but would that start interfering with other touch/hover and 'hybrid' devices with touch screens + hover events?

```<code>const actions = document.querySelector('.actions');

actions.addEventListener('click', e => {
  e.preventDefault();
  actions.classList.toggle('visble');
});
</code>```

The issue with the above is that it only targets 1 (1 first) instance of the element on the page. As there will be several of this component on a page. I'd need it to just  toggle the class on the one that's clicked. How could I extended this?

Then I guess I'd specify the current hover/focus/active styling in a media query. Then the same but on a class in another media query, like below?

```<code>@media (hover: hover) { add current hover/focus/active styles here }

@media (hover: none) { add class-based toggle styles }
</code>```

/* Product */

.product-grid {
  display: grid;
  grid-column-gap: 1px;
  grid-row-gap: 1px;
  grid-template-columns: 1fr 1fr 1fr;
  margin: 64px auto;
  max-width: 1000px;
}

.product-card {
  position: relative;
}

.product-card img {
  display: block;
  width: 100%;
  max-width: 100%;
}

/* Quick Buy */

.quick-buy {
  background: black;
  border-radius: 100%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 32px;
  z-index: 100;
}

.quick-buy__variant {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  display: block;
  font-size: 12px;
  opacity: 0;
  padding: 4px;
  position: absolute;
  text-align: center;
  transition: all .08s .08s ease-out;
  min-width: 12px;
  z-index: 1;
}

/* Hover */

.quick-buy__variant:hover {
  color: white;
}

.quick-buy__variant--top    {top: -12px;}
.quick-buy__variant--right  {right: -12px;}
.quick-buy__variant--bottom {bottom: -12px;}
.quick-buy__variant--left   {left: -12px;}

.quick-buy__icon {
  display: flex;
}

.quick-buy__icon svg {
  position: relative;
}

.quick-buy__icon:before {
  background: black;
  border-radius: 100%;
  content: "";
  display: block;
  height: 32px;
  position: absolute;
  inset: 0;
/*   top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); */
  transition: height .16s, inset .16s, width .16s;
  width: 32px;
}

.quick-buy:hover .quick-buy__icon:before {
  height: 112px;
  inset: -40px;
  width: 112px;
}

.quick-buy:hover .quick-buy__variant--top     {opacity: 1; top: -24px;}
.quick-buy:hover .quick-buy__variant--right   {opacity: 1; right: -24px;}
.quick-buy:hover .quick-buy__variant--bottom  {opacity: 1; bottom: -24px;}
.quick-buy:hover .quick-buy__variant--left    {opacity: 1; left: -24px;}

/* Options */

.options {
  height: 32px;
  position: absolute;
  bottom: 16px;
  right: 16px;
  transition: transform .12s;
  width: 32px;
}

.options__btn {
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
  border: none;
  border-radius: 100%;
  color: black;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  height: 32px;
  opacity: 0;
  position: absolute;
  text-align: center;
  transition: all .12s ease-out;
  width: 32px;
  z-index: -1;
}

.options__btn:hover {
  filter: invert(1);
  transition: filter .08s .08s;
}

.options__btn:nth-child(1) {top: -16px;}
.options__btn:nth-child(2) {left: -16px;}
.options__btn:nth-child(3) {bottom: -16px;}

.options__pivot {
  background: black;
  border-radius: 100%;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  text-align: center;
  transition: filter .08s, transform .16s;
  width: 32px;
}

.options__pivot:before {
  background: transparent;
  border-radius: 100%;
  content: "";
  display: block;
  height: 32px;
  position: absolute;
  height: 100%;
  width: 100%;
}

/* Hover */

.options:hover .options__btn {
  z-index: 1;
}

.options:hover .options__btn:nth-child(1) {opacity: 1; top: -32px;}
.options:hover .options__btn:nth-child(2) {opacity: 1; left: -32px;}
.options:hover .options__btn:nth-child(3) {opacity: 1; bottom: -32px;}

.options:hover .options__pivot {
  filter: invert(1);
  transform: scale(.64);
}

.options:hover .options__pivot svg {
  opacity: .48;
}

.options:hover .options__pivot:before {
  height: 144px;
  width: 144px;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="product-grid">

  <div class="product-card">
    <img src="https://images.pexels.com/photos/14845056/pexels-photo-14845056.jpeg" />
    <div class="quick-buy">
      <button class="quick-buy__variant quick-buy__variant--top">S</button>
      <button class="quick-buy__variant quick-buy__variant--right">M</button>
      <button class="quick-buy__variant quick-buy__variant--bottom">L</button>
      <button class="quick-buy__variant quick-buy__variant--left">XL</button>
      <span class="quick-buy__icon">
        <svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.96962 4C8.98964 3.8367 9 3.66976 9 3.5C9 1.567 7.65685 0 6 0C4.34315 0 3 1.567 3 3.5C3 3.66976 3.01036 3.8367 3.03038 4H4.03853C4.01338 3.841 4 3.67413 4 3.5C4 1.96911 5.0345 1 6 1C6.9655 1 8 1.96911 8 3.5C8 3.67413 7.98662 3.841 7.96147 4H8.96962Z" fill="white"/>
<rect x="0.5" y="4.5" width="11" height="9" stroke="white"/>
</svg>
      </span>
    </div>
  </div>

  <div class="product-card">
    <img src="https://images.pexels.com/photos/14845056/pexels-photo-14845056.jpeg" />
    <div class="options">
      <button class="options__btn">
        <svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.85659 1.8436C2.1256 1.57652 2.44674 1.36433 2.80118 1.21947C3.15562 1.07461 3.53624 1 3.92073 1C4.30521 1 4.68583 1.07461 5.04027 1.21947C5.39471 1.36433 5.71585 1.57652 5.98486 1.8436L6.99957 2.84348L8.01428 1.8436C8.28329 1.57652 8.60443 1.36433 8.95887 1.21947C9.31331 1.07461 9.69393 1 10.0784 1C10.4629 1 10.8435 1.07461 11.198 1.21947C11.5524 1.36433 11.8735 1.57652 12.1426 1.8436C12.6922 2.38875 13 3.12167 13 3.88503C13 4.64838 12.6922 5.3813 12.1426 5.92644L7.00043 11L1.85831 5.92644C1.30848 5.38152 1.00032 4.64872 1 3.88537C0.99968 3.12201 1.30722 2.38897 1.85659 1.8436V1.8436Z" stroke="black" stroke-miterlimit="10"/>
</svg>
      </button>
      <button class="options__btn">
        <svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.96962 4C8.98964 3.8367 9 3.66976 9 3.5C9 1.567 7.65685 0 6 0C4.34315 0 3 1.567 3 3.5C3 3.66976 3.01036 3.8367 3.03038 4H4.03853C4.01338 3.841 4 3.67413 4 3.5C4 1.96911 5.0345 1 6 1C6.9655 1 8 1.96911 8 3.5C8 3.67413 7.98662 3.841 7.96147 4H8.96962Z" fill="black"/>
<rect x="0.5" y="4.5" width="11" height="9" stroke="black"/>
</svg>
      </button>
      <button class="options__btn">3D</button>
      <span class="options__pivot">
        <svg width="2" height="10" viewBox="0 0 2 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="1" cy="9" r="1" transform="rotate(180 1 9)" fill="white"/>
<circle cx="1" cy="5" r="1" transform="rotate(180 1 5)" fill="white"/>
<circle cx="1" cy="1" r="1" transform="rotate(180 1 1)" fill="white"/>
</svg>
      </span>
    </div>
  </div>

  <div class="product-card">
    <img src="https://images.pexels.com/photos/14845056/pexels-photo-14845056.jpeg" />
    <div class="options">
      <button class="options__btn">
        <svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.85659 1.8436C2.1256 1.57652 2.44674 1.36433 2.80118 1.21947C3.15562 1.07461 3.53624 1 3.92073 1C4.30521 1 4.68583 1.07461 5.04027 1.21947C5.39471 1.36433 5.71585 1.57652 5.98486 1.8436L6.99957 2.84348L8.01428 1.8436C8.28329 1.57652 8.60443 1.36433 8.95887 1.21947C9.31331 1.07461 9.69393 1 10.0784 1C10.4629 1 10.8435 1.07461 11.198 1.21947C11.5524 1.36433 11.8735 1.57652 12.1426 1.8436C12.6922 2.38875 13 3.12167 13 3.88503C13 4.64838 12.6922 5.3813 12.1426 5.92644L7.00043 11L1.85831 5.92644C1.30848 5.38152 1.00032 4.64872 1 3.88537C0.99968 3.12201 1.30722 2.38897 1.85659 1.8436V1.8436Z" stroke="black" stroke-miterlimit="10"/>
</svg>
      </button>
      <button class="options__btn">
        <svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.96962 4C8.98964 3.8367 9 3.66976 9 3.5C9 1.567 7.65685 0 6 0C4.34315 0 3 1.567 3 3.5C3 3.66976 3.01036 3.8367 3.03038 4H4.03853C4.01338 3.841 4 3.67413 4 3.5C4 1.96911 5.0345 1 6 1C6.9655 1 8 1.96911 8 3.5C8 3.67413 7.98662 3.841 7.96147 4H8.96962Z" fill="black"/>
<rect x="0.5" y="4.5" width="11" height="9" stroke="black"/>
</svg>
      </button>
      <span class="options__pivot">
        <svg width="2" height="10" viewBox="0 0 2 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="1" cy="9" r="1" transform="rotate(180 1 9)" fill="white"/>
<circle cx="1" cy="5" r="1" transform="rotate(180 1 5)" fill="white"/>
<circle cx="1" cy="1" r="1" transform="rotate(180 1 1)" fill="white"/>
</svg>
      </span>
    </div>
  </div>

</div></code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a couple of 'fun' UI pieces I'm looking at which basically reveal more options when you hover over an icon. This works fine and as expected but obviously on mobile it doesn't behave as well.

Oddly the left most (with S/M/L/XL) does open on 'tap' but is difficult to close. Where as the icon based version doesn't open at all, even though it uses the same approach - maybe to do with the z-index changing?

Even if the icons are expanded on mobile it's difficult to close. So I wondered if using a Javascript toggle just for touch devices would be a best practice approach? Or is there a simpler solution I'm missing?

I tried the following Javascript but would that start interfering with other touch/hover and 'hybrid' devices with touch screens + hover events?

const actions = document.querySelector('.actions');

actions.addEventListener('click', e => {
  e.preventDefault();
  actions.classList.toggle('visble');
});

The issue with the above is that it only targets 1 (1 first) instance of the element on the page. As there will be several of this component on a page. I'd need it to just  toggle the class on the one that's clicked. How could I extended this?

Then I guess I'd specify the current hover/focus/active styling in a media query. Then the same but on a class in another media query, like below?

@media (hover: hover) { add current hover/focus/active styles here }

@media (hover: none) { add class-based toggle styles }

/* Product */

.product-grid {
  display: grid;
  grid-column-gap: 1px;
  grid-row-gap: 1px;
  grid-template-columns: 1fr 1fr 1fr;
  margin: 64px auto;
  max-width: 1000px;
}

.product-card {
  position: relative;
}

.product-card img {
  display: block;
  width: 100%;
  max-width: 100%;
}

/* Quick Buy */

.quick-buy {
  background: black;
  border-radius: 100%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 32px;
  z-index: 100;
}

.quick-buy__variant {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  display: block;
  font-size: 12px;
  opacity: 0;
  padding: 4px;
  position: absolute;
  text-align: center;
  transition: all .08s .08s ease-out;
  min-width: 12px;
  z-index: 1;
}

/* Hover */

.quick-buy__variant:hover {
  color: white;
}

.quick-buy__variant--top    {top: -12px;}
.quick-buy__variant--right  {right: -12px;}
.quick-buy__variant--bottom {bottom: -12px;}
.quick-buy__variant--left   {left: -12px;}

.quick-buy__icon {
  display: flex;
}

.quick-buy__icon svg {
  position: relative;
}

.quick-buy__icon:before {
  background: black;
  border-radius: 100%;
  content: "";
  display: block;
  height: 32px;
  position: absolute;
  inset: 0;
/*   top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); */
  transition: height .16s, inset .16s, width .16s;
  width: 32px;
}

.quick-buy:hover .quick-buy__icon:before {
  height: 112px;
  inset: -40px;
  width: 112px;
}

.quick-buy:hover .quick-buy__variant--top     {opacity: 1; top: -24px;}
.quick-buy:hover .quick-buy__variant--right   {opacity: 1; right: -24px;}
.quick-buy:hover .quick-buy__variant--bottom  {opacity: 1; bottom: -24px;}
.quick-buy:hover .quick-buy__variant--left    {opacity: 1; left: -24px;}

/* Options */

.options {
  height: 32px;
  position: absolute;
  bottom: 16px;
  right: 16px;
  transition: transform .12s;
  width: 32px;
}

.options__btn {
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
  border: none;
  border-radius: 100%;
  color: black;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  height: 32px;
  opacity: 0;
  position: absolute;
  text-align: center;
  transition: all .12s ease-out;
  width: 32px;
  z-index: -1;
}

.options__btn:hover {
  filter: invert(1);
  transition: filter .08s .08s;
}

.options__btn:nth-child(1) {top: -16px;}
.options__btn:nth-child(2) {left: -16px;}
.options__btn:nth-child(3) {bottom: -16px;}

.options__pivot {
  background: black;
  border-radius: 100%;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  text-align: center;
  transition: filter .08s, transform .16s;
  width: 32px;
}

.options__pivot:before {
  background: transparent;
  border-radius: 100%;
  content: "";
  display: block;
  height: 32px;
  position: absolute;
  height: 100%;
  width: 100%;
}

/* Hover */

.options:hover .options__btn {
  z-index: 1;
}

.options:hover .options__btn:nth-child(1) {opacity: 1; top: -32px;}
.options:hover .options__btn:nth-child(2) {opacity: 1; left: -32px;}
.options:hover .options__btn:nth-child(3) {opacity: 1; bottom: -32px;}

.options:hover .options__pivot {
  filter: invert(1);
  transform: scale(.64);
}

.options:hover .options__pivot svg {
  opacity: .48;
}

.options:hover .options__pivot:before {
  height: 144px;
  width: 144px;
}

      <button class="quick-buy__variant quick-buy__variant--top">S</button>
      <button class="quick-buy__variant quick-buy__variant--right">M</button>
      <button class="quick-buy__variant quick-buy__variant--bottom">L</button>
      <button class="quick-buy__variant quick-buy__variant--left">XL</button>

        <svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.96962 4C8.98964 3.8367 9 3.66976 9 3.5C9 1.567 7.65685 0 6 0C4.34315 0 3 1.567 3 3.5C3 3.66976 3.01036 3.8367 3.03038 4H4.03853C4.01338 3.841 4 3.67413 4 3.5C4 1.96911 5.0345 1 6 1C6.9655 1 8 1.96911 8 3.5C8 3.67413 7.98662 3.841 7.96147 4H8.96962Z" fill="white"/>
<rect x="0.5" y="4.5" width="11" height="9" stroke="white"/>
</svg>

      <button class="options__btn">
        <svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.85659 1.8436C2.1256 1.57652 2.44674 1.36433 2.80118 1.21947C3.15562 1.07461 3.53624 1 3.92073 1C4.30521 1 4.68583 1.07461 5.04027 1.21947C5.39471 1.36433 5.71585 1.57652 5.98486 1.8436L6.99957 2.84348L8.01428 1.8436C8.28329 1.57652 8.60443 1.36433 8.95887 1.21947C9.31331 1.07461 9.69393 1 10.0784 1C10.4629 1 10.8435 1.07461 11.198 1.21947C11.5524 1.36433 11.8735 1.57652 12.1426 1.8436C12.6922 2.38875 13 3.12167 13 3.88503C13 4.64838 12.6922 5.3813 12.1426 5.92644L7.00043 11L1.85831 5.92644C1.30848 5.38152 1.00032 4.64872 1 3.88537C0.99968 3.12201 1.30722 2.38897 1.85659 1.8436V1.8436Z" stroke="black" stroke-miterlimit="10"/>
</svg>
      </button>
      <button class="options__btn">
        <svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.96962 4C8.98964 3.8367 9 3.66976 9 3.5C9 1.567 7.65685 0 6 0C4.34315 0 3 1.567 3 3.5C3 3.66976 3.01036 3.8367 3.03038 4H4.03853C4.01338 3.841 4 3.67413 4 3.5C4 1.96911 5.0345 1 6 1C6.9655 1 8 1.96911 8 3.5C8 3.67413 7.98662 3.841 7.96147 4H8.96962Z" fill="black"/>
<rect x="0.5" y="4.5" width="11" height="9" stroke="black"/>
</svg>
      </button>
      <button class="options__btn">3D</button>

        <svg width="2" height="10" viewBox="0 0 2 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="1" cy="9" r="1" transform="rotate(180 1 9)" fill="white"/>
<circle cx="1" cy="5" r="1" transform="rotate(180 1 5)" fill="white"/>
<circle cx="1" cy="1" r="1" transform="rotate(180 1 1)" fill="white"/>
</svg>

      <button class="options__btn">
        <svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.85659 1.8436C2.1256 1.57652 2.44674 1.36433 2.80118 1.21947C3.15562 1.07461 3.53624 1 3.92073 1C4.30521 1 4.68583 1.07461 5.04027 1.21947C5.39471 1.36433 5.71585 1.57652 5.98486 1.8436L6.99957 2.84348L8.01428 1.8436C8.28329 1.57652 8.60443 1.36433 8.95887 1.21947C9.31331 1.07461 9.69393 1 10.0784 1C10.4629 1 10.8435 1.07461 11.198 1.21947C11.5524 1.36433 11.8735 1.57652 12.1426 1.8436C12.6922 2.38875 13 3.12167 13 3.88503C13 4.64838 12.6922 5.3813 12.1426 5.92644L7.00043 11L1.85831 5.92644C1.30848 5.38152 1.00032 4.64872 1 3.88537C0.99968 3.12201 1.30722 2.38897 1.85659 1.8436V1.8436Z" stroke="black" stroke-miterlimit="10"/>
</svg>
      </button>
      <button class="options__btn">
        <svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.96962 4C8.98964 3.8367 9 3.66976 9 3.5C9 1.567 7.65685 0 6 0C4.34315 0 3 1.567 3 3.5C3 3.66976 3.01036 3.8367 3.03038 4H4.03853C4.01338 3.841 4 3.67413 4 3.5C4 1.96911 5.0345 1 6 1C6.9655 1 8 1.96911 8 3.5C8 3.67413 7.98662 3.841 7.96147 4H8.96962Z" fill="black"/>
<rect x="0.5" y="4.5" width="11" height="9" stroke="black"/>
</svg>
      </button>

        <svg width="2" height="10" viewBox="0 0 2 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="1" cy="9" r="1" transform="rotate(180 1 9)" fill="white"/>
<circle cx="1" cy="5" r="1" transform="rotate(180 1 5)" fill="white"/>
<circle cx="1" cy="1" r="1" transform="rotate(180 1 1)" fill="white"/>
</svg>


问:
Using linear regression model, fear of crime as a function of "state" and "trait anxiety" or both state & trait anxiety?
```<code>Library(readr)
crime_replication <- read_csv("crime_replciation.csv")
head(crime_replication)
</code>```

need suggestion which formula should be used to find the solution....

I tried the code(still not confirmed), and i am looking for the formula?

Body:
Library(readr)
crime_replication <- read_csv("crime_replciation.csv")
head(crime_replication)

need suggestion which formula should be used to find the solution....

I tried the code(still not confirmed), and i am looking for the formula?


问:
How to place output from the Notepad++ Run command to the current file's cursor position?
I have a simple one line run script in Notepad++ that sends the output of a Powershell script to the clipboard.  I'm trying to send the output directly to the current cursor position in the current file.  Yes, just to save a keyboard stroke...  I'm using the "Run > Run..." menu option.

Note: The version of Notepad++ I'm using is 7.5.1 (64bit)

```<code>    powershell.exe $("Set-Clipboard '------------------------------------------------------' ; Get-Date -Format 'yyyy-MM-dd hh:mm tt' | Set-Clipboard -Append")
</code>```

Body:
I have a simple one line run script in Notepad++ that sends the output of a Powershell script to the clipboard.  I'm trying to send the output directly to the current cursor position in the current file.  Yes, just to save a keyboard stroke...  I'm using the "Run > Run..." menu option.

Note: The version of Notepad++ I'm using is 7.5.1 (64bit)

    powershell.exe $("Set-Clipboard '------------------------------------------------------' ; Get-Date -Format 'yyyy-MM-dd hh:mm tt' | Set-Clipboard -Append")


问:
Run packages in isolate - Flutter
I'm trying to run some image processing and MLmodel prediction inside isolate for all images in the gallery device. But some packages like FaceDetector(from google_ml_kit), and PhotoGallery, don't let me run inside isolate. The question is, exist any possibility to run everything inside an isolate, like an entire package with these imports?

Without using isolate all the code is working and is kind of fast but the screen freezes when I start to load and process the images.
I also could process one by one image whitout freezing, but takes too much time.

So I m trying to run with isolate for example when a run this code:

```<code>void process(String path){
  final options = FaceDetectorOptions(
        performanceMode: FaceDetectorMode.accurate,
        minFaceSize: .4,
      );
      final faceDetector = FaceDetector(options: options);

      var file = File(path);
      var image = InputImage.fromFile(file);
      var bytes = file.readAsBytesSync();
      var faces = (await faceDetector.processImage(image))
          .map(
            (e) => FaceRect(
              e.boundingBox.left,
              e.boundingBox.top,
              e.boundingBox.width,
              e.boundingBox.height,
            ),
          )
          .toList();
      var faceImage = FacesImage(path, faces, bytes);
}

compute(process, "/storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20221022-WA0006.jpeg");

</code>```

I get this:

```<code>[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Binding has not yet been initialized.
E/flutter (32478): The "instance" getter on the ServicesBinding binding mixin is only available once that binding has been initialized.
E/flutter (32478): Typically, this is done by calling "WidgetsFlutterBinding.ensureInitialized()" or "runApp()" (the latter calls the former). Typically this call is done in the "void main()" method. The "ensureInitialized" method is idempotent; calling it multiple times is not harmful. After calling that method, the "instance" getter will return the binding
</code>```

But I can't call WidgetsFlutterBinding.ensureInitialized() in isolate and my app already have.

There is any alternative to find all photos and albuns that can be called in isolate? and faceDetector?
Run an entire package in isolate is a possibility?

Title: Run packages in isolate - Flutter

Body:
I'm trying to run some image processing and MLmodel prediction inside isolate for all images in the gallery device. But some packages like FaceDetector(from google_ml_kit), and PhotoGallery, don't let me run inside isolate. The question is, exist any possibility to run everything inside an isolate, like an entire package with these imports?

Without using isolate all the code is working and is kind of fast but the screen freezes when I start to load and process the images.
I also could process one by one image whitout freezing, but takes too much time.

So I m trying to run with isolate for example when a run this code:

void process(String path){
  final options = FaceDetectorOptions(
        performanceMode: FaceDetectorMode.accurate,
        minFaceSize: .4,
      );
      final faceDetector = FaceDetector(options: options);

      var file = File(path);
      var image = InputImage.fromFile(file);
      var bytes = file.readAsBytesSync();
      var faces = (await faceDetector.processImage(image))
          .map(
            (e) => FaceRect(
              e.boundingBox.left,
              e.boundingBox.top,
              e.boundingBox.width,
              e.boundingBox.height,
            ),
          )
          .toList();
      var faceImage = FacesImage(path, faces, bytes);
}

compute(process, "/storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20221022-WA0006.jpeg");

I get this:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Binding has not yet been initialized.
E/flutter (32478): The "instance" getter on the ServicesBinding binding mixin is only available once that binding has been initialized.
E/flutter (32478): Typically, this is done by calling "WidgetsFlutterBinding.ensureInitialized()" or "runApp()" (the latter calls the former). Typically this call is done in the "void main()" method. The "ensureInitialized" method is idempotent; calling it multiple times is not harmful. After calling that method, the "instance" getter will return the binding

But I can't call WidgetsFlutterBinding.ensureInitialized() in isolate and my app already have.

There is any alternative to find all photos and albuns that can be called in isolate? and faceDetector?
Run an entire package in isolate is a possibility?


问:
Xamarin - Bulk change ContentPage to an inherited Content Page?
I have a medium sized project with around 50-100 ContentPages.

I've created an CustomContentPage class which inherits from ContentPage and I want to change all my content pages to CustomContentPage.

I can do a simple find and replace of ": ContentPage" to ": CustomContentPage", but having trouble with the XAML side, especially on the opening tags "<ContentPage"

Any tips on how to do this?


问:
jQuery appended elements not showing without page refresh
I do not have much experience with jQuery. I am trying to get appended buttons to appear on a page. The user types something into the search bar, it gets added to an array in local storage which will then generate buttons. However, it does not work and I am not sure why. When I refresh the page they show up. They do not appear in the html either until the page is refreshed.

I have tried moving the code I tried using location.reload() but this does not work. I do not know where to start. I have included the relevant part of the code I think.

```<code>btnIcon.addEventListener("click", function (e) {
    e.preventDefault();

    var searchInput = document.querySelector("#search-input").value;
    console.log(searchInput)

    if (!cities.includes(searchInput)) {
        cities.push(searchInput)
        localStorage.setItem("cities", JSON.stringify(cities))

    }

    queryURL = "https://api.openweathermap.org/data/2.5/weather?q=" + searchInput + apiKey;
    getWeather(queryURL);
})

for (var i = 0; i < cities.length; i++) {

    var button = $("<button>").text(cities[i]).attr("id", cities[i]).on("click", function () {
        console.log(this)
        queryURL = "https://api.openweathermap.org/data/2.5/weather?q=" + $(this).attr("id") + apiKey;

        getWeather(queryURL);

    })

    $("#history").prepend(button)

}
</code>```

Body:
I do not have much experience with jQuery. I am trying to get appended buttons to appear on a page. The user types something into the search bar, it gets added to an array in local storage which will then generate buttons. However, it does not work and I am not sure why. When I refresh the page they show up. They do not appear in the html either until the page is refreshed.

I have tried moving the code I tried using location.reload() but this does not work. I do not know where to start. I have included the relevant part of the code I think.

btnIcon.addEventListener("click", function (e) {
    e.preventDefault();

    var searchInput = document.querySelector("#search-input").value;
    console.log(searchInput)

    if (!cities.includes(searchInput)) {
        cities.push(searchInput)
        localStorage.setItem("cities", JSON.stringify(cities))

    }

    queryURL = "https://api.openweathermap.org/data/2.5/weather?q=" + searchInput + apiKey;
    getWeather(queryURL);
})

for (var i = 0; i < cities.length; i++) {

    var button = $("<button>").text(cities[i]).attr("id", cities[i]).on("click", function () {
        console.log(this)
        queryURL = "https://api.openweathermap.org/data/2.5/weather?q=" + $(this).attr("id") + apiKey;

        getWeather(queryURL);

    })

    $("#history").prepend(button)

}


问:
render function is returning empty div in tests after upgrading my react project from v16 to v18

UPDATE

After reviewing more of my tests I have found this behavior to be inconsistent. I have very similar tests and some render and perform as expected after the update, but others return the empty div. Does anyone have any insight on what the issue may be?

Recently at work I updated our ui from using React v16 to v18. I also updated the dev dependencies as recommended. Some of my tests are working just fine, specifically ones that test routes and functionality after the element is rendered based on a route. Imports are the same in both test scenarios.

```<code>// Sample Component
import React, {useState} from "react";
import Modal from "react-bootstrap/Modal";
import Button from "react-bootstrap/Button";

export default function MyModal({
show,
message
}) {
if (!show) {
  return null;
}
const [visible, setVisible] = useState(true);

return (
 <Modal
  show={visible}
  data-testid={"myComponent-modal"}
 >
  <Modal.Body>
    {message}
  </Modal.Body>
  <Modal.Footer>
    <Button>Ok</Button>
  </Modal.Footer>
 </Modal
);
}
</code>```

Testing some route that eventually will show MyModal component after some simulated actions.

```<code>// Test details
const {getByRole} = render(
  <MemoryRouter initialEntries={["/somePath"]}>
   <UserContext.Provider value={value}>
    <Routes>
     <Route
       path="/somePath"
       element={<MyComponent {...props} />}
     />
    </Routes>
   </UserContext.Provider>
  </MemoryRouter>
);

// fill in some form detail, then click submit button, then myModal appears

// Result is everything renders as I expect and test passes.
</code>```

Other tests, specifically ones where I am just trying to render a component, are just returning an empty div to me from the render function.

```<code>// Test Details
// This is an MRE not my actual test as I can't that code
import "@testing-library/jest-dom"
import React from "react";
import MyModal from "../../components/MyModal";
import { render, screen } from "@testing-library/react";

const {queryByText} = render(
  <MyModal show={true} message={"Test Message"} />
);
screen.debug();
const modalMessage = queryByText("Test Message");
expect(modalMessage).toBeInTheDocument();

// Result: assertion fails
// screen.debug() returns <body><div /></body>
</code>```
```<code>Dev Dependencies
@testing-library/dom: "^8.5.0"
@testing-library/jest-dom: "^5.11.10"
@testing-library/react: "^13.4.0"
@testing-library/react-hooks: "^7.0.2"
@testing-library/user-event: "^13.5.0"
react-test-renderer: "^18.2.0"
react-testing-library: "^7.0.1"
jest: "^26.6.3"
jest-cli: "^26.6.3"
jest-junit: "^6.2.1"
jest-mock-axios: "^4.2.1"
jsdom: "11.9.0"
</code>```

We have several other dev dependencies, but none that I believe would be affecting these tests.

I have tried changing dev dependency versions, as not all have been updated to latest, but that didn't seem to work. I have downgraded them all back, but that seems to run the tests in react v17 not 18 which isn't desired.
I've tried debugging, but am struggling there. When it reaches the line to render the component it seems to jump up to the test signature and not into my component where I have break points then eventually back down to the test, but at that point it's already an empty div element.
I've tried looking through blogs other posts, but am either not finding any solution or have found other posts with my same issue where no answers have been provided.
I've also tried waiting after the render, but that didn't seem to help.
I tried wrapping the component within a MemoryRouter.
It just seems as though render is not even trying to render my component.

Any assistance would be greatly appreciated. As frustrating as this has been to resolve I am still loving the developer life. Happy coding to everyone!!!

Body:
UPDATE

After reviewing more of my tests I have found this behavior to be inconsistent. I have very similar tests and some render and perform as expected after the update, but others return the empty div. Does anyone have any insight on what the issue may be?

Recently at work I updated our ui from using React v16 to v18. I also updated the dev dependencies as recommended. Some of my tests are working just fine, specifically ones that test routes and functionality after the element is rendered based on a route. Imports are the same in both test scenarios.

// Sample Component
import React, {useState} from "react";
import Modal from "react-bootstrap/Modal";
import Button from "react-bootstrap/Button";

export default function MyModal({
show,
message
}) {
if (!show) {
  return null;
}
const [visible, setVisible] = useState(true);

return (
 <Modal
  show={visible}
  data-testid={"myComponent-modal"}
 >
  <Modal.Body>
    {message}
  </Modal.Body>
  <Modal.Footer>
    <Button>Ok</Button>
  </Modal.Footer>
 </Modal
);
}

Testing some route that eventually will show MyModal component after some simulated actions.

// Test details
const {getByRole} = render(
  <MemoryRouter initialEntries={["/somePath"]}>
   <UserContext.Provider value={value}>
    <Routes>
     <Route
       path="/somePath"
       element={<MyComponent {...props} />}
     />
    </Routes>
   </UserContext.Provider>
  </MemoryRouter>
);

// fill in some form detail, then click submit button, then myModal appears

// Result is everything renders as I expect and test passes.

Other tests, specifically ones where I am just trying to render a component, are just returning an empty div to me from the render function.

// Test Details
// This is an MRE not my actual test as I can't that code
import "@testing-library/jest-dom"
import React from "react";
import MyModal from "../../components/MyModal";
import { render, screen } from "@testing-library/react";

const {queryByText} = render(
  <MyModal show={true} message={"Test Message"} />
);
screen.debug();
const modalMessage = queryByText("Test Message");
expect(modalMessage).toBeInTheDocument();

// Result: assertion fails
// screen.debug() returns

Dev Dependencies
@testing-library/dom: "^8.5.0"
@testing-library/jest-dom: "^5.11.10"
@testing-library/react: "^13.4.0"
@testing-library/react-hooks: "^7.0.2"
@testing-library/user-event: "^13.5.0"
react-test-renderer: "^18.2.0"
react-testing-library: "^7.0.1"
jest: "^26.6.3"
jest-cli: "^26.6.3"
jest-junit: "^6.2.1"
jest-mock-axios: "^4.2.1"
jsdom: "11.9.0"

We have several other dev dependencies, but none that I believe would be affecting these tests.

I have tried changing dev dependency versions, as not all have been updated to latest, but that didn't seem to work. I have downgraded them all back, but that seems to run the tests in react v17 not 18 which isn't desired.
I've tried debugging, but am struggling there. When it reaches the line to render the component it seems to jump up to the test signature and not into my component where I have break points then eventually back down to the test, but at that point it's already an empty div element.
I've tried looking through blogs other posts, but am either not finding any solution or have found other posts with my same issue where no answers have been provided.
I've also tried waiting after the render, but that didn't seem to help.
I tried wrapping the component within a MemoryRouter.
It just seems as though render is not even trying to render my component.

Any assistance would be greatly appreciated. As frustrating as this has been to resolve I am still loving the developer life. Happy coding to everyone!!!


问:
How to serve airtable images from server and not airtable with Gridsome?
As airtable announced new changes, any attachment URLs obtained via the Airtable Web API and the CSV export functionality will expire after a few hours.

My question is how to serve images locally with Gridsome on build? In other words I would like to download them on build and place them in images folder and not serve them from Airtable.

For my project I am using Netlify, Gridsome and source-airtable


问:
What is the relation between Apache web server and an Express (Node.js) server created for the backend of a website?
If I understand it correctly, a web server (such as Apache) is software that is installed on a server (hardware) where files making up a website are stored, and handles requests to the server. When I purchase a hosting service from a hosting company, the web server software is normally already installed on the server (hardware) space on which I am renting, so I do not need to set up the web server software myself.

But when I upload to the server (hardware) the files of a website that has a backend written using Node.js (Express) for example, it also contains a file server.js with instructions how to handle GET, POST requests, etc. My question is, what is the difference in the purpose of the web server software (e.g. Apache) and the Express server I create for the backend of my website?

To better understand the logic, I am seeking answers to the following subquestions:

Could the Express server be used on its own on the server hardware to handle all requests , replacing the web server like Apache altogether when the website is live on the Internet?

In general, can a customer to make changes to the configuration of the web server software that comes with the server hardware provided by the host?

Is it common to rent only server hardware and install/configure web server software there on one's own?

Express server (example):

```<code>const express = require('express');
const cors = require('cors');
const mongoose = require('mongoose');
mongoose.set('strictQuery', false);

require('dotenv').config();

const app = express();
const port = process.env.PORT || 5000;

app.use(cors());
app.use(express.json());

const uri = process.env.ATLAS_URI;
mongoose.connect(uri, { useNewUrlParser: true});
const connection = mongoose.connection;

connection.once('open', () => {
    console.log('MongoDB database connection established successfully')
})

const exercisesRouter = require('./routes/exercises');
const usersRouter = require('./routes/users');

app.use('/exercises', exercisesRouter);
app.use('/users', usersRouter);

app.listen(port, () => {
    console.log(`Server is running on port ${port}`)
});
</code>```

Routes (example):

```<code>const router = require('express').Router();
let Exercise = require('../models/exercise.model');

router.route('/').get((req, res) => {
    Exercise.find()
        .then(exercises => res.json(exercises))
        .catch(err => res.status(400).json('Error ' + err));
});

router.route('/add').post((req, res) => {
    const username = req.body.username;
    const description = req.body.description;
    const duration = Number(req.body.duration);
    const date = Date.parse(req.body.date);

    const newExercise = new Exercise({username, description, duration, date});

    newExercise.save()
        .then(() => res.json('Exercise added!'))
        .catch(err => res.status(400).json('Error ' + err))
});
</code>```

File structure

Body:
If I understand it correctly, a web server (such as Apache) is software that is installed on a server (hardware) where files making up a website are stored, and handles requests to the server. When I purchase a hosting service from a hosting company, the web server software is normally already installed on the server (hardware) space on which I am renting, so I do not need to set up the web server software myself.

But when I upload to the server (hardware) the files of a website that has a backend written using Node.js (Express) for example, it also contains a file server.js with instructions how to handle GET, POST requests, etc. My question is, what is the difference in the purpose of the web server software (e.g. Apache) and the Express server I create for the backend of my website?

To better understand the logic, I am seeking answers to the following subquestions:

Could the Express server be used on its own on the server hardware to handle all requests , replacing the web server like Apache altogether when the website is live on the Internet?

In general, can a customer to make changes to the configuration of the web server software that comes with the server hardware provided by the host?

Is it common to rent only server hardware and install/configure web server software there on one's own?

Express server (example):

const express = require('express');
const cors = require('cors');
const mongoose = require('mongoose');
mongoose.set('strictQuery', false);

require('dotenv').config();

const app = express();
const port = process.env.PORT || 5000;

app.use(cors());
app.use(express.json());

const uri = process.env.ATLAS_URI;
mongoose.connect(uri, { useNewUrlParser: true});
const connection = mongoose.connection;

connection.once('open', () => {
    console.log('MongoDB database connection established successfully')
})

const exercisesRouter = require('./routes/exercises');
const usersRouter = require('./routes/users');

app.use('/exercises', exercisesRouter);
app.use('/users', usersRouter);

app.listen(port, () => {
    console.log(`Server is running on port ${port}`)
});

Routes (example):

const router = require('express').Router();
let Exercise = require('../models/exercise.model');

router.route('/').get((req, res) => {
    Exercise.find()
        .then(exercises => res.json(exercises))
        .catch(err => res.status(400).json('Error ' + err));
});

router.route('/add').post((req, res) => {
    const username = req.body.username;
    const description = req.body.description;
    const duration = Number(req.body.duration);
    const date = Date.parse(req.body.date);

    const newExercise = new Exercise({username, description, duration, date});

    newExercise.save()
        .then(() => res.json('Exercise added!'))
        .catch(err => res.status(400).json('Error ' + err))
});

File structure


问:
Getting schema information from JDBC in batch
Is there a way of retrieving the schema of a database via JDBC in a batch, without having to make to make a .getTableNames call followed by a series of .getColumnNames / .getColumnTypes calls? I would like to be able to issue a single call (that resulted in a single or small number of queries to the database) that returned all the tables in a schema, along with their columns and column type info. For large schemas, the separate method calls can take a long time.

Of course, it can be done with a database-system-specific query against the database's information schema, but I'm looking for a way that is generic to JDBC.


问:
Introduce left/right swipe gestures to a Javascript class toggle?
I have a modal that has two panels. One is off canvas until it is triggered/toggled by clicking a link.

I've included an example showing this working but I was wondering is there away I can also toggle the classes using left/right swipes on touch devices? I tried a CSS approach using scroll-snap which wasn't as smooth as the current transitions I have + obviously it didn't update the class on the container.

In the example, if you click the "Trigger Cart" link the modal will slide into view and then you can use the vertical/red bar (Pair With...) to toggle between the two states ...how/can I introduce a swipe into that?

const html = document.querySelector('html');
 const btnOpen = document.querySelector('.trigger-cart');
 const allCloseButtons = document.querySelectorAll('.cart-head__close');

 btnOpen.addEventListener('click', e => {
   e.preventDefault();
   html.classList.add('cart-visible');
 });

 allCloseButtons.forEach(el => {
  el.addEventListener('click', e => {
    e.preventDefault();
    html.classList.remove('cart-visible');

    setTimeout(function() {
        cart.classList.remove('cart-toggled');
    }, (320)); // Match with time it takes to close menu.
  });
});

 /* Toggle Class on Cart */

const cart = document.querySelector('.cart');
const toggle = document.querySelector('.cart__toggle');

const handleToggleClick = e => {
  e.preventDefault();
  cart.classList.toggle('cart-toggled');
};

const handleResize = () => {
  if (window.matchMedia(`(min-width: 64em)`).matches) {
    cart.classList.remove('cart-toggled');
  }
};

toggle.addEventListener('click', handleToggleClick);
window.addEventListener('resize', handleResize);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>html,
body {
  min-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

.page {
  min-height: 100%;
}

.cart {
  background: white;
  display: flex;
  flex-direction: row;
  height: 100%;
  overflow: hidden;
  position: fixed;
  top: 0;
  right: -375px;
  transition: right .24s ease-out;
  width: 375px;
}

.cart-visible .cart {
  right: 0;
  animation: example 1.28s ease;
}

.cart-head {
  background: rgba(255, 0, 0, .24);
}

.cart-items {
  background: rgba(255, 0, 0, .24);
  flex: 1 1 auto;
  overflow: auto;
}

.cart-foot {
  background: rgba(255, 0, 0, .24);
  margin-top: auto;
  margin-bottom: 40px;
  width: 100%;
}

.cart__main,
.cart__toggle,
.cart__upsell {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.cart__main,
.cart__upsell {
  width: calc(100% - 48px);
}

.cart__main {
  margin: 0;
  transition: margin .24s ease-out;
}

.cart.cart-toggled .cart__main {
  margin-left: calc(-100% + 48px);
}

.cart.cart-toggled .cart__pag {
  margin-left: 48px;
}

.cart.cart-toggled .cart__pag-item:first-child {
  background: none;
}

.cart.cart-toggled .cart__pag-item:last-child {
  background: black;
}

.cart__toggle {
  background: red;
  height: 100%;
  padding: 16px 0;
  width: 48px;
}

.cart__toggle-label {
  transform: rotate(90deg);
  white-space: nowrap;
}

.cart__pag {
  display: flex;
  justify-content: center;
  position: absolute;
  bottom: 16px;
  left: 0;
  transition: margin .24s ease-out;
  width: calc(100% - 64px);
}

.cart__pag-item {
  border: 1px solid black;
  box-sizing: border-box;
  border-radius: 100%;
  height: 8px;
  margin: 0 2px;
  width: 8px;
}

.cart__pag-item:first-child {
  background: black;
}

@keyframes example {
  0%        {right: -375px;}
  40%       {right: 96px;}
  100%      {right: 0;}
}</code>```

  Trigger Cart

Header

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Footer

Pair with..

Pair With...

      x

```

Body:
I have a modal that has two panels. One is off canvas until it is triggered/toggled by clicking a link.

I've included an example showing this working but I was wondering is there away I can also toggle the classes using left/right swipes on touch devices? I tried a CSS approach using scroll-snap which wasn't as smooth as the current transitions I have + obviously it didn't update the class on the container.

In the example, if you click the "Trigger Cart" link the modal will slide into view and then you can use the vertical/red bar (Pair With...) to toggle between the two states ...how/can I introduce a swipe into that?

const html = document.querySelector('html');
 const btnOpen = document.querySelector('.trigger-cart');
 const allCloseButtons = document.querySelectorAll('.cart-head__close');

 btnOpen.addEventListener('click', e => {
   e.preventDefault();
   html.classList.add('cart-visible');
 });

 allCloseButtons.forEach(el => {
  el.addEventListener('click', e => {
    e.preventDefault();
    html.classList.remove('cart-visible');

    setTimeout(function() {
        cart.classList.remove('cart-toggled');
    }, (320)); // Match with time it takes to close menu.
  });
});

 /* Toggle Class on Cart */

const cart = document.querySelector('.cart');
const toggle = document.querySelector('.cart__toggle');

const handleToggleClick = e => {
  e.preventDefault();
  cart.classList.toggle('cart-toggled');
};

const handleResize = () => {
  if (window.matchMedia(`(min-width: 64em)`).matches) {
    cart.classList.remove('cart-toggled');
  }
};

toggle.addEventListener('click', handleToggleClick);
window.addEventListener('resize', handleResize);

html,
body {
  min-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

.page {
  min-height: 100%;
}

.cart {
  background: white;
  display: flex;
  flex-direction: row;
  height: 100%;
  overflow: hidden;
  position: fixed;
  top: 0;
  right: -375px;
  transition: right .24s ease-out;
  width: 375px;
}

.cart-visible .cart {
  right: 0;
  animation: example 1.28s ease;
}

.cart-head {
  background: rgba(255, 0, 0, .24);
}

.cart-items {
  background: rgba(255, 0, 0, .24);
  flex: 1 1 auto;
  overflow: auto;
}

.cart-foot {
  background: rgba(255, 0, 0, .24);
  margin-top: auto;
  margin-bottom: 40px;
  width: 100%;
}

.cart__main,
.cart__toggle,
.cart__upsell {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.cart__main,
.cart__upsell {
  width: calc(100% - 48px);
}

.cart__main {
  margin: 0;
  transition: margin .24s ease-out;
}

.cart.cart-toggled .cart__main {
  margin-left: calc(-100% + 48px);
}

.cart.cart-toggled .cart__pag {
  margin-left: 48px;
}

.cart.cart-toggled .cart__pag-item:first-child {
  background: none;
}

.cart.cart-toggled .cart__pag-item:last-child {
  background: black;
}

.cart__toggle {
  background: red;
  height: 100%;
  padding: 16px 0;
  width: 48px;
}

.cart__toggle-label {
  transform: rotate(90deg);
  white-space: nowrap;
}

.cart__pag {
  display: flex;
  justify-content: center;
  position: absolute;
  bottom: 16px;
  left: 0;
  transition: margin .24s ease-out;
  width: calc(100% - 64px);
}

.cart__pag-item {
  border: 1px solid black;
  box-sizing: border-box;
  border-radius: 100%;
  height: 8px;
  margin: 0 2px;
  width: 8px;
}

.cart__pag-item:first-child {
  background: black;
}

@keyframes example {
  0%        {right: -375px;}
  40%       {right: 96px;}
  100%      {right: 0;}
}

  Trigger Cart

Header

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Footer

Pair with..

Pair With...

      x


问:
Is there any python specific solution for conversion of an excel file to its respective pdf?
I have been trying to convert an excel file to its pdf form.
But the django server is getting hanged.

I read about this issue with flask server also
https://forum.aspose.com/t/python-flask-web-server-hang-at-aspose-cells/232218/6

As of now have used aspose-cells python library which has dependency upon Java.
It works fine inside console but not with Django web server (as the server is getting hanged indefinitely)

```<code>import asposecells
import jpype
jpype.startJVM()
from asposecells.api import Workbook

workbook = Workbook("input.xlsx")
workbook.save("output.pdf")
jpype.shutdownJVM()

</code>```

I am trying it out on mac M2.

Body:
I have been trying to convert an excel file to its pdf form.
But the django server is getting hanged.

I read about this issue with flask server also
https://forum.aspose.com/t/python-flask-web-server-hang-at-aspose-cells/232218/6

As of now have used aspose-cells python library which has dependency upon Java.
It works fine inside console but not with Django web server (as the server is getting hanged indefinitely)

import asposecells
import jpype
jpype.startJVM()
from asposecells.api import Workbook

workbook = Workbook("input.xlsx")
workbook.save("output.pdf")
jpype.shutdownJVM()

I am trying it out on mac M2.


问:
Angular Material Theme not wroking after update from 14 to 15
Can anyone help me to understand what happened with my theme when I am update Angular & Angular Material from 14 to 15. The way I am using to create theme in Angular Material 14 I use the same way to create theme in Angular Material 15 with some changes and it get errors.

When I write hex or rgb color code instead of css var it works fine.

_variables.scss

```<code>:root {

  //Primary Color
  --primary-color:  39 84 186;
  --primary-lighter-color: 190 204 234;
  --primary-darker-color: 23 58 163;

  //Accent Color
  --accent-color: 255 200 69;
  --accent-lighter-color: 255 239 199;
  --accent-darker-color: 255 180 46;

  //Warn Color
  --warn-color: 248 90 64;
  --warn-lighter-color: 253 206 198;
  --warn-darker-color: 245 63 42;
}
</code>```

styles.scss

```<code>@use '@angular/material' as mat;
@import './styles/variables';

@include mat.core();

$my-primary: mat.define-palette((
  100: rgb(var(--primary-color)),
  500: rgb(var(--primary-color)),
  700: rgb(var(--primary-color)),
  contrast: (
    100: #fff,
    500: #fff,
    700: #000,
  )
));
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);

$my-theme: mat.define-light-theme((
 color: (
   primary: $my-primary,
   accent: $my-accent,
 ),
 typography: mat.define-typography-config(),
 density: 0,
));

@include mat.all-component-themes($my-theme)
</code>```

the errors what I get

CSS Variables set properly but when I get it to create a color palette it shows this is not a color.

Body:
Can anyone help me to understand what happened with my theme when I am update Angular & Angular Material from 14 to 15. The way I am using to create theme in Angular Material 14 I use the same way to create theme in Angular Material 15 with some changes and it get errors.

When I write hex or rgb color code instead of css var it works fine.

_variables.scss

:root {

  //Primary Color
  --primary-color:  39 84 186;
  --primary-lighter-color: 190 204 234;
  --primary-darker-color: 23 58 163;

  //Accent Color
  --accent-color: 255 200 69;
  --accent-lighter-color: 255 239 199;
  --accent-darker-color: 255 180 46;

  //Warn Color
  --warn-color: 248 90 64;
  --warn-lighter-color: 253 206 198;
  --warn-darker-color: 245 63 42;
}

styles.scss

@use '@angular/material' as mat;
@import './styles/variables';

@include mat.core();

$my-primary: mat.define-palette((
  100: rgb(var(--primary-color)),
  500: rgb(var(--primary-color)),
  700: rgb(var(--primary-color)),
  contrast: (
    100: #fff,
    500: #fff,
    700: #000,
  )
));
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);

$my-theme: mat.define-light-theme((
 color: (
   primary: $my-primary,
   accent: $my-accent,
 ),
 typography: mat.define-typography-config(),
 density: 0,
));

@include mat.all-component-themes($my-theme)

the errors what I get

CSS Variables set properly but when I get it to create a color palette it shows this is not a color.


问:
Confused Pip install with Virtual Environments
Probably a rookie question: I created a project folder, cd'ed to it, created a virtual environment via

python -m venv .venv
```
<p>and it made the VE in the right place with what looks like the right stuff. But pip-installing modules <em>sometimes</em> (??) fails, with the module going into the global site-packages. This is a vanilla Python 3.9 install on Linux (Raspberry Pi) and being used within Visual Studio Code. To get it right I need to use the "Pip Manager" extension. Why?? To illustrate my confusion, I understand that Python (and Pip?) uses <strong>sys.path</strong> to resolve packages (see XKCD 1897). So after activating the VE, I looked and got this? I expected to see the <strong>.venv</strong> site-packages in that path <em>first</em>, right? Well here is what I get:
<img src="https://i.stack.imgur.com/8kp1A.png" alt="terminal snapshot" />
Where am I misinformed or otherwise confused?</p>
<p><strong>Info added in response to questions below</strong></p>
<p>This system never had Python2 on it. Within the activated .venv there are links:</p>
<pre class="lang-none prettyprint-override"><code>pi@rpi1:~/Documents/alpyca-device*.venv/bin $ ls -l pyt*
lrwxrwxrwx 1 pi pi 15 Dec 14 14:41 python -> /usr/bin/python
lrwxrwxrwx 1 pi pi  6 Dec 14 14:41 python3 -> python
lrwxrwxrwx 1 pi pi  6 Dec 14 14:41 python3.9 -> python
</code>```

and this is the usual way it is put into the Python3 virtuals by the venv module, which is recommended now over virtualenv and other schemes.

(.venv) pi@rpi1:~/Documents/alpyca $ which python
/home/pi/Documents/alpyca/.venv/bin/python
```
<p>and other requests for info:</p>
<pre class="lang-none prettyprint-override"><code>(.venv) pi@rpi1:~/Documents/alpyca $ grep VIRTUAL_ENV= .venv/bin/activate
VIRTUAL_ENV="/home/pi/Documents/alpyca/.venv"

(.venv) pi@rpi1:~/Documents/alpyca $ .venv/bin/python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/home/pi/Documents/alpyca/.venv/lib/python3.9/site-packages']
>>>
</code>```

I don't know about Python 2, I have never used it.

Body:
Probably a rookie question: I created a project folder, cd'ed to it, created a virtual environment via

python -m venv .venv

and it made the VE in the right place with what looks like the right stuff. But pip-installing modules sometimes (??) fails, with the module going into the global site-packages. This is a vanilla Python 3.9 install on Linux (Raspberry Pi) and being used within Visual Studio Code. To get it right I need to use the "Pip Manager" extension. Why?? To illustrate my confusion, I understand that Python (and Pip?) uses sys.path to resolve packages (see XKCD 1897). So after activating the VE, I looked and got this? I expected to see the .venv site-packages in that path first, right? Well here is what I get:

Where am I misinformed or otherwise confused?

Info added in response to questions below

This system never had Python2 on it. Within the activated .venv there are links:

pi@rpi1:~/Documents/alpyca-device*.venv/bin $ ls -l pyt*
lrwxrwxrwx 1 pi pi 15 Dec 14 14:41 python -> /usr/bin/python
lrwxrwxrwx 1 pi pi  6 Dec 14 14:41 python3 -> python
lrwxrwxrwx 1 pi pi  6 Dec 14 14:41 python3.9 -> python

and this is the usual way it is put into the Python3 virtuals by the venv module, which is recommended now over virtualenv and other schemes.

(.venv) pi@rpi1:~/Documents/alpyca $ which python
/home/pi/Documents/alpyca/.venv/bin/python

and other requests for info:

(.venv) pi@rpi1:~/Documents/alpyca $ grep VIRTUAL_ENV= .venv/bin/activate
VIRTUAL_ENV="/home/pi/Documents/alpyca/.venv"

(.venv) pi@rpi1:~/Documents/alpyca $ .venv/bin/python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/home/pi/Documents/alpyca/.venv/lib/python3.9/site-packages']
>>>

I don't know about Python 2, I have never used it.


问:
how Do I change the filters and calculation to avoid showing the same total for each person

here is the image

i am trying to show items completed by items/hour
completed by employee Name but all I am seeing is the same total


问:
Simplify exporting all files in a folder to import them using 'destructered import'
I have a folder extractors with a bunch of files each containing a function. (Yes, I have my reasons why I've seperated it). I want to export all of the files in a way that allows me to import them (destructered):

const { ..., ..., ...} = require(...);
```
<hr />
<p>First things first, my current code works. <em>However</em>, I'm trying to find a better solution since the way I'm doing it now feels a bit '<em>janky</em>'.</p>
<p>Currently, I have an <code>index.js</code> file in the <code>extractors</code> folder which exports the files:</p>
<pre class="lang-js prettyprint-override"><code>const AccountData = require('./Account');
const BitmojiData = require('./Bitmoji');
//...

module.exports = {
    AccountData,
    BitmojiData,
    //...
}
</code>```

This allows me to use:

const { AccountData, BitmojiData, ... } = require('./extractors/index.js');
```
<p>And prevents me from having to do:</p>
<pre class="lang-js prettyprint-override"><code>const AccountData = require('./extractors/AccountData.js');
const BitmojiData = require('./extractors/BitmojiData.js');
//...
</code>```

However, I can't help but feel like what I'm doing is.. 'suboptimal'. So I'm trying to find a better solution, but couldn't find one.

I hope someone is able to help me out, thanks in advance!

Example function /extractors/Example.js

const Example = (data) => {
   //...
   return ({
      k: 'v'
   })
}

module.exports = Example;
```

Also, I'm pretty sure I'm on ES5, I can't use export default etc.

Body:
I have a folder extractors with a bunch of files each containing a function. (Yes, I have my reasons why I've seperated it). I want to export all of the files in a way that allows me to import them (destructered):

const { ..., ..., ...} = require(...);

First things first, my current code works. However, I'm trying to find a better solution since the way I'm doing it now feels a bit 'janky'.

Currently, I have an index.js file in the extractors folder which exports the files:

const AccountData = require('./Account');
const BitmojiData = require('./Bitmoji');
//...

module.exports = {
    AccountData,
    BitmojiData,
    //...
}

This allows me to use:

const { AccountData, BitmojiData, ... } = require('./extractors/index.js');

And prevents me from having to do:

const AccountData = require('./extractors/AccountData.js');
const BitmojiData = require('./extractors/BitmojiData.js');
//...

However, I can't help but feel like what I'm doing is.. 'suboptimal'. So I'm trying to find a better solution, but couldn't find one.

I hope someone is able to help me out, thanks in advance!

Example function /extractors/Example.js

const Example = (data) => {
   //...
   return ({
      k: 'v'
   })
}

module.exports = Example;

Also, I'm pretty sure I'm on ES5, I can't use export default etc.


问:
Error after clicking submit button in CRUD application in PHP
I have made a CRUD application. Every operation works well but update operation gives error.

This is index.php
index.php`

This is update.php

update.php

This is the home page:
This is after clicking UPDATE button: Here is not any error, GET method works successfully:
This is after clicking  submit button, the recorde is not updated.

I am trying to fix this from last 2 days. Please help me.

I am trying to make a CRUD operation.


问:
libX11 on Android NDK (for Mouse pointer moving)
I'm trying to build an Android NDK application(C++) that sometimes changes the mouse position.

In this answer: https://stackoverflow.com/a/2433488/2584197 I found that I probably need to use the X11 library and set the position by XWarpPointer function.

I also saw that I need to add the -lX11 flag to the gcc complaining so I've tried to do that by the LDLIBS:

```<code>LOCAL_LDLIBS := -lX11
</code>```

But I get the error:

Android.mk: error: "my_app (EXECUTABLES android-arm) missing libX11 (SHARED_LIBRARIES android-arm)"

So my question is how can I get the lx11 library to work on Android c++ applications or is there any alternative option to change the mouse position by c++ code on Android?

Edit:
Thanks to Richard, I found that it's not possible to use libX11 ON android.

Is there another way to change the mouse cursor in Android?

Thanks!

Body:
I'm trying to build an Android NDK application(C++) that sometimes changes the mouse position.

In this answer: https://stackoverflow.com/a/2433488/2584197 I found that I probably need to use the X11 library and set the position by XWarpPointer function.

I also saw that I need to add the -lX11 flag to the gcc complaining so I've tried to do that by the LDLIBS:

LOCAL_LDLIBS := -lX11

But I get the error:

Android.mk: error: "my_app (EXECUTABLES android-arm) missing libX11 (SHARED_LIBRARIES android-arm)"

So my question is how can I get the lx11 library to work on Android c++ applications or is there any alternative option to change the mouse position by c++ code on Android?

Edit:
Thanks to Richard, I found that it's not possible to use libX11 ON android.

Is there another way to change the mouse cursor in Android?

Thanks!


问:
Laravel Project Installation Error using Composer
I got errors while installing laravel app using composer. I used composer create-project laravel/laravel myApp and my os is Ubuntu 22.04. I have totally fined installing laravel using composer until this day. I got these messages in my terminal.

How can I fix this?


问:
read from conf file in python3 and modify it
```<code>[building1] {
  floors = 7
  occupied_floors = 5
  [floor:1] {
    [section1] {
      total_flat = 50
      occupied = 2
    }
    [section2] {
      total_flat = 50
      occupied = 5
    }
  }
}
</code>```

How can I parse this file?

I tried

```<code>config=configparser.ConfigParser()
config.read('myfile')
</code>```

I get below error

```<code>MissingSectionHeaderError: File contains no section headers.
</code>```

Body:
[building1] {
  floors = 7
  occupied_floors = 5
  [floor:1] {
    [section1] {
      total_flat = 50
      occupied = 2
    }
    [section2] {
      total_flat = 50
      occupied = 5
    }
  }
}

How can I parse this file?

I tried

config=configparser.ConfigParser()
config.read('myfile')

I get below error

MissingSectionHeaderError: File contains no section headers.


问:
Pine script for low above Ema for 10 days
Could someone please help me how I can set the pine script code for an indicator to know whether the low price of last 10 daily are above 20 EMA. Thank you for your reply in advance.

```<code>if (low > ema and low[1] > ema[1] and low[2] > ema[2] and low[3] > ema[3] and low[4] > ema[4] and low[5] > ema[5] and low[6] > ema[6] and low[7] > ema[7] and low[8] > ema[8] and low[9] > ema[9])
    lowAboveEMA = true
</code>```

I tried this code but showing error

Body:
Could someone please help me how I can set the pine script code for an indicator to know whether the low price of last 10 daily are above 20 EMA. Thank you for your reply in advance.

if (low > ema and low[1] > ema[1] and low[2] > ema[2] and low[3] > ema[3] and low[4] > ema[4] and low[5] > ema[5] and low[6] > ema[6] and low[7] > ema[7] and low[8] > ema[8] and low[9] > ema[9])
    lowAboveEMA = true

I tried this code but showing error


问:
The method from_now of Class: BusinessTime::BusinessDays returns different results under the same context
The Method from_now of Class: BusinessTime::BusinessDays is used to calculate a specific date in a Ruby on Rails application. Sometimes (only sometimes!) wrong date was delivered back at a specific point.  I just could not find out what the problem is, until I placed the following lines into my code, just for the sake of experiementing:

```<code>puts "500.business_days&.from_now1: #{500.business_days&.from_now}"
puts "500.business_days&.from_now2: #{500.business_days&.from_now}"
puts "500.business_days&.from_now3: #{500.business_days&.from_now}"
puts "500.business_days&.from_now4: #{500.business_days&.from_now}"
puts "500.business_days&.from_now5: #{500.business_days&.from_now}"
puts "500.business_days&.from_now6: #{500.business_days&.from_now}"
puts "500.business_days&.from_now7: #{500.business_days&.from_now}"
</code>```

This is the screenshot, what was returned on the console:

Here is a content of the console as text:

```<code>500.business_days&.from_now1: 2024-12-30 09:00:00 +0100
500.business_days&.from_now2: 2024-12-30 09:00:00 +0100
500.business_days&.from_now3: 2024-11-29 09:00:00 +0100
500.business_days&.from_now4: 2024-12-19 09:00:00 +0100
500.business_days&.from_now5: 2024-12-30 09:00:00 +0100
500.business_days&.from_now6: 2024-12-30 09:00:00 +0100
500.business_days&.from_now7: 2024-12-30 09:00:00 +0100
</code>```

As you see, sometimes the Date 2024-11-29 is returned but sometimes 2024-12-30.

How can that be? It is the same context, the lines are next to each other, exactly the same, still the result is different. I just cannot get my head around that.

Body:
The Method from_now of Class: BusinessTime::BusinessDays is used to calculate a specific date in a Ruby on Rails application. Sometimes (only sometimes!) wrong date was delivered back at a specific point.  I just could not find out what the problem is, until I placed the following lines into my code, just for the sake of experiementing:

puts "500.business_days&.from_now1: #{500.business_days&.from_now}"
puts "500.business_days&.from_now2: #{500.business_days&.from_now}"
puts "500.business_days&.from_now3: #{500.business_days&.from_now}"
puts "500.business_days&.from_now4: #{500.business_days&.from_now}"
puts "500.business_days&.from_now5: #{500.business_days&.from_now}"
puts "500.business_days&.from_now6: #{500.business_days&.from_now}"
puts "500.business_days&.from_now7: #{500.business_days&.from_now}"

This is the screenshot, what was returned on the console:

Here is a content of the console as text:

500.business_days&.from_now1: 2024-12-30 09:00:00 +0100
500.business_days&.from_now2: 2024-12-30 09:00:00 +0100
500.business_days&.from_now3: 2024-11-29 09:00:00 +0100
500.business_days&.from_now4: 2024-12-19 09:00:00 +0100
500.business_days&.from_now5: 2024-12-30 09:00:00 +0100
500.business_days&.from_now6: 2024-12-30 09:00:00 +0100
500.business_days&.from_now7: 2024-12-30 09:00:00 +0100

As you see, sometimes the Date 2024-11-29 is returned but sometimes 2024-12-30.

How can that be? It is the same context, the lines are next to each other, exactly the same, still the result is different. I just cannot get my head around that.


问:
MYSQL Error Code 1146: 'database.table does not exist' when trying to execute a stored procedure
I'm new to MYSQL functions/procedures and am trying to create something that will loop through some tables in information_schema.tables and populate an existing table with information taken from those tables. However, the program doesn't seem to recognize the alias 'info', even though when I test it outside the procedure it is usable. Not sure what is going on.</p>
```<code>CREATE DEFINER=`root`@`localhost` PROCEDURE `unite`()
BEGIN
     DECLARE n int;
     DECLARE i int;
SELECT
    table_name AS info
FROM
    information_schema.tables;
SELECT
    COUNT(*)
FROM
    info INTO n;

     SET i=0;
     WHILE i<n DO
     IF info LIKE 'transactions_20%' THEN
     INSERT INTO days_totals
     (date,num_of_ppl,punches,admission_total,pass_total,misc_total,food_total,drink_total,grand_total)
     VALUES(
     (SELECT SUBSTRING(info,14,23)),
     (SELECT COUNT(amount) FROM info WHERE name = 'adult admission' OR name = 'punch a pass' OR name = 'child admission'),
     (SELECT COUNT(amount) FROM info WHERE name = 'punch a pass'),
     (SELECT SUM(total) FROM info WHERE name = 'adult admission' OR name = 'child admission'),
     (SELECT SUM(total) FROM info WHERE name = 'ten visit pass'),
     (SELECT SUM(total) FROM info WHERE type = 'misc' AND name != 'adult admission' AND name != 'child admission' AND name != 'ten visit pass'),
     (SELECT SUM(total) FROM info WHERE type = 'food'),
     (SELECT SUM(total) FROM info WHERE type = 'drink'),
     (SELECT SUM(total) FROM info WHERE type = 'misc' OR type = 'food' OR type = 'drink')
     );
     SET i = i + 1;
     ELSE
        SET i = i + 1;
    END IF;
    END WHILE;

END
</code>```

Body:
I'm new to MYSQL functions/procedures and am trying to create something that will loop through some tables in information_schema.tables and populate an existing table with information taken from those tables. However, the program doesn't seem to recognize the alias 'info', even though when I test it outside the procedure it is usable. Not sure what is going on.

CREATE DEFINER=`root`@`localhost` PROCEDURE `unite`()
BEGIN
     DECLARE n int;
     DECLARE i int;
SELECT
    table_name AS info
FROM
    information_schema.tables;
SELECT
    COUNT(*)
FROM
    info INTO n;

     SET i=0;
     WHILE i<n DO
     IF info LIKE 'transactions_20%' THEN
     INSERT INTO days_totals
     (date,num_of_ppl,punches,admission_total,pass_total,misc_total,food_total,drink_total,grand_total)
     VALUES(
     (SELECT SUBSTRING(info,14,23)),
     (SELECT COUNT(amount) FROM info WHERE name = 'adult admission' OR name = 'punch a pass' OR name = 'child admission'),
     (SELECT COUNT(amount) FROM info WHERE name = 'punch a pass'),
     (SELECT SUM(total) FROM info WHERE name = 'adult admission' OR name = 'child admission'),
     (SELECT SUM(total) FROM info WHERE name = 'ten visit pass'),
     (SELECT SUM(total) FROM info WHERE type = 'misc' AND name != 'adult admission' AND name != 'child admission' AND name != 'ten visit pass'),
     (SELECT SUM(total) FROM info WHERE type = 'food'),
     (SELECT SUM(total) FROM info WHERE type = 'drink'),
     (SELECT SUM(total) FROM info WHERE type = 'misc' OR type = 'food' OR type = 'drink')
     );
     SET i = i + 1;
     ELSE
        SET i = i + 1;
    END IF;
    END WHILE;

END


问:
tkinter changing a button's state weirdly acting
I'm a beginner programmer and trying to learn tkinter module. I'm trying to change my button's state when it's clicked. I'm able to change it by using: my_button.config(state="active")
When I check it by printing: print(f"After: {my_button.cget('state')}")

it says its active. I mean everything happens to be normal so far.

from tkinter import *

window = Tk()
window.minsize(width=500, height=500)

def change_button_state():
    print(f"Before if statement: {my_button.cget('state')}")
    if my_button.cget("state") == "normal":
        print(f"Before: {my_button.cget('state')}")
        my_button.config(state="active")
        print(f"After: {my_button.cget('state')}")
    else:
        print(f"Before: {my_button.cget('state')}")
        my_button.config(state="normal")
        print(f"After: {my_button.cget('state')}")

my_button = Button(text="Something", command=change_button_state)
my_button.pack()

window.mainloop()
```
<p>The problem occurs when I clicked the button again. Let me show you the outcome of clicking the button twice before I explain further.</p>
<pre class="lang-none prettyprint-override"><code>Before if statement: normal
Before: normal
After: active

Before if statement: normal
Before: normal
After: active
</code>```

I mean how can second "Before if statement" be "normal"? Didn't I just changed it to active? I'm really lost at this point. If you can help me I would be glad.

Body:
I'm a beginner programmer and trying to learn tkinter module. I'm trying to change my button's state when it's clicked. I'm able to change it by using: my_button.config(state="active")
When I check it by printing: print(f"After: {my_button.cget('state')}")

it says its active. I mean everything happens to be normal so far.

from tkinter import *

window = Tk()
window.minsize(width=500, height=500)

def change_button_state():
    print(f"Before if statement: {my_button.cget('state')}")
    if my_button.cget("state") == "normal":
        print(f"Before: {my_button.cget('state')}")
        my_button.config(state="active")
        print(f"After: {my_button.cget('state')}")
    else:
        print(f"Before: {my_button.cget('state')}")
        my_button.config(state="normal")
        print(f"After: {my_button.cget('state')}")

my_button = Button(text="Something", command=change_button_state)
my_button.pack()

window.mainloop()

The problem occurs when I clicked the button again. Let me show you the outcome of clicking the button twice before I explain further.

Before if statement: normal
Before: normal
After: active

Before if statement: normal
Before: normal
After: active

I mean how can second "Before if statement" be "normal"? Didn't I just changed it to active? I'm really lost at this point. If you can help me I would be glad.


问:
why is material top tab not taking up the full height
i'm trying to set the height to full screen but can't set dynamic height, can only set fixed height

i tried to set contentContainerStyle={{flex:1}} but nothing changed


问:
Why window.FB.login is not triggered in Facebook built in browser?
I have this code:

<button
                        className={`${styles.button} ${styles.facebookBtn}`}
                        onClick={() => {
                            if (!window.FB) {
                                log(
                                    {
                                        text: '!window.FB' + getTempUserShortId(),
                                    },
                                    env
                                )
                                return
                            }
                            log(
                                {
                                    text:
                                        'window.FB.login will be called ' + getTempUserShortId(),
                                },
                                env
                            )
                            window.FB.login(function (res: any) {
                                log(
                                    {
                                        text: 'window.FB.login get called ' + getTempUserShortId(),
                                    },
                                    env
                                )
```
<p>In each browser Facebook login triggers but not Facebook's own built in browser, why?</p>
<p>I checked even in stack overflow I can login with Facebook when a page is opened in Faebbok browser, what do I miss?</p>
<p>Maybe I should use https://www.npmjs.com/package/react-facebook-login</p>
<p>Here in useEvveft I am adding the needed Facebook codes:</p>
<pre class="lang-js prettyprint-override"><code>    useEffect(() => {
        setIsEmbedded(false)
        log(
            {
                text:
                    'LoginAndRegistrationRAL useEffect get called ' +
                    getTempUserShortId() +
                    ` window.navigator.userAgent: ${JSON.stringify(
                        window.navigator.userAgent
                    )}`,
            },
            env
        )

        setIsRegistration(false)

        window.fbAsyncInit = function () {
            window.FB.init({
                appId: fbAppId(env),
                cookie: true,
                xfbml: true,
                version: 'v14.0',
            })
            window.FB.AppEvents.logPageView()
            if (
                navigator.userAgent.indexOf('FBAN') != -1 ||
                navigator.userAgent.indexOf('FBAV') != -1
            ) {
                setIsEmbedded(true)
            }
        }
        ;(function (d, s, id) {
            var js,
                fjs = d.getElementsByTagName(s)[0]
            if (d.getElementById(id)) {
                return
            }
            js = (d.createElement(s) as HTMLImageElement) || null
            js.id = id
            js.src = 'https://connect.facebook.net/en_US/sdk.js'
            fjs.parentNode?.insertBefore(js, fjs)
        })(document, 'script', 'facebook-jssdk')
    }, [])
</code>```

Body:
I have this code:

<button
                        className={`${styles.button} ${styles.facebookBtn}`}
                        onClick={() => {
                            if (!window.FB) {
                                log(
                                    {
                                        text: '!window.FB' + getTempUserShortId(),
                                    },
                                    env
                                )
                                return
                            }
                            log(
                                {
                                    text:
                                        'window.FB.login will be called ' + getTempUserShortId(),
                                },
                                env
                            )
                            window.FB.login(function (res: any) {
                                log(
                                    {
                                        text: 'window.FB.login get called ' + getTempUserShortId(),
                                    },
                                    env
                                )

In each browser Facebook login triggers but not Facebook's own built in browser, why?

I checked even in stack overflow I can login with Facebook when a page is opened in Faebbok browser, what do I miss?

Maybe I should use https://www.npmjs.com/package/react-facebook-login

Here in useEvveft I am adding the needed Facebook codes:

    useEffect(() => {
        setIsEmbedded(false)
        log(
            {
                text:
                    'LoginAndRegistrationRAL useEffect get called ' +
                    getTempUserShortId() +
                    ` window.navigator.userAgent: ${JSON.stringify(
                        window.navigator.userAgent
                    )}`,
            },
            env
        )

        setIsRegistration(false)

        window.fbAsyncInit = function () {
            window.FB.init({
                appId: fbAppId(env),
                cookie: true,
                xfbml: true,
                version: 'v14.0',
            })
            window.FB.AppEvents.logPageView()
            if (
                navigator.userAgent.indexOf('FBAN') != -1 ||
                navigator.userAgent.indexOf('FBAV') != -1
            ) {
                setIsEmbedded(true)
            }
        }
        ;(function (d, s, id) {
            var js,
                fjs = d.getElementsByTagName(s)[0]
            if (d.getElementById(id)) {
                return
            }
            js = (d.createElement(s) as HTMLImageElement) || null
            js.id = id
            js.src = 'https://connect.facebook.net/en_US/sdk.js'
            fjs.parentNode?.insertBefore(js, fjs)
        })(document, 'script', 'facebook-jssdk')
    }, [])


问:
Remove the parent default window in ImGui
I used one of the examples from ImGui source code (D3d11), I want to remove the ugly default host window that has the title "Dear ImGui DirectX11 Example" (image attached) and only use my own created window (the red one).

From the code I can see that it is created using this:

```<code>// Create application window
//ImGui_ImplWin32_EnableDpiAwareness();
WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ImGui Example", NULL };
::RegisterClassExW(&wc);
HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX11 Example", WS_OVERLAPPEDWINDOW, 100, 100, 600, 600, NULL, NULL, wc.hInstance, NULL);
</code>```

Body:
I used one of the examples from ImGui source code (D3d11), I want to remove the ugly default host window that has the title "Dear ImGui DirectX11 Example" (image attached) and only use my own created window (the red one).

From the code I can see that it is created using this:

// Create application window
//ImGui_ImplWin32_EnableDpiAwareness();
WNDCLASSEXW wc = { sizeof(wc), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"ImGui Example", NULL };
::RegisterClassExW(&wc);
HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Dear ImGui DirectX11 Example", WS_OVERLAPPEDWINDOW, 100, 100, 600, 600, NULL, NULL, wc.hInstance, NULL);


Title: Merging 2 tables adding variable DV01 by Date using R

Body:
what's the best way to do the procedure below using R?

I have these two tables and the idea it's to group the variable DV01 by fixing date on the second table. So since the dates doesn't match I need to sum the DV01 between the fixing dates and merge it on the second table.

The final result should be the second table including a new column DV01 added by contract.

#this first table is and example, since the original have more than 100k rows.

DT_VCTO
DV01

1/5/2023
0

11/5/2023
-0.04

3/5/2025
-0.08

9/5/2025
-0.07

1/5/2026
-0.08

3/10/2023
0

1/5/2023
0

1/5/2023
0

6/5/2023
-0.01

6/5/2023
0

2/5/2023
-0.01

3/5/2024
-0.04

6/5/2024
-0.06

1/5/2025
-0.07

12/5/2025
-0.08

6/5/2023
-0.01

9/5/2023
-0.02

11/5/2023
-0.02

4/5/2023
0

5/5/2023
0

9/5/2023
-0.03

12/5/2023
-0.04

7/5/2024
-0.06

And this second one which include the futures contracts from B3:

symbol
price_previous
price
change
fixing
adjusted_tax
DV01_CTO

DI1F23
99796.97
99796.98
0.01
2023-01-02
0.13659
-0.14

DI1G23
98687.03
98688.07
1.04
2023-02-01
0.13655
-0.9

DI1H23
97786.97
97786.91
-0.06
2023-03-01
0.13675
-1.5

DI1J23
96644.95
96644.66
-0.29
2023-04-03
0.13697
-2.26

DI1K23
95752.06
95752.62
0.56
2023-05-02
0.13732
-2.84

DI1M23
94666.68
94668.52
1.84
2023-06-01
0.13773
-3.53

DI1N23
93653.91
93657.68
3.77
2023-07-03
0.13769
-4.18

DI1Q23
92650.52
92657.22
6.7
2023-08-01
0.13767
-4.82

DI1U23
91576.32
91587.12
10.8
2023-09-01
0.13741
-5.5

DI1V23
90658.14
90673
14.86
2023-10-02
0.13713
-6.07

DI1X23
89717.69
89735.19
17.5
2023-11-01
0.13671
-6.67

DI1Z23
88845.3
88864.82
19.52
2023-12-01
0.13619
-7.23

DI1F24
88006.43
88027.2
20.77
2024-01-02
0.13544
-7.78

DI1J24
85469.38
85502.54
33.16
2024-04-01
0.13394
-9.39

DI1N24
83011.86
83056.79
44.93
2024-07-01
0.13212
-10.97

DI1V24
80534.85
80572.14
37.29
2024-10-01
0.13075
-12.52

DI1F25
78261.21
78284.41
23.2
2025-01-02
0.1294
-13.94

DI1J25
76044.4
76051.56
7.16
2025-04-01
0.12914
-15.18

DI1N25
73853.35
73859.61
6.26
2025-07-01
0.12907
-16.33

DI1V25
71518.64
71520.32
1.68
2025-10-01
0.12923
-17.46

DI1F26
69338.9
69326
-12.9
2026-01-02
0.12916
-18.51

DI1J26
67307.25
67270.6
-36.65
2026-04-01
0.1294
-19.4

DI1N26
65347.98
65281.56
-66.42
2026-07-01
0.12958
-20.22

DI1V26
63337.09
63282.81
-54.28
2026-10-01
0.12948
-21.05

DI1F27
61461.24
61405.16
-56.08
2027-01-04
0.12939
-21.79

DI1J27
59740.83
59667.42
-73.41
2027-04-01
0.12932
-22.43

DI1N27
57953.6
57869.08
-84.52
2027-07-01
0.12937
-23.03

DI1V27
56186.79
56088.39
-98.4
2027-10-01
0.12934
-23.6

DI1F28
54501.64
54408.51
-93.13
2028-01-03
0.12934
-24.1

DI1F29
48291.85
48167.79
-124.06
2029-01-02
0.12965
-25.54

DI1F30
42914.94
42723.09
-191.85
2030-01-02
0.12949
-26.41

DI1F31
37955.22
37790.81
-164.41
2031-01-02
0.12955
-26.71

DI1F32
33695.24
33525.65
-169.59
2032-01-02
0.12923
-26.68

DI1F33
29826.72
29625.97
-200.75
2033-01-03
0.12947
-26.2

DI1F34
26466.52
26270.75
-195.77
2034-01-02
0.12936
-25.55

DI1F35
23531.97
23342.33
-189.64
2035-01-02
0.12917
-24.74

DI1F36
20838.15
20656.44
-181.71
2036-01-02
0.12932
-23.71

DI1F37
18401.01
18228.23
-172.78
2037-01-02
0.12952
-22.54

I've tried to sum a group the DV01 by fixing dat, but couldn't use left join + groupby using tow conditions simultaneously since you need to consider that the DT_VCTO should be higher than the fixing date before and lower or equal the next fixing date.

#The final table should be like this one and can be easly obtained using excel, for example:

symbol
price_previous
price
change
fixing
adjusted_tax
DV01_CTO
DV01

DI1F23
99796.97
99796.98
0.01
1/2/2023
0.136590066
-0.14
0

DI1G23
98687.03
98688.07
1.04
2/1/2023
0.136550458
-0.9
0

DI1H23
97786.97
97786.91
-0.06
3/1/2023
0.136749968
-1.5
-0.01

DI1J23
96644.95
96644.66
-0.29
4/3/2023
0.136969815
-2.26
0

DI1K23
95752.06
95752.62
0.56
5/2/2023
0.137320144
-2.84
0

DI1M23
94666.68
94668.52
1.84
6/1/2023
0.137729913
-3.53
0

DI1N23
93653.91
93657.68
3.77
7/3/2023
0.137689998
-4.18
-0.02

DI1Q23
92650.52
92657.22
6.7
8/1/2023
0.137669919
-4.82
0

DI1U23
91576.32
91587.12
10.8
9/1/2023
0.137409989
-5.5
0

DI1V23
90658.14
90673
14.86
10/2/2023
0.137130072
-6.07
-0.05

DI1X23
89717.69
89735.19
17.5
11/1/2023
0.136709948
-6.67
0

DI1Z23
88845.3
88864.82
19.52
12/1/2023
0.136189996
-7.23
-0.06

DI1F24
88006.43
88027.2
20.77
1/2/2024
0.135440044
-7.78
-0.04

DI1J24
85469.38
85502.54
33.16
4/1/2024
0.133940035
-9.39
-0.04

DI1N24
83011.86
83056.79
44.93
7/1/2024
0.132120039
-10.97
-0.06

DI1V24
80534.85
80572.14
37.29
10/1/2024
0.13075002
-12.52
-0.06

DI1F25
78261.21
78284.41
23.2
1/2/2025
0.129400013
-13.94
0

DI1J25
76044.4
76051.56
7.16
4/1/2025
0.129140027
-15.18
-0.15

DI1N25
73853.35
73859.61
6.26
7/1/2025
0.129070031
-16.33
0

DI1V25
71518.64
71520.32
1.68
10/1/2025
0.129230021
-17.46
-0.07

DI1F26
69338.9
69326
-12.9
1/2/2026
0.129160012
-18.51
-0.08

DI1J26
67307.25
67270.6
-36.65
4/1/2026
0.129399981
-19.4
-0.08

DI1N26
65347.98
65281.56
-66.42
7/1/2026
0.129579997
-20.22
0

DI1V26
63337.09
63282.81
-54.28
10/1/2026
0.12948002
-21.05
0

DI1F27
61461.24
61405.16
-56.08
1/4/2027
0.12938999
-21.79
0

DI1J27
59740.83
59667.42
-73.41
4/1/2027
0.129319999
-22.43
0

DI1N27
57953.6
57869.08
-84.52
7/1/2027
0.129369987
-23.03
0

DI1V27
56186.79
56088.39
-98.4
10/1/2027
0.129340016
-23.6
0

DI1F28
54501.64
54408.51
-93.13
1/3/2028
0.129339996
-24.1
0

DI1F29
48291.85
48167.79
-124.06
1/2/2029
0.129650013
-25.54
0

DI1F30
42914.94
42723.09
-191.85
1/2/2030
0.129490006
-26.41
0

DI1F31
37955.22
37790.81
-164.41
1/2/2031
0.129549983
-26.71
0

DI1F32
33695.24
33525.65
-169.59
1/2/2032
0.12923001
-26.68
0

DI1F33
29826.72
29625.97
-200.75
1/3/2033
0.129470016
-26.2
0

DI1F34
26466.52
26270.75
-195.77
1/2/2034
0.129360016
-25.55
0

DI1F35
23531.97
23342.33
-189.64
1/2/2035
0.129169999
-24.74
0

DI1F36
20838.15
20656.44
-181.71
1/2/2036
0.12932
-23.71
0

DI1F37
18401.01
18228.23
-172.78
1/2/2037
0.129519986
-22.54
0