问:
How to make InAppWebView disable vertical drags if any horizontal drag detected?
Hi I am currently working on tradingview LightWeight charts to display a chart in my app. I want a chart that is scrollable only in horizontal direction. Just like Binance's chart. I managed to do it. However, ı want to scroll the page vertically by dragging the InAppWebView , without scrolling the InAppWebView inside. The code  below provides me everything ı want except dragging the page vertically while tap is on the InAppWebView. So I thought that the best way to solve this problem is:

When a horizontal drag captured by InAppWebView, disable any vertical drag and  allow only horizontal drag on InAppWebView. Otherwise, do not disable vertical drag.

Thanks for all replies. :)

```<code>Widget build(BuildContext context) {
    InAppWebViewController _controller;
    return InAppWebView(
      initialFile: "assets/tradingview/index.html",
      initialOptions: InAppWebViewGroupOptions(
        crossPlatform: InAppWebViewOptions(
          javaScriptEnabled: true,
          transparentBackground: true,
          supportZoom: true,
          disableVerticalScroll: true,
          disableHorizontalScroll: true,
        ),
        ios: IOSInAppWebViewOptions(
          disallowOverScroll: true,
          alwaysBounceVertical: false,
        ),
      ),
      gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
        Factory<VerticalDragGestureRecognizer>(
          () => VerticalDragGestureRecognizer(),
        ),
      },
      onWebViewCreated: (controller) {
        _controller = controller;

        );
      },
    );
  }
</code>```

Body:
Hi I am currently working on tradingview LightWeight charts to display a chart in my app. I want a chart that is scrollable only in horizontal direction. Just like Binance's chart. I managed to do it. However, ı want to scroll the page vertically by dragging the InAppWebView , without scrolling the InAppWebView inside. The code  below provides me everything ı want except dragging the page vertically while tap is on the InAppWebView. So I thought that the best way to solve this problem is:

When a horizontal drag captured by InAppWebView, disable any vertical drag and  allow only horizontal drag on InAppWebView. Otherwise, do not disable vertical drag.

Thanks for all replies. :)

Widget build(BuildContext context) {
    InAppWebViewController _controller;
    return InAppWebView(
      initialFile: "assets/tradingview/index.html",
      initialOptions: InAppWebViewGroupOptions(
        crossPlatform: InAppWebViewOptions(
          javaScriptEnabled: true,
          transparentBackground: true,
          supportZoom: true,
          disableVerticalScroll: true,
          disableHorizontalScroll: true,
        ),
        ios: IOSInAppWebViewOptions(
          disallowOverScroll: true,
          alwaysBounceVertical: false,
        ),
      ),
      gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
        Factory<VerticalDragGestureRecognizer>(
          () => VerticalDragGestureRecognizer(),
        ),
      },
      onWebViewCreated: (controller) {
        _controller = controller;

        );
      },
    );
  }


来源: stackexchange

问:
How can I set the size of Window fixed to its content in cocoa macOS?
There is a modifier called windowResizability in macOS SwiftUI which simply make the window be in the same size of its content like this code: .windowResizability(.contentSize) this code is for SwiftUI, I am looking the same effect in cocoa macOS-Storyboard.

Just need to know the needed code, thanks

ContentLicense: CC BY-SA 4.0


问:
Troubles installing Exchange 2019 CU12 remotely
Afternoon,

I'm running into an issue with making a script that will install Exchange 2019 CU12 on a server through PS Remoting.

When I try to run the commands

```<code>Invoke-Command $Hostname -ScriptBlock {

    # Extend the schema and Prepare Active Directory
    Write-Output 'Extending Active Directory Schema and Preparing Active Directory...'
    & C:\EXCH\Exchange_2019_CU12\Setup.exe /prepareAD /OrganizationName:"$env:USERDOMAIN" /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF

    Write-Output 'Preparing Domain...'
    & C:\EXCH\Exchange_2019_CU12\Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF /PrepareAllDomains

}
</code>```

it errors out with

```<code>C:\EXCH\Exchange_2019_CU12\Setup.exe : Global updates need to be made to Active Directory, and this user account isn't
a member of the 'Enterprise Admins' group.
    + CategoryInfo          : NotSpecified: (Global updates ... Admins' group.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Active Directory must be prepared with 'Setup /PrepareAD' before domains can be prepared for Exchange Server.
Setup encountered a problem while validating the state of Active Directory: Active Directory operation failed on . The
supplied credential for 'V204\tdcadmin' is invalid.  See the Exchange setup log for more information on this error.
The forest functional level of the current Active Directory forest is not Windows Server 2012 R2 or later. To install
Exchange Server 2019, the forest functional level must be at least Windows Server 2012 R2.
Either Active Directory doesn't exist, or it can't be contacted.
</code>```

I'm logged into the computer with an account that is part of the appropriate groups.

If I log onto the server with the same account and run the commands locally, it works with no issues.

Am I missing something with my remote commands?

Body:
Afternoon,

I'm running into an issue with making a script that will install Exchange 2019 CU12 on a server through PS Remoting.

When I try to run the commands

Invoke-Command $Hostname -ScriptBlock {

    # Extend the schema and Prepare Active Directory
    Write-Output 'Extending Active Directory Schema and Preparing Active Directory...'
    & C:\EXCH\Exchange_2019_CU12\Setup.exe /prepareAD /OrganizationName:"$env:USERDOMAIN" /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF

    Write-Output 'Preparing Domain...'
    & C:\EXCH\Exchange_2019_CU12\Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF /PrepareAllDomains

}

it errors out with

C:\EXCH\Exchange_2019_CU12\Setup.exe : Global updates need to be made to Active Directory, and this user account isn't
a member of the 'Enterprise Admins' group.
    + CategoryInfo          : NotSpecified: (Global updates ... Admins' group.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Active Directory must be prepared with 'Setup /PrepareAD' before domains can be prepared for Exchange Server.
Setup encountered a problem while validating the state of Active Directory: Active Directory operation failed on . The
supplied credential for 'V204\tdcadmin' is invalid.  See the Exchange setup log for more information on this error.
The forest functional level of the current Active Directory forest is not Windows Server 2012 R2 or later. To install
Exchange Server 2019, the forest functional level must be at least Windows Server 2012 R2.
Either Active Directory doesn't exist, or it can't be contacted.

I'm logged into the computer with an account that is part of the appropriate groups.

If I log onto the server with the same account and run the commands locally, it works with no issues.

Am I missing something with my remote commands?


问:
If I have 1700 name items on Excel, and I have a PDF document that needs to be rename to each item. Instead of renaming 1 by 1
If I have 1700 name items on Excel, and I have a PDF document that needs to be rename to each item. Instead of renaming 1 by 1
enter image description here

google but no luck
[enter image descgoogle but no luck
enter image description hereription here](https://i.stack.imgur.com/Su7KK.png)


问:
Chart.js with Typescript access first iteration of object
I am having a lot of trouble with this, I have four sets of datasets all in an list of objects and I can't seem to figure out how to access the first one, I am pretty new to typescript. What I am trying to do is be able to press a button and then switch between the datasets.

```<code>export type LineType = {

    labels: string[];
    datasets: {
        label: string;
        data: number[];
        fill: boolean;
        borderColor: string;
        tension: number;
    }[];
}

//first dataset config
      const config1: LineType = {
        labels: chartData.labels,
        datasets: chartData.datasets[0] //i am getting an error here
      }

//when i do "datasets: chartData.datasets" i am able to access the last dataset

//datasets
export default {
    /* marketData datasets[0] */
      labels: ["Q1", "Q2", "Q3", "Q4"],
      datasets: [
        {
          label: "Fannie Mae",
          data: [5, 6, 7, 8],
          fill: false,
          borderColor: 'rgb(75, 192, 192)',
          tension: 0.1
        },
        {
          label: "Freddie Mac",
          data: [9, 10, 11, 12],
          fill: false,
          borderColor: 'red',
          tension: 0.1
        },
        {
          label: "Mortgage Bankers Association",
          data: [8, 12, 6, 7],
          fill: false,
          borderColor: 'purple',
          tension: 0.1
        },
        {
          label: "National Association of Realtors",
          data: [4, 7, 3, 0],
          fill: false,
          borderColor: 'green',
          tension: 0.1
        }],
    /* forecastRates datasets[1]*/
        datasets: [
          {
            label: "Fannie Mae",
            data: [3.5, 4.0, 4.7, 5.2],
            fill: false,
            borderColor: 'rgb(75, 192, 192)',
            tension: 0.1
          },
          {
            label: "Freddie Mac",
            data: [4.0, 4.7, 5.2, 6.0],
            fill: false,
            borderColor: 'red',
            tension: 0.1
          },
          {
            label: "Mortgage Bankers Association",
            data: [4.2, 5.5, 5.8, 6.5],
            fill: false,
            borderColor: 'purple',
            tension: 0.1
          },
          {
            label: "National Association of Realtors",
            data: [3.2, 6.3, 7.3, 6.5],
            fill: false,
            borderColor: 'green',
            tension: 0.1
          }],
    /* forecastOrignations datasets[2]*/
      datasets: [
        {
          label: "Fannie Mae",
          data: [100, 200, 300, 400],
          fill: false,
          borderColor: 'rgb(75, 192, 192)',
          tension: 0.1
        },
        {
          label: "Freddie Mac",
          data: [500, 600, 400, 300],
          fill: false,
          borderColor: 'red',
          tension: 0.1
        },
        {
          label: "Mortgage Bankers Association",
          data: [400, 500, 580, 650],
          fill: false,
          borderColor: 'purple',
          tension: 0.1
        },
        {
          label: "National Association of Realtors",
          data: [320, 630, 730, 650],
          fill: false,
          borderColor: 'green',
          tension: 0.1
        }],
      /* orignations datasets[]*/
        datasets: [
          {
            label: "Fannie Mae",
            data: [100, 200, 300, 700],
            fill: false,
            borderColor: 'rgb(75, 192, 192)',
            tension: 0.1
          },
          {
            label: "Freddie Mac",
            data: [333, 666, 555, 444],
            fill: false,
            borderColor: 'red',
            tension: 0.1
          },
          {
            label: "Mortgage Bankers Association",
            data: [543, 631, 713, 323],
            fill: false,
            borderColor: 'purple',
            tension: 0.1
          },
          {
            label: "National Association of Realtors",
            data: [433, 655, 733, 655],
            fill: false,
            borderColor: 'green',
            tension: 0.1
          }]

  }

</code>```

the error I am getting is "Type '{ label: string; data: number[]; fill: boolean; borderColor: string; tension: number; }' is missing the following properties from type '{ label: string; data: number[]; fill: boolean; borderColor: string; tension: number; }[]': length, pop, push, concat, and 28 more" I have been stuck on this problem for a few days and can't seem to figure it out. Ant help would be appreciated

Body:
I am having a lot of trouble with this, I have four sets of datasets all in an list of objects and I can't seem to figure out how to access the first one, I am pretty new to typescript. What I am trying to do is be able to press a button and then switch between the datasets.

export type LineType = {

    labels: string[];
    datasets: {
        label: string;
        data: number[];
        fill: boolean;
        borderColor: string;
        tension: number;
    }[];
}

//first dataset config
      const config1: LineType = {
        labels: chartData.labels,
        datasets: chartData.datasets[0] //i am getting an error here
      }

//when i do "datasets: chartData.datasets" i am able to access the last dataset

//datasets
export default {
    /* marketData datasets[0] */
      labels: ["Q1", "Q2", "Q3", "Q4"],
      datasets: [
        {
          label: "Fannie Mae",
          data: [5, 6, 7, 8],
          fill: false,
          borderColor: 'rgb(75, 192, 192)',
          tension: 0.1
        },
        {
          label: "Freddie Mac",
          data: [9, 10, 11, 12],
          fill: false,
          borderColor: 'red',
          tension: 0.1
        },
        {
          label: "Mortgage Bankers Association",
          data: [8, 12, 6, 7],
          fill: false,
          borderColor: 'purple',
          tension: 0.1
        },
        {
          label: "National Association of Realtors",
          data: [4, 7, 3, 0],
          fill: false,
          borderColor: 'green',
          tension: 0.1
        }],
    /* forecastRates datasets[1]*/
        datasets: [
          {
            label: "Fannie Mae",
            data: [3.5, 4.0, 4.7, 5.2],
            fill: false,
            borderColor: 'rgb(75, 192, 192)',
            tension: 0.1
          },
          {
            label: "Freddie Mac",
            data: [4.0, 4.7, 5.2, 6.0],
            fill: false,
            borderColor: 'red',
            tension: 0.1
          },
          {
            label: "Mortgage Bankers Association",
            data: [4.2, 5.5, 5.8, 6.5],
            fill: false,
            borderColor: 'purple',
            tension: 0.1
          },
          {
            label: "National Association of Realtors",
            data: [3.2, 6.3, 7.3, 6.5],
            fill: false,
            borderColor: 'green',
            tension: 0.1
          }],
    /* forecastOrignations datasets[2]*/
      datasets: [
        {
          label: "Fannie Mae",
          data: [100, 200, 300, 400],
          fill: false,
          borderColor: 'rgb(75, 192, 192)',
          tension: 0.1
        },
        {
          label: "Freddie Mac",
          data: [500, 600, 400, 300],
          fill: false,
          borderColor: 'red',
          tension: 0.1
        },
        {
          label: "Mortgage Bankers Association",
          data: [400, 500, 580, 650],
          fill: false,
          borderColor: 'purple',
          tension: 0.1
        },
        {
          label: "National Association of Realtors",
          data: [320, 630, 730, 650],
          fill: false,
          borderColor: 'green',
          tension: 0.1
        }],
      /* orignations datasets[]*/
        datasets: [
          {
            label: "Fannie Mae",
            data: [100, 200, 300, 700],
            fill: false,
            borderColor: 'rgb(75, 192, 192)',
            tension: 0.1
          },
          {
            label: "Freddie Mac",
            data: [333, 666, 555, 444],
            fill: false,
            borderColor: 'red',
            tension: 0.1
          },
          {
            label: "Mortgage Bankers Association",
            data: [543, 631, 713, 323],
            fill: false,
            borderColor: 'purple',
            tension: 0.1
          },
          {
            label: "National Association of Realtors",
            data: [433, 655, 733, 655],
            fill: false,
            borderColor: 'green',
            tension: 0.1
          }]

  }

the error I am getting is "Type '{ label: string; data: number[]; fill: boolean; borderColor: string; tension: number; }' is missing the following properties from type '{ label: string; data: number[]; fill: boolean; borderColor: string; tension: number; }[]': length, pop, push, concat, and 28 more" I have been stuck on this problem for a few days and can't seem to figure it out. Ant help would be appreciated


问:
java:11: error: cannot find symbol, java.lang.NoClassDefFoundError: com/google/gson/JsonElement
I asked a question about running .class on terminal earlier so please check that out if you're willing to(please ignore the changes in folder names). I thought the first question isn't able to have an answer since I had a problem from compiling it. The error I got when I try to compile the file is this:

My folders and files look like:
java(I put gson-2.9.1.jar here and added it to the classpath)/Parsing/Parsing.java
java/Parsing/Parsing.class(in the same folder)

I'm using the Eclipse and it runs fine on Eclipse console. This is run configuration command line from Eclipse:

```<code>/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/bin/java
-Dfile.encoding=UTF-8
-classpath /Users/thiscomputer/java/Parsing:/Users/thiscomputer/java/gson-2.9.1.jar Parsing
</code>```

Body:
I asked a question about running .class on terminal earlier so please check that out if you're willing to(please ignore the changes in folder names). I thought the first question isn't able to have an answer since I had a problem from compiling it. The error I got when I try to compile the file is this:

My folders and files look like:
java(I put gson-2.9.1.jar here and added it to the classpath)/Parsing/Parsing.java
java/Parsing/Parsing.class(in the same folder)

I'm using the Eclipse and it runs fine on Eclipse console. This is run configuration command line from Eclipse:

/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/bin/java
-Dfile.encoding=UTF-8
-classpath /Users/thiscomputer/java/Parsing:/Users/thiscomputer/java/gson-2.9.1.jar Parsing


问:
Sending text in python selenium using javascript execute_script()
I have requirement of passing the lengthy text to input text field, I tried to use javascript and used below two approaches but none of them working, Could someone please help what could be the issue?

Solution 1:

```<code>self.driver.execute_script("document.getElementsByClassName('ck-tag')[0].value='" + data + "'")
self.driver.execute_script("document.getElementsByClassName('ck-tag')[0].value='" + data + "';")
self.driver.execute_script("document.getElementsByClassName('ck-tag')[0].value='data'")
</code>```

None of the above line worked and text box is empty. In the dev console though "document.getElementsByClassName('ck-tag')[0]" returns proper element.

Solution 2:

```<code>    xpath = '//div[@aria-label="Rich Text Editor, main"]//p'
    element = self.driver.find_element(By.XPATH, xpath)
    element.send_keys("Hello")
    # Above line works
    self.driver.execute_script('arguments[0].value=" ' + data + ' " ;', element)
    self.driver.execute_script('arguments[0].value=" ' + data + ' " ', element)
    # Both above line fails and does not enter any text.
</code>```

Body:
I have requirement of passing the lengthy text to input text field, I tried to use javascript and used below two approaches but none of them working, Could someone please help what could be the issue?

Solution 1:

self.driver.execute_script("document.getElementsByClassName('ck-tag')[0].value='" + data + "'")
self.driver.execute_script("document.getElementsByClassName('ck-tag')[0].value='" + data + "';")
self.driver.execute_script("document.getElementsByClassName('ck-tag')[0].value='data'")

None of the above line worked and text box is empty. In the dev console though "document.getElementsByClassName('ck-tag')[0]" returns proper element.

Solution 2:

    xpath = '//div[@aria-label="Rich Text Editor, main"]//p'
    element = self.driver.find_element(By.XPATH, xpath)
    element.send_keys("Hello")
    # Above line works
    self.driver.execute_script('arguments[0].value=" ' + data + ' " ;', element)
    self.driver.execute_script('arguments[0].value=" ' + data + ' " ', element)
    # Both above line fails and does not enter any text.


问:
How to send alert if tabcmd fails in .bat file?
I currently have a .bat file set up to execute a tabcmd for refreshing an extract on Tableau server. This .bat file is executed via SQL Server Agent job (CmdExec). There are several occasions where the Tableau extract isn't refreshed, even though the SQL job runs successfully, and there is no failure on the Tableau server side for it.

I'm wondering if there is a way to include an alert in the .bat file that sends out an email if the tabcmd extract refresh doesn't execute. Can this be done? I've found questions/answers regarding sending emails via batch file but need to know if there is a way to only send the alert if the tabcmd doesn't execute.

I would also accept the ability to send the email if the tabcmd executes successfully.


问:
How to transcode discord opus bytes wav?
I am trying to convert discords opus audio bytes to wav bytes. I'm using the discord python library Pycord to receive opus audio. This receives opus aduio from a socket. This audio is 2 channel, 48khz.

I want transcode these bytes into 1 channel 16khz wav. So that I can pass it into Pico voice their porcupine (pvporcupine) wake word detection.

I tried convert the decoced data with audioop but this doesn't work.

converted = audioop.ratecv(data.decoded_data, 2, 2, 48000, 16000, None)
converted = audioop.tomono(converted[0], 2, 1, 0)
```

Pycord has a feature that it writes the bytes into a wav file. I can use ffmpeg to then transcode it into an 1 channel 16khz wav file. I can then feed this file into pvporcupine. It then detects the desired wake words.

But I want to transcode the decoded bytes and then pass them into pvpvporcupine.

Any help towards an answer would be appreciated.

Body:
I am trying to convert discords opus audio bytes to wav bytes. I'm using the discord python library Pycord to receive opus audio. This receives opus aduio from a socket. This audio is 2 channel, 48khz.

I want transcode these bytes into 1 channel 16khz wav. So that I can pass it into Pico voice their porcupine (pvporcupine) wake word detection.

I tried convert the decoced data with audioop but this doesn't work.

converted = audioop.ratecv(data.decoded_data, 2, 2, 48000, 16000, None)
converted = audioop.tomono(converted[0], 2, 1, 0)

Pycord has a feature that it writes the bytes into a wav file. I can use ffmpeg to then transcode it into an 1 channel 16khz wav file. I can then feed this file into pvporcupine. It then detects the desired wake words.

But I want to transcode the decoded bytes and then pass them into pvpvporcupine.

Any help towards an answer would be appreciated.


问:
What is the key difference between these codes if both perform the same actions, but return a different answer?
list = [1,3,5,4,2]
print(list.sort())

list = [1,3,5,4,2]
list.sort()
print(list)

I understand that methods perform an action, but can't understand why the syntax has to be written differently.

Ive tried examples with data string type where the .title method has been placed inside the print function. Which returns with a none return value. I figured it is the same.


问:
Getting data from a table in my database and printing it in a for to make a questionnaire
I have succesfuly created an array of "questions" and checkboxes for a quiz project I've been working on. Thing is I have created a service to get them from the API and I have succesfully done that prior to creating the array I need. But with how the method is created, I haven't been able to concatenate it properly

My .ts

```<code>import { AfterViewInit, Component, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { MatDatepicker } from '@angular/material/datepicker';
import { Router } from '@angular/router';
import { Candidato } from 'src/app/interfaces/candidato';
import { Cuestionario } from 'src/app/interfaces/cuestionario';
import { CuestionarioService } from 'src/app/services/cuestionario.service';

@Component({
  selector: 'app-cuestionario',
  templateUrl: './cuestionario.component.html',
  styleUrls: ['./cuestionario.component.css']
})
export class CuestionarioComponent implements OnInit, AfterViewInit {
  Genero: string[] = ['M', 'F', 'X'];
  Opcion: any = ['V','F'];
  displayedColumns: string[] = ['#', 'Pregunta','verdadero', 'falso'];
  @ViewChild(MatPaginator) paginator!: MatPaginator;
  dataSource:MatTableDataSource<Cuestionario>
  list:Cuestionario[] = [];
  maxDate: Date;
  cuestionarioForm: FormGroup;

  preguntas: string[] = [];
  preview: string = '';

  constructor(private fb: FormBuilder,
              private radios: FormBuilder,
              private router:Router,
              private Cuestionario:CuestionarioService) {
      this.dataSource = new MatTableDataSource();
      this.maxDate = new Date();
      this.cuestionarioForm = this.fb.group({
        Nombre: ['', [Validators.required, Validators.maxLength(30)]],
        A_Paterno: ['', Validators.required],
        A_Materno: ['', Validators.required],
        Genero: ['', Validators.required],
        Fecha_nac: ['', Validators.required],
        Correo: ['', [Validators.required,  Validators.email]],
        'direcciones': this.fb.array([
        ])
      })

  }

  changeOpcion(e:any){
    /* this.direcciones?.setValue(e.target.value,{
      onlySelf:true,
    }) */
    this.cuestionarioForm.patchValue(e.target.value,{
      onlySelf:true,
    })
  }

  get direcciones(){
    return this.cuestionarioForm.get('direcciones') as FormArray
  }

  ngOnInit(): void {
    for(let i=1;i<91;i++){
      let x = "Pregunta #"+ i
      this.preguntas.push(x)
    }
    for(let i=0;i<this.preguntas.length;i++){
      this.direcciones.push(this.fb.control('',Validators.required))
    }
  }

  ngAfterViewInit(): void {
/*     this.dataSource.paginator = this.paginator;
    this.dataSource.paginator._intl.itemsPerPageLabel = "Preguntas por Página"; */
  }

/*   obtenerPreguntas() {
    this.Cuestionario.getPreguntas().subscribe((res:Cuestionario[])=>{
      this.dataSource.data=res
  })
    this.dataSource.paginator = this.paginator;
    this.dataSource.paginator._intl.itemsPerPageLabel = "Preguntas por Página";
  } */

  agregarCuestionario() {
    const candidato: Candidato = {
      Nombre: this.cuestionarioForm.value.Nombre,
      A_Paterno: this.cuestionarioForm.value.A_Paterno,
      A_Materno: this.cuestionarioForm.value.A_Materno,
      Fecha_nac: this.cuestionarioForm.value.Fecha_nac,
      Genero: this.cuestionarioForm.value.Genero,
      Correo: this.cuestionarioForm.value.Correo

    }
    /* console.log(candidato) */
  }

/*   addEditCandidato() {
    const candidato: Candidato = {
      Nombre: this.cuestionarioForm.value.Nombre,
      A_Paterno: this.cuestionarioForm.value.A_Paterno,
      A_Materno: this.cuestionarioForm.value.A_Materno,
      Fecha_nac: this.cuestionarioForm.value.Fecha_nac,
      Correo: this.cuestionarioForm.value.Correo,
      Genero: this.cuestionarioForm.value.Genero
    }
    console.log(candidato)
  } */

  home(){
    localStorage.removeItem('token')
    this.router.navigate(['/inicio'])
  }
  save() {
    console.log(this.cuestionarioForm.value)
  }

}

</code>```

My .html

```<code><form  (ngSubmit)="agregarCuestionario()" [formGroup]="cuestionarioForm">

    <div formArrayName="direcciones">
        <div class="container">
                <ng-container *ngFor="let x of direcciones.controls;let i=index;">
                    <div class="row">
                    <div class="col-md">
                        <label>{{preguntas[i]}}</label>
                    </div>
                    <div class="col-md">
                        <select class="custom-select" (change)="changeOpcion($event)" [formControlName]="i">
                            <option value="">(V/F)</option>
                            <option *ngFor="let opcion of Opcion" [ngValue]="">{{opcion}}</option>
                        </select>
                    </div>
                    </div>
                </ng-container>

        </div>
    </div>

    <span class="example-spacer"></span>
    <button type="submit" mat-button (click)="save()">Aceptar</button>

</form>
</code>```

My main goal is to link the question's number with the answer from the checkbox and insert them in a table from my database, but it seems I'm stuck. I'm fairly new to typescript/angular and although my backend and database connections have worked well, frontend seems to be my main concern. Luckily, the submit fucntion does indeed create an object with the selected option from the checkbox, getting me closer to my goal. I can't help but feel I'm very close to the answer but I'm not quite yet there. Either my logic is wrong or subscribing to the service and getting it in the for is not the way to solve this very specific issue

Body:
I have succesfuly created an array of "questions" and checkboxes for a quiz project I've been working on. Thing is I have created a service to get them from the API and I have succesfully done that prior to creating the array I need. But with how the method is created, I haven't been able to concatenate it properly

My .ts

import { AfterViewInit, Component, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { MatDatepicker } from '@angular/material/datepicker';
import { Router } from '@angular/router';
import { Candidato } from 'src/app/interfaces/candidato';
import { Cuestionario } from 'src/app/interfaces/cuestionario';
import { CuestionarioService } from 'src/app/services/cuestionario.service';

@Component({
  selector: 'app-cuestionario',
  templateUrl: './cuestionario.component.html',
  styleUrls: ['./cuestionario.component.css']
})
export class CuestionarioComponent implements OnInit, AfterViewInit {
  Genero: string[] = ['M', 'F', 'X'];
  Opcion: any = ['V','F'];
  displayedColumns: string[] = ['#', 'Pregunta','verdadero', 'falso'];
  @ViewChild(MatPaginator) paginator!: MatPaginator;
  dataSource:MatTableDataSource<Cuestionario>
  list:Cuestionario[] = [];
  maxDate: Date;
  cuestionarioForm: FormGroup;

  preguntas: string[] = [];
  preview: string = '';

  constructor(private fb: FormBuilder,
              private radios: FormBuilder,
              private router:Router,
              private Cuestionario:CuestionarioService) {
      this.dataSource = new MatTableDataSource();
      this.maxDate = new Date();
      this.cuestionarioForm = this.fb.group({
        Nombre: ['', [Validators.required, Validators.maxLength(30)]],
        A_Paterno: ['', Validators.required],
        A_Materno: ['', Validators.required],
        Genero: ['', Validators.required],
        Fecha_nac: ['', Validators.required],
        Correo: ['', [Validators.required,  Validators.email]],
        'direcciones': this.fb.array([
        ])
      })

  }

  changeOpcion(e:any){
    /* this.direcciones?.setValue(e.target.value,{
      onlySelf:true,
    }) */
    this.cuestionarioForm.patchValue(e.target.value,{
      onlySelf:true,
    })
  }

  get direcciones(){
    return this.cuestionarioForm.get('direcciones') as FormArray
  }

  ngOnInit(): void {
    for(let i=1;i<91;i++){
      let x = "Pregunta #"+ i
      this.preguntas.push(x)
    }
    for(let i=0;i<this.preguntas.length;i++){
      this.direcciones.push(this.fb.control('',Validators.required))
    }
  }

  ngAfterViewInit(): void {
/*     this.dataSource.paginator = this.paginator;
    this.dataSource.paginator._intl.itemsPerPageLabel = "Preguntas por Página"; */
  }

/*   obtenerPreguntas() {
    this.Cuestionario.getPreguntas().subscribe((res:Cuestionario[])=>{
      this.dataSource.data=res
  })
    this.dataSource.paginator = this.paginator;
    this.dataSource.paginator._intl.itemsPerPageLabel = "Preguntas por Página";
  } */

  agregarCuestionario() {
    const candidato: Candidato = {
      Nombre: this.cuestionarioForm.value.Nombre,
      A_Paterno: this.cuestionarioForm.value.A_Paterno,
      A_Materno: this.cuestionarioForm.value.A_Materno,
      Fecha_nac: this.cuestionarioForm.value.Fecha_nac,
      Genero: this.cuestionarioForm.value.Genero,
      Correo: this.cuestionarioForm.value.Correo

    }
    /* console.log(candidato) */
  }

/*   addEditCandidato() {
    const candidato: Candidato = {
      Nombre: this.cuestionarioForm.value.Nombre,
      A_Paterno: this.cuestionarioForm.value.A_Paterno,
      A_Materno: this.cuestionarioForm.value.A_Materno,
      Fecha_nac: this.cuestionarioForm.value.Fecha_nac,
      Correo: this.cuestionarioForm.value.Correo,
      Genero: this.cuestionarioForm.value.Genero
    }
    console.log(candidato)
  } */

  home(){
    localStorage.removeItem('token')
    this.router.navigate(['/inicio'])
  }
  save() {
    console.log(this.cuestionarioForm.value)
  }

}

My .html

<form  (ngSubmit)="agregarCuestionario()" [formGroup]="cuestionarioForm">

                <ng-container *ngFor="let x of direcciones.controls;let i=index;">

                        {{preguntas[i]}}

                        <select class="custom-select" (change)="changeOpcion($event)" [formControlName]="i">
                            <option value="">(V/F)</option>
                            <option *ngFor="let opcion of Opcion" [ngValue]="">{{opcion}}</option>
                        </select>

                </ng-container>

    <button type="submit" mat-button (click)="save()">Aceptar</button>

</form>

My main goal is to link the question's number with the answer from the checkbox and insert them in a table from my database, but it seems I'm stuck. I'm fairly new to typescript/angular and although my backend and database connections have worked well, frontend seems to be my main concern. Luckily, the submit fucntion does indeed create an object with the selected option from the checkbox, getting me closer to my goal. I can't help but feel I'm very close to the answer but I'm not quite yet there. Either my logic is wrong or subscribing to the service and getting it in the for is not the way to solve this very specific issue


问:
Trace the date when a message was sent in Vkontakte
How can I trace the date when a message was sent in Vkontakte?
I read the documentation but found nothing like this, is it possible to do this through bs4?</p>


问:
How to get non-homogenous options or two one-ways for a roundtrip in FlightOffersSearch API get or post call?
I am using the FlightOffersSearch API and want to get 2 one-ways for a round trip search. I am also trying to get non-homogenous options in the results.

My question is what option should I send in the request to get the 2 one-ways or non-homogenous flights?

I used the FlightOffersSearch API and included the "addOneWayOffers=true" in the GET method as shown below-

https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=SYD&destinationLocationCode=BKK&departureDate=2023-05-01&returnDate=2023-06-01&adults=1&max=250&children=1&travelClass=PREMIUM_ECONOMY&currencyCode=USD&infants=1&addOneWayOffers=true

I am getting an error in the response as below.

```<code>{
    "errors": [
        {
            "status": 400,
            "code": 572,
            "title": "INVALID OPTION",
            "detail": "Invalid query parameter",
            "source": {
                "parameter": "addOneWayOffers"
            }
        }
    ]
}
</code>```

Kindly let me know if anyone encountered this issue and was able to resolve it?

Body:
I am using the FlightOffersSearch API and want to get 2 one-ways for a round trip search. I am also trying to get non-homogenous options in the results.

My question is what option should I send in the request to get the 2 one-ways or non-homogenous flights?

I used the FlightOffersSearch API and included the "addOneWayOffers=true" in the GET method as shown below-

https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=SYD&destinationLocationCode=BKK&departureDate=2023-05-01&returnDate=2023-06-01&adults=1&max=250&children=1&travelClass=PREMIUM_ECONOMY&currencyCode=USD&infants=1&addOneWayOffers=true

I am getting an error in the response as below.

{
    "errors": [
        {
            "status": 400,
            "code": 572,
            "title": "INVALID OPTION",
            "detail": "Invalid query parameter",
            "source": {
                "parameter": "addOneWayOffers"
            }
        }
    ]
}

Kindly let me know if anyone encountered this issue and was able to resolve it?


问:
How to tell if an entire request is recieved with the LWIP stack
I am trying to write a http server for the Pi Pico using LWIP. I understand that a request will arrive in some number of pbuf chains. I can read these chains and put their payload in a buffer ready to process, but how do I know when the request is complete? I know that when pbuf->len == pbuf->tot_len the chain is complete, but I do not understand how to know that I have received all the incoming chains.

I could begin processing my payload buffer to find the Content-Length http header, but I may not have received enough data to obtain the content length after the first chain.


问:
How to provide custom message in pytest JUNITXML report?
I am running a codebuild(AWS) which runs series of tests in selenium python and generates a JUNIT xml report at the end.I am using pytest for this as described by AWS https://docs.aws.amazon.com/codebuild/latest/userguide/test-report-pytest.html

The problem is I want to include my custom message for every test (for eg: A text like 'Successfully enterd transaction type'). I've included this custom message in my tests, but its not reflecting in the report.
When I click on a test case report radio button, I only see "No message" text displayed there.

Is there a way to include our messages in the report?

My buildspec.yaml looks something like this.

```<code>  build:
    commands:
      - pytest -v -s --cache-clear --capture=tee-sys --html=pytest_reports/report.html --self-contained-html --cov-report=html:pytest_reports/coverage --junitxml=pytest_reports/junit.xml --log-file=pytest_reports/logs.txt
      - export FOLDER=PY-$(date +%Y-%m-%d_%H:%M)
      - mkdir $FOLDER
      - mv *.png $FOLDER

  post_build:
    commands:

reports:
  coverage:
    files:
      - "coverage/*"
    base-directory: 'pytest_reports'
    discard-paths: yes
  report:
    files:
      - 'junit.xml'
      - 'report.html'
      - 'assets/*'
    base-directory: 'pytest_reports'
    discard-paths: yes
    file-format: JunitXml

artifacts:
  files:
  - "**/*"
</code>```

Body:
I am running a codebuild(AWS) which runs series of tests in selenium python and generates a JUNIT xml report at the end.I am using pytest for this as described by AWS https://docs.aws.amazon.com/codebuild/latest/userguide/test-report-pytest.html

The problem is I want to include my custom message for every test (for eg: A text like 'Successfully enterd transaction type'). I've included this custom message in my tests, but its not reflecting in the report.
When I click on a test case report radio button, I only see "No message" text displayed there.

Is there a way to include our messages in the report?

My buildspec.yaml looks something like this.

  build:
    commands:
      - pytest -v -s --cache-clear --capture=tee-sys --html=pytest_reports/report.html --self-contained-html --cov-report=html:pytest_reports/coverage --junitxml=pytest_reports/junit.xml --log-file=pytest_reports/logs.txt
      - export FOLDER=PY-$(date +%Y-%m-%d_%H:%M)
      - mkdir $FOLDER
      - mv *.png $FOLDER

  post_build:
    commands:

reports:
  coverage:
    files:
      - "coverage/*"
    base-directory: 'pytest_reports'
    discard-paths: yes
  report:
    files:
      - 'junit.xml'
      - 'report.html'
      - 'assets/*'
    base-directory: 'pytest_reports'
    discard-paths: yes
    file-format: JunitXml

artifacts:
  files:
  - "**/*"


问:
I can't find GoogleSignInClient()
I'm trying to use the Friebase Google Authentication in my project, but the GoogleSignInClient() isn't even found in the Android Studio.

I already using the Firebase to create and login users with email and password, so the Firebase is OK. But is my first time using the Google Authenticator.

Here's my code:

MainActivity:

```<code>private lateinit var googleSignInClient: GoogleSignInClient
</code>```

Build Gradle (Firebase Dependencies):

```<code>implementation platform('com.google.firebase:firebase-bom:31.1.0')
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.google.android.gms:play-services-auth:20.4.0'
</code>```

================================================================

> I SOLVED IT!
I just updated the "com.google.gms.google-services" version in the build.gradle(app-name) file!

Title: I can't find GoogleSignInClient()

Body:
I'm trying to use the Friebase Google Authentication in my project, but the GoogleSignInClient() isn't even found in the Android Studio.

I already using the Firebase to create and login users with email and password, so the Firebase is OK. But is my first time using the Google Authenticator.

Here's my code:

MainActivity:

private lateinit var googleSignInClient: GoogleSignInClient

Build Gradle (Firebase Dependencies):

implementation platform('com.google.firebase:firebase-bom:31.1.0')
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.google.android.gms:play-services-auth:20.4.0'

================================================================

> I SOLVED IT!
I just updated the "com.google.gms.google-services" version in the build.gradle(app-name) file!


问:
Batch file: How to export to Csv into 1 column A, having commas in file title
I have this code that export the file path of a directory/subdirectory into csv list

My problem come when a file have commas in title.
My .csv export, instead having all the file path in one column A, the file path get separated in other columns depending how many commas I have in file title.

I need the file path in one column, first column A

```<code>@echo off

set "videodir=E:\Export"
set "exportdir=F:\Dropbox\IMACRO-ACTIV\DataSources
del F:\Dropbox\IMACRO-ACTIV\DataSources\mp4list.csv 2>nul

for /F "delims=" %%I in ('dir "%videodir%\*.mp4" /-p /o:gn /B /S 2^>nul') do echo %%I>>"%exportdir%\mp4list.csv"
FOR /F delims^= %%A IN ('DIR "%videodir%" /AD/B/S^|SORT/R') DO RD "%%A"
</code>```

Example title in directory

```<code>Dua Lipa, Coldplay, Martin Garrix & Kygo, The Chainsmokers Style  (10).mp4
</code>```

in my csv export look like:

```<code>E:\Export\grup-1\Canal-1\Dua Lipa    Coldplay    Martin Garrix & Kygo    The Chainsmokers Style  (1).mp4
</code>```

and I need to be like bellow

```<code>E:\Export\grup-1\Canal-1\Dua Lipa, Coldplay, Martin Garrix & Kygo, The Chainsmokers Style  (10).mp4
</code>```

Any Idea how I can improve for this issue?
thank you

Body:
I have this code that export the file path of a directory/subdirectory into csv list

My problem come when a file have commas in title.
My .csv export, instead having all the file path in one column A, the file path get separated in other columns depending how many commas I have in file title.

I need the file path in one column, first column A

@echo off

set "videodir=E:\Export"
set "exportdir=F:\Dropbox\IMACRO-ACTIV\DataSources
del F:\Dropbox\IMACRO-ACTIV\DataSources\mp4list.csv 2>nul

for /F "delims=" %%I in ('dir "%videodir%\*.mp4" /-p /o:gn /B /S 2^>nul') do echo %%I>>"%exportdir%\mp4list.csv"
FOR /F delims^= %%A IN ('DIR "%videodir%" /AD/B/S^|SORT/R') DO RD "%%A"

Example title in directory

Dua Lipa, Coldplay, Martin Garrix & Kygo, The Chainsmokers Style  (10).mp4

in my csv export look like:

E:\Export\grup-1\Canal-1\Dua Lipa    Coldplay    Martin Garrix & Kygo    The Chainsmokers Style  (1).mp4

and I need to be like bellow

E:\Export\grup-1\Canal-1\Dua Lipa, Coldplay, Martin Garrix & Kygo, The Chainsmokers Style  (10).mp4

Any Idea how I can improve for this issue?
thank you


问:
Error while trying to use Pycaret.regression AttributeError: 'OneHotEncoder' object has no attribute 'get_feature_names'
I am currently trying to use the pycaret library in order to identify the best model for my data, however, I am getting this error message "AttributeError: 'OneHotEncoder' object has no attribute 'get_feature_names'"

This is the code that I am currently using

```<code>from pycaret.regression import *
df_caret = pd.concat([data_math, data_por], ignore_index = True) #This corresponds to my df
df_caret.columns
var_cat = ['school', 'sex', 'address', 'famsize', 'Pstatus',
       'Mjob', 'Fjob', 'reason', 'guardian','schoolsup', 'famsup', 'paid', 'activities', 'nursery',
       'higher', 'internet', 'romantic']
experimento = setup(df_caret,target='G3',categorical_features=var_cat,fold_shuffle=True)
</code>```

Body:
I am currently trying to use the pycaret library in order to identify the best model for my data, however, I am getting this error message "AttributeError: 'OneHotEncoder' object has no attribute 'get_feature_names'"

This is the code that I am currently using

from pycaret.regression import *
df_caret = pd.concat([data_math, data_por], ignore_index = True) #This corresponds to my df
df_caret.columns
var_cat = ['school', 'sex', 'address', 'famsize', 'Pstatus',
       'Mjob', 'Fjob', 'reason', 'guardian','schoolsup', 'famsup', 'paid', 'activities', 'nursery',
       'higher', 'internet', 'romantic']
experimento = setup(df_caret,target='G3',categorical_features=var_cat,fold_shuffle=True)


问:
jboss admin console failing behind k3s ingress. Insufficient priviledges
I have setup a jboss instance in a container and am trying to get the console working remotely. I setup the ingrerss to map /console and /management and can now get a login screen to present. Whenever I enter the default "admin" that is deployed, it fails with the following error:

```<code>Access Denied: Insufficient privileges to access this interface.
</code>```

I looked at this page which was a similar issue but the resolution was for an apache server and does not work with K3s/Kubernetetes: Wildfly management console Access Denied Insufficient Privileges

Is there a way to get console authentication working in jboss from outside of a container?

Edit:
Jboss states the following error when attempting to login:

```<code>Request rejected due to HOST/ORIGIN mismatch
</code>```

Body:
I have setup a jboss instance in a container and am trying to get the console working remotely. I setup the ingrerss to map /console and /management and can now get a login screen to present. Whenever I enter the default "admin" that is deployed, it fails with the following error:

Access Denied: Insufficient privileges to access this interface.

I looked at this page which was a similar issue but the resolution was for an apache server and does not work with K3s/Kubernetetes: Wildfly management console Access Denied Insufficient Privileges

Is there a way to get console authentication working in jboss from outside of a container?

Edit:
Jboss states the following error when attempting to login:

Request rejected due to HOST/ORIGIN mismatch


问:
In Angular, how can I wait a function finish before execute a post petition that returns an observable?
I need to generate a Google reCAPTCHA V3 token and send it on the body of my post petition. Something like this:

```<code>let body = {}

@Injectable({
  providedIn: 'root'
})
export class SujetoObligadoService {

  constructor( private http:HttpClient, private recaptchaV3Service: ReCaptchaV3Service, private verificationServcice: RecaptchaService ) {
  }

  generateToken(){
    this.recaptchaV3Service.execute('importantAction')
      .subscribe((token) => {
        console.log('My Token: '+ token)
        body = {
          token: token
        }
    });
  }

  getAllSujetosObligados(): Observable<sujetosObligados[]> {
    this.generateToken();
      return this.http.post<sujetosObligados[]>("http://localhost:8080/back/api/sujetos-obligados", body)
  }
}
</code>```

The problem is that the http.post run before the generateToken() function get the token...

I tried with Promises but I got an error because my function needs to receive an Observable instead a Promise...

Help me please!

Body:
I need to generate a Google reCAPTCHA V3 token and send it on the body of my post petition. Something like this:

let body = {}

@Injectable({
  providedIn: 'root'
})
export class SujetoObligadoService {

  constructor( private http:HttpClient, private recaptchaV3Service: ReCaptchaV3Service, private verificationServcice: RecaptchaService ) {
  }

  generateToken(){
    this.recaptchaV3Service.execute('importantAction')
      .subscribe((token) => {
        console.log('My Token: '+ token)
        body = {
          token: token
        }
    });
  }

  getAllSujetosObligados(): Observable<sujetosObligados[]> {
    this.generateToken();
      return this.http.post<sujetosObligados[]>("http://localhost:8080/back/api/sujetos-obligados", body)
  }
}

The problem is that the http.post run before the generateToken() function get the token...

I tried with Promises but I got an error because my function needs to receive an Observable instead a Promise...

Help me please!


问:
When I assign value to the last column of the array, the first element on the next row updates too
```<code>typedef struct _PQ {
    short cost;
} PQ;

</code>```
```<code>void Dijkstra(short** arr, short row, short col) {
    //initialize DIST

    PQ **table;
    table = malloc(sizeof(*table) * (row));
    for (int i = 0; i < row; i++) {
        table[i] = malloc(sizeof(table) * col);
    }

    // 1. graph
    for (short i = 0; i < row; i++) {
        for (short j = 0; j < col; j++) {
            table[i][j].cost = arr[i][j];
        }
        if (i == 0) {
            printf("First run: %hd %hd\n", arr[0][4], table[0][4].cost);
            printf("%hd ", table[1][0].cost);
        }
    }
}

</code>```

row is 5 and column is 4.
I'm currently inserting 5 (arr[0][4])  at table[0][4].cost
However, as soon as I insert the value to table[0][4].cost, table[1][0].cost updates with the same value.

Also after finish inserting the second row, my first row value changes.

After inserting the first row

4 2 1 0 5

5

After inserting the second row

4 2 1 0 2

2 0 4 1 0

and this happens every row. Last element on the row and first element on the next row are same.
I'm really not sure why this happens.

Also, I checked if my arr[i][j] value, but the arr is correct.

after inserting the second row,

I should have

4 2 1 0 5

2 0 4 1 0

instead of

4 2 1 0 2

2 0 4 1 0

I feel like it's related to pointer, but I'm not sure what to do

Body:
typedef struct _PQ {
    short cost;
} PQ;

void Dijkstra(short** arr, short row, short col) {
    //initialize DIST

    PQ **table;
    table = malloc(sizeof(*table) * (row));
    for (int i = 0; i < row; i++) {
        table[i] = malloc(sizeof(table) * col);
    }

    // 1. graph
    for (short i = 0; i < row; i++) {
        for (short j = 0; j < col; j++) {
            table[i][j].cost = arr[i][j];
        }
        if (i == 0) {
            printf("First run: %hd %hd\n", arr[0][4], table[0][4].cost);
            printf("%hd ", table[1][0].cost);
        }
    }
}

row is 5 and column is 4.
I'm currently inserting 5 (arr[0][4])  at table[0][4].cost
However, as soon as I insert the value to table[0][4].cost, table[1][0].cost updates with the same value.

Also after finish inserting the second row, my first row value changes.

After inserting the first row

4 2 1 0 5

5

After inserting the second row

4 2 1 0 2

2 0 4 1 0

and this happens every row. Last element on the row and first element on the next row are same.
I'm really not sure why this happens.

Also, I checked if my arr[i][j] value, but the arr is correct.

after inserting the second row,

I should have

4 2 1 0 5

2 0 4 1 0

instead of

4 2 1 0 2

2 0 4 1 0

I feel like it's related to pointer, but I'm not sure what to do


问:
React Native Navigation: navigate from every Screen?
in with React Native Navigation, is there a way to navigate to a point from different components/routes, from the main layer?

In my example:
I am located "NavigationController -> Drawer -> ToursStackNavigator -> TourScreen -> List -> User" and I want to navigate from there, to "NavigationController -> Drawer -> UserStackNavigation -> UserDetail with ID.

Here my Navigation Structure:

```<code>- StackNavigation (Root)
     - Auth
          - Login
          - Register

     - Portal

        - Drawer

            - TourStackScreens
                 - TourList
                 - TourDetail

            - UserStackScreens
                 - UserScreens
                 - UserDetail

...
</code>```

In TourDetails I have a component called Userpill (Participants list), this same component is in UserDetail (Friends list).

I do manage to get from the TourDetails userpill list to the UserDetails of the user - but not, with the same statement of UserDetails, because useNavigation always passes only the next possible navigation.

Is there somehow the possibility to navigate from the very first element?

Example:
navigation.goBackToRoot().navigate('Portal', {
screen : 'Drawer',
params : {
screen : 'UserStackScreens',
params : {
screen : 'UserDetail',
params : {
user_id : user.id
}
}
}
})

I have already tried to set a reference to the NavigationContainer with useRef and to control something from there - but it did not work.

With useNavigation, unfortunately, only the current navigation is output.

If I create a continuous loop with getParent(), up to the last element, I can still not specify the complete path.

I'm running out of ideas - I'm still very new to React Native.

Body:
in with React Native Navigation, is there a way to navigate to a point from different components/routes, from the main layer?

In my example:
I am located "NavigationController -> Drawer -> ToursStackNavigator -> TourScreen -> List -> User" and I want to navigate from there, to "NavigationController -> Drawer -> UserStackNavigation -> UserDetail with ID.

Here my Navigation Structure:

- StackNavigation (Root)
     - Auth
          - Login
          - Register

     - Portal

        - Drawer

            - TourStackScreens
                 - TourList
                 - TourDetail

            - UserStackScreens
                 - UserScreens
                 - UserDetail

...

In TourDetails I have a component called Userpill (Participants list), this same component is in UserDetail (Friends list).

I do manage to get from the TourDetails userpill list to the UserDetails of the user - but not, with the same statement of UserDetails, because useNavigation always passes only the next possible navigation.

Is there somehow the possibility to navigate from the very first element?

Example:
navigation.goBackToRoot().navigate('Portal', {
screen : 'Drawer',
params : {
screen : 'UserStackScreens',
params : {
screen : 'UserDetail',
params : {
user_id : user.id
}
}
}
})

I have already tried to set a reference to the NavigationContainer with useRef and to control something from there - but it did not work.

With useNavigation, unfortunately, only the current navigation is output.

If I create a continuous loop with getParent(), up to the last element, I can still not specify the complete path.

I'm running out of ideas - I'm still very new to React Native.


问:
Python - argparse - (Singleton) Argument w/ optional parameter
before I code something that argparse can do, I wanted to ask here.

I am using "argparse" to parse the arguments in my python script.

My current approach looks like this, but it does not work as intended.

```<code>import argparse

parser = argparse.ArgumentParser(description="---",
                                 formatter_class=argparse.ArgumentDefaultsHelpFormatter)

file= parser.add_argument_group('file')
file.add_argument("-l", "--location", help="add a new location")
file.add_argument("-d", "--dynamic", help="add a new dynamic script")
file.add_argument("-g", "--game", help="initialize a new project")

file.add_argument("-b", "--build", help="build the project", action='store_true')
file.add_argument("-r", "--run", help="run the project", action='store_true')
file.add_argument("-v", "--version", help="displays the current version", action='store_true')

args = parser.parse_args()
</code>```

I would like the following usage:

```<code>Usage: [ -v | -h | ( -i | -l | -d | -b | -r ) NAME  ]
</code>```

Where "|" means or and []/() are groups.

Is there a way to implement this with "argparse" (or another framework)?

If not, I can implement it for myself without any problems. However, since I want to have a clean code, I would prefer a "short" solution using a framework.

Edit:

Thanks to hpauljI I changed my code as follows and it is working now:

```<code># usage: [-h] [-l LOCATION | -d DYNAMIC | -g GAME | -b | -r | -v]

# -- attrinutes with a parameter
group = parser.add_mutually_exclusive_group()
group.add_argument("-l", "--location", help="add a new location")
group.add_argument("-d", "--dynamic", help="add a new dynamic script")
group.add_argument("-g", "--game", help="initialize a new project")

# -- attributes w/o parameter
group.add_argument("-b", "--build", help="build the project", action='store_true')
group.add_argument("-r", "--run", help="run the project", action='store_true')
group.add_argument("-v", "--version", help="displays the current version", action='store_true')
</code>```

Body:
before I code something that argparse can do, I wanted to ask here.

I am using "argparse" to parse the arguments in my python script.

My current approach looks like this, but it does not work as intended.

import argparse

parser = argparse.ArgumentParser(description="---",
                                 formatter_class=argparse.ArgumentDefaultsHelpFormatter)

file= parser.add_argument_group('file')
file.add_argument("-l", "--location", help="add a new location")
file.add_argument("-d", "--dynamic", help="add a new dynamic script")
file.add_argument("-g", "--game", help="initialize a new project")

file.add_argument("-b", "--build", help="build the project", action='store_true')
file.add_argument("-r", "--run", help="run the project", action='store_true')
file.add_argument("-v", "--version", help="displays the current version", action='store_true')

args = parser.parse_args()

I would like the following usage:

Usage: [ -v | -h | ( -i | -l | -d | -b | -r ) NAME  ]

Where "|" means or and []/() are groups.

Is there a way to implement this with "argparse" (or another framework)?

If not, I can implement it for myself without any problems. However, since I want to have a clean code, I would prefer a "short" solution using a framework.

Edit:

Thanks to hpauljI I changed my code as follows and it is working now:

# usage: [-h] [-l LOCATION | -d DYNAMIC | -g GAME | -b | -r | -v]

# -- attrinutes with a parameter
group = parser.add_mutually_exclusive_group()
group.add_argument("-l", "--location", help="add a new location")
group.add_argument("-d", "--dynamic", help="add a new dynamic script")
group.add_argument("-g", "--game", help="initialize a new project")

# -- attributes w/o parameter
group.add_argument("-b", "--build", help="build the project", action='store_true')
group.add_argument("-r", "--run", help="run the project", action='store_true')
group.add_argument("-v", "--version", help="displays the current version", action='store_true')


问:
psycopg2 declare connection name and info
how can i declare connection information in psycopg?
is that possible?

in pg_hero we can manage and view all connections!
I realized that some tools like metabase send connection information

so I wonder is that possible in psycopg or not?
what is that ability name anyway?
I saw the info class in connection (psycopg2.extensions.ConnectionInfo(connection))
But I couldn't find any example for using it


问:
App store(private) release into multiple regions
I’m part of a team about to release a private ios app(for employees). And only one requirement is holding us from releasing. The app is only accessible for people using apple id from the same region.while we have many who uses US app store id and they cant access it. Is there any method,or approach. could help us deliver the final release and be available in two regions stores?(accessible for user on US app store, and ASIA APP STORE )

We reached out via appconnect. Explaining that we are a diverse corporate, and many people uses US based/region app store account. And they cant have access to the employee app.
The reason is that the corporate isnt based on the united state


Title: ASCII Art with Python in console

Body:
I need to show this ASCII code in print (python) but when i do, it's show me error. I'm not using other files extras only simple file.py

The console show me "SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 122-123: truncated \xXX escape"

print("""

            ______________________
           /\  __________________ \
          /xx\ \________________/\ \
         /x/\x\ \            /x/\x\ \
        /x/ /\x\ \          /x/ /\x\ \
       /x/ /  \x\ \________/_/_/__\_\ \____________________
      /x/ /    \x\____________________  __________________ \
     /x/ /     /x/ __________________/\ \________________/\ \
    /x/ /_____/x/ /_____/x/ /_____/x/\x\ \____        /x/\x\ \
   /x/_/_____/x/ /______\/_/_____/x/ /\x\ \__ \      /x/ /\x\ \
   \x\ \____/x/ /_______/\ \____/x/ /  \x\ \/\ \____/_/_/__\_\ \
    \x\ \  /x/ /     /x/\x\ \  /x/ /    \x\_____________________\
     \x\ \/x/ /     /x/ /\x\_\/x/ /    _/x/ ______ ___________  /
      \x\/x/ /_____/_/_/__\_\/x/_/_____/x/ /__\_\_\/_/     /x/ /
       \xx/_/________________\/_/_____/x/ /______\/_/     /x/ /
       /xx\ \________________/\ \____/x/ /______ /\ \    /x/ /
      /x/\x\ \  /x/ /_____/x/\x\ \__/x/ /     /x/\x\ \  /x/ /
     /x/ /\x\ \/x/_/_____/x/ /\x\ \/x/ /     /x/ /\x\ \/x/ /
    /x/ /  \x\ \_\_\____/_/_/__\_\/x/ /\____/_/_/__\_\/x/ /
   /x/ /    \x\___________________\/ /________________\/ /
  /x/ /     /x/ __________________  ____________________/
 /x/ /_____/x/ /__\_\/x/ /_____/x/ /__\_\/x/ /
/x/_/_____/x/ /______\/_/_____/x/ /______\/ /
\x\ \____/x/ /_______/\ \____/x/ /_________/
 \x\ \  /x/ /        \x\ \  /x/ /
  \x\ \/x/ /          \x\ \/x/ /
   \x\/x/ /____________\_\/x/ /
    \xx/ /________________\/ /
     \/_____________________/

""")

I tried triple quotes, apostrophes and none have worked for me. and also i tried with import modules of UTF-8 but also doesn't work


问:
Trying to deploy an ml model as an api through bentoml
```<code>import bentoml
import numpy as np
from bentoml.io import NumpyNdarray

# Get the runner
xgb_runner = bentoml.models.get("xgb_booster:latest").to_runner()

# Create a Service object
svc = bentoml.Service("xgb_classifier", runners=[xgb_runner])

# Create an endpoint named classify
@svc.api(input=NumpyNdarray(), output=NumpyNdarray())
def classify(input_series) -> np.ndarray:
    # Convert the input string to numpy array
    label = xgb_runner.predict.run(input_series)

    return label
</code>```

bentoml serve service.py:svc --reload

so this is my code
and the error i am getting is

Error: [bentoml-cli] serve failed: Failed to load bento or import service 'Service.py:svc'.
If you are attempting to import bento in local store: 'Failed to import module "Service.py": No module named 'Service.py''.
If you are importing by python module path: 'Bento 'Service.py:svc' is not found in BentoML store <osfs '/root/bentoml/bentos'>'.

so i tried pip install service

Body:
import bentoml
import numpy as np
from bentoml.io import NumpyNdarray

# Get the runner
xgb_runner = bentoml.models.get("xgb_booster:latest").to_runner()

# Create a Service object
svc = bentoml.Service("xgb_classifier", runners=[xgb_runner])

# Create an endpoint named classify
@svc.api(input=NumpyNdarray(), output=NumpyNdarray())
def classify(input_series) -> np.ndarray:
    # Convert the input string to numpy array
    label = xgb_runner.predict.run(input_series)

    return label

bentoml serve service.py:svc --reload

so this is my code
and the error i am getting is

Error: [bentoml-cli] serve failed: Failed to load bento or import service 'Service.py:svc'.
If you are attempting to import bento in local store: 'Failed to import module "Service.py": No module named 'Service.py''.
If you are importing by python module path: 'Bento 'Service.py:svc' is not found in BentoML store <osfs '/root/bentoml/bentos'>'.

so i tried pip install service


问:
Rails ActiveRecord Query: Summarize items by Parent category, when each item only references Subcategory
I need to feed summarized data into a chart library. It should look something like ["parent 1"=> $$$, "parent 2"=> $$$, ... "parent n"=>$$$]

I've got something working with pure SQL, but how do I replicate it with active record?

```<code>SELECT parents.name, SUM(trxes.amount)
FROM categories as parents
JOIN categories as subcategories ON subcategories.parent_id = parents.id
JOIN trxes ON trxes.category_id = subcategories.id
GROUP BY parents.id
ORDER BY parents.id
=>
[{"name"=>"Income Parent", "SUM(trxes.amount)"=>2270832},
 {"name"=>"Other", "SUM(trxes.amount)"=>1721246},
 {"name"=>"1. Everyday Expenses", "SUM(trxes.amount)"=>-14638},
 {"name"=>"2. Monthly Expenses", "SUM(trxes.amount)"=>-492363},
 {"name"=>"4. Sinking Funds", "SUM(trxes.amount)"=>59742}]
</code>```

The closest I've come is getting the Parent-Category_ID.

```<code>Category.includes(:trxes).group("categories.parent_id").sum(:amount)
=> {nil=>0, 1=>2270832, 2=>1721246, 3=>-14638, 4=>-492363, 5=>0, 6=>59742, 7=>0}
</code>```

The following query fails with "no such column" error. Its generated SQL call seems to miss the self JOIN of the category table.

```<code>Category.includes(:trxes).group("categories.parent_id.name").sum(:amount)

Category Sum (0.3ms)
SELECT SUM(amount) AS "sum_amount", categories.parent_id.name AS "categories_parent_id_name"
FROM "categories"
LEFT OUTER JOIN "trxes" ON "trxes"."category_id" = "categories"."id"
GROUP BY categories.parent_id.name

.../database.rb:152:in `initialize': SQLite3::SQLException: no such column: categories.parent_id.name (ActiveRecord::StatementInvalid)

.../database.rb:152:in `initialize': no such column: categories.parent_id.name (SQLite3::SQLException)
</code>```

Here are my models:

```<code>class Category < ApplicationRecord
  belongs_to :parent, class_name: "Category", optional: true
  has_many :subcategories, class_name: "Category", foreign_key: :parent_id
  has_many :trxes
...
class Trx < ApplicationRecord
  belongs_to :category, optional: true
...
</code>```

schema.rb

```<code>  create_table "categories", force: :cascade do |t|
    t.string "name", null: false
    t.integer "parent_id"
    ...
  end
  create_table "trxes", force: :cascade do |t|
    t.integer "amount", default: 0, null: false
    t.integer "account_id"
    t.integer "category_id"
    t.index ["category_id"], name: "index_trxes_on_category_id"
    ...
  end
</code>```

Body:
I need to feed summarized data into a chart library. It should look something like ["parent 1"=> $$$, "parent 2"=> $$$, ... "parent n"=>$$$]

I've got something working with pure SQL, but how do I replicate it with active record?

SELECT parents.name, SUM(trxes.amount)
FROM categories as parents
JOIN categories as subcategories ON subcategories.parent_id = parents.id
JOIN trxes ON trxes.category_id = subcategories.id
GROUP BY parents.id
ORDER BY parents.id
=>
[{"name"=>"Income Parent", "SUM(trxes.amount)"=>2270832},
 {"name"=>"Other", "SUM(trxes.amount)"=>1721246},
 {"name"=>"1. Everyday Expenses", "SUM(trxes.amount)"=>-14638},
 {"name"=>"2. Monthly Expenses", "SUM(trxes.amount)"=>-492363},
 {"name"=>"4. Sinking Funds", "SUM(trxes.amount)"=>59742}]

The closest I've come is getting the Parent-Category_ID.

Category.includes(:trxes).group("categories.parent_id").sum(:amount)
=> {nil=>0, 1=>2270832, 2=>1721246, 3=>-14638, 4=>-492363, 5=>0, 6=>59742, 7=>0}

The following query fails with "no such column" error. Its generated SQL call seems to miss the self JOIN of the category table.

Category.includes(:trxes).group("categories.parent_id.name").sum(:amount)

Category Sum (0.3ms)
SELECT SUM(amount) AS "sum_amount", categories.parent_id.name AS "categories_parent_id_name"
FROM "categories"
LEFT OUTER JOIN "trxes" ON "trxes"."category_id" = "categories"."id"
GROUP BY categories.parent_id.name

.../database.rb:152:in `initialize': SQLite3::SQLException: no such column: categories.parent_id.name (ActiveRecord::StatementInvalid)

.../database.rb:152:in `initialize': no such column: categories.parent_id.name (SQLite3::SQLException)

Here are my models:

class Category < ApplicationRecord
  belongs_to :parent, class_name: "Category", optional: true
  has_many :subcategories, class_name: "Category", foreign_key: :parent_id
  has_many :trxes
...
class Trx < ApplicationRecord
  belongs_to :category, optional: true
...

schema.rb

  create_table "categories", force: :cascade do |t|
    t.string "name", null: false
    t.integer "parent_id"
    ...
  end
  create_table "trxes", force: :cascade do |t|
    t.integer "amount", default: 0, null: false
    t.integer "account_id"
    t.integer "category_id"
    t.index ["category_id"], name: "index_trxes_on_category_id"
    ...
  end


问:
Calculate AUC from observation values
Can I somehow use sklearn method below to compute the AUC value? without having the y coordinates? Or is there some other method that I can use?

```<code>import numpy as np
from sklearn import metrics

# observations
obs_points = [5.7, 6.0, 6.2, 6.3, 6.4, 6.6, 6.7, 6.9, 7.0, 7.4]
obs_labels = ['O1','O2','O3','O4','O5','O6','O7','O8','O9', 'O10']

y = np.array([])
pred = np.array(obs_points)
fpr, tpr, thresholds = metrics.roc_curve(y, pred, pos_label=2)
metrics.auc(fpr, tpr)
</code>```

Thanks in advance!

Title: Calculate AUC from observation values

Body:
Can I somehow use sklearn method below to compute the AUC value? without having the y coordinates? Or is there some other method that I can use?

import numpy as np
from sklearn import metrics

# observations
obs_points = [5.7, 6.0, 6.2, 6.3, 6.4, 6.6, 6.7, 6.9, 7.0, 7.4]
obs_labels = ['O1','O2','O3','O4','O5','O6','O7','O8','O9', 'O10']

y = np.array([])
pred = np.array(obs_points)
fpr, tpr, thresholds = metrics.roc_curve(y, pred, pos_label=2)
metrics.auc(fpr, tpr)

Thanks in advance!


问:
Google Maps auto refresh info window
I's like to auto refresh location in info windows every second not just on click but automatically...</p>
```<code>marker.addListener('click', function () {
        var content = '<p>Lat:'+this.getPosition().lat()+'</p><p>Lng:'+ this.getPosition().lng();
        infowindow.setContent(content);
        infowindow.open(map,this);
    });

        infowindow.open(map,marker);

            marker.setMap( map );
            flightPath.push( pos );
            isInitialized = true;
        }
</code>```

Title: Google Maps auto refresh info window

Body:
I's like to auto refresh location in info windows every second not just on click but automatically...

marker.addListener('click', function () {
        var content = '
Lat:'+this.getPosition().lat()+'

Lng:'+ this.getPosition().lng();
        infowindow.setContent(content);
        infowindow.open(map,this);
    });

        infowindow.open(map,marker);

            marker.setMap( map );
            flightPath.push( pos );
            isInitialized = true;
        }


问:
How to automate versioning app on a successful merge in GitLab CI?
I am new to app deployment, basically I want to automate the process of incrementing the version of my app whenever a merge request is approved.

So a merge request is sent to the test branch

tests run

user manually completes the merge request into test branch via button click

** Here I want to automate running npm version patch and update the packages & package version on the test branch **

Any ideas on how I can implement this successfully? I have been researching and also already tried having this run in a separate job that runs only on the test branch, but then it was failing because it runs in an infinite loop - it will update the version, then GitLab rebuilds it, then it runs update again since the jobs are sequential.

Ex of what I tried so far:

```<code>update-v:
  stage: update
  script:
    - echo "moving on to update build version..."
    - npm version patch
  only:
    - test
</code>```

Body:
I am new to app deployment, basically I want to automate the process of incrementing the version of my app whenever a merge request is approved.

So a merge request is sent to the test branch

tests run

user manually completes the merge request into test branch via button click

** Here I want to automate running npm version patch and update the packages & package version on the test branch **

Any ideas on how I can implement this successfully? I have been researching and also already tried having this run in a separate job that runs only on the test branch, but then it was failing because it runs in an infinite loop - it will update the version, then GitLab rebuilds it, then it runs update again since the jobs are sequential.

Ex of what I tried so far:

update-v:
  stage: update
  script:
    - echo "moving on to update build version..."
    - npm version patch
  only:
    - test


问:
How do I get the page_id for a confluence cloud page from the shared url?
My company is migrating to Confluence Cloud. For my automation/integration with Confluence, I use page_id and page_title often. I use the Atlassian/Confluence python library.

I see in the confluence cloud there is a new type of URL that I am calling "shared" url. In the datacenter confluence, clicking "Share" would provide a shortened URL (with /x/ and a convertible string to page_id, example below). In the shared url, there may be a similar conversion, but I have not figured it out and cannot find any reference material for it.

Example (using python here):

```<code>from base64 import b64decode

short_x_url = 'https://teradata-pe-dev-003.atlassian.net/wiki/x/OAvV'
tiny_id = short_x_url.split('/')[-1]
page_id = int.from_bytes(b64decode(tiny_id.ljust(8,'A').replace('_', '+').replace('-', '/').encode()), byteorder='little')
</code>```

page_id = 13962040

The shared url for the same page is:
'https://teradata-pe-dev-003.atlassian.net/l/cp/et51WoVX'

So what I would like is to find a way to convert that to either a page id, or a page title with wiki 'space'. Thanks.

Body:
My company is migrating to Confluence Cloud. For my automation/integration with Confluence, I use page_id and page_title often. I use the Atlassian/Confluence python library.

I see in the confluence cloud there is a new type of URL that I am calling "shared" url. In the datacenter confluence, clicking "Share" would provide a shortened URL (with /x/ and a convertible string to page_id, example below). In the shared url, there may be a similar conversion, but I have not figured it out and cannot find any reference material for it.

Example (using python here):

from base64 import b64decode

short_x_url = 'https://teradata-pe-dev-003.atlassian.net/wiki/x/OAvV'
tiny_id = short_x_url.split('/')[-1]
page_id = int.from_bytes(b64decode(tiny_id.ljust(8,'A').replace('_', '+').replace('-', '/').encode()), byteorder='little')

page_id = 13962040

The shared url for the same page is:
'https://teradata-pe-dev-003.atlassian.net/l/cp/et51WoVX'

So what I would like is to find a way to convert that to either a page id, or a page title with wiki 'space'. Thanks.


问:
Is it possible to BehaviorSubject reset my useState value?
Problem: Whenever I click 't' key my theme changed as I expected. But for some reason this cause isModalVisible state reset. This cause one problem - When I have my modal open and click t - the modal disapear. I don't know why. Maybe BehaviorSubject cause the problem? Additionally, if I create another useState for test, which initial value is string 'AAA', and on open modal I set this state to string 'BBB'. Then I click 't' to change theme this test useState back to beginning value 'AAA'

My code looks like this:

const Component1 = () => {
  const [mode, setMode] = useRecoilState(selectedModeState);

  const { switcher, status } = useThemeSwitcher();

  const toggleMode = (newTheme: MODE_TYPE) => {
    theme$.next({ theme: newTheme });
    localStorage.setItem('theme', newTheme);
  };

  useEffect(() => {
    const mode_sub = theme$.subscribe(({ theme }) => {
      switcher({ theme: theme });
      setMode(theme);
    });

    return () => {
      mode_sub.unsubscribe();
    };
  }, []);

  return <Component2 toggleMode={toggleMode} currentMode={mode} />
}
```
<pre class="lang-js prettyprint-override"><code>const Component2 = ({toggleMode, currentMode}) => {
  const [mode, setMode] = useState(currentMode);
  const [savedTheme, setSavedTheme] = useRecoilState(selectedThemeState);

  const getTheme = mode === MODE_TYPE.LIGHT ? MODE_TYPE.DARK : MODE_TYPE.LIGHT;

  const themeListener = (event: KeyboardEvent) => {
    switch (event.key) {
      case 't':
        setMode(getTheme);
        toggleMode(getTheme);
        break;
    }
  };
  useEffect(() => {
    document.addEventListener('keydown', themeListener);
    document.body.setAttribute('data-theme', savedTheme);
    localStorage.setItem('color', savedTheme);

    return () => {
      document.removeEventListener('keydown', themeListener);
    };
  }, [savedTheme]);

  const [isModalVisible, setIsModalVisible] = useState<boolean>(false);

return (

<Modal isModalVisible={isModalVisible} setIsModalVisible={setIsModalVisible} />
)
}
</code>```

UTILS:

export const selectedModeState = atom<MODE_TYPE>({
  key: 'selectedThemeState',
  default: (localStorage.getItem('theme') as MODE_TYPE) || MODE_TYPE.LIGHT,
});

export const selectedThemeState = atom<string>({
  key: 'selectedColorState',
  default: (localStorage.getItem('color') as string) || 'blue',
});

export const theme$ = new BehaviorSubject({
  theme: (localStorage.getItem('theme') as THEME_TYPE) || THEME_TYPE.LIGHT,
});
```

I would like the theme change not to set visibleModal to false which causes the modal to close

Body:
Problem: Whenever I click 't' key my theme changed as I expected. But for some reason this cause isModalVisible state reset. This cause one problem - When I have my modal open and click t - the modal disapear. I don't know why. Maybe BehaviorSubject cause the problem? Additionally, if I create another useState for test, which initial value is string 'AAA', and on open modal I set this state to string 'BBB'. Then I click 't' to change theme this test useState back to beginning value 'AAA'

My code looks like this:

const Component1 = () => {
  const [mode, setMode] = useRecoilState(selectedModeState);

  const { switcher, status } = useThemeSwitcher();

  const toggleMode = (newTheme: MODE_TYPE) => {
    theme$.next({ theme: newTheme });
    localStorage.setItem('theme', newTheme);
  };

  useEffect(() => {
    const mode_sub = theme$.subscribe(({ theme }) => {
      switcher({ theme: theme });
      setMode(theme);
    });

    return () => {
      mode_sub.unsubscribe();
    };
  }, []);

  return <Component2 toggleMode={toggleMode} currentMode={mode} />
}

const Component2 = ({toggleMode, currentMode}) => {
  const [mode, setMode] = useState(currentMode);
  const [savedTheme, setSavedTheme] = useRecoilState(selectedThemeState);

  const getTheme = mode === MODE_TYPE.LIGHT ? MODE_TYPE.DARK : MODE_TYPE.LIGHT;

  const themeListener = (event: KeyboardEvent) => {
    switch (event.key) {
      case 't':
        setMode(getTheme);
        toggleMode(getTheme);
        break;
    }
  };
  useEffect(() => {
    document.addEventListener('keydown', themeListener);
    document.body.setAttribute('data-theme', savedTheme);
    localStorage.setItem('color', savedTheme);

    return () => {
      document.removeEventListener('keydown', themeListener);
    };
  }, [savedTheme]);

  const [isModalVisible, setIsModalVisible] = useState<boolean>(false);

return (

<Modal isModalVisible={isModalVisible} setIsModalVisible={setIsModalVisible} />
)
}

UTILS:

export const selectedModeState = atom<MODE_TYPE>({
  key: 'selectedThemeState',
  default: (localStorage.getItem('theme') as MODE_TYPE) || MODE_TYPE.LIGHT,
});

export const selectedThemeState = atom<string>({
  key: 'selectedColorState',
  default: (localStorage.getItem('color') as string) || 'blue',
});

export const theme$ = new BehaviorSubject({
  theme: (localStorage.getItem('theme') as THEME_TYPE) || THEME_TYPE.LIGHT,
});

I would like the theme change not to set visibleModal to false which causes the modal to close


问:
is it possible to run Hyperledger Explorer on ARM64 like Raspberry pi?
I am trying to see the blocks or Fabric using Hyperledger Explorer on raspberry pi. everytime I run docker-compose up the result is always the same like this:
Creating explorerdb.mynetwork.com ... done Creating explorer.mynetwork.com   ... done Attaching to explorerdb.mynetwork.com, explorer.mynetwork.com explorer.mynetwork.com      | exec /usr/local/bin/docker-entrypoint.sh: exec format error explorerdb.mynetwork.com    | 2022-12-13 19:59:02.094 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432 explorerdb.mynetwork.com    | 2022-12-13 19:59:02.096 UTC [1] LOG:  listening on IPv6 address "::", port 5432 explorerdb.mynetwork.com    | 2022-12-13 19:59:02.102 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" explorerdb.mynetwork.com    | 2022-12-13 19:59:02.152 UTC [20] LOG:  database system was shut down at 2022-12-13 19:58:39 UTC explorerdb.mynetwork.com    | 2022-12-13 19:59:02.164 UTC [1] LOG:  database system is ready to accept connections explorer.mynetwork.com exited with code 1

my docker-compose.yaml

`version: '2.1'

volumes:
pgdata:
walletstore:

networks:
mynetwork.com:
name: el_red

services:

explorerdb.mynetwork.com:
image: hyperledger/explorer-db:latest
container_name: explorerdb.mynetwork.com
hostname: explorerdb.mynetwork.com
environment:
- DATABASE_DATABASE=fabricexplorer
- DATABASE_USERNAME=hppoc
- DATABASE_PASSWORD=password
healthcheck:
test: "pg_isready -h localhost -p 5432 -q -U postgres"
interval: 30s
timeout: 10s
retries: 5
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- mynetwork.com

explorer.mynetwork.com:
image: hyperledger/explorer:latest
container_name: explorer.mynetwork.com
hostname: explorer.mynetwork.com
environment:
- DATABASE_HOST=explorerdb.mynetwork.com
- DATABASE_DATABASE=fabricexplorer
- DATABASE_USERNAME=hppoc
- DATABASE_PASSWD=password
- LOG_LEVEL_APP=debug
- LOG_LEVEL_DB=debug
- LOG_LEVEL_CONSOLE=info
- LOG_CONSOLE_STDOUT=true
- DISCOVERY_AS_LOCALHOST=false
volumes:
- ./config.json:/opt/explorer/app/platform/fabric/config.json
- ./connection-profile:/opt/explorer/app/platform/fabric/connection-profile
- ./organizations:/tmp/crypto
- walletstore:/opt/explorer/wallet
ports:
- 8080:8080
depends_on:
explorerdb.mynetwork.com:
condition: service_healthy
networks:
- mynetwork.com

`

my test-network.json

`
{
"name": "my-network",
"version": "1.0.0",
"client": {
"tlsEnable": true,
"adminCredential": {
"id": "exploreradmin",
"password": "exploreradminpw"
},
"enableAuthentication": true,
"organization": "Org1MSP",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
},
"orderer": "300"
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer0.org1.example.com": {}
}
}
},
"organizations": {
"Org1MSP": {
"mspid": "Org1MSP",
"adminPrivateKey": {
"pem": "-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgtkP3OchnVeSd6c0n\ns/SXp7E3JLiBQZExi1UVXuCQYcahRANCAAQgJLvV9SaRC550c1hyDVfDao1MaxJU\nlvnDq1Yi51/d2d5sLndQ4q33nuAoybKIR3eQIrvE2Wu4wTGQCL2r3t2F\n-----END PRIVATE KEY-----\n"

```<code>        },
        "peers": ["peer0.org1.example.com"],
        "signedCert": {
            "path": "/tmp/crypto//peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/cert.pem"
        }
    }
},
"peers": {
    "peer0.org1.example.com": {
        "tlsCACerts": {
            "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
        },
        "url": "grpcs://peer0.org1.example.com:7051"
    }
}
</code>```

}
`

I wait for like an hour everytime I run docker-compose up but nothing happen. Please help. Thank you so much in advance.

Body:
I am trying to see the blocks or Fabric using Hyperledger Explorer on raspberry pi. everytime I run docker-compose up the result is always the same like this:
Creating explorerdb.mynetwork.com ... done Creating explorer.mynetwork.com   ... done Attaching to explorerdb.mynetwork.com, explorer.mynetwork.com explorer.mynetwork.com      | exec /usr/local/bin/docker-entrypoint.sh: exec format error explorerdb.mynetwork.com    | 2022-12-13 19:59:02.094 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432 explorerdb.mynetwork.com    | 2022-12-13 19:59:02.096 UTC [1] LOG:  listening on IPv6 address "::", port 5432 explorerdb.mynetwork.com    | 2022-12-13 19:59:02.102 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" explorerdb.mynetwork.com    | 2022-12-13 19:59:02.152 UTC [20] LOG:  database system was shut down at 2022-12-13 19:58:39 UTC explorerdb.mynetwork.com    | 2022-12-13 19:59:02.164 UTC [1] LOG:  database system is ready to accept connections explorer.mynetwork.com exited with code 1

my docker-compose.yaml

`version: '2.1'

volumes:
pgdata:
walletstore:

networks:
mynetwork.com:
name: el_red

services:

explorerdb.mynetwork.com:
image: hyperledger/explorer-db:latest
container_name: explorerdb.mynetwork.com
hostname: explorerdb.mynetwork.com
environment:
- DATABASE_DATABASE=fabricexplorer
- DATABASE_USERNAME=hppoc
- DATABASE_PASSWORD=password
healthcheck:
test: "pg_isready -h localhost -p 5432 -q -U postgres"
interval: 30s
timeout: 10s
retries: 5
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- mynetwork.com

explorer.mynetwork.com:
image: hyperledger/explorer:latest
container_name: explorer.mynetwork.com
hostname: explorer.mynetwork.com
environment:
- DATABASE_HOST=explorerdb.mynetwork.com
- DATABASE_DATABASE=fabricexplorer
- DATABASE_USERNAME=hppoc
- DATABASE_PASSWD=password
- LOG_LEVEL_APP=debug
- LOG_LEVEL_DB=debug
- LOG_LEVEL_CONSOLE=info
- LOG_CONSOLE_STDOUT=true
- DISCOVERY_AS_LOCALHOST=false
volumes:
- ./config.json:/opt/explorer/app/platform/fabric/config.json
- ./connection-profile:/opt/explorer/app/platform/fabric/connection-profile
- ./organizations:/tmp/crypto
- walletstore:/opt/explorer/wallet
ports:
- 8080:8080
depends_on:
explorerdb.mynetwork.com:
condition: service_healthy
networks:
- mynetwork.com

`

my test-network.json

`
{
"name": "my-network",
"version": "1.0.0",
"client": {
"tlsEnable": true,
"adminCredential": {
"id": "exploreradmin",
"password": "exploreradminpw"
},
"enableAuthentication": true,
"organization": "Org1MSP",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
},
"orderer": "300"
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer0.org1.example.com": {}
}
}
},
"organizations": {
"Org1MSP": {
"mspid": "Org1MSP",
"adminPrivateKey": {
"pem": "-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgtkP3OchnVeSd6c0n\ns/SXp7E3JLiBQZExi1UVXuCQYcahRANCAAQgJLvV9SaRC550c1hyDVfDao1MaxJU\nlvnDq1Yi51/d2d5sLndQ4q33nuAoybKIR3eQIrvE2Wu4wTGQCL2r3t2F\n-----END PRIVATE KEY-----\n"

        },
        "peers": ["peer0.org1.example.com"],
        "signedCert": {
            "path": "/tmp/crypto//peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/cert.pem"
        }
    }
},
"peers": {
    "peer0.org1.example.com": {
        "tlsCACerts": {
            "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
        },
        "url": "grpcs://peer0.org1.example.com:7051"
    }
}

}
`

I wait for like an hour everytime I run docker-compose up but nothing happen. Please help. Thank you so much in advance.


问:
Accessing HTTPonly cookies in PHP
So, I've been making some custom session initiation code and have run across some issues in uisng HTTPonly cookies, for some reason I am not able to acess the cookies set to HTTPonly using $_COOKIE["cookie"]

I've been using the following code to set the cookie and I cannot see the cookie in the dev tools either so I'm unable to understand wether I've made a mistake in making the cookies or is there another way to access the cookies

```<code>setcookie("cookie","true",time() + (60*60*24*3), "/", true, true)
</code>```

I've tried storing the cookie normally with

```<code>setcookie("cookie","true",time() + (60*60*24*3), "/", false, false)
</code>```

In this case, I can see the cookie on the dev tool and also can access the cookie within php but as soon as I set HTTPonly to true, the code starts failing.

I have tried fetching with credentials and even tried encoding the cookie in the header but none of those worked. I have gone through the solutions posted but none of them deal with accessing these cookies

Title: Accessing HTTPonly cookies in PHP

Body:
So, I've been making some custom session initiation code and have run across some issues in uisng HTTPonly cookies, for some reason I am not able to acess the cookies set to HTTPonly using $_COOKIE["cookie"]

I've been using the following code to set the cookie and I cannot see the cookie in the dev tools either so I'm unable to understand wether I've made a mistake in making the cookies or is there another way to access the cookies

setcookie("cookie","true",time() + (60*60*24*3), "/", true, true)

I've tried storing the cookie normally with

setcookie("cookie","true",time() + (60*60*24*3), "/", false, false)

In this case, I can see the cookie on the dev tool and also can access the cookie within php but as soon as I set HTTPonly to true, the code starts failing.

I have tried fetching with credentials and even tried encoding the cookie in the header but none of those worked. I have gone through the solutions posted but none of them deal with accessing these cookies


问:
Uncaught (in promise) TypeError: src is undefined
I would like to ask for some help with my javascript code.

When my trigger is an  tag and plain text inside it, it works. But for structural reasons I had to use a  tag inside my , and that way I'm getting an error, "Uncaught (in promise) TypeError: src is undefined".

Here's the part of the JS code that the error is referring to:

```<code>     // destructure values
      const { link, src, artist, title, moodcover } = e.target.dataset;
      const peaksSrc = src.replace('.mp3', '.json');

      const res = await fetch(peaksSrc);
      const { data: peaks } = await res.json();

      wavesurfer.load(src, peaks);
      document.body.scrollTop = 0;
</code>```

What would be the solution for this problem?

Thanks in advance!

I've tried using  or
 instead of , but that didn't help.

Body:
I would like to ask for some help with my javascript code.

When my trigger is an  tag and plain text inside it, it works. But for structural reasons I had to use a  tag inside my , and that way I'm getting an error, "Uncaught (in promise) TypeError: src is undefined".

Here's the part of the JS code that the error is referring to:

     // destructure values
      const { link, src, artist, title, moodcover } = e.target.dataset;
      const peaksSrc = src.replace('.mp3', '.json');

      const res = await fetch(peaksSrc);
      const { data: peaks } = await res.json();

      wavesurfer.load(src, peaks);
      document.body.scrollTop = 0;

What would be the solution for this problem?

Thanks in advance!

I've tried using  or
 instead of , but that didn't help.