问:
Printing from dynamic Excel list box
I have a workbook that is a 'quick print' sheet for my workplace.

I am not very skilled with VBA, but I have found various bits from web searches that have given me mostly desired results.

This is the desired look of the sheet:

The column C and D is a List Box with the VBA code:

```<code>Private Sub Worksheet_Activate()
Dim Sh

    Me.ListBoxSh.Clear

    For Each Sh In ThisWorkbook.Sheets
        Me.ListBoxSh.AddItem Sh.Name
    Next Sh

End Sub
</code>```

The print icon in D2 is linked to macro:

```<code>Sub Print_Sheets()
Dim i As Long, c As Long
Dim SheetArray() As String

    With ActiveSheet.ListBoxSh

        For i = 0 To .ListCount - 1
            If .Selected(i) Then
                ReDim Preserve SheetArray(c)
                SheetArray(c) = .List(i)
                c = c + 1
            End If
        Next i

        Application.Dialogs(xlDialogPrinterSetup).Show

        Worksheets(SheetArray()).PrintOut Copies:=1

    End With

End Sub
</code>```

and finally the sheet has following in ThisWorkbook in order to refresh the List Box and put the user on the correct page:

```<code>Private Sub Workbook_Open()

    Sheets(2).Select
    Sheets(1).Select

End Sub
</code>```

The final bit of VBA seems to work as intended, but I included it anyway in case it could interfere with something (I don't think it can, but just to be sure).

The List Box populates as intended, but I can't get it to stay the width of the columns C:D, and the height of the populated cells in B, every time the workbook is opened the box will increase in size both to the right and down.

The print button works mostly as intended; when clicked it will prompt with available printers, and then OK to print, but cancelling still causes the document to print. It will also allow the printing of the "Please Select..." page - the name of the sheet this form is on - which I have tried to stop from happening but can't get it to work.

On the point of having the list box resize correctly, I have followed this answer but I can't figure out how to keep the size as the range, rather than an integer.

Edit: I have now figured out that I can use Me.ListBoxSh.Width = Range("C:D").Width to set the width the same as the desired columns, as well as Me.ListBoxSh.Height = Range("3:7").Height for the height in the image shown. However, I will be adding to this list and am not sure how to have the VBA code work as "Start in row 3 and continue until an unpopulated row".

On not being able to print the "Please Select..." sheet, I followed this guide and it didn't seem to do anything at all. I had changed the WsName = "Sheet1" line to read WsName = "Please Select..." also.

Any help would be appreciated.

Title: Printing from dynamic Excel list box

Body:
I have a workbook that is a 'quick print' sheet for my workplace.

I am not very skilled with VBA, but I have found various bits from web searches that have given me mostly desired results.

This is the desired look of the sheet:

The column C and D is a List Box with the VBA code:

Private Sub Worksheet_Activate()
Dim Sh

    Me.ListBoxSh.Clear

    For Each Sh In ThisWorkbook.Sheets
        Me.ListBoxSh.AddItem Sh.Name
    Next Sh

End Sub

The print icon in D2 is linked to macro:

Sub Print_Sheets()
Dim i As Long, c As Long
Dim SheetArray() As String

    With ActiveSheet.ListBoxSh

        For i = 0 To .ListCount - 1
            If .Selected(i) Then
                ReDim Preserve SheetArray(c)
                SheetArray(c) = .List(i)
                c = c + 1
            End If
        Next i

        Application.Dialogs(xlDialogPrinterSetup).Show

        Worksheets(SheetArray()).PrintOut Copies:=1

    End With

End Sub

and finally the sheet has following in ThisWorkbook in order to refresh the List Box and put the user on the correct page:

Private Sub Workbook_Open()

    Sheets(2).Select
    Sheets(1).Select

End Sub

The final bit of VBA seems to work as intended, but I included it anyway in case it could interfere with something (I don't think it can, but just to be sure).

The List Box populates as intended, but I can't get it to stay the width of the columns C:D, and the height of the populated cells in B, every time the workbook is opened the box will increase in size both to the right and down.

The print button works mostly as intended; when clicked it will prompt with available printers, and then OK to print, but cancelling still causes the document to print. It will also allow the printing of the "Please Select..." page - the name of the sheet this form is on - which I have tried to stop from happening but can't get it to work.

On the point of having the list box resize correctly, I have followed this answer but I can't figure out how to keep the size as the range, rather than an integer.

Edit: I have now figured out that I can use Me.ListBoxSh.Width = Range("C:D").Width to set the width the same as the desired columns, as well as Me.ListBoxSh.Height = Range("3:7").Height for the height in the image shown. However, I will be adding to this list and am not sure how to have the VBA code work as "Start in row 3 and continue until an unpopulated row".

On not being able to print the "Please Select..." sheet, I followed this guide and it didn't seem to do anything at all. I had changed the WsName = "Sheet1" line to read WsName = "Please Select..." also.

Any help would be appreciated.


来源: stackexchange

问:
Matillion : missing environment variable type when export environment variable via ETL API v1
Using the MATILLION ETL API v1 to get environment variables, it seems that the type of the variables is missing in the output JSON.

I m using the following syntax

http:///rest/v1/group/name//project/name//environment/name//variable/export

Link here to the doc

Exemple of environment varibale

JSON output for export environment variables

Any idea if this could be acheived ?

ContentLicense: CC BY-SA 4.0


问:
AixLib 1.3.0 & 1.3.1 library is not loading in OpenModelica v1.19 & v1.20
I wanted to use AixLib in OpenModelica, but it does not load.

I tried loading both AixLib 1.3.0 & 1.3.1, but neither worked. It was tested on both OpenModelica v1.19 & v1.20.

I wonder whether this is the OpenModelica compatibility issue. Is anyone using this library with OpenModelica?


问:
Upate hash parameter in Android WebView
I want to update the url hash parameter of a Webview. It reloads the url, if the base url changes, but not if the hash does.

```<code>import android.webkit.WebView;

public class MyClass {

    private WebView myWebView;

    public void start() {
        getActivity().runOnUiThread(() -> {
            this.assistantWebView.loadUrl("https://www.myCoolName.de/index.html");
        }

        MyClass self = this;

        new android.os.Handler(Looper.getMainLooper()).postDelayed(
            new Runnable() {
                public void run() {
                    getActivity().runOnUiThread(() -> {
                         self.myWebView.loadUrl("https://www.myCoolName.de/index.html#myValue");
                    });
                }
            }, 8000);
     }
}
</code>```

After 8 seconds the page flickers shortly, but it did not change anything.

How do I update a page with hashtags?

Title: Upate hash parameter in Android WebView

Body:
I want to update the url hash parameter of a Webview. It reloads the url, if the base url changes, but not if the hash does.

import android.webkit.WebView;

public class MyClass {

    private WebView myWebView;

    public void start() {
        getActivity().runOnUiThread(() -> {
            this.assistantWebView.loadUrl("https://www.myCoolName.de/index.html");
        }

        MyClass self = this;

        new android.os.Handler(Looper.getMainLooper()).postDelayed(
            new Runnable() {
                public void run() {
                    getActivity().runOnUiThread(() -> {
                         self.myWebView.loadUrl("https://www.myCoolName.de/index.html#myValue");
                    });
                }
            }, 8000);
     }
}

After 8 seconds the page flickers shortly, but it did not change anything.

How do I update a page with hashtags?


问:
What exactly is deobfuscation
Lately I have been hearing about code deobfuscation, I know that its something about formatting code to make it readable but, what im really looking for is what would it even look like(an example) why would I even do it, how can it be done. Just to clear it up, i do  fully understand the meaning of the word deobfuscation, improving things that are unclear or unreadable. What i don’t understand is the usage of this word in coding.

my main goal is to get a full understanding about deobfuscation because google has really confused me

Title: What exactly is deobfuscation


问:
is it good to settimeout to hold state update?
I had to show fading out of OutterNav when clicked on it and open a model in its place and all this should have transition.

so what I did was to add the className on click of the OutterNav to show the scale and fade transition of OutterNav . But the opening of modal was based on state value which changed on click of OutterNav. So I added a delay in state update using setTimeout.

I had a question that if it is a good way to hold state update in such scenario or there is a good way to do it?

here is some code for reference

import React from "react";
import { useRef } from "react";

const OutterNav = ({ setShowInnerNav }) => {
    const containerRef = useRef(null);

    const handleClick = () => {
        if (containerRef.current) {
            containerRef.current.classList.add(
                "search-widget-container-animation"
            );
        }

        setTimeout(() => {
            setShowInnerNav(true);
        }, 300);  //is it okay....?
    };

    return (

            <button className='btn'>
                Anywhere
            </button>
            <button className='btn'>
                Any week
            </button>

    );
};

export default AirbnbOutterNav;

```


问:
405 Method Not Allowed - Contact Form HTML + form.php
I am trying to enable a simple contact form, however, every time on the button submit, I get redirected to /form.php with the error 405 Method Not Allowed in the console.

Here is the form in index.html

```<code><div class="container text-center pt-5 pb-5" id="contact">
      <h1 class="word">Contact Us</h1>
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-lg-6">
            <form action="form.php" method="POST">
              <div class="form-group">
                <label for="name">Name</label>
                <input type="text" class="form-control text-white" id="name" name="name" placeholder="Enter your name">
              </div>
              <div class="form-group">
                <label for="email">Email</label>
                <input type="email" class="form-control text-white" id="email" name="email" placeholder="Enter your email">
              </div>
              <div class="form-group">
                <label for="message">Message</label>
                <textarea class="form-control text-white" id="message" name="message" rows="3" placeholder="Enter your message"></textarea>
              </div>
              <button type="submit" class="btn btn-primary mt-3 btn-lg mt-4">Send Message</button>
            </form>
          </div>
        </div>
      </div>
    </div>
</code>```

And here is my form.php

```<code><?php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  // Get the form data
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];

  // Set the recipient email address
  $to = "hello@doctrina.ai";

  // Set the email subject
  $subject = "Message from Contact Form";

  // Build the email content
  $email_content = "Name: $name\n";
  $email_content .= "Email: $email\n\n";
  $email_content .= "Message:\n$message\n";

  // Build the email headers
  $email_headers = "From: $name <$email>";

  // Send the email
  mail($to, $subject, $email_content, $email_headers);

  // Redirect to the thank you page
  header('Location: thanks.html');
}

?>
</code>```

I have thanks.html page as well. I am using Vercel for deployment. Thank you in advance for your help!

Body:
I am trying to enable a simple contact form, however, every time on the button submit, I get redirected to /form.php with the error 405 Method Not Allowed in the console.

Here is the form in index.html

Contact Us

            <form action="form.php" method="POST">

                Name
                <input type="text" class="form-control text-white" id="name" name="name" placeholder="Enter your name">

                Email
                <input type="email" class="form-control text-white" id="email" name="email" placeholder="Enter your email">

                Message
                <textarea class="form-control text-white" id="message" name="message" rows="3" placeholder="Enter your message"></textarea>

              <button type="submit" class="btn btn-primary mt-3 btn-lg mt-4">Send Message</button>
            </form>

And here is my form.php

<?php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  // Get the form data
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];

  // Set the recipient email address
  $to = "hello@doctrina.ai";

  // Set the email subject
  $subject = "Message from Contact Form";

  // Build the email content
  $email_content = "Name: $name\n";
  $email_content .= "Email: $email\n\n";
  $email_content .= "Message:\n$message\n";

  // Build the email headers
  $email_headers = "From: $name <$email>";

  // Send the email
  mail($to, $subject, $email_content, $email_headers);

  // Redirect to the thank you page
  header('Location: thanks.html');
}

?>

I have thanks.html page as well. I am using Vercel for deployment. Thank you in advance for your help!


问:
Data from Localstorage load any other page, expect app-component page
I have a shopping card which a sidebar, and in app-component i have navbar. And when i toggle button on navbar.The app-component where the navbar located, toggle card.component. Everything is working, but for some reason its not works in the app-component. The card.component actually renderes, i see only static template. Although, if I proceed any other page and toggle the card, it shows data, and data comes independently from localstorage. And if i set toggle boolean in the app-component to true by default. I see my card from localstorage. But if retoggle it some reason not shows data. I don't clue why it works like that. But if retoggle it some reason not works. I don't have a clue why it works like that. Though, if i go any other page, the ngIf condition is works. There is something i didn't know, i have no clue.

card.component.ts

```<code>import { Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {faClose, faMinus, faPlus} from "@fortawesome/free-solid-svg-icons"

@Component({
  selector: 'app-card',
  templateUrl: './card.component.html',
  styleUrls: ['./card.component.scss']
})
export class CardComponent implements OnInit {
  card: any
  closeIcon = faClose
  minusIcon = faMinus
  plusIcon = faPlus

totalSum: number = 0
minus: boolean = false
plus: boolean = true

removeFromCard(index: any){
if(index ===0){
  index = this.card.length
}
  let i = this.card.length - index
    if(index > -1){
    this.card.splice(i, 1)
    }

if(this.card[0] === null || this.card[0] === undefined){
  localStorage.removeItem("card")
}else {
  localStorage.setItem("card", JSON.stringify(this.card))
}
}

getCardPrice(card: any){
  let sum = 0
  for(let i = 0;i<card.length;i++){
      this.totalSum = sum + card[i].totalCardPrice * card[i].quantity
    }
  this.totalSum = sum
  }

getQuantity(index: any, quant: boolean){
for(let i = 0;i<this.card.length; i++){
  if(i === index){
   if(this.card[i].quantity > 0 && this.card[i].quantity !== 0){
    if(quant){
      this.card[i].quantity = +this.card[i].quantity + 1
     } else {
      if(this.card[i].quantity - 1 !== 0){
        this.card[i].quantity = +this.card[i].quantity - 1
      }else {
        this.card[i].quantity = this.card[i].quantity
      }
     }
   }
  }
}
this.getCardPrice(this.card)
}

  constructor(){
    this.card = localStorage.getItem("card")
    if(this.card === null){
    this.card = null
    console.log(this.card)
    }else {
      this.card = JSON.parse(this.card)

      console.log("not null", this.card)
    }

  }

@Input() isCard: boolean = false
@Output() toActive = new EventEmitter<boolean>()

ngOnInit(){

}

isCloseCard(e:any){
  return false
}

block(event: any){
  event.stopPropaganation()
}
}
</code>```

card.component.html

```<code><main >
    <div class="dummy" (click)="toActive.emit(true)">
    </div>
    <section (click)="block($event)">
        <div class="header"><div class="name"><h1>Корзина</h1><p *ngIf="card != null">{{card.length}}</p></div><span (click)="toActive.emit(true)"></span></div>

        <div class="card" *ngIf="card != null && card.length > 0">
            <div class="wrap" *ngFor="let product of card; let i = index">
                <img src="{{product.option.selectedOption.img}}">
                <div class="card-detail">
                  <header> <a routerLink="/order">{{product.product.title}}</a> <span><fa-icon [icon]="closeIcon" (click)="removeFromCard(i)"></fa-icon></span></header>
                  <div class="detail">
                    <div class="option" *ngIf="product.option && product.option.selectedOption">
                        <span>{{product.option.name}}:</span><p>{{product.option.selectedOption.name}}</p>
                    </div>
                    <div class="option">
                        <span>Переключатели:</span><p>{{product.switch}}</p>
                    </div>
                    <div class="option" *ngIf="product.switchLube !== 'Нет, спасибо!'">
                        <span>Смазка свитчей:</span><p>{{product.switchLube}}</p>
                    </div>
                    <div class="option" *ngIf="product.tapeMode !== 'Нет, спасибо!'">
                        <span>Tape мод:</span><p>{{product.tapeMode}}</p>
                    </div>
                    <div class="option" *ngIf="product.soundDumping !== false &&     product.soundDumping !== ''">
                        <span>Шумоподавление:</span><p>Да, +5000тг</p>
                    </div>
                  </div>
                  <div class="total">
                    <div class="quantity">
                        <div class="control minus" (click)="getQuantity(i, minus)"><fa-icon   [icon]="minusIcon"></fa-icon></div>
                        <div class="quant">{{product.quantity}}</div>
                                <div class="control plus" (click)="getQuantity(i, plus)"><fa-icon         [icon]="plusIcon"></fa-icon></div>
                    </div>
                    <div class="sum">{{product.quantity * product.totalCardPrice}}тг</div>
                  </div>
                </div>
            </div>
        </div>
</code>```

app-component.ts

```<code>  cardActive(){
  if(this.isCard === false){
    this.isCard = true

  }
    else {
      this.isCard = false
    }
  }

  isCardClose(card: boolean){
  this.isCard = false
  console.log("Working")
  }

ngOnInit(){
     }
</code>```

app-component.html isCardClose() callback function to close sidebar card

```<code><div class="container">
  <router-outlet>
  </router-outlet>
  <app-card *ngIf="isCard" [isCard]="isCard" (toActive)="isCardClose($event)"></app-card>
</div>
<app-footer></app-footer>

</div>
</code>```

I know that problem is here. But why it works in other pages?

```<code>    <div class="card" *ngIf="card != null && card.length > 0">
        <div class="wrap" *ngFor="let product of card; let i = index">
            <img src="{{product.option.selectedOption.img}}">
            <div class="card-detail">
              <header> <a routerLink="/order">{{product.product.title}}</a> <span><fa-icon [icon]="closeIcon" (click)="removeFromCard(i)"></fa-icon></span></header>
              <div class="detail">
                <div class="option" *ngIf="product.option && product.option.selectedOption">
                    <span>{{product.option.name}}:</span><p>{{product.option.selectedOption.name}}</p>
                </div>
                <div class="option">
                    <span>Переключатели:</span><p>{{product.switch}}</p>
                </div>
                <div class="option" *ngIf="product.switchLube !== 'Нет, спасибо!'">
                    <span>Смазка свитчей:</span><p>{{product.switchLube}}</p>
                </div>
                <div class="option" *ngIf="product.tapeMode !== 'Нет, спасибо!'">
                    <span>Tape мод:</span><p>{{product.tapeMode}}</p>
                </div>
                <div class="option" *ngIf="product.soundDumping !== false &&     product.soundDumping !== ''">
                    <span>Шумоподавление:</span><p>Да, +5000тг</p>
                </div>
              </div>
              <div class="total">
                <div class="quantity">
                    <div class="control minus" (click)="getQuantity(i, minus)"><fa-icon   [icon]="minusIcon"></fa-icon></div>
                    <div class="quant">{{product.quantity}}</div>
                            <div class="control plus" (click)="getQuantity(i, plus)"><fa-icon         [icon]="plusIcon"></fa-icon></div>
                </div>
                <div class="sum">{{product.quantity * product.totalCardPrice}}тг</div>
              </div>
            </div>
        </div>
</code>```

Body:
I have a shopping card which a sidebar, and in app-component i have navbar. And when i toggle button on navbar.The app-component where the navbar located, toggle card.component. Everything is working, but for some reason its not works in the app-component. The card.component actually renderes, i see only static template. Although, if I proceed any other page and toggle the card, it shows data, and data comes independently from localstorage. And if i set toggle boolean in the app-component to true by default. I see my card from localstorage. But if retoggle it some reason not shows data. I don't clue why it works like that. But if retoggle it some reason not works. I don't have a clue why it works like that. Though, if i go any other page, the ngIf condition is works. There is something i didn't know, i have no clue.

card.component.ts

import { Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {faClose, faMinus, faPlus} from "@fortawesome/free-solid-svg-icons"

@Component({
  selector: 'app-card',
  templateUrl: './card.component.html',
  styleUrls: ['./card.component.scss']
})
export class CardComponent implements OnInit {
  card: any
  closeIcon = faClose
  minusIcon = faMinus
  plusIcon = faPlus

totalSum: number = 0
minus: boolean = false
plus: boolean = true

removeFromCard(index: any){
if(index ===0){
  index = this.card.length
}
  let i = this.card.length - index
    if(index > -1){
    this.card.splice(i, 1)
    }

if(this.card[0] === null || this.card[0] === undefined){
  localStorage.removeItem("card")
}else {
  localStorage.setItem("card", JSON.stringify(this.card))
}
}

getCardPrice(card: any){
  let sum = 0
  for(let i = 0;i<card.length;i++){
      this.totalSum = sum + card[i].totalCardPrice * card[i].quantity
    }
  this.totalSum = sum
  }

getQuantity(index: any, quant: boolean){
for(let i = 0;i<this.card.length; i++){
  if(i === index){
   if(this.card[i].quantity > 0 && this.card[i].quantity !== 0){
    if(quant){
      this.card[i].quantity = +this.card[i].quantity + 1
     } else {
      if(this.card[i].quantity - 1 !== 0){
        this.card[i].quantity = +this.card[i].quantity - 1
      }else {
        this.card[i].quantity = this.card[i].quantity
      }
     }
   }
  }
}
this.getCardPrice(this.card)
}

  constructor(){
    this.card = localStorage.getItem("card")
    if(this.card === null){
    this.card = null
    console.log(this.card)
    }else {
      this.card = JSON.parse(this.card)

      console.log("not null", this.card)
    }

  }

@Input() isCard: boolean = false
@Output() toActive = new EventEmitter<boolean>()

ngOnInit(){

}

isCloseCard(e:any){
  return false
}

block(event: any){
  event.stopPropaganation()
}
}

card.component.html

Корзина

{{card.length}}

 0">

                   {{product.product.title}} <fa-icon [icon]="closeIcon" (click)="removeFromCard(i)"></fa-icon>

                        {{product.option.name}}:
{{product.option.selectedOption.name}}

                        Переключатели:
{{product.switch}}

                        Смазка свитчей:
{{product.switchLube}}

                        Tape мод:
{{product.tapeMode}}

                        Шумоподавление:
Да, +5000тг

<fa-icon   [icon]="minusIcon"></fa-icon>

{{product.quantity}}

<fa-icon         [icon]="plusIcon"></fa-icon>

{{product.quantity * product.totalCardPrice}}тг

app-component.ts

  cardActive(){
  if(this.isCard === false){
    this.isCard = true

  }
    else {
      this.isCard = false
    }
  }

  isCardClose(card: boolean){
  this.isCard = false
  console.log("Working")
  }

ngOnInit(){
     }

app-component.html isCardClose() callback function to close sidebar card

  <router-outlet>
  </router-outlet>
  <app-card *ngIf="isCard" [isCard]="isCard" (toActive)="isCardClose($event)"></app-card>

<app-footer></app-footer>

I know that problem is here. But why it works in other pages?

 0">

               {{product.product.title}} <fa-icon [icon]="closeIcon" (click)="removeFromCard(i)"></fa-icon>

                    {{product.option.name}}:
{{product.option.selectedOption.name}}

                    Переключатели:
{{product.switch}}

                    Смазка свитчей:
{{product.switchLube}}

                    Tape мод:
{{product.tapeMode}}

                    Шумоподавление:
Да, +5000тг

<fa-icon   [icon]="minusIcon"></fa-icon>

{{product.quantity}}

<fa-icon         [icon]="plusIcon"></fa-icon>

{{product.quantity * product.totalCardPrice}}тг


问:
Read data for localstorage with Vuejs application
I am trying to read data from localstorage in a Vue.js application.

I want to have a web page that displays a table like this :
| Name  | Age  | Mail  |
|-------|------|-------|
| Name  | Age  | Mail  |
| Name2 | Age2 | Mail2 |

I tried to do this in my Vue.js program:

```<code><div class="localstorage">
    <table>
        <thead>
            <tr>
                <th>Key</th>
                <th>Value</th>
            </tr>
        </thead>
        <tbody>
            <tr v-for="(value, key) in store" :key="key">
                <td>{{ key }}</td>
                <td>{{ value }}</td>
            </tr>
        </tbody>
    </table>
</div>
</code>```

By I don't have the table that I want. I get all the values at once

if you have any idea what i can do or or if you have any other tips?

Body:
I am trying to read data from localstorage in a Vue.js application.

I want to have a web page that displays a table like this :
| Name  | Age  | Mail  |
|-------|------|-------|
| Name  | Age  | Mail  |
| Name2 | Age2 | Mail2 |

I tried to do this in my Vue.js program:

                Key
                Value

                {{ key }}
                {{ value }}

By I don't have the table that I want. I get all the values at once

if you have any idea what i can do or or if you have any other tips?


问:
Select2 doesn't select option
I use select2 with AJAX data source. It shows the options, but when I choose one, it doesn't show/select the label. It keeps showing empty or the placeholder.

HTML

```<code><input   name="organization" id="organization" placeholder="Organization" />
</code>```

Javascript

```<code>jQuery('#organization').select2({
            placeholder: 'Select an organization',
            ajax: {
                url: '/organizations.json',
                dataType: 'json',
            }
        });
</code>```

JSON Sample:

```<code>   {
     "results":
     [
      {
       "id": 1,
       "name": "Test Company",
       "value": 1,
       "title": "Test Company",
       "text": "Test Company",
      },
      {
       "id": 2,
       "name": "ABC Company",
       "value": 2,
       "title": "ABC Company",
       "text": "ABC Company",
      }
     ]
   }
</code>```

Am I missing something to make it work?

Title: Select2 doesn't select option

Body:
I use select2 with AJAX data source. It shows the options, but when I choose one, it doesn't show/select the label. It keeps showing empty or the placeholder.

HTML

<input   name="organization" id="organization" placeholder="Organization" />

Javascript

jQuery('#organization').select2({
            placeholder: 'Select an organization',
            ajax: {
                url: '/organizations.json',
                dataType: 'json',
            }
        });

JSON Sample:

   {
     "results":
     [
      {
       "id": 1,
       "name": "Test Company",
       "value": 1,
       "title": "Test Company",
       "text": "Test Company",
      },
      {
       "id": 2,
       "name": "ABC Company",
       "value": 2,
       "title": "ABC Company",
       "text": "ABC Company",
      }
     ]
   }

Am I missing something to make it work?


问:
How to Secure Django Media Files in Production
In my localhost server, I was able to restrict users from accessing pdf media files which they are not supposed to access given that they are not the uploader of the file or the admin of the system.

The problem is that when I tried to deploy my application, the restriction on my media files no longer works.

This is my urls.py

```<code>urlpatterns = [ path('media/pdf/<str:path>', views.pdf, name='pdf'), ]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root= settings.MEDIA_ROOT)
</code>```

And my MEDIA_URL and MEDIA_ROOT in settings.py:

```<code>MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
</code>```

Also my debug is still set to TRUE in deployment, could this also be the problem?

Body:
In my localhost server, I was able to restrict users from accessing pdf media files which they are not supposed to access given that they are not the uploader of the file or the admin of the system.

The problem is that when I tried to deploy my application, the restriction on my media files no longer works.

This is my urls.py

urlpatterns = [ path('media/pdf/<str:path>', views.pdf, name='pdf'), ]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root= settings.MEDIA_ROOT)

And my MEDIA_URL and MEDIA_ROOT in settings.py:

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')

Also my debug is still set to TRUE in deployment, could this also be the problem?


问:
How to i convert the data in the database to JSON in a different format?
This is the data I created in my database

```<code>{
  "id": 1,
  "values": "80,90",
  "name": "number"
},
{
  "id": 2,
  "values": "22351,25252,27123,29123,32123",
  "name": "numbers_1"
},
{
  "id": 3,
  "values": "12351,15252,17123,19123,12123",
  "name": "numbers_2"
}
</code>```

I want to make the data saved in the above database in JSON format with Java as follows. How can I do that?

```<code>{
  "id": 1,
  "highNumber": "80",
  "numbers": [
    {
      "id": 2,
      "numbersCode": "22351,25252,27123,29123,32123"
    }
  ]

},
{
  "id": 2,
  "highNumber": "90",
  "numbers": [
    {
      "id": 1,
      "numbersCode": "22351,25252,27123,29123,32123"
    }
  ]

}
</code>```

I wrote the JDBC connection code, but I don't know how to write what in the while, can you help?

I wrote the JDBC connection code, but I don't know how to write what in the while, can you help?

```<code>public List<Number> getAllNumber() {
    List<Number> list = new ArrayList<>();

    try {
        Class.forName("DriverClass");
        Connection conn = JDBCUtils.getConnection();
        PreparedStatement ps = conn.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();

        while (rs.next()) {
            String number= rs.getString("VALUES");
            System.out.println(number);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    return list;
}
</code>```

What I want to do is return these numbers "22351,25252,27123,29123,32123" for number 80, return these numbers "22351,25252,27123,29123,32123" for number 90.

Body:
This is the data I created in my database

{
  "id": 1,
  "values": "80,90",
  "name": "number"
},
{
  "id": 2,
  "values": "22351,25252,27123,29123,32123",
  "name": "numbers_1"
},
{
  "id": 3,
  "values": "12351,15252,17123,19123,12123",
  "name": "numbers_2"
}

I want to make the data saved in the above database in JSON format with Java as follows. How can I do that?

{
  "id": 1,
  "highNumber": "80",
  "numbers": [
    {
      "id": 2,
      "numbersCode": "22351,25252,27123,29123,32123"
    }
  ]

},
{
  "id": 2,
  "highNumber": "90",
  "numbers": [
    {
      "id": 1,
      "numbersCode": "22351,25252,27123,29123,32123"
    }
  ]

}

I wrote the JDBC connection code, but I don't know how to write what in the while, can you help?

I wrote the JDBC connection code, but I don't know how to write what in the while, can you help?

public List<Number> getAllNumber() {
    List<Number> list = new ArrayList<>();

    try {
        Class.forName("DriverClass");
        Connection conn = JDBCUtils.getConnection();
        PreparedStatement ps = conn.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();

        while (rs.next()) {
            String number= rs.getString("VALUES");
            System.out.println(number);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    return list;
}

What I want to do is return these numbers "22351,25252,27123,29123,32123" for number 80, return these numbers "22351,25252,27123,29123,32123" for number 90.


问:
casting iterator returned by thrust::find_if to a struct pointer
I am using c++ for my project and facing this error in one of my functions.

"a const_cast can only adjust type qualifiers; it cannot change the underlying type"

I am working with thrust library and all my vectors are device type.
The problem is that when I change host_vector to device_vector, I get errors and the above error is one of them.
I need to cast the iterator of find_if(inode) to Node*(Node is a struct). As I mentioned, this problem appears after changing the host_vector to the device_vector. Before that everything's fine.
Unfortunately, I cannot find any solution to this problem so I'm stuck a bit:|
I'm not even sure if I can cast this iterator to the desired struct type.
By the way, if it helps, the type of inode after changing to device_vector is sth like this:
thrust::detail::normal_iteratorthrust::device_ptr<Node>

Could someone help me, please...

Here is my function:
I have tried (*inode), (&inode), (&(*inode)), and so on. And none of them worked.

```<code>Node* getItem(int const& p_itemValue)
{
    auto inode = thrust::find_if(thrust::device, _itemList.begin(), _itemList.end(), __host__ __device__ [&p_itemValue](Node const& p_node)
        {
            return p_node._itemValue == p_itemValue;
        });

    //int index = inode - _itemList.begin();

    if (inode != _itemList.end())
    {
        Node* node = const_cast<Node*>(inode);
        return node;
    }

    return nullptr;
}
</code>```

Body:
I am using c++ for my project and facing this error in one of my functions.

"a const_cast can only adjust type qualifiers; it cannot change the underlying type"

I am working with thrust library and all my vectors are device type.
The problem is that when I change host_vector to device_vector, I get errors and the above error is one of them.
I need to cast the iterator of find_if(inode) to Node*(Node is a struct). As I mentioned, this problem appears after changing the host_vector to the device_vector. Before that everything's fine.
Unfortunately, I cannot find any solution to this problem so I'm stuck a bit:|
I'm not even sure if I can cast this iterator to the desired struct type.
By the way, if it helps, the type of inode after changing to device_vector is sth like this:
thrust::detail::normal_iteratorthrust::device_ptr<Node>

Could someone help me, please...

Here is my function:
I have tried (*inode), (&inode), (&(*inode)), and so on. And none of them worked.

Node* getItem(int const& p_itemValue)
{
    auto inode = thrust::find_if(thrust::device, _itemList.begin(), _itemList.end(), __host__ __device__ [&p_itemValue](Node const& p_node)
        {
            return p_node._itemValue == p_itemValue;
        });

    //int index = inode - _itemList.begin();

    if (inode != _itemList.end())
    {
        Node* node = const_cast<Node*>(inode);
        return node;
    }

    return nullptr;
}


问:
Service worker caches images as html/text when deployed on Vercel

PWA Application Cache error

I'm creating a PWA Application with React. I've created a fallback page for when the application is offline. I would like to have a image showing when offline, so I cached it successfully on localhost but when deployed on Vercel, the caching isn't right.

On localhost png caches as image/png.

localhost screenshot

When deployed on Vercel, caches content is Text/Html

vercel screenshot

const staticCache = "site-static-v1";:

const assets = [
  "index.html",
  "offline.html",
  "script/useSW.js",
  "assets/Logo-offline.png",
];

self.addEventListener("install", (event) => {
  event.waitUntil(
    caches.open(staticCache).then((cache) => {
      cache.addAll(assets);
    })
  );
});
```

Anyone knows how to solve this issue?

Body:
PWA Application Cache error

I'm creating a PWA Application with React. I've created a fallback page for when the application is offline. I would like to have a image showing when offline, so I cached it successfully on localhost but when deployed on Vercel, the caching isn't right.

On localhost png caches as image/png.

localhost screenshot

When deployed on Vercel, caches content is Text/Html

vercel screenshot

const staticCache = "site-static-v1";:

const assets = [
  "index.html",
  "offline.html",
  "script/useSW.js",
  "assets/Logo-offline.png",
];

self.addEventListener("install", (event) => {
  event.waitUntil(
    caches.open(staticCache).then((cache) => {
      cache.addAll(assets);
    })
  );
});

Anyone knows how to solve this issue?


问:
Android studio running tasks indicator is not visible
In my android studio while rebuilding project or running the code, I am not able to visible the loading indicator at the bottom of screen. I am attaching the screenshots for what i can't able to see on my android studio screen.

I want that indicator while rebuilding or running the code in android studio


问:
The issue with downloading files with Selenium with Jenkins
Testers may have this issue for sure.

Assume that we have a testcase that should be automated. And it has a step to download a file from the webpage by clicking a link and it will be downloaded to our local machine’s download folder. As the next step it should be verified that the file is downloaded.

So in a local machine this can be handled easily by using the download paths and all. But the matter that I have is this exact same testcase is getting fail in Jenkins (cloud run). It returns a null value because the download directory cannot be found in Jenkins.

Do you guys know what kind of solution that can we take for this? I heard something using API request to download the file. Yes this file is also getting downloaded by a GET request with parameters. But I don’t know how to perform that.

Thanks for your time.

I tried the bellow options.

Changing the directory to Windows and Linux as per the documents

By using jenkins home directory

What I want to do?

to verify that the file is downloaded

Read the file and check with the db (This has existing methods)


问:
Adding Excel Formula to Data Validation List
I need some help with putting this formula in cell C3 of Sheet1 into a data validation list please. I have a sheet (ScoreSheet) that lists all the subjects including year 2 and 3 exam scores. When a subject (Biology, Physics, Chemistry) is entered into Cell D3 of Sheet1, the dropdown list of Cell C3 of Sheet1 should reflect the student's test scores, exam retake scores and final exam scores. So if I entered 'Biology' in Cell D3 and the student took the tests and/or exams multiple times, I want all scores to appear in the data validation list of Cell C3.

```<code>=IFERROR(VLOOKUP(D3,CHOOSE({3,2,1},ScoreSheet!B2:B6,ScoreSheet!C2:C6,ScoreSheet!D2:D6),3,0),0)
</code>```

Screenshot of Cell 3 and Formula

I tried using the if statement in the data validation list but in instances where the scores appear more than 7 times, the data validation fails.

Body:
I need some help with putting this formula in cell C3 of Sheet1 into a data validation list please. I have a sheet (ScoreSheet) that lists all the subjects including year 2 and 3 exam scores. When a subject (Biology, Physics, Chemistry) is entered into Cell D3 of Sheet1, the dropdown list of Cell C3 of Sheet1 should reflect the student's test scores, exam retake scores and final exam scores. So if I entered 'Biology' in Cell D3 and the student took the tests and/or exams multiple times, I want all scores to appear in the data validation list of Cell C3.

=IFERROR(VLOOKUP(D3,CHOOSE({3,2,1},ScoreSheet!B2:B6,ScoreSheet!C2:C6,ScoreSheet!D2:D6),3,0),0)

Screenshot of Cell 3 and Formula

I tried using the if statement in the data validation list but in instances where the scores appear more than 7 times, the data validation fails.


问:
How can I differentiate between code block and normal string in string
I am having one string as given below:

```<code>"explain this code \n dependencies {\n    implementation 'com.squareup.okhttp3:okhttp:3.9.1'\n    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.20'\n    implementation 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.8.0'\n    //implementation 'org.conscrypt:conscrypt-android:1.4.0'\n    // runtimeOnly 'org.conscrypt:conscrypt-android:2.2.1'\n    implementation 'com.google.android:android:4.1.1.4'\n    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'\n    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'\n}"
</code>```

Now in the above string, how can I differentiate between the normal string part and the code block as I want to highlight the code block with highlight.js.

I have tried using highlight.js but its highlights normal string as well.

Body:
I am having one string as given below:

"explain this code \n dependencies {\n    implementation 'com.squareup.okhttp3:okhttp:3.9.1'\n    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.20'\n    implementation 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.8.0'\n    //implementation 'org.conscrypt:conscrypt-android:1.4.0'\n    // runtimeOnly 'org.conscrypt:conscrypt-android:2.2.1'\n    implementation 'com.google.android:android:4.1.1.4'\n    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'\n    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'\n}"

Now in the above string, how can I differentiate between the normal string part and the code block as I want to highlight the code block with highlight.js.

I have tried using highlight.js but its highlights normal string as well.


问:
Not able to upload large file to sharepoint using graph
i need to upload large to sharepoint using graph rest api but i am facing issue in uploading any one can suggest solution

{
"error":
{
"code":"invalidRequest",
"message":"The Content-Range header is missing or malformed."
}
}


问:
Firestore Connection Dropped Error in React Unit Test
I'm using Firestore as my backend for my React app. I'm implementing unit testing, but it throws me an error as such:

```<code>@firebase/firestore: Firestore (9.14.0): Connection GRPC stream error. Code: 14 Message: 14 UNAVAILABLE: Connection dropped
</code>```

After that, it logs me another error:

```<code>@firebase/firestore: Firestore (9.14.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unavailable]: 14 UNAVAILABLE: Connection dropped
    This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend
</code>```

My guess is that I'm unable to call to the database when unit testing.

Is there a way I can work around this error? Or do I have to make a mock for it? If yes, is there a reference I can refer to regarding this?

Body:
I'm using Firestore as my backend for my React app. I'm implementing unit testing, but it throws me an error as such:

@firebase/firestore: Firestore (9.14.0): Connection GRPC stream error. Code: 14 Message: 14 UNAVAILABLE: Connection dropped

After that, it logs me another error:

@firebase/firestore: Firestore (9.14.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unavailable]: 14 UNAVAILABLE: Connection dropped
    This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend

My guess is that I'm unable to call to the database when unit testing.

Is there a way I can work around this error? Or do I have to make a mock for it? If yes, is there a reference I can refer to regarding this?


问:
How to get the name of the speedDial rendered element in MuiV4?
I have the following code where I want to get the name of the clicked element but for some reason it is not compatible with any type of action in typescript ?

const _setModal = () => {
    const element = e.currentTarget;
    const name = element.name;

    // the the modal acording to the name at hand
  };

  const actions = [
    { icon: <HelpIcon name='tutorial' />, name: 'Tutorial', onClick: _setModal },
    { icon: <AddCircleIcon />, name: 'Add Day', onClick: _setModal },
  ];

   return (
    <SpeedDial
    >
      {actions.map((el) => {

        return <SpeedDialAction id={el.name} key={el.name} icon={el.icon}               onClick={el.onClick} />;
      })}

    </SpeedDial>
  );```


问:
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: How to i fix it?
Error All

```<code>Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot invoke "javafx.scene.control.Label.setText(String)" because "this.as" is null
    at com.gluonhq.samples.comments.views.ProfilePresenter.initData(ProfilePresenter.java:51)
    at com.gluonhq.samples.comments.views.CommentsPresenter.lambda$initialize$3(CommentsPresenter.java:104)
    at javafx.base@19/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base@19/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
    at javafx.base@19/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base@19/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base@19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base@19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base@19/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base@19/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics@19/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3599)
    at javafx.graphics@19/javafx.scene.Scene$MouseHandler.process(Scene.java:3903)
    at javafx.graphics@19/javafx.scene.Scene.processMouseEvent(Scene.java:1887)
    at javafx.graphics@19/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2620)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
    at javafx.graphics@19/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
    at javafx.graphics@19/com.sun.glass.ui.View.notifyMouse(View.java:937)
    at javafx.graphics@19/com.sun.glass.ui.mac.MacView.notifyMouse(MacView.java:127)

</code>```

ProfilePresenter.java
Here is my fxml controller and I'm fetching the information from the commentPresenter

```<code>package com.gluonhq.samples.comments.views;

import com.gluonhq.charm.glisten.animation.BounceInRightTransition;
import com.gluonhq.charm.glisten.application.AppManager;
import com.gluonhq.charm.glisten.control.AppBar;
import com.gluonhq.charm.glisten.control.ListTile;
import com.gluonhq.charm.glisten.mvc.View;
import com.gluonhq.charm.glisten.visual.MaterialDesignIcon;
import com.gluonhq.samples.comments.model.Comment;
import javafx.beans.binding.Bindings;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.text.Text;

import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;

public class ProfilePresenter  {

@FXML
protected View profile;
@FXML
private Label as;

@FXML
private ImageView jembatan;

@FXML
private Button back;

@FXML
private Label bridge;

    private String data;

    public void initData(Comment comment){
        var listSel = comment;

        String value = listSel.getAuthor();
        as.setText(value);
    }

    public  void setData(String name) {
       data = name;
    }

    public void initialize() {
        Image img = new Image("jembatan_1.jpeg");
        jembatan.setImage(img);

        profile.showingProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue) {
                AppBar appBar = AppManager.getInstance().getAppBar();
                appBar.setNavIcon(MaterialDesignIcon.ARROW_BACK.button(e ->
                        AppViewManager.COMMENTS_VIEW.switchView()));
                appBar.setTitleText("Brigde Profile");
            }
        });

    }

    public void updateData(String content) {
        bridge.setText(content);
    }

}
</code>```

CommentPresenter.java
Here is my fxml controller and I'm fetching the information from the commentPresenter

```<code>/*
 * Copyright (c) 2016, 2021, Gluon
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *     * Neither the name of Gluon, any associated website, nor the
 * names of its contributors may be used to endorse or promote products
 * derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL GLUON BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package com.gluonhq.samples.comments.views;

import com.gluonhq.charm.glisten.application.AppManager;
import com.gluonhq.charm.glisten.control.AppBar;
import com.gluonhq.charm.glisten.control.FloatingActionButton;
import com.gluonhq.charm.glisten.mvc.View;
import com.gluonhq.charm.glisten.visual.MaterialDesignIcon;
import com.gluonhq.samples.comments.cloud.Service;
import com.gluonhq.samples.comments.model.Comment;

import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;

import javax.inject.Inject;
import java.io.IOException;

public class CommentsPresenter{

    @Inject
    protected Service service;

    @FXML
    protected View comments;

    @FXML
    protected ListView<Comment> commentsList;

    public void initialize() {
        comments.showingProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue) {
                AppBar appBar = AppManager.getInstance().getAppBar();
                appBar.setNavIcon(MaterialDesignIcon.MENU.button(e ->
                        AppManager.getInstance().getDrawer().open()));
                appBar.setTitleText("List Bridge");
            }
        });

        commentsList.setCellFactory(p -> new CommentListCell());
        commentsList.setPlaceholder(new Label("There are no comments"));
        commentsList.getItems().add(new Comment("1","Jembatan Merah", "Palembang Indonesia"));

        commentsList.setOnMouseClicked(mouseEvent -> {

            var myIndex = commentsList.getSelectionModel().getSelectedIndex();
            var test = commentsList.getItems().get(myIndex);

            ProfilePresenter profilePresenter = new ProfilePresenter();

            profilePresenter.initData(commentsList.getSelectionModel().getSelectedItem());
            AppViewManager.PROFILE_VIEW.switchView();

        });

        service.retrieveComments();
    }

}
</code>```

I conveyed information from the Comment Presenter to the Presenter Profile and then I wanted to setText my label but instead there was an error like the one above, but when it was printed in the console the data appeared. How to Fix It

Body:
Error All

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot invoke "javafx.scene.control.Label.setText(String)" because "this.as" is null
    at com.gluonhq.samples.comments.views.ProfilePresenter.initData(ProfilePresenter.java:51)
    at com.gluonhq.samples.comments.views.CommentsPresenter.lambda$initialize$3(CommentsPresenter.java:104)
    at javafx.base@19/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base@19/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
    at javafx.base@19/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base@19/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base@19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base@19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base@19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base@19/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base@19/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base@19/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics@19/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3599)
    at javafx.graphics@19/javafx.scene.Scene$MouseHandler.process(Scene.java:3903)
    at javafx.graphics@19/javafx.scene.Scene.processMouseEvent(Scene.java:1887)
    at javafx.graphics@19/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2620)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
    at javafx.graphics@19/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
    at javafx.graphics@19/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
    at javafx.graphics@19/com.sun.glass.ui.View.notifyMouse(View.java:937)
    at javafx.graphics@19/com.sun.glass.ui.mac.MacView.notifyMouse(MacView.java:127)

ProfilePresenter.java
Here is my fxml controller and I'm fetching the information from the commentPresenter

package com.gluonhq.samples.comments.views;

import com.gluonhq.charm.glisten.animation.BounceInRightTransition;
import com.gluonhq.charm.glisten.application.AppManager;
import com.gluonhq.charm.glisten.control.AppBar;
import com.gluonhq.charm.glisten.control.ListTile;
import com.gluonhq.charm.glisten.mvc.View;
import com.gluonhq.charm.glisten.visual.MaterialDesignIcon;
import com.gluonhq.samples.comments.model.Comment;
import javafx.beans.binding.Bindings;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.text.Text;

import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;

public class ProfilePresenter  {

@FXML
protected View profile;
@FXML
private Label as;

@FXML
private ImageView jembatan;

@FXML
private Button back;

@FXML
private Label bridge;

    private String data;

    public void initData(Comment comment){
        var listSel = comment;

        String value = listSel.getAuthor();
        as.setText(value);
    }

    public  void setData(String name) {
       data = name;
    }

    public void initialize() {
        Image img = new Image("jembatan_1.jpeg");
        jembatan.setImage(img);

        profile.showingProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue) {
                AppBar appBar = AppManager.getInstance().getAppBar();
                appBar.setNavIcon(MaterialDesignIcon.ARROW_BACK.button(e ->
                        AppViewManager.COMMENTS_VIEW.switchView()));
                appBar.setTitleText("Brigde Profile");
            }
        });

    }

    public void updateData(String content) {
        bridge.setText(content);
    }

}

CommentPresenter.java
Here is my fxml controller and I'm fetching the information from the commentPresenter

/*
 * Copyright (c) 2016, 2021, Gluon
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *     * Neither the name of Gluon, any associated website, nor the
 * names of its contributors may be used to endorse or promote products
 * derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL GLUON BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package com.gluonhq.samples.comments.views;

import com.gluonhq.charm.glisten.application.AppManager;
import com.gluonhq.charm.glisten.control.AppBar;
import com.gluonhq.charm.glisten.control.FloatingActionButton;
import com.gluonhq.charm.glisten.mvc.View;
import com.gluonhq.charm.glisten.visual.MaterialDesignIcon;
import com.gluonhq.samples.comments.cloud.Service;
import com.gluonhq.samples.comments.model.Comment;

import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;

import javax.inject.Inject;
import java.io.IOException;

public class CommentsPresenter{

    @Inject
    protected Service service;

    @FXML
    protected View comments;

    @FXML
    protected ListView<Comment> commentsList;

    public void initialize() {
        comments.showingProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue) {
                AppBar appBar = AppManager.getInstance().getAppBar();
                appBar.setNavIcon(MaterialDesignIcon.MENU.button(e ->
                        AppManager.getInstance().getDrawer().open()));
                appBar.setTitleText("List Bridge");
            }
        });

        commentsList.setCellFactory(p -> new CommentListCell());
        commentsList.setPlaceholder(new Label("There are no comments"));
        commentsList.getItems().add(new Comment("1","Jembatan Merah", "Palembang Indonesia"));

        commentsList.setOnMouseClicked(mouseEvent -> {

            var myIndex = commentsList.getSelectionModel().getSelectedIndex();
            var test = commentsList.getItems().get(myIndex);

            ProfilePresenter profilePresenter = new ProfilePresenter();

            profilePresenter.initData(commentsList.getSelectionModel().getSelectedItem());
            AppViewManager.PROFILE_VIEW.switchView();

        });

        service.retrieveComments();
    }

}

I conveyed information from the Comment Presenter to the Presenter Profile and then I wanted to setText my label but instead there was an error like the one above, but when it was printed in the console the data appeared. How to Fix It


问:
Can MathJax use anything else than curly braces to write symbols like sqrt{} or frac{}?
I'm using MathJax to render math equations on my website. I use Python to create those math equations and I use f-strings a lot.

Currently, I have to concatenate every string because to write a square root in mathJax (as far as I can tell), you can only use sqrt{x=3}, but that's a problem because in Python f-strings use {} too.

Is there any other way to write a square root in mathJax or fraction in mathJax without using curly brackets?

An example of what I'm talking about/in other words:

Off of what I know currently, this is how you write a square root in mathJax:

$$sqrt{4}$$
```
<p>But in Python when dealing with f-strings:</p>
<pre class="lang-py prettyprint-override"><code>x = 4
equation = f'$$sqrt{x}$$'
</code>```

creates

$$sqrt4$$
```
<p>– which is not what I want.</p>
<p>Of course I see that you can just concatenate the string by doing and not do an f-string:</p>
<pre class="lang-py prettyprint-override"><code>equation = '$$sqrt{' + x + '}$$'
</code>```

However when I'm doing larger problems, and I'm making a lot of varying equations and this takes forever to do for every string.

Body:
I'm using MathJax to render math equations on my website. I use Python to create those math equations and I use f-strings a lot.

Currently, I have to concatenate every string because to write a square root in mathJax (as far as I can tell), you can only use sqrt{x=3}, but that's a problem because in Python f-strings use {} too.

Is there any other way to write a square root in mathJax or fraction in mathJax without using curly brackets?

An example of what I'm talking about/in other words:

Off of what I know currently, this is how you write a square root in mathJax:

$$sqrt{4}$$

But in Python when dealing with f-strings:

x = 4
equation = f'$$sqrt{x}$$'

creates

$$sqrt4$$

– which is not what I want.

Of course I see that you can just concatenate the string by doing and not do an f-string:

equation = '$$sqrt{' + x + '}$$'

However when I'm doing larger problems, and I'm making a lot of varying equations and this takes forever to do for every string.


问:
git alias not accepting shell command, Does it have any solution?
Working alias for ref:

```<code>git config  --global alias.br "branch -vva"
</code>```

The below alias not working

```<code>git config  --global alias.br "branch -vva  | awk '{print $1}'"
</code>```

The Git alias is not working after adding awk in command. Does it have any fix for it?

Running alias as below in terminal:

```<code>git br
</code>```

Body:
Working alias for ref:

git config  --global alias.br "branch -vva"

The below alias not working

git config  --global alias.br "branch -vva  | awk '{print $1}'"

The Git alias is not working after adding awk in command. Does it have any fix for it?

Running alias as below in terminal:

git br


问:
Disable default value of a column in Postgresql
I know how to remove or set the default value of a column in PostgreSQL.

```<code>ALTER TABLE products ALTER COLUMN price DROP DEFAULT;
ALTER TABLE products ALTER COLUMN price SET DEFAULT 7.77;
</code>```

However is there a way to disable the default value of a column?

My scenario is to ingest data in a table however (I think) the default value of a column is not letting me ingest the data. I want to either disable the default value for the ingestion and then enable it or I want to drop the default values of all the tables (keeping the record of dropped values) and then set the values again to default.

Is there an efficient way of doing this?

Body:
I know how to remove or set the default value of a column in PostgreSQL.

ALTER TABLE products ALTER COLUMN price DROP DEFAULT;
ALTER TABLE products ALTER COLUMN price SET DEFAULT 7.77;

However is there a way to disable the default value of a column?

My scenario is to ingest data in a table however (I think) the default value of a column is not letting me ingest the data. I want to either disable the default value for the ingestion and then enable it or I want to drop the default values of all the tables (keeping the record of dropped values) and then set the values again to default.

Is there an efficient way of doing this?


问:
ImportError: DLL load failed while importing win32api: The specified procedure could not be found. pyinstaller
The files i have imported in my code:

```<code>import datetime as dt
#import pyautogui
#import win32api
#from Screenshot import Screenshot
#from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import imghdr
from email.message import EmailMessage
import smtplib
import time
import base64
from io import BytesIO
</code>```

The Traceback:
Traceback (most recent call last):
File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32comgenpy.py", line 40, in
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "win32com_init_.py", line 5, in
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.

I am getting this error while trying to run my application that i just converted using pyinstaller.
I have tried importing pywin32, win32api etc. but the issue remains.
I have also tried using the --hidden-import=modulename and have also tested the .py file which is running fine but when i convert it to .exe, this error is thrown. Can someone please help me?

Body:
The files i have imported in my code:

import datetime as dt
#import pyautogui
#import win32api
#from Screenshot import Screenshot
#from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import imghdr
from email.message import EmailMessage
import smtplib
import time
import base64
from io import BytesIO

The Traceback:
Traceback (most recent call last):
File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32comgenpy.py", line 40, in
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "win32com_init_.py", line 5, in
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.

I am getting this error while trying to run my application that i just converted using pyinstaller.
I have tried importing pywin32, win32api etc. but the issue remains.
I have also tried using the --hidden-import=modulename and have also tested the .py file which is running fine but when i convert it to .exe, this error is thrown. Can someone please help me?


问:
isDirty is always false when having react-hook-form, forwardRef, and react-router-dom
I am a student who is new to React. I currently try to build a form using yup, react-hook-form, styled-components, and react-router-dom for navigating and switching between sites.
The problem is the when I try to test if the input field is blank, or back to blank input when user erases the input field, formState.touchedFields are working, except for isDirty and dirtyFields continuing being blank or false. This problem only occurs when trying to use isDirty, and dirtyFields with the custom Input component that has forwardRef.

When submitting, the console log still prints the useForm's data. Also, when accessing the touchedFields in the formState, it still prints if the user has touched the input. However, when printing isDirty, or dirtyFields, it keeps being false or empty object.

const Input = forwardRef((props, ref) => (
  <input ref={ref} {...props} />
));
const validationSchema = yup.object().shape({
  username: yup.string().required('Username is required')
});
```
<pre class="lang-js prettyprint-override"><code>const LoginForm = () => {
  const defaultValues = { username: '' };
  const { register, handleSubmit, formState: { errors, isDirty, touchedFields } } = useForm({
    defaultValues: defaultValues,
    resolver: yupResolver(validationSchema)
  });

  const onSubmit = (data) => {
    console.log(data); // working
    console.log(touchedFields); // working
    console.log(isDirty); // always being False despite inputting input
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <Input
        type="text"
        placeholder="Username"
        {...register('username')}
      />
      <button type="submit" disabled={!formState.isDirty}>
        Login
      </button>
    </form>
  );
};
</code>```

However, if I try with simple input (not using custom Input), the isDirty works normally.

<input {...register('username')} />
```
<p>I also try fixing the same as <em><strong>How to share ref usage?</strong></em> in the <em><strong>reat-hook-form</strong></em> documentation, but it gives me error</p>
<pre class="lang-js prettyprint-override"><code>const Input = forwardRef((props, ref, register, registerName) => (
  <input ref={(event) => {
        register(registerName).ref(event);
        ref.current = event;} } {...props} />
));
const validationSchema = yup.object().shape({
  username: yup.string().required('Username is required')
});
</code>```

  <input ref={ref} register={register} registerName="username" {...props} />
```
```react-dom.development.js:12056 Uncaught TypeError: Cannot set properties of null (setting 'current')
    at ref (Input.jsx:65:13)
    at commitAttachRef (react-dom.development.js:23645:20)
    at commitLayoutEffectOnFiber (react-dom.development.js:23503:9)
    at commitLayoutMountEffects_complete (react-dom.development.js:24688:9)
    at commitLayoutEffects_begin (react-dom.development.js:24674:7)
    at commitLayoutEffects (react-dom.development.js:24612:3)
    at commitRootImpl (react-dom.development.js:26823:5)
    at commitRoot (react-dom.development.js:26682:5)
    at performSyncWorkOnRoot (react-dom.development.js:26117:3)
    at flushSyncCallbacks (react-dom.development.js:12042:22)
```
```The above error occurred in the <input> component:

    at input
    at O2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1155:6)
    at Input2 (http://localhost:5173/src/components/Input/Input.jsx?t=1672837406977:23:3)
    at form
    at O2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1155:6)
    at TweetInput (http://localhost:5173/src/components/Sections/TweetSection/TweetInput.jsx?t=1672837406977:26:6)
    at div
    at O2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1155:6)
    at Home (http://localhost:5173/src/pages/Home.jsx?t=1672837406977:28:6)
    at RenderedRoute (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:2707:5)
    at Outlet (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:2972:26)
    at div
    at VisualElementHandler (http://localhost:5173/node_modules/.vite/deps/framer-motion.js?v=cb867138:273:28)
    at MotionComponent (http://localhost:5173/node_modules/.vite/deps/framer-motion.js?v=cb867138:299:40)
    at O2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1155:6)
    at Main (http://localhost:5173/src/pages/Main.jsx?t=1672828435928:41:3)
    at RenderedRoute (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:2707:5)
    at Routes (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:3032:5)
    at PresenceChild (http://localhost:5173/node_modules/.vite/deps/framer-motion.js?v=cb867138:6253:24)
    at AnimatePresence (http://localhost:5173/node_modules/.vite/deps/framer-motion.js?v=cb867138:6308:26)
    at Fe (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1110:40)
    at div
    at App (http://localhost:5173/src/App.jsx?t=1672837406977:39:33)
    at PersistGate2 (http://localhost:5173/node_modules/.vite/deps/redux-persist_integration_react.js?v=cb867138:90:5)
    at Provider (http://localhost:5173/node_modules/.vite/deps/react-redux.js?v=cb867138:823:3)
    at QueryClientProvider (http://localhost:5173/node_modules/.vite/deps/chunk-RMCMWTPY.js?v=cb867138:2624:3)
    at Router (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:2979:15)
    at BrowserRouter (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:3390:5)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
```

May I ask what's the problem?

Body:
I am a student who is new to React. I currently try to build a form using yup, react-hook-form, styled-components, and react-router-dom for navigating and switching between sites.
The problem is the when I try to test if the input field is blank, or back to blank input when user erases the input field, formState.touchedFields are working, except for isDirty and dirtyFields continuing being blank or false. This problem only occurs when trying to use isDirty, and dirtyFields with the custom Input component that has forwardRef.

When submitting, the console log still prints the useForm's data. Also, when accessing the touchedFields in the formState, it still prints if the user has touched the input. However, when printing isDirty, or dirtyFields, it keeps being false or empty object.

const Input = forwardRef((props, ref) => (
  <input ref={ref} {...props} />
));
const validationSchema = yup.object().shape({
  username: yup.string().required('Username is required')
});

const LoginForm = () => {
  const defaultValues = { username: '' };
  const { register, handleSubmit, formState: { errors, isDirty, touchedFields } } = useForm({
    defaultValues: defaultValues,
    resolver: yupResolver(validationSchema)
  });

  const onSubmit = (data) => {
    console.log(data); // working
    console.log(touchedFields); // working
    console.log(isDirty); // always being False despite inputting input
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <Input
        type="text"
        placeholder="Username"
        {...register('username')}
      />
      <button type="submit" disabled={!formState.isDirty}>
        Login
      </button>
    </form>
  );
};

However, if I try with simple input (not using custom Input), the isDirty works normally.

<input {...register('username')} />

I also try fixing the same as How to share ref usage? in the reat-hook-form documentation, but it gives me error

const Input = forwardRef((props, ref, register, registerName) => (
  <input ref={(event) => {
        register(registerName).ref(event);
        ref.current = event;} } {...props} />
));
const validationSchema = yup.object().shape({
  username: yup.string().required('Username is required')
});

  <input ref={ref} register={register} registerName="username" {...props} />

react-dom.development.js:12056 Uncaught TypeError: Cannot set properties of null (setting 'current')
    at ref (Input.jsx:65:13)
    at commitAttachRef (react-dom.development.js:23645:20)
    at commitLayoutEffectOnFiber (react-dom.development.js:23503:9)
    at commitLayoutMountEffects_complete (react-dom.development.js:24688:9)
    at commitLayoutEffects_begin (react-dom.development.js:24674:7)
    at commitLayoutEffects (react-dom.development.js:24612:3)
    at commitRootImpl (react-dom.development.js:26823:5)
    at commitRoot (react-dom.development.js:26682:5)
    at performSyncWorkOnRoot (react-dom.development.js:26117:3)
    at flushSyncCallbacks (react-dom.development.js:12042:22)

The above error occurred in the <input> component:

    at input
    at O2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1155:6)
    at Input2 (http://localhost:5173/src/components/Input/Input.jsx?t=1672837406977:23:3)
    at form
    at O2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1155:6)
    at TweetInput (http://localhost:5173/src/components/Sections/TweetSection/TweetInput.jsx?t=1672837406977:26:6)
    at div
    at O2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1155:6)
    at Home (http://localhost:5173/src/pages/Home.jsx?t=1672837406977:28:6)
    at RenderedRoute (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:2707:5)
    at Outlet (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:2972:26)
    at div
    at VisualElementHandler (http://localhost:5173/node_modules/.vite/deps/framer-motion.js?v=cb867138:273:28)
    at MotionComponent (http://localhost:5173/node_modules/.vite/deps/framer-motion.js?v=cb867138:299:40)
    at O2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1155:6)
    at Main (http://localhost:5173/src/pages/Main.jsx?t=1672828435928:41:3)
    at RenderedRoute (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:2707:5)
    at Routes (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:3032:5)
    at PresenceChild (http://localhost:5173/node_modules/.vite/deps/framer-motion.js?v=cb867138:6253:24)
    at AnimatePresence (http://localhost:5173/node_modules/.vite/deps/framer-motion.js?v=cb867138:6308:26)
    at Fe (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=cb867138:1110:40)
    at div
    at App (http://localhost:5173/src/App.jsx?t=1672837406977:39:33)
    at PersistGate2 (http://localhost:5173/node_modules/.vite/deps/redux-persist_integration_react.js?v=cb867138:90:5)
    at Provider (http://localhost:5173/node_modules/.vite/deps/react-redux.js?v=cb867138:823:3)
    at QueryClientProvider (http://localhost:5173/node_modules/.vite/deps/chunk-RMCMWTPY.js?v=cb867138:2624:3)
    at Router (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:2979:15)
    at BrowserRouter (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=cb867138:3390:5)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.

May I ask what's the problem?


问:
How to change Doxygen macro / function arguments formatting?
I want to change Doxygen macros and function arguments formatting. Whatever this formatting is trying to achieve can be done with @param, which will describe function parameters way better in the section down below. Also, explicitly saying void as function arguments formats it with some strange spacing, while right above it Doxygen understood that nop(void) is equal to nop(), which just drives me crazy.

I think that macro / function arguments formatting should be a configurable option. I want to change mine formatting from multiline to one line, since I don't see the benefits of doing otherwise.

```<code>#define ADD(a, b) a + b
int add(int a, int b)
</code>```

I couldn't find anything about function arguments formatting. About void people said to use aliases, but gave no examples, so I am stuck here. Hope I gave enough info on what I am trying to achieve!

Body:
I want to change Doxygen macros and function arguments formatting. Whatever this formatting is trying to achieve can be done with @param, which will describe function parameters way better in the section down below. Also, explicitly saying void as function arguments formats it with some strange spacing, while right above it Doxygen understood that nop(void) is equal to nop(), which just drives me crazy.

I think that macro / function arguments formatting should be a configurable option. I want to change mine formatting from multiline to one line, since I don't see the benefits of doing otherwise.

#define ADD(a, b) a + b
int add(int a, int b)

I couldn't find anything about function arguments formatting. About void people said to use aliases, but gave no examples, so I am stuck here. Hope I gave enough info on what I am trying to achieve!


问:
Loading .vds files at specific scenes and auto play using Javascript version of SAPUI5 VDS Viewer
I have been working with the SAPUI5 Viewer API (Javascript). Loading the .vds files works as expected. I have been looking for a way to select which scene I would like to start on and to auto play that scene. I have looked through the API Documentation and cannot find a setScene(), or similar, function. I do see sap.ui.vk.AnimationPlayer has a play function. Does anyone know of a way to accomplish this? Thanks in advance for any help.

Here is a link to the SAPUI5 Viewer

I have looked through the API Documentation with no luck.


问:
how to specify the PCCS_URL
I have installed and COnfigured the PCCS, using link :
https://www.intel.com/content/www/us/en/developer/articles/guide/intel-software-guard-extensions-data-center-attestation-primitives-quick-install-guide.html
my question is that how can I specify PCCS_URL in /opt/intel/sgx-pck-id-retrieval-tool/network_setting.conf  while I have installed the PCCS on the same machine?
PCCS is installed in /opt/intel/sgx-dcap-pccs dir.
I tried :

```<code>PCCS_URL=https://localhost:8081/sgx/certification/v4/platforms
</code>```

Title: how to specify the PCCS_URL

Body:
I have installed and COnfigured the PCCS, using link :
https://www.intel.com/content/www/us/en/developer/articles/guide/intel-software-guard-extensions-data-center-attestation-primitives-quick-install-guide.html
my question is that how can I specify PCCS_URL in /opt/intel/sgx-pck-id-retrieval-tool/network_setting.conf  while I have installed the PCCS on the same machine?
PCCS is installed in /opt/intel/sgx-dcap-pccs dir.
I tried :

PCCS_URL=https://localhost:8081/sgx/certification/v4/platforms


问:
How to export Class properties to JSON
I have defined the following class:

```<code>class Person:

    def __init__(self, name):
        self.name = name
        self.children = []

    def add_child(self, name, age):
        tmp = {}
        tmp["name"] = name
        tmp["age"] = age
        self.children.append(tmp)
</code>```

I have list of these classes persons, and I would like to export it to JSON. However I have problem with exporting list of dictionaries (children), what is one of the property.

I have tried this:

```<code>s = json.dumps(persons.__dict__)
</code>```

but it returns error

```<code>AttributeError: 'list' object has no attribute '__dict__'
</code>```

Is there any way how to simply export it?

Title: How to export Class properties to JSON

Body:
I have defined the following class:

class Person:

    def __init__(self, name):
        self.name = name
        self.children = []

    def add_child(self, name, age):
        tmp = {}
        tmp["name"] = name
        tmp["age"] = age
        self.children.append(tmp)

I have list of these classes persons, and I would like to export it to JSON. However I have problem with exporting list of dictionaries (children), what is one of the property.

I have tried this:

s = json.dumps(persons.__dict__)

but it returns error

AttributeError: 'list' object has no attribute '__dict__'

Is there any way how to simply export it?


问:
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup - Spring Boot and Swagger Entegration
When I add Swagger to Spring Boot project, I get error I mentioned.

I tried a lot but couldn't find the problem.

Error

```<code>Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup
</code>```

Main class

```<code>@SpringBootApplication
@Import({SwaggerConfiguration.class})
public class ExampleMain {
    public static void main(String[] args) {
        SpringApplication.run(ExampleMain.class, args);
    }
}
</code>```

pom.xml

```<code>            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>2.7.4</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>3.0.0</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.2</version>
            </dependency>

            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>3.0.0</version>
            </dependency>
</code>```

SwaggerConfiguration class

```<code>@Configuration
@EnableSwagger2
public class SwaggerConfiguration {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2).select()
                .apis(RequestHandlerSelectors.basePackage("com.example.rest")).paths(PathSelectors.any())
                .build();
    }

}
</code>```

Why does this problem occur, How can I fix?

Body:
When I add Swagger to Spring Boot project, I get error I mentioned.

I tried a lot but couldn't find the problem.

Error

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup

Main class

@SpringBootApplication
@Import({SwaggerConfiguration.class})
public class ExampleMain {
    public static void main(String[] args) {
        SpringApplication.run(ExampleMain.class, args);
    }
}

pom.xml

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>2.7.4</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>3.0.0</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.2</version>
            </dependency>

            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>3.0.0</version>
            </dependency>

SwaggerConfiguration class

@Configuration
@EnableSwagger2
public class SwaggerConfiguration {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2).select()
                .apis(RequestHandlerSelectors.basePackage("com.example.rest")).paths(PathSelectors.any())
                .build();
    }

}

Why does this problem occur, How can I fix?


问:
WPF - Change TabItem Style when TabItem is not selected
I have a UserControl containing a TabControl, it looks something like:

<TabControl ItemsSource="{Binding AllTabs}">
            <TabControl.Resources>

            </TabControl.Resources>
        </TabControl>
```
<p>The <code>ItemsSource</code> is of type <code>ObservableCollection<object></code>, so each <code>TabItem</code> can have different type.
On file Styles.xaml I have a <code>DataTemplate</code> for each type the tab can have, it looks like this:</p>
<pre class="lang-xml prettyprint-override"><code><DataTemplate DataType="{x:Type modelA}">
        <StackPanel>
            <WrapPanel>
                <Rectangle Fill="{Binding BgColor}"/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="title: "/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
        </StackPanel>
    </DataTemplate>

<DataTemplate DataType="{x:Type modelB}">
        <StackPanel>
            <WrapPanel>
                <Rectangle Fill="{Binding BgColor}"/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
            <WrapPanel>
                <Path Data="{Binding PathData}"/>
                <TextBlock Text="{Binding SomeText}"/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="title: "/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
        </StackPanel>
    </DataTemplate>
</code>```

I need to change the style of the TabItem when it is unselected (not focused). I tried, for example, to add style trigger like this:

<DataTemplate DataType="{x:Type modelA}">
        <StackPanel>
            <WrapPanel>
                <Rectangle Fill="{Binding BgColor}"/>
                <TextBlock Text="{Binding SomeText}">
                    <TextBlock.Style>

                        </Style>
                    </TextBlock.Style>
                </TextBlock>
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="title: "/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
        </StackPanel>
    </DataTemplate>
```

But I can't have the parent (the TabItem itself) IsFocused property.
Changing the place of the code is not optional, I need to keep the code in its current location.

How could I do what I need?

I tried to add style trigger to the datatemplate, but it didn't work, because I can't have the parent (tab) status data. Other then that, I don't have any idea how to solve this.

Body:
I have a UserControl containing a TabControl, it looks something like:

<TabControl ItemsSource="{Binding AllTabs}">
            <TabControl.Resources>

            </TabControl.Resources>
        </TabControl>

The ItemsSource is of type ObservableCollection<object>, so each TabItem can have different type.
On file Styles.xaml I have a DataTemplate for each type the tab can have, it looks like this:

<DataTemplate DataType="{x:Type modelA}">
        <StackPanel>
            <WrapPanel>
                <Rectangle Fill="{Binding BgColor}"/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="title: "/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
        </StackPanel>
    </DataTemplate>

<DataTemplate DataType="{x:Type modelB}">
        <StackPanel>
            <WrapPanel>
                <Rectangle Fill="{Binding BgColor}"/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
            <WrapPanel>
                <Path Data="{Binding PathData}"/>
                <TextBlock Text="{Binding SomeText}"/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="title: "/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
        </StackPanel>
    </DataTemplate>

I need to change the style of the TabItem when it is unselected (not focused). I tried, for example, to add style trigger like this:

<DataTemplate DataType="{x:Type modelA}">
        <StackPanel>
            <WrapPanel>
                <Rectangle Fill="{Binding BgColor}"/>
                <TextBlock Text="{Binding SomeText}">
                    <TextBlock.Style>

                        </Style>
                    </TextBlock.Style>
                </TextBlock>
            </WrapPanel>
            <WrapPanel>
                <TextBlock Text="title: "/>
                <TextBlock Text="{Binding SomeText}"/>
            </WrapPanel>
        </StackPanel>
    </DataTemplate>

But I can't have the parent (the TabItem itself) IsFocused property.
Changing the place of the code is not optional, I need to keep the code in its current location.

How could I do what I need?

I tried to add style trigger to the datatemplate, but it didn't work, because I can't have the parent (tab) status data. Other then that, I don't have any idea how to solve this.


问:
change project config in unreal engine via python scripting plugin
i was looking for a way to change the Unreal's project configurations via the python plugin,
I looked in the docs but didnt find anything relating to the topic.
So i was wondering if it could be achieved in python.
(I saw that it can be done in C++ using the descriptor json but I'm looking for a way to do it in python)</p>