问:
debugging with OpenOCD reports Protocol error with Rcmd
I'm working on establishing a debug connection to a Renesas RZ/G2L MPU.
My OpenOCD connection appears to launch fine (and i can connect to it with gdb from the shell afterwards with (gdb) target remote localhost:3333 fine):

```<code>Open On-Chip Debugger 0.12.0-rc2+dev-00989-g9501b263e-dirty (2022-12-12-17:03)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
G2L
    G2L - 0 CA57(s), 2 CA55(s), 0 CA53(s), 0 CR7(s),  1 CM33(s)
    Boot Core - CA55

r9a07g044l.cpu
SMP targets: r9a07g044l.a55.0 r9a07g044l.a55.1
init_reset
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : J-Link V11 compiled Dec  5 2022 13:50:41
Info : Hardware version: 11.00
Info : VTarget = 1.812 V
Info : clock speed 4000 kHz
Info : JTAG tap: r9a07g044l.cpu tap/device found: 0x6ba00477 (mfg: 0x23b (ARM Ltd), part: 0xba00, ver: 0x6)
Info : r9a07g044l.a55.0: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for r9a07g044l.a55.0 on 3333
Info : Listening on port 3333 for gdb connections
Info : starting gdb server for r9a07g044l.m33 on 3334
Info : Listening on port 3334 for gdb connections
Info : gdb port disabled
</code>```

I'm trying to hook it up with eclipse to debug Flash Writer which should allow me to bring up the system. I createda debug configuration, set the init commands under start up (per instructions from Renesas) and set the launch target to localhost:3333. Upon launch of a debug session from Eclipse however, I get the following error:

```<code>Error in final launch sequence:

Failed to execute MI command:
source /home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer
Error message from debugger back end:
/home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer:12: Error in sourced command file:
Protocol error with Rcmd
Failed to execute MI command:
source /home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer
Error message from debugger back end:
/home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer:12: Error in sourced command file:
Protocol error with Rcmd
Failed to execute MI command:
source /home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer
Error message from debugger back end:
/home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer:12: Error in sourced command file:
Protocol error with Rcmd
/home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer:12: Error in sourced command file:\nProtocol error with Rcmd
</code>```

and on the OpenOCD console:

```<code>Info : accepting 'gdb' connection on tcp/3333
Info : r9a07g044l.a55.0 cluster 0 core 0 multi core
r9a07g044l.a55.0 halted in AArch64 state due to debug-request, current mode: EL3H
cpsr: 0x400003cd pc: 0x3a94
MMU: disabled, D-Cache: disabled, I-Cache: enabled
Info : New GDB Connection: 1, Target r9a07g044l.a55.0, state: halted
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: r9a07g044l.cpu: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (0) in DAP response
Info : Deferring arp_examine of r9a07g044l.a55.1
Info : Use arp_examine command to examine it manually!
Info : Deferring arp_examine of r9a07g044l.m33
Info : Use arp_examine command to examine it manually!
Error: Invalid ACK (0) in DAP response
Error: Debug regions are unpowered, an unexpected reset might have happened
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Info : dropped 'gdb' connection
</code>```

Oh I'm running this from a Fedora 36 host - if it matters

Body:
I'm working on establishing a debug connection to a Renesas RZ/G2L MPU.
My OpenOCD connection appears to launch fine (and i can connect to it with gdb from the shell afterwards with (gdb) target remote localhost:3333 fine):

Open On-Chip Debugger 0.12.0-rc2+dev-00989-g9501b263e-dirty (2022-12-12-17:03)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
G2L
    G2L - 0 CA57(s), 2 CA55(s), 0 CA53(s), 0 CR7(s),  1 CM33(s)
    Boot Core - CA55

r9a07g044l.cpu
SMP targets: r9a07g044l.a55.0 r9a07g044l.a55.1
init_reset
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : J-Link V11 compiled Dec  5 2022 13:50:41
Info : Hardware version: 11.00
Info : VTarget = 1.812 V
Info : clock speed 4000 kHz
Info : JTAG tap: r9a07g044l.cpu tap/device found: 0x6ba00477 (mfg: 0x23b (ARM Ltd), part: 0xba00, ver: 0x6)
Info : r9a07g044l.a55.0: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for r9a07g044l.a55.0 on 3333
Info : Listening on port 3333 for gdb connections
Info : starting gdb server for r9a07g044l.m33 on 3334
Info : Listening on port 3334 for gdb connections
Info : gdb port disabled

I'm trying to hook it up with eclipse to debug Flash Writer which should allow me to bring up the system. I createda debug configuration, set the init commands under start up (per instructions from Renesas) and set the launch target to localhost:3333. Upon launch of a debug session from Eclipse however, I get the following error:

Error in final launch sequence:

Failed to execute MI command:
source /home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer
Error message from debugger back end:
/home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer:12: Error in sourced command file:
Protocol error with Rcmd
Failed to execute MI command:
source /home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer
Error message from debugger back end:
/home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer:12: Error in sourced command file:
Protocol error with Rcmd
Failed to execute MI command:
source /home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer
Error message from debugger back end:
/home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer:12: Error in sourced command file:
Protocol error with Rcmd
/home/mistywest/git/rzg2_flash_writer/gdb_smarc_g2l_flash_writer:12: Error in sourced command file:\nProtocol error with Rcmd

and on the OpenOCD console:

Info : accepting 'gdb' connection on tcp/3333
Info : r9a07g044l.a55.0 cluster 0 core 0 multi core
r9a07g044l.a55.0 halted in AArch64 state due to debug-request, current mode: EL3H
cpsr: 0x400003cd pc: 0x3a94
MMU: disabled, D-Cache: disabled, I-Cache: enabled
Info : New GDB Connection: 1, Target r9a07g044l.a55.0, state: halted
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: r9a07g044l.cpu: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (0) in DAP response
Info : Deferring arp_examine of r9a07g044l.a55.1
Info : Use arp_examine command to examine it manually!
Info : Deferring arp_examine of r9a07g044l.m33
Info : Use arp_examine command to examine it manually!
Error: Invalid ACK (0) in DAP response
Error: Debug regions are unpowered, an unexpected reset might have happened
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the APB-AP
Info : dropped 'gdb' connection

Oh I'm running this from a Fedora 36 host - if it matters


来源: stackexchange

问:
Images will load from ".html", but are not loading at run-time from the ".js" file when deployed to server
Please help me out. I have wasted all of the day trying to solve this problem. I couldn't, thats why I am asking for help here.

My images are loaded on run-time through javascript from "index.js" file. The images are shown when on localhost but when i build the project for the production, then the images that supposed to be load at run-time using the "index.js" file, will not be showing BUT if i put the same image in the ".html" file, it will load.

There are same queries in the past like this, and the answer to those queries here is that:
1- Github is case-sensitive so use all small letters
2- put ./ at the start or remove / from the url.

My problem is nothing like the above. It is something else. Here is the link to my github: https://github.com/Yasirkhan6499/tweet-personal

Please I need your help!!!

ContentLicense: CC BY-SA 4.0


问:
CustomInitContainers are not executing in Helmchart
I am  deploying Jenkins helm chart with some custom values, but the custominitcontainer is not getting executed when i deploy the Helm chart.

Created my chart values as below, copying some of the contents to java keystore for Ldap integration , but   after deploying the helm chart , I don't see the container is created/code is executed inside the  custominitcontainer .

Can someone help me, here .

The  Helm chart code is

```<code>controller:
  JCasC:
    defaultConfig: true
    configUrls: []
    configScripts: {}
    security:
      apiToken:
        creationOfLegacyTokenEnabled: false
        tokenGenerationOnCreationEnabled: false
        usageStatisticsEnabled: true
    authorizationStrategy: |-
      loggedInUsersCanDoAnything:
        allowAnonymousRead: false
  adminUser: "admin"
  adminPassword: "**********"
  numExecutors: 4
  resources:
    requests:
      cpu: "50m"
      memory: "512Mi"
    limits:
      cpu: "2000m"
      memory: "1024Mi"
  installPlugins:
    - configuration-as-code:1569.vb_72405b_80249
    - kubernetes:3734.v562b_b_a_627ea_c
  installLatestPlugins: false
  scriptApproval: []
servicePort: 8080
targetPort: 8080
customInitContainers:
    - name: "check-certificates"
      image: "jenkins/jenkins:2.361.2-jdk11"
      imagePullPolicy: "Always"
      command:
         -sh
      args:
         - -c
         - cp -f "${JAVA_HOME}/lib/security/cacerts" /var/jenkins_keystore/; if [
          "$(ls /var/jenkins_keystore)" ]; then for f in
          /var/jenkins_keystore/*; do keytool -importcert -file "${f}"
          -alias "$(basename "${f}")" -keystore /var/jenkins_keystore
          -storepass changeit -trustcacerts -noprompt; done; fi;
persistence:
  volumes:
    - name: jenkins-https-keystore
      secret:
        secretName: jenkins-https-jks
        items:
          - key: jenkins-jks-file
            path: keystore.jks
  mounts:
    - name: jenkins-https-keystore
      mountPath: /var/jenkins_keystore

containerEnv:
    - name: JENKINS_HTTPS_KEYSTORE_PASSWORD
      valueFrom:
        secretKeyRef:
          name: jenkins-https-jks
          key: https-jks-password
</code>```

Body:
I am  deploying Jenkins helm chart with some custom values, but the custominitcontainer is not getting executed when i deploy the Helm chart.

Created my chart values as below, copying some of the contents to java keystore for Ldap integration , but   after deploying the helm chart , I don't see the container is created/code is executed inside the  custominitcontainer .

Can someone help me, here .

The  Helm chart code is

controller:
  JCasC:
    defaultConfig: true
    configUrls: []
    configScripts: {}
    security:
      apiToken:
        creationOfLegacyTokenEnabled: false
        tokenGenerationOnCreationEnabled: false
        usageStatisticsEnabled: true
    authorizationStrategy: |-
      loggedInUsersCanDoAnything:
        allowAnonymousRead: false
  adminUser: "admin"
  adminPassword: "**********"
  numExecutors: 4
  resources:
    requests:
      cpu: "50m"
      memory: "512Mi"
    limits:
      cpu: "2000m"
      memory: "1024Mi"
  installPlugins:
    - configuration-as-code:1569.vb_72405b_80249
    - kubernetes:3734.v562b_b_a_627ea_c
  installLatestPlugins: false
  scriptApproval: []
servicePort: 8080
targetPort: 8080
customInitContainers:
    - name: "check-certificates"
      image: "jenkins/jenkins:2.361.2-jdk11"
      imagePullPolicy: "Always"
      command:
         -sh
      args:
         - -c
         - cp -f "${JAVA_HOME}/lib/security/cacerts" /var/jenkins_keystore/; if [
          "$(ls /var/jenkins_keystore)" ]; then for f in
          /var/jenkins_keystore/*; do keytool -importcert -file "${f}"
          -alias "$(basename "${f}")" -keystore /var/jenkins_keystore
          -storepass changeit -trustcacerts -noprompt; done; fi;
persistence:
  volumes:
    - name: jenkins-https-keystore
      secret:
        secretName: jenkins-https-jks
        items:
          - key: jenkins-jks-file
            path: keystore.jks
  mounts:
    - name: jenkins-https-keystore
      mountPath: /var/jenkins_keystore

containerEnv:
    - name: JENKINS_HTTPS_KEYSTORE_PASSWORD
      valueFrom:
        secretKeyRef:
          name: jenkins-https-jks
          key: https-jks-password


问:
PSEXEC command runs correctly on remote computer but redirecting data back to source computer results in user name or password incorrect
I have run the PSEC command successfully on my old WIN 10 computer for years. Recently I had to buy a new computer running WIN 11. The PSEC command runs successfully on new computer with return code 0 but the redirect commands to return data to source computer results in error "The user name or password is incorrect. Shown below is the PSEC command I run.

```<code>C:\Windows\System32>c:\windows\system32\psexec \\main -h -f  -accepteula -u main\abc -p xyz -c "c:\users\123\documents\backup\Log_enable_Main.bat"
</code>```

An extract of Log_enable_Main.bat is below:

```<code>hostname
hostname >> \\ShopNew\users\123\documents\backup\logenable.log
</code>```

And the execution of that command results in:

```<code>C:\WINDOWS\system32>hostname
Main
C:\WINDOWS\system32>hostname  1>>\\ShopNew\users\123\documents\backup\logenable.log
**The user name or password is incorrect.**
</code>```

I don't even know what user name or password it refers to. Like I indicated the bat file runs correctly on remote computer. It executes several commands on the remote and saves the data locally  it just won't send data back to the source computer. I have credentials on both computers that points to the other computer. I am at a loss where to begin.

As indicated above, this command has run successfully for years on my old WIN 10 computer I just can't get it to work on my WIN 11. The remote computer is still running WIN 10.

Body:
I have run the PSEC command successfully on my old WIN 10 computer for years. Recently I had to buy a new computer running WIN 11. The PSEC command runs successfully on new computer with return code 0 but the redirect commands to return data to source computer results in error "The user name or password is incorrect. Shown below is the PSEC command I run.

C:\Windows\System32>c:\windows\system32\psexec \\main -h -f  -accepteula -u main\abc -p xyz -c "c:\users\123\documents\backup\Log_enable_Main.bat"

An extract of Log_enable_Main.bat is below:

hostname
hostname >> \\ShopNew\users\123\documents\backup\logenable.log

And the execution of that command results in:

C:\WINDOWS\system32>hostname
Main
C:\WINDOWS\system32>hostname  1>>\\ShopNew\users\123\documents\backup\logenable.log
**The user name or password is incorrect.**

I don't even know what user name or password it refers to. Like I indicated the bat file runs correctly on remote computer. It executes several commands on the remote and saves the data locally  it just won't send data back to the source computer. I have credentials on both computers that points to the other computer. I am at a loss where to begin.

As indicated above, this command has run successfully for years on my old WIN 10 computer I just can't get it to work on my WIN 11. The remote computer is still running WIN 10.


问:
ffmpeg-next how can I enable multithreading on a decoder?
I'm using the rust crate ffmpeg-next to decode some video into individual frames for usage in another library. Problem is when I run my test it only seems to use a single core. I've tried modifying the threading configuration for my decoder as you can see below, but It doesn't seem to be do anything

        let context_decoder =
            ffmpeg_next::codec::context::Context::from_parameters(input_stream.parameters())?;
        let mut decoder = context_decoder.decoder().video()?;
        let mut threading_config = decoder.threading();
        threading_config.count = num_cpus::get();
        threading_config.kind = ThreadingType::Frame;

        decoder.set_threading(threading_config);
```


问:
Google Apps script on cell background change recalculation
I am having custom function that counts number of colored cells within a A1 notation range.

```<code>function countByColor(color, inputA1) {
  let count = 0

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = sheet.getRange(inputA1);

  range.getBackgrounds().forEach(function(value) {
  if(value[0] != undefined) {
    if(value[0] == color) {
      count=count+1
    }
  }
 });
 return count
}
</code>```

I am coloring the cells using conditional forwarding, so basically the argument of the calling function is not changed. I need to refresh the results within the sheet on change, but If I create Trigger event (based time) it tries to call that function, but failing as I am not providing (within the declaration in Apps Script) any arguments
In Cells the function looks like this -

```<code>=countByColor("#00ff00", "I7:I70")*1
</code>```

The function works find, but if another cell within that range changes color, it doesn't recalculate. Since I am using that function in 20 cells, I need to quickly recalculate all of them

Time Triggers

On Change Triggers

Body:
I am having custom function that counts number of colored cells within a A1 notation range.

function countByColor(color, inputA1) {
  let count = 0

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = sheet.getRange(inputA1);

  range.getBackgrounds().forEach(function(value) {
  if(value[0] != undefined) {
    if(value[0] == color) {
      count=count+1
    }
  }
 });
 return count
}

I am coloring the cells using conditional forwarding, so basically the argument of the calling function is not changed. I need to refresh the results within the sheet on change, but If I create Trigger event (based time) it tries to call that function, but failing as I am not providing (within the declaration in Apps Script) any arguments
In Cells the function looks like this -

=countByColor("#00ff00", "I7:I70")*1

The function works find, but if another cell within that range changes color, it doesn't recalculate. Since I am using that function in 20 cells, I need to quickly recalculate all of them

Time Triggers

On Change Triggers


问:
What does core parameter do in search.maven.org's REST API?
From this REST API page:
https://central.sonatype.org/search/rest-api-guide/

There is an example: https://search.maven.org/solrsearch/select?q=g:com.google.inject+AND+a:guice&core=gav&rows=20&wt=json

I noticed it has the parameter core=gav. I tried the API with/without it, the results do not seem to be changed.

Does anyone know what it is?


问:
Wordpress BODY class - add page slug as body class AND make it the first class
The standard 'Add page slug as body class' function page is good.
How to make the class(es) appear first in the list displayed in the body tag?

E.g. Currently: <body class="page-template page-template-main page-template-main-php page page-id-XXXX page-main">

Change to: <body class="page-main page-template page-template-main page-template-main-php page page-id-XXXX">

Original code:

```<code>// ADD PAGE SLUG TO BODY CLASS
function add_page_slug_body_class( $classes ) {
    global $post;

    if ( isset( $post ) ) {
        $classes[] = 'page-' . $post->post_name;
    }
    return $classes;
}
add_filter( 'body_class', 'add_page_slug_body_class' );
</code>```

Body:
The standard 'Add page slug as body class' function page is good.
How to make the class(es) appear first in the list displayed in the body tag?

E.g. Currently: <body class="page-template page-template-main page-template-main-php page page-id-XXXX page-main">

Change to: <body class="page-main page-template page-template-main page-template-main-php page page-id-XXXX">

Original code:

// ADD PAGE SLUG TO BODY CLASS
function add_page_slug_body_class( $classes ) {
    global $post;

    if ( isset( $post ) ) {
        $classes[] = 'page-' . $post->post_name;
    }
    return $classes;
}
add_filter( 'body_class', 'add_page_slug_body_class' );


问:
How to configure GitHub so that a Pull Request to a forked repository uses as basis the fork and not the upstream repository?
The current question is related to a previous question I asked.

There was a suggestion for a follow-up question on how to configure GitHub to achieved the desired result of pushing code to the fork (not the upstream repository). Hence, here it is.


问:
Using Microsoft Access VBA to Update Teamup Calendar via API
I'm an experienced VBA programmer but have little experience with API's.

My goal is to use VBA to add an event to a Teamup calendar with the click of a button.  The required data is present in the database, I have a Teamup API key and Teamup has provided the following rules:

API access MUST be done over TLS/SSL via https://api.teamup.com/

All API requests must include an API key in a request header

Strings in requests and responses MUST be using the UTF-8 character set

Successful responses will have status codes in the 200-299 range

Client errors will have status codes in the 400-499 range

Server errors will have status codes in the 500-599 range

Placeholders in URL examples are indicated by curly braces, e.g. {eventId}

API responses are in JSON using the application/json content type

Any help figuring this out, or in pointing me to the right resources would be appreciated.

I've played around with CreateObject("MSXML2.XMLHTTP"), but not sure if I'm on the right track.

In advance, thank you!


问:
How to change the font-size in PdfPTable to all cells of the dataGridView?
I managed to change the fonte size only at the HeatherTest, how can I do it for all other cells?
i would like when i save datagridview to pdf, all cells changed the font size.
I did a lot of research but couldn't find an adequate answer to my need.

 private void btnPrintPdf_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count > 0)

            {
                SaveFileDialog save = new SaveFileDialog();
                save.Filter = "PDF (*.pdf)|*.pdf";
                save.FileName = "Result.pdf";
                bool ErrorMessage = false;
                if (save.ShowDialog() == DialogResult.OK)
                {
                    if (File.Exists(save.FileName))
                    {
                        try
                        {
                            File.Delete(save.FileName);
                        }
                        catch (Exception ex)
                        {
                            ErrorMessage = true;

                            MessageBox.Show("Impossibile scrivere i dati nel disco" + ex.Message);
                        }
                    }
                    if (!ErrorMessage)
                    {
                        try
                        {
                            iTextSharp.text.Font fontH1 = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.COURIER, 8, iTextSharp.text.Font.NORMAL);
                            PdfPTable pTable = new PdfPTable(dataGridView1.Columns.Count);
                            pTable.DefaultCell.Padding = 0;
                            pTable.WidthPercentage = 100;
                            pTable.HorizontalAlignment = Element.ALIGN_LEFT;
                            foreach (DataGridViewColumn col in dataGridView1.Columns)
                            {
                                PdfPCell pCell = new PdfPCell(new Phrase(col.HeaderText, fontH1));
                                pTable.AddCell(pCell);
                            }
                            foreach (DataGridViewRow viewRow in dataGridView1.Rows)
                            {
                                foreach (DataGridViewCell dcell in viewRow.Cells)
                                {
                                    pTable.AddCell(dcell.Value.ToString());
                                }
                            }
                            using (FileStream fileStream = new FileStream(save.FileName, FileMode.Create))
                            {
                                Document document = new Document(PageSize.A4.Rotate());
                                PdfWriter.GetInstance(document, fileStream);
                                document.Open();
                                document.Add(pTable);
                                document.Close();
                                fileStream.Close();
                            }
                            MessageBox.Show("Esportazione dei dati riuscita", "Messaggio", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Error while exporting Data" + ex.Message);
                        }
                  ```


问:
How to hash a PyTorch Tensor
Given a PyTorch Tensor of integers, for example, torch.Size(N, C, H, W).
Is there a way to efficiently hash each element of the tensor such that I get an output from [-MAX_INT32 to +MAX_INT32] or [0 to MAX_INT32] that fast runs on the GPU?

Also in a way I can perform output % N, and each element will be uniformly or almost uniformly distributed from 0 - N.

Title: How to hash a PyTorch Tensor


问:
How do I create multiple graphs iteratively across a dataset?
My goal is to create a specific lollipop graph for each column in my dataset.

```<code># A tibble: 388 × 29
   ID    Treatment_Co…¹ Sense…² Sense…³ Sense…⁴ Sense…⁵ Sense…⁶ Sense…⁷ Caree…⁸ Caree…⁹ Caree…˟ Caree…˟ Caree…˟ Caree…˟ Caree…˟ Sense…˟ Sense…˟ Sense…˟ Sense…˟ Sense…˟ Earth…˟
   <chr>          <dbl>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>
 1 1                  1       1       0       0       1       0       0       0       0       0       0       0      -1       0       0       0       0       0       0      -3
 2 2                  1      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA
 3 3                  2      -1      -2       0       1      -2       0       0       0      -1       0      -1      -1      -1       0       0       1       0       0       3
 4 4                  2       0       0       0       0       0       0       0       1       0       2       1       0       0       0       0       0       0       0      -1
 5 5                  2       0       0       0       1       0       0       0       2       1       1       0       0       1       0       0       0       0       0       1
 6 6                  2       0       3       3       1       0       1       0       0       0      -1       1       1       1       1       1       2       1       1       1
 7 7                  1       0      -2      -1       0      -1      -1      -2      -2      -2      -2      -2       0       0       0       0       0       0       0       0
 8 8                  2       0       0       0      -1       0       0       1       1      -1       0      -1      -1      -1       0       0       0       0       0       1
 9 9                  2      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA
10 10                 1       0       0      -1       0      -1       0       1       0       1       2       0       1       0       0       0       0       0       1       0
</code>```

The following code successfully creates the lollipop chart I'd like to create (or at least is close)--forgive me if this is garbage code, I'm pretty new to R.

```<code>data_ES_LS_Change_subset %>%
  drop_na(SenseofBelonging_1_Change) %>%
  ggplot(aes(x= reorder(`ID`, SenseofBelonging_1_Change), y=SenseofBelonging_1_Change)) +
  geom_point(stat='identity', aes(color= factor(Treatment_Control)), size=2) +
  geom_segment(aes(y = 0, x = `ID`, yend = SenseofBelonging_1_Change, xend = `ID`, color= factor(Treatment_Control))) +
  scale_color_manual(name="", labels=c("Treatment", "Control"), values=c("dodgerblue4", "firebrick4")) +
  theme(
      panel.background = element_rect(fill='transparent'),
      plot.background = element_rect(fill='transparent', color=NA),
      panel.grid.major.x = element_line(color="gray"),
      panel.grid.major.y = element_blank(),
      panel.grid.minor = element_blank(),
      legend.background = element_rect(fill='transparent'),
      legend.box.background = element_rect(color = NA),
      legend.key = element_rect(fill = 'transparent'),
      legend.position="top",
      axis.text.x = element_text(vjust = .40, hjust = .5, size = 10),
      axis.title.x = element_text(size = 10),
      axis.text.y = element_blank(),
      axis.ticks.y = element_blank(),
      text = element_text(size = 15)) +
    labs(title = "SenseofBelonging_1_Change",
         #subtitle= "Organized by greatest change",
         caption=  paste("Number of observations: ", data_all_subset.num %>%
                           summarise(sum(!is.na(SenseofBelonging_1_Change)))),
         x = "",
         y = "Change from beginning of the semester to the end",
         fill = "# Cylinders") +
  annotate("text", x = 250, y = -3.5, color = "dodgerblue4", size = 4,
           label = paste0("Positive Change = ",
                          sum(data_ES_LS_Change_subset$SenseofBelonging_1_Change[data_ES_LS_Change_subset$SenseofBelonging_1_Change > 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 1], na.rm = TRUE))) +
  annotate("text", x = 245, y = -3.5, color = "firebrick4", size = 4,
           label = paste0("Positive Change = ",
                          sum(data_ES_LS_Change_subset$SenseofBelonging_1_Change[data_ES_LS_Change_subset$SenseofBelonging_1_Change > 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 2], na.rm = TRUE))) +
  annotate("text", x = 7, y = 3.5, color = "dodgerblue4", size = 4,
           label = paste0("Negative Change = ",
                          sum(data_ES_LS_Change_subset$SenseofBelonging_1_Change[data_ES_LS_Change_subset$SenseofBelonging_1_Change < 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 1], na.rm = TRUE))) +
   annotate("text", x = 2, y = 3.5, color = "firebrick4", size = 4,
           label = paste0("Negative Change = ",
                          sum(data_ES_LS_Change_subset$SenseofBelonging_1_Change[data_ES_LS_Change_subset$SenseofBelonging_1_Change < 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 2], na.rm = TRUE))) +
  scale_y_continuous(breaks = c(-5:5), limits = c(-5,5)) +
  coord_flip()
</code>```

Ultimately though, I'd love not to have to manually copy/paste column names to create this graph for each column. In other words, I'd love to loop through the dataset and have it run automatically. Here is my failing effort at that:

```<code>plot.lollipop <- function(xvar) {
  data_ES_LS_Change_subset %>%
    drop_na(xvar) %>%
    ggplot(aes(x= reorder(`ID`, xvar), y= .data[[xvar]])) +
    geom_point(stat='identity', aes(color= factor(Treatment_Control)), size=2) +
    geom_segment(aes(y = 0, x = `ID`, yend = xvar, xend = `ID`, color= factor(Treatment_Control))) +
    scale_color_manual(name="", labels=c("Treatment", "Control"), values=c("dodgerblue4", "firebrick4")) +
    theme(
        panel.background = element_rect(fill='transparent'),
        plot.background = element_rect(fill='transparent', color=NA),
        panel.grid.major.x = element_line(color="gray"),
        panel.grid.major.y = element_blank(),
        panel.grid.minor = element_blank(),
        legend.background = element_rect(fill='transparent'),
        legend.box.background = element_rect(color = NA),
        legend.key = element_rect(fill = 'transparent'),
        legend.position="top",
        axis.text.x = element_text(vjust = .40, hjust = .5, size = 10),
        axis.title.x = element_text(size = 10),
        axis.text.y = element_blank(),
        axis.ticks.y = element_blank(),
        text = element_text(size = 15)) +
      labs(title = "xvar",
           #subtitle= "Organized by greatest change",
           caption=  paste("Number of observations: ", data_ES_LS_Change_subset %>%
                             summarise(sum(!is.na(xvar)))),
           x = "",
           y = "Change from beginning of the semester to the end",
           fill = "# Cylinders") +
    annotate("text", x = 250, y = -3.5, color = "dodgerblue4", size = 4,
             label = paste0("Positive Change = ",
                            sum(data_ES_LS_Change_subset$xvar[data_ES_LS_Change_subset$xvar > 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 1], na.rm = TRUE))) +
    annotate("text", x = 245, y = -3.5, color = "firebrick4", size = 4,
             label = paste0("Positive Change = ",
                            sum(data_ES_LS_Change_subset$xvar[data_ES_LS_Change_subset$xvar > 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 2], na.rm = TRUE))) +
    annotate("text", x = 7, y = 3.5, color = "dodgerblue4", size = 4,
             label = paste0("Negative Change = ",
                            sum(data_ES_LS_Change_subset$xvar[data_ES_LS_Change_subset$xvar < 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 1], na.rm = TRUE))) +
    annotate("text", x = 2, y = 3.5, color = "firebrick4", size = 4,
             label = paste0("Negative Change = ",
                            sum(data_ES_LS_Change_subset$xvar[data_ES_LS_Change_subset$xvar < 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 2], na.rm = TRUE))) +
    scale_y_continuous(breaks = c(-5:5), limits = c(-5,5)) +
    coord_flip()
# save pdf
  ggsave(paste0("/directory/lollipop charts/", xvar,"_change",".pdf"),  bg = "transparent", width = 10, height = 10)
} # END FUNCTION plot.lollipop

lapply(names(data_ES_LS_Change_subset)[3:19], plot.lollipop) #Plot lollipops
</code>```

Any help on the matter would be greatly appreciated.

Body:
My goal is to create a specific lollipop graph for each column in my dataset.

# A tibble: 388 × 29
   ID    Treatment_Co…¹ Sense…² Sense…³ Sense…⁴ Sense…⁵ Sense…⁶ Sense…⁷ Caree…⁸ Caree…⁹ Caree…˟ Caree…˟ Caree…˟ Caree…˟ Caree…˟ Sense…˟ Sense…˟ Sense…˟ Sense…˟ Sense…˟ Earth…˟
   <chr>          <dbl>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>
 1 1                  1       1       0       0       1       0       0       0       0       0       0       0      -1       0       0       0       0       0       0      -3
 2 2                  1      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA
 3 3                  2      -1      -2       0       1      -2       0       0       0      -1       0      -1      -1      -1       0       0       1       0       0       3
 4 4                  2       0       0       0       0       0       0       0       1       0       2       1       0       0       0       0       0       0       0      -1
 5 5                  2       0       0       0       1       0       0       0       2       1       1       0       0       1       0       0       0       0       0       1
 6 6                  2       0       3       3       1       0       1       0       0       0      -1       1       1       1       1       1       2       1       1       1
 7 7                  1       0      -2      -1       0      -1      -1      -2      -2      -2      -2      -2       0       0       0       0       0       0       0       0
 8 8                  2       0       0       0      -1       0       0       1       1      -1       0      -1      -1      -1       0       0       0       0       0       1
 9 9                  2      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA      NA
10 10                 1       0       0      -1       0      -1       0       1       0       1       2       0       1       0       0       0       0       0       1       0

The following code successfully creates the lollipop chart I'd like to create (or at least is close)--forgive me if this is garbage code, I'm pretty new to R.

data_ES_LS_Change_subset %>%
  drop_na(SenseofBelonging_1_Change) %>%
  ggplot(aes(x= reorder(`ID`, SenseofBelonging_1_Change), y=SenseofBelonging_1_Change)) +
  geom_point(stat='identity', aes(color= factor(Treatment_Control)), size=2) +
  geom_segment(aes(y = 0, x = `ID`, yend = SenseofBelonging_1_Change, xend = `ID`, color= factor(Treatment_Control))) +
  scale_color_manual(name="", labels=c("Treatment", "Control"), values=c("dodgerblue4", "firebrick4")) +
  theme(
      panel.background = element_rect(fill='transparent'),
      plot.background = element_rect(fill='transparent', color=NA),
      panel.grid.major.x = element_line(color="gray"),
      panel.grid.major.y = element_blank(),
      panel.grid.minor = element_blank(),
      legend.background = element_rect(fill='transparent'),
      legend.box.background = element_rect(color = NA),
      legend.key = element_rect(fill = 'transparent'),
      legend.position="top",
      axis.text.x = element_text(vjust = .40, hjust = .5, size = 10),
      axis.title.x = element_text(size = 10),
      axis.text.y = element_blank(),
      axis.ticks.y = element_blank(),
      text = element_text(size = 15)) +
    labs(title = "SenseofBelonging_1_Change",
         #subtitle= "Organized by greatest change",
         caption=  paste("Number of observations: ", data_all_subset.num %>%
                           summarise(sum(!is.na(SenseofBelonging_1_Change)))),
         x = "",
         y = "Change from beginning of the semester to the end",
         fill = "# Cylinders") +
  annotate("text", x = 250, y = -3.5, color = "dodgerblue4", size = 4,
           label = paste0("Positive Change = ",
                          sum(data_ES_LS_Change_subset$SenseofBelonging_1_Change[data_ES_LS_Change_subset$SenseofBelonging_1_Change > 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 1], na.rm = TRUE))) +
  annotate("text", x = 245, y = -3.5, color = "firebrick4", size = 4,
           label = paste0("Positive Change = ",
                          sum(data_ES_LS_Change_subset$SenseofBelonging_1_Change[data_ES_LS_Change_subset$SenseofBelonging_1_Change > 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 2], na.rm = TRUE))) +
  annotate("text", x = 7, y = 3.5, color = "dodgerblue4", size = 4,
           label = paste0("Negative Change = ",
                          sum(data_ES_LS_Change_subset$SenseofBelonging_1_Change[data_ES_LS_Change_subset$SenseofBelonging_1_Change < 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 1], na.rm = TRUE))) +
   annotate("text", x = 2, y = 3.5, color = "firebrick4", size = 4,
           label = paste0("Negative Change = ",
                          sum(data_ES_LS_Change_subset$SenseofBelonging_1_Change[data_ES_LS_Change_subset$SenseofBelonging_1_Change < 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 2], na.rm = TRUE))) +
  scale_y_continuous(breaks = c(-5:5), limits = c(-5,5)) +
  coord_flip()

Ultimately though, I'd love not to have to manually copy/paste column names to create this graph for each column. In other words, I'd love to loop through the dataset and have it run automatically. Here is my failing effort at that:

plot.lollipop <- function(xvar) {
  data_ES_LS_Change_subset %>%
    drop_na(xvar) %>%
    ggplot(aes(x= reorder(`ID`, xvar), y= .data[[xvar]])) +
    geom_point(stat='identity', aes(color= factor(Treatment_Control)), size=2) +
    geom_segment(aes(y = 0, x = `ID`, yend = xvar, xend = `ID`, color= factor(Treatment_Control))) +
    scale_color_manual(name="", labels=c("Treatment", "Control"), values=c("dodgerblue4", "firebrick4")) +
    theme(
        panel.background = element_rect(fill='transparent'),
        plot.background = element_rect(fill='transparent', color=NA),
        panel.grid.major.x = element_line(color="gray"),
        panel.grid.major.y = element_blank(),
        panel.grid.minor = element_blank(),
        legend.background = element_rect(fill='transparent'),
        legend.box.background = element_rect(color = NA),
        legend.key = element_rect(fill = 'transparent'),
        legend.position="top",
        axis.text.x = element_text(vjust = .40, hjust = .5, size = 10),
        axis.title.x = element_text(size = 10),
        axis.text.y = element_blank(),
        axis.ticks.y = element_blank(),
        text = element_text(size = 15)) +
      labs(title = "xvar",
           #subtitle= "Organized by greatest change",
           caption=  paste("Number of observations: ", data_ES_LS_Change_subset %>%
                             summarise(sum(!is.na(xvar)))),
           x = "",
           y = "Change from beginning of the semester to the end",
           fill = "# Cylinders") +
    annotate("text", x = 250, y = -3.5, color = "dodgerblue4", size = 4,
             label = paste0("Positive Change = ",
                            sum(data_ES_LS_Change_subset$xvar[data_ES_LS_Change_subset$xvar > 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 1], na.rm = TRUE))) +
    annotate("text", x = 245, y = -3.5, color = "firebrick4", size = 4,
             label = paste0("Positive Change = ",
                            sum(data_ES_LS_Change_subset$xvar[data_ES_LS_Change_subset$xvar > 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 2], na.rm = TRUE))) +
    annotate("text", x = 7, y = 3.5, color = "dodgerblue4", size = 4,
             label = paste0("Negative Change = ",
                            sum(data_ES_LS_Change_subset$xvar[data_ES_LS_Change_subset$xvar < 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 1], na.rm = TRUE))) +
    annotate("text", x = 2, y = 3.5, color = "firebrick4", size = 4,
             label = paste0("Negative Change = ",
                            sum(data_ES_LS_Change_subset$xvar[data_ES_LS_Change_subset$xvar < 0 &
                                                                                data_ES_LS_Change_subset$Treatment_Control == 2], na.rm = TRUE))) +
    scale_y_continuous(breaks = c(-5:5), limits = c(-5,5)) +
    coord_flip()
# save pdf
  ggsave(paste0("/directory/lollipop charts/", xvar,"_change",".pdf"),  bg = "transparent", width = 10, height = 10)
} # END FUNCTION plot.lollipop

lapply(names(data_ES_LS_Change_subset)[3:19], plot.lollipop) #Plot lollipops

Any help on the matter would be greatly appreciated.


问:
nginx forwarding from another server
I host a website using Linode (UnixUniverse.net) and would like to share some files from my home server, which is of course on a different IP. Sorry for the noob question, I'm quite new to nginx and proxying.

Basically, I want to have files.unixuniverse.net (and if possible ftp.unixuniverse.net) point to my home server with a directory browser. Would the best way be to mount the home server using an NFS mount/fuse, or is there a better way of doing it? Understandably, I wish to do this to not expose my home ip to the internet but still be able to share isos and software builds that would take up too much space on my 25gb VM host.

Thanks!

Title: nginx forwarding from another server


问:
Resolving an issue's checklist from pull request
Say I have an issue with checklist like so:

Issue #1:

```<code>This issue will fix the following things:

- [x] Checklist item 1
- [] Checklist item 2
- [] Checklist item 3
</code>```

Now, I know that I can specify which issue to fix from the PR using terms like, fixes, resolves, etc. However, is there a way to specify in the PR what checklist item from the issue that PR fixes? So something like:

```<code>Fixes #1-#2, fixes #1-#3
</code>```

Any help is appreciated. Thanks

Body:
Say I have an issue with checklist like so:

Issue #1:

This issue will fix the following things:

- [x] Checklist item 1
- [] Checklist item 2
- [] Checklist item 3

Now, I know that I can specify which issue to fix from the PR using terms like, fixes, resolves, etc. However, is there a way to specify in the PR what checklist item from the issue that PR fixes? So something like:

Fixes #1-#2, fixes #1-#3

Any help is appreciated. Thanks


问:
Same data object for all child processes with vanilla nodejs
I'm trying to create a server that receives the request and sends it to the servers running on different ports. All child processes servers are the same, they just have different ports.

For example, port 4000 listens for a request, and sends it to the 4001 port which prepares a response and sends the response back to the 4000 port and from the 4000 port to the client and next requests 4000 sends to 4002 and so on.

But I want all processes to work with the same simple data object (without installing any packages) which is stored in a separate file that means if the 4001 port changes this object, the 4002 port should work with this changed object without creating a new one in memory.

Here is the sample code-

```<code>const cluster = require("cluster");
const http = require("http");
const os = require("os");

let port = 4000;
let current = 1;

if (cluster.isPrimary) {
  const redirectHandler = (req, response) => {
      const request = http.request(
        { ...req, path: req.url, port: 4000 + current },
        (res) => {
          res.pipe(response);
        }
      );
      request.end();
      if (current === os.cpus().length - 1) {
        current = 0;
      } else {
        current++;
      }
  };

  const server = http.createServer(redirectHandler);
  server.listen(port, () => port++);

  for (let i = 0; i < os.cpus().length - 1; i++) {
    const worker = cluster.fork({ TASK_PORT: ++port });
  }
}
if (cluster.isWorker) {
  const workerPort = process.env["TASK_PORT"];
  const workerServer = http.createServer((req, res) => {
    /* change JS object which is located in separate file */
    res.end("Text" + workerPort);
  });
  workerServer.listen(+workerPort);
}

</code>```

Body:
I'm trying to create a server that receives the request and sends it to the servers running on different ports. All child processes servers are the same, they just have different ports.

For example, port 4000 listens for a request, and sends it to the 4001 port which prepares a response and sends the response back to the 4000 port and from the 4000 port to the client and next requests 4000 sends to 4002 and so on.

But I want all processes to work with the same simple data object (without installing any packages) which is stored in a separate file that means if the 4001 port changes this object, the 4002 port should work with this changed object without creating a new one in memory.

Here is the sample code-

const cluster = require("cluster");
const http = require("http");
const os = require("os");

let port = 4000;
let current = 1;

if (cluster.isPrimary) {
  const redirectHandler = (req, response) => {
      const request = http.request(
        { ...req, path: req.url, port: 4000 + current },
        (res) => {
          res.pipe(response);
        }
      );
      request.end();
      if (current === os.cpus().length - 1) {
        current = 0;
      } else {
        current++;
      }
  };

  const server = http.createServer(redirectHandler);
  server.listen(port, () => port++);

  for (let i = 0; i < os.cpus().length - 1; i++) {
    const worker = cluster.fork({ TASK_PORT: ++port });
  }
}
if (cluster.isWorker) {
  const workerPort = process.env["TASK_PORT"];
  const workerServer = http.createServer((req, res) => {
    /* change JS object which is located in separate file */
    res.end("Text" + workerPort);
  });
  workerServer.listen(+workerPort);
}


问:
How to fix the bug in rectangle-circle collision detection?
I've a user controlled rectangle div and a circle div which when met need to bounce away. I've used the below logic to achieve it, where x and y are the positions and w and h are the width and height:

```<code>function collisionDetection(rect, circle) {

//a is rect, b is circle

  let aLeftOfB = (rect.x + rect.w) < circle.x;
  let aRightOfB = rect.x > (circle.x + circle.w);
  let aAboveB = (rect.y + rect.h) < circle.y;
  let aBelowB = rect.y > (circle.y + circle.h);

  return !(aLeftOfB || aRightOfB || aAboveB || aBelowB);
}
</code>```

It's mostly working, the circle bounces away from the rectangle on collision except at few points. Around the edge of the rectangle or when it's above/below, it slides up/down the rectangle and then bounces away. How can I fix this issue?

Body:
I've a user controlled rectangle div and a circle div which when met need to bounce away. I've used the below logic to achieve it, where x and y are the positions and w and h are the width and height:

function collisionDetection(rect, circle) {

//a is rect, b is circle

  let aLeftOfB = (rect.x + rect.w) < circle.x;
  let aRightOfB = rect.x > (circle.x + circle.w);
  let aAboveB = (rect.y + rect.h) < circle.y;
  let aBelowB = rect.y > (circle.y + circle.h);

  return !(aLeftOfB || aRightOfB || aAboveB || aBelowB);
}

It's mostly working, the circle bounces away from the rectangle on collision except at few points. Around the edge of the rectangle or when it's above/below, it slides up/down the rectangle and then bounces away. How can I fix this issue?


问:
Firebase hosting not recognising next.js index page
We have picked up a very messy half built project and are trying to get it into an external beta testing state...

It is a next.js application which works fine if we run npm run build and then npm run start.

We prefer to host it on Firebase, for all the normal reasons and I believe it should be possible to do so.

However, when we install firebase and enable firebase experiments:enable webframeworks and firebase init hosting and accept the default options (Y,N) it adds the standard firebase index.html to the public folder - even though it didn't ask if we wanted that...

If we leave that index.html in place in the public folder then run firebase serve or firebase deploy, the /public/index.html is delivered as the root page of our site. When it should be the Index of the next application. If we delete the firebase index.html, and then rerun firebase serve to rebuild, then we get an 'undefined url' error (as it can't find the /public/index.html presumably).

We have an index.tsx in the /pages dir and when we run firebase serve, the build process does seem to be placing index-xxxxx.js chunk files etc. in .firebase/sitename/hosting/_next/static/chunks/pages.

We have tried adding rewrites in the firebase.json of various sorts, changed versions, everything we can think of. But still can't work out why firebase is not recognising the site root index page when it is running just fine on npm run start.

Any help appreciated to help us troubleshoot.


问:
Is there any way to get new versions by giving a specific artifact versoin with https://search.maven.org/solrsearch/select REST API?
I have been playing around sonatype maven REST API, but I have not yet worked out if there is a way that I can get new versions by giving specific version to the API.

So far, I found that I can put asterisk symbol for example:
https://search.maven.org/solrsearch/select?q=c:junit+AND+v:2.0.2*&rows=200&wt=json

Which shows any versions like 2.0.20, 2.0.21, 2.0.22...etc.

But I want to just see new versions with the given version.
For example, if I put version 2.0.21, is possible to return new versions:
2.0.22, 2.0.23, 3.0.1, 3.0.2....etc?


问:
Empty Struct gets populated with no apparent pattern in C
I am currently trying to create a method to populate student with data, while having it inside an array of student, in order to be able to process its data with ease later on.

I have created two structs:

```<code>typedef struct{
    char email[100];
    char name[100];
    char age[100];
    char score[100];
}student;

typedef struct{
    student *array;
}student_Array;
</code>```

Then, within main(), I would declare them to be populated right after, using the Student Score Data.txt:

```<code>|NAME|E-MAIL|AGE|SCORE
|James|James@gmail.com|20 Years Old|20/50
|Charlie|Charls@gmail.com|21 Years Old|23/50
|Parker|prak@gmail.com|22 Years Old|26/50
</code>```
```<code>int main(){
    char fileName[100];
    printf("Please enter file name:\n");

    scanf("%[^\n]",fileName);
    char  *contents = readFileRaw(fileName); //Student Score Data.txt

    student_Array students;

    students.array = malloc(sizeof(student) * 100);

    if(contents != NULL)
    Fill_Contents(contents, students); //Method to fill the structs using the text file.
    else
    printf("its empty\n");

    free(contents)

    ...
    ...

}
</code>```

However, after at some point, I have noticed that specifically one of the parameters, students.array[0].name was populated with a part of the text file when I have not.

Note that all the other parameters of the same index, email, age and score was behaving normally, and so did all of the parameters on greater indexes.

Here is what the terminal printed after it has assigned its values:

```<code>STUDENT 0 INFORMATION:
student 0's age is 20 Years Old
student 0's name is Old|23/50
|Parker|prak@gmail.com|35 Years Old|26/50/50James
student 0's email is └James@gmail.com
student 0's score is 20/50

 STUDENT 1 INFORMATION:
student 1's age is 21 Years Old
student 1's name is Charlie
student 1's email is Charls@gmail.com
student 1's score is 23/50

 STUDENT 2 INFORMATION:
student 2's age is 35 Years Old
student 2's name is Parker
student 2's email is prak@gmail.com
student 2's score is 26/50
</code>```

At first, I assumed it had to do with the Fill_Contents() method that I had created has some error, but it became clear that it was not the case.

By removing from main() the above mentioned method, it printed this:

```<code>STUDENT 0 INFORMATION:
student 0's age is
student 0's name is Old|23/50
|Parker|prak@gmail.com|35 Years Old|26/50/50
student 0's email is └
student 0's score is

 STUDENT 1 INFORMATION:
student 1's age is
student 1's name is
student 1's email is
student 1's score is

 STUDENT 2 INFORMATION:
student 2's age is
student 2's name is
student 2's email is
student 2's score is
</code>```

It has now suddenly appeared as if regardless of being assigned or not using the Fill_Contents(), it would have been already populated with Old|23/50|Parker|prak@gmail.com|35 Years Old|26/50/50 for unknown reason.

My only suspect now is at the students.array = malloc(sizeof(student) * 100);, where it could have been something related to the memory, but I have no idea how to move on from here.

I hope this has been clear, and I hope someone could help me with this.
I'm new to c, so apologies if I missed out on something.

Body:
I am currently trying to create a method to populate student with data, while having it inside an array of student, in order to be able to process its data with ease later on.

I have created two structs:

typedef struct{
    char email[100];
    char name[100];
    char age[100];
    char score[100];
}student;

typedef struct{
    student *array;
}student_Array;

Then, within main(), I would declare them to be populated right after, using the Student Score Data.txt:

|NAME|E-MAIL|AGE|SCORE
|James|James@gmail.com|20 Years Old|20/50
|Charlie|Charls@gmail.com|21 Years Old|23/50
|Parker|prak@gmail.com|22 Years Old|26/50

int main(){
    char fileName[100];
    printf("Please enter file name:\n");

    scanf("%[^\n]",fileName);
    char  *contents = readFileRaw(fileName); //Student Score Data.txt

    student_Array students;

    students.array = malloc(sizeof(student) * 100);

    if(contents != NULL)
    Fill_Contents(contents, students); //Method to fill the structs using the text file.
    else
    printf("its empty\n");

    free(contents)

    ...
    ...

}

However, after at some point, I have noticed that specifically one of the parameters, students.array[0].name was populated with a part of the text file when I have not.

Note that all the other parameters of the same index, email, age and score was behaving normally, and so did all of the parameters on greater indexes.

Here is what the terminal printed after it has assigned its values:

STUDENT 0 INFORMATION:
student 0's age is 20 Years Old
student 0's name is Old|23/50
|Parker|prak@gmail.com|35 Years Old|26/50/50James
student 0's email is └James@gmail.com
student 0's score is 20/50

 STUDENT 1 INFORMATION:
student 1's age is 21 Years Old
student 1's name is Charlie
student 1's email is Charls@gmail.com
student 1's score is 23/50

 STUDENT 2 INFORMATION:
student 2's age is 35 Years Old
student 2's name is Parker
student 2's email is prak@gmail.com
student 2's score is 26/50

At first, I assumed it had to do with the Fill_Contents() method that I had created has some error, but it became clear that it was not the case.

By removing from main() the above mentioned method, it printed this:

STUDENT 0 INFORMATION:
student 0's age is
student 0's name is Old|23/50
|Parker|prak@gmail.com|35 Years Old|26/50/50
student 0's email is └
student 0's score is

 STUDENT 1 INFORMATION:
student 1's age is
student 1's name is
student 1's email is
student 1's score is

 STUDENT 2 INFORMATION:
student 2's age is
student 2's name is
student 2's email is
student 2's score is

It has now suddenly appeared as if regardless of being assigned or not using the Fill_Contents(), it would have been already populated with Old|23/50|Parker|prak@gmail.com|35 Years Old|26/50/50 for unknown reason.

My only suspect now is at the students.array = malloc(sizeof(student) * 100);, where it could have been something related to the memory, but I have no idea how to move on from here.

I hope this has been clear, and I hope someone could help me with this.
I'm new to c, so apologies if I missed out on something.


问:
Squarespace drop up menu not functioning correctly (clickable part vanishing from view)
I am working on a custom Squarespace project for a client, and having trouble with a dropdown menu. Squarespace's default is to have the menu push down all other content blocks on the page. To prevent this, I had applied a z-index that helped it overlap over the rest of the page content on a different page, but it's not working on the default Squarespace blog page layout. So my alternative was to have the menu drop-up instead, but this is malfunctioning as the clickable part of the menu vanishes as soon as it is clicked. It also cuts off the upper part of the menu.

Please note the Squarespace CMS idiosyncrasies - as I can only go in and modify what's already there, the id and class names are not my choice. The dropdown menu is part of an "Archive block" that I am manipulating. The bottom property is positioning the menu where it needs to be on the page.

Page: https://www.youbelongsd.com/blog/

My code:

```<code>#collection-5b4791458a922da6575e66cf {
.archive-block-wrapper.archive-block-setting-layout-dropdown {
    width: 80%;
    position: absolute;
    z-index: 1!important;
        bottom: -90%;
  }
}
</code>```

In contrast, you can see the correctly functioning menu on a separate landing page I created for the blog to live on: https://www.youbelongsd.com/new-blog

(Because of the way Squarespace works, when individual post categories are clicked on, they direct you to the default blog page, the one that's causing problems with the dropdown/up menu. Otherwise I wouldn't even be messing with it.)

I've tried changing the z-index (no effect), adjusting display (no effect), and adjusting the bottom property which just moves the whole thing up and down. I added an overflow property, but that just created an awkward horizontal scroll bar. Any advice would be appreciated.

Body:
I am working on a custom Squarespace project for a client, and having trouble with a dropdown menu. Squarespace's default is to have the menu push down all other content blocks on the page. To prevent this, I had applied a z-index that helped it overlap over the rest of the page content on a different page, but it's not working on the default Squarespace blog page layout. So my alternative was to have the menu drop-up instead, but this is malfunctioning as the clickable part of the menu vanishes as soon as it is clicked. It also cuts off the upper part of the menu.

Please note the Squarespace CMS idiosyncrasies - as I can only go in and modify what's already there, the id and class names are not my choice. The dropdown menu is part of an "Archive block" that I am manipulating. The bottom property is positioning the menu where it needs to be on the page.

Page: https://www.youbelongsd.com/blog/

My code:

#collection-5b4791458a922da6575e66cf {
.archive-block-wrapper.archive-block-setting-layout-dropdown {
    width: 80%;
    position: absolute;
    z-index: 1!important;
        bottom: -90%;
  }
}

In contrast, you can see the correctly functioning menu on a separate landing page I created for the blog to live on: https://www.youbelongsd.com/new-blog

(Because of the way Squarespace works, when individual post categories are clicked on, they direct you to the default blog page, the one that's causing problems with the dropdown/up menu. Otherwise I wouldn't even be messing with it.)

I've tried changing the z-index (no effect), adjusting display (no effect), and adjusting the bottom property which just moves the whole thing up and down. I added an overflow property, but that just created an awkward horizontal scroll bar. Any advice would be appreciated.


问:
Error: Failed to serialize user into session in my Node.js Passport PSQL web app
This is my passport-config.js file. It should show the user can be serialised but for some reason it is not working.

```<code>const LocalStrategy = require('passport-local').Strategy
const { pool } = require("./db-config");
const bcrypt = require('bcrypt')

function initialize(passport, getUserById) {
  const authenticateUser = async (email, password, done) => {
    console.log(email, password);
        pool.query(
          `SELECT * FROM users WHERE email = $1;`,
          [email],
          (err, results) => {
            if (err) {
              throw err;
            }
            console.log(results.rows);

            if (results.rows.length > 0) {
              const user = results.rows[0];

              bcrypt.compare(password, user.password, (err, isMatch) => {
                if (err) {
                  console.log(err);
                }
                if (isMatch) {
                  return done(null, user);
                } else {
                  //password is incorrect
                  return done(null, false, { message: "Password is incorrect" });
                }
              });
            } else {
              // No user
              return done(null, false, {
                message: "No user with that email address"
              });
            }
          }
        );
      };

  passport.use(new LocalStrategy({ usernameField: 'email' }, authenticateUser))
  passport.serializeUser((user, done) => done(null, user.id))
  passport.deserializeUser((id, done) => {
    return done(null, getUserById(id))
  })
}

module.exports = initialize
</code>```

I think it's something to do with the PSQL query and it not recognising the user id. Please help :)

Body:
This is my passport-config.js file. It should show the user can be serialised but for some reason it is not working.

const LocalStrategy = require('passport-local').Strategy
const { pool } = require("./db-config");
const bcrypt = require('bcrypt')

function initialize(passport, getUserById) {
  const authenticateUser = async (email, password, done) => {
    console.log(email, password);
        pool.query(
          `SELECT * FROM users WHERE email = $1;`,
          [email],
          (err, results) => {
            if (err) {
              throw err;
            }
            console.log(results.rows);

            if (results.rows.length > 0) {
              const user = results.rows[0];

              bcrypt.compare(password, user.password, (err, isMatch) => {
                if (err) {
                  console.log(err);
                }
                if (isMatch) {
                  return done(null, user);
                } else {
                  //password is incorrect
                  return done(null, false, { message: "Password is incorrect" });
                }
              });
            } else {
              // No user
              return done(null, false, {
                message: "No user with that email address"
              });
            }
          }
        );
      };

  passport.use(new LocalStrategy({ usernameField: 'email' }, authenticateUser))
  passport.serializeUser((user, done) => done(null, user.id))
  passport.deserializeUser((id, done) => {
    return done(null, getUserById(id))
  })
}

module.exports = initialize

I think it's something to do with the PSQL query and it not recognising the user id. Please help :)


问:
How to draw fractal graph in networkx library?
I need to draw fractal graph or self-similar graph (for example like in picture below)

Does the networkx library have a special function for constructing this graph?


问:
Disable Kernel Spectre/Meltdown Mitigations
Is it possible to disable spectre/meltdown mitigations on container optimized OS instances? Because the root filesystem is readonly it doesn't seem to be possible to modify boot flags.

These are instances that run in isolated environments without internet access doing high performance processing.


问:
Why does my training loop completely skip after the first epoch in PyTorch?
I am currently trying to train a neural network in PyTorch. I first initialize:

#Start training
import torch.optim as optim
import itertools
model = unet()
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device)
optimizer = optim.Adam(model.parameters(),lr=1e-4)
criterion = nn.MSELoss()
criterion = criterion.to(device)
```
<p>And I define a training and validation function:</p>
<pre class="lang-py prettyprint-override"><code>#TRAINING

def train(model, iterator,optimizer,criterion):
  running_loss = 0.0
  epoch_acc = 0.0
  model.train()
  for (batch_idx,batch) in enumerate(iterator):

    spad,ground_truth = batch
    spad = spad.cuda()
    ground_truth = ground_truth.cuda()
    output = model(spad)

      #Compare reconstructed depth from SPAD to ground truth.
    loss = criterion(output,ground_truth)
    acc = ssim_accuracy(output,ground_truth)
    optimizer.zero_grad()
    loss.backward()

    optimizer.step()

    running_loss += loss.item()
    epoch_acc += acc.item()
    if(batch_idx % 10 == 9):
      print(epoch_acc / len(iterator))
      print(len(iterator))

  return running_loss / len(iterator), epoch_acc / len(iterator)
</code>```

def evaluate(model,iterator,criterion):
  epoch_loss = 0.0
  epoch_acc = 0.0

  with torch.no_grad():
    for (batch_idx,batch) in enumerate(iterator):
      spad,ground_truth = batch
      spad = spad.cuda()
      ground_truth = ground_truth.cuda()

      predictions = model(spad)
      #predictions = predictions.unsqueeze(0).unsqueeze(0)

      acc = ssim_accuracy(predictions, ground_truth)
      loss = criterion(predictions,ground_truth)

      #keep track of loss and accuracy
      epoch_loss += loss.item()
      epoch_acc += acc.item()

    #return epoch_loss / len(iterator), epoch_acc / len(iterator)
    return epoch_loss / len(iterator), epoch_acc / len(iterator)
```
<p>Finally, I train:</p>
<pre class="lang-py prettyprint-override"><code>EPOCHS = 10
print(len(train_iterator))
for epoch in range(1,EPOCHS+1):
  print("EPOCH " + str(epoch))
  train_loss,train_acc = train(model,train_iterator,optimizer,criterion)
  valid_loss,valid_acc = evaluate(model,test_iterator,criterion)

    # Showing statistics
  print(f'\tTrain Loss: {train_loss:.3f} | Train Acc: {train_acc*100:.2f}%')
  print(f'\t Val. Loss: {valid_loss:.3f} |  Val. Acc: {valid_acc*100:.2f}%')

</code>```

However, after the first epoch, the program completely stops and gives me "Train Loss = 0.00 | Train Acc = 0.00" for every epoch after, see below. Python does not even run the training loop and I have no idea why.

This is the output for a sample training, I make it return the current training accuracy after every 10 loops (that's the 0.04549... numbers). As you can see, it is certainly improving in accuracy. However, it completely skips any epochs after the first epoch.

```<code>88
EPOCH 1
/usr/local/lib/python3.8/dist-packages/scipy/io/matlab/mio.py:226: MatReadWarning: Duplicate variable name "None" in stream - replacing previous with new
Consider mio5.varmats_from_mat to split file into single variable files
  matfile_dict = MR.get_variables(variable_names)
0.045496476983482186
88
0.09700817919590256
88
0.15018199756741524
88
0.21078435704112053
88
0.2749210965226997
88
0.33811280131340027
88
    Train Loss: 1.706 | Train Acc: 37.47%
     Val. Loss: 2.058 |  Val. Acc: 54.50%
EPOCH 2
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 3
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 4
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 5
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 6
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 7
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 8
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 9
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 10
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
</code>```

If I make the training dataset set smaller or make it iterate over less of it, then the accuracy goes down. However, I have tried things like making it loop through half the data in one training loop, then make it train through the other half, and it still stops after the first loop and ignores the second loop. Do you know what might be the issue?

Could this be a problem with Google Colab? I doubt it, but I am using the free GPU that it provides right now. Maybe something to do with running out of memory? I have had it run out of memory before, but the system itself tells me if this is the case, rather than just refuse to run anything after a certain point with no explanation.

Body:
I am currently trying to train a neural network in PyTorch. I first initialize:

#Start training
import torch.optim as optim
import itertools
model = unet()
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device)
optimizer = optim.Adam(model.parameters(),lr=1e-4)
criterion = nn.MSELoss()
criterion = criterion.to(device)

And I define a training and validation function:

#TRAINING

def train(model, iterator,optimizer,criterion):
  running_loss = 0.0
  epoch_acc = 0.0
  model.train()
  for (batch_idx,batch) in enumerate(iterator):

    spad,ground_truth = batch
    spad = spad.cuda()
    ground_truth = ground_truth.cuda()
    output = model(spad)

      #Compare reconstructed depth from SPAD to ground truth.
    loss = criterion(output,ground_truth)
    acc = ssim_accuracy(output,ground_truth)
    optimizer.zero_grad()
    loss.backward()

    optimizer.step()

    running_loss += loss.item()
    epoch_acc += acc.item()
    if(batch_idx % 10 == 9):
      print(epoch_acc / len(iterator))
      print(len(iterator))

  return running_loss / len(iterator), epoch_acc / len(iterator)

def evaluate(model,iterator,criterion):
  epoch_loss = 0.0
  epoch_acc = 0.0

  with torch.no_grad():
    for (batch_idx,batch) in enumerate(iterator):
      spad,ground_truth = batch
      spad = spad.cuda()
      ground_truth = ground_truth.cuda()

      predictions = model(spad)
      #predictions = predictions.unsqueeze(0).unsqueeze(0)

      acc = ssim_accuracy(predictions, ground_truth)
      loss = criterion(predictions,ground_truth)

      #keep track of loss and accuracy
      epoch_loss += loss.item()
      epoch_acc += acc.item()

    #return epoch_loss / len(iterator), epoch_acc / len(iterator)
    return epoch_loss / len(iterator), epoch_acc / len(iterator)

Finally, I train:

EPOCHS = 10
print(len(train_iterator))
for epoch in range(1,EPOCHS+1):
  print("EPOCH " + str(epoch))
  train_loss,train_acc = train(model,train_iterator,optimizer,criterion)
  valid_loss,valid_acc = evaluate(model,test_iterator,criterion)

    # Showing statistics
  print(f'\tTrain Loss: {train_loss:.3f} | Train Acc: {train_acc*100:.2f}%')
  print(f'\t Val. Loss: {valid_loss:.3f} |  Val. Acc: {valid_acc*100:.2f}%')

However, after the first epoch, the program completely stops and gives me "Train Loss = 0.00 | Train Acc = 0.00" for every epoch after, see below. Python does not even run the training loop and I have no idea why.

This is the output for a sample training, I make it return the current training accuracy after every 10 loops (that's the 0.04549... numbers). As you can see, it is certainly improving in accuracy. However, it completely skips any epochs after the first epoch.

88
EPOCH 1
/usr/local/lib/python3.8/dist-packages/scipy/io/matlab/mio.py:226: MatReadWarning: Duplicate variable name "None" in stream - replacing previous with new
Consider mio5.varmats_from_mat to split file into single variable files
  matfile_dict = MR.get_variables(variable_names)
0.045496476983482186
88
0.09700817919590256
88
0.15018199756741524
88
0.21078435704112053
88
0.2749210965226997
88
0.33811280131340027
88
    Train Loss: 1.706 | Train Acc: 37.47%
     Val. Loss: 2.058 |  Val. Acc: 54.50%
EPOCH 2
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 3
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 4
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 5
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 6
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 7
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 8
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 9
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%
EPOCH 10
    Train Loss: 0.000 | Train Acc: 0.00%
     Val. Loss: 0.000 |  Val. Acc: 0.00%

If I make the training dataset set smaller or make it iterate over less of it, then the accuracy goes down. However, I have tried things like making it loop through half the data in one training loop, then make it train through the other half, and it still stops after the first loop and ignores the second loop. Do you know what might be the issue?

Could this be a problem with Google Colab? I doubt it, but I am using the free GPU that it provides right now. Maybe something to do with running out of memory? I have had it run out of memory before, but the system itself tells me if this is the case, rather than just refuse to run anything after a certain point with no explanation.


问:
How to read a data from text file and store it in CSV without overriding it pandas
I have text files which contain random data(no of lines are also different). I want to read it in such a way that the first line is store in first row of CSV file and second line on second row and so on. if rows finish and if data is left it can add a comma(,) and start storing again.

```<code>def round():
    cli = int(input('no of rows:: '))
    df_round_robin = self.path_to_csv.head(cli)
    df_round_robin.assign(new_column='0')
    queue = []
    fileloaction = "C:\Users\pro\.....*"
    for filename in os.listdir(filelocation):
        complete_path = filelocation + filename
        f = open(complete_path, "r")
        for i in f:
            queue.append(i)
        for i in queue:
            df_round_robin["new_column"] = i
            df_round_robin.to_csv(f'{filename}_round.csv')
            print(df_round_robin)
        quit()
</code>```

now this function which i wrote is working but not like what I want it always override data and also all rows contain same data.

this is what i want. but can't get it

```<code>if cli = 2
file contain four line
1
2
3
4

row1  row2  row3 new_column
1      2     3      1,3  or [1,3] # or list anything but in this form
1      2     3      2,4

if cli = 2
file contain five line
1
2
3
4
5

row1  row2  row3 new_column
1      2     3      1,3,5
1      2     3      2,4
</code>```

Body:
I have text files which contain random data(no of lines are also different). I want to read it in such a way that the first line is store in first row of CSV file and second line on second row and so on. if rows finish and if data is left it can add a comma(,) and start storing again.

def round():
    cli = int(input('no of rows:: '))
    df_round_robin = self.path_to_csv.head(cli)
    df_round_robin.assign(new_column='0')
    queue = []
    fileloaction = "C:\Users\pro\.....*"
    for filename in os.listdir(filelocation):
        complete_path = filelocation + filename
        f = open(complete_path, "r")
        for i in f:
            queue.append(i)
        for i in queue:
            df_round_robin["new_column"] = i
            df_round_robin.to_csv(f'{filename}_round.csv')
            print(df_round_robin)
        quit()

now this function which i wrote is working but not like what I want it always override data and also all rows contain same data.

this is what i want. but can't get it

if cli = 2
file contain four line
1
2
3
4

row1  row2  row3 new_column
1      2     3      1,3  or [1,3] # or list anything but in this form
1      2     3      2,4

if cli = 2
file contain five line
1
2
3
4
5

row1  row2  row3 new_column
1      2     3      1,3,5
1      2     3      2,4


问:
matrix multiplication using shared memory and fork
i have assigment to create c++ program which will multiple 2 uknown size matrix using fork and shared memory, I have write this code but at the end for multiplication result i get all zeros. Sorry for mess code im new in this.

`

```<code>`#include<iostream>
#include<math.h>
#include<vector>
#include<signal.h>
#include<unistd.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include<sys/wait.h>
using namespace std;

int l, m, n, job_numb;
key_t id_shared_mem;
int **B, **C, **A;

int **generateMatrix(int **matrix, int iterator, int vel){
  for (int i = 0; i < iterator; i++)
  {
    matrix[i] = new int[vel];
    for (int j = 0; j < vel; j++)
    {
      matrix[i][j] = (rand() % 9);
    }
  }
  return matrix;
}

int **generateMatrixC(int **matrix, int iterator, int vel)
{
  for (int i = 0; i < iterator; i++)
  {
    matrix[i] = new int[vel];
  }
  return matrix;
}

void *writeMatrixResult(int **matrix, int stupac, int red)
{
  for (int i = 0; i < stupac; i++)
  {
    for (int j = 0; j < red; j++)
    {
      cout << matrix[i][j] << " ";
    }
    cout << endl;
  }
  return NULL;
}

void write()
{
  cout << "Mnozenik = " << endl;
  writeMatrixResult(A, l, m);
  cout << "Mnozitelj  = " << endl;
  writeMatrixResult(B, m, l);
  cout << "Umnozak = " << endl;
  writeMatrixResult(C, l, l);
}

void abort(int sig) {

  if (sig == SIGINT) {
    for (int i = 0; i < job_numb; i++) wait(NULL);
    shmdt(A);
    shmdt(B);
    shmctl(id_shared_mem, IPC_RMID, NULL);
  } else {
    write();
    shmdt(A);
    shmdt(B);
    shmctl(id_shared_mem, IPC_RMID, NULL);
  }
  exit(0);
}

void proces(int procesId)
{
  while (job_numb > procesId)
  {
    int i = 0;
    while (i < l)
    {
      int j = 0;
      C[procesId][i] = 0;
      while (m > j)
      {
        C[procesId][i] = C[procesId][i] + A[procesId][j] * B[j][i];
        j++;
      }
      i++;
    }
    procesId++;
  }
}

int main(int argc, char ** argv) {

  if (argc != 4) {
    cout << " unesite 3 argumenta!" << endl;
    return 0;
  }

  l = atoi(argv[1]);
  m = atoi(argv[2]);
  n = atoi(argv[3]);
  job_numb = l / n;

  if (l % n) {
    job_numb++;
  }

  id_shared_mem = shmget(IPC_PRIVATE, sizeof(int) * 10, 0600);
  sigset(SIGINT, abort);

  A = (int **)shmat(id_shared_mem, NULL, 0);
  B = A + l;
  C = B + l * m*m;

  A = new int *[l];
  B = new int *[m];
  C = new int *[l];

  srand(time(NULL));
  A = generateMatrix(A,l, m );
  B = generateMatrix(B,m,l);
  C = generateMatrixC(C,l,l);

  for (int i = 0; i < n; i++)
  {
    switch (fork()) {
      case 0: { //dijete
        proces(i);
        exit(0);
      }
      case -1: { //greska
        cout << "Fatalna pogreska!" << endl;
        exit(1);
      }
    }
  }
  for (int i = 0; i < job_numb; i++) wait(NULL);
  abort(0);
}`
</code>```

`

i have try to assign only one value to matrix C  like c[1][1] = 2 in proces function to see if it will write any, but still im getting all zeros on printl.

Body:
i have assigment to create c++ program which will multiple 2 uknown size matrix using fork and shared memory, I have write this code but at the end for multiplication result i get all zeros. Sorry for mess code im new in this.

`

`#include<iostream>
#include<math.h>
#include<vector>
#include<signal.h>
#include<unistd.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include<sys/wait.h>
using namespace std;

int l, m, n, job_numb;
key_t id_shared_mem;
int **B, **C, **A;

int **generateMatrix(int **matrix, int iterator, int vel){
  for (int i = 0; i < iterator; i++)
  {
    matrix[i] = new int[vel];
    for (int j = 0; j < vel; j++)
    {
      matrix[i][j] = (rand() % 9);
    }
  }
  return matrix;
}

int **generateMatrixC(int **matrix, int iterator, int vel)
{
  for (int i = 0; i < iterator; i++)
  {
    matrix[i] = new int[vel];
  }
  return matrix;
}

void *writeMatrixResult(int **matrix, int stupac, int red)
{
  for (int i = 0; i < stupac; i++)
  {
    for (int j = 0; j < red; j++)
    {
      cout << matrix[i][j] << " ";
    }
    cout << endl;
  }
  return NULL;
}

void write()
{
  cout << "Mnozenik = " << endl;
  writeMatrixResult(A, l, m);
  cout << "Mnozitelj  = " << endl;
  writeMatrixResult(B, m, l);
  cout << "Umnozak = " << endl;
  writeMatrixResult(C, l, l);
}

void abort(int sig) {

  if (sig == SIGINT) {
    for (int i = 0; i < job_numb; i++) wait(NULL);
    shmdt(A);
    shmdt(B);
    shmctl(id_shared_mem, IPC_RMID, NULL);
  } else {
    write();
    shmdt(A);
    shmdt(B);
    shmctl(id_shared_mem, IPC_RMID, NULL);
  }
  exit(0);
}

void proces(int procesId)
{
  while (job_numb > procesId)
  {
    int i = 0;
    while (i < l)
    {
      int j = 0;
      C[procesId][i] = 0;
      while (m > j)
      {
        C[procesId][i] = C[procesId][i] + A[procesId][j] * B[j][i];
        j++;
      }
      i++;
    }
    procesId++;
  }
}

int main(int argc, char ** argv) {

  if (argc != 4) {
    cout << " unesite 3 argumenta!" << endl;
    return 0;
  }

  l = atoi(argv[1]);
  m = atoi(argv[2]);
  n = atoi(argv[3]);
  job_numb = l / n;

  if (l % n) {
    job_numb++;
  }

  id_shared_mem = shmget(IPC_PRIVATE, sizeof(int) * 10, 0600);
  sigset(SIGINT, abort);

  A = (int **)shmat(id_shared_mem, NULL, 0);
  B = A + l;
  C = B + l * m*m;

  A = new int *[l];
  B = new int *[m];
  C = new int *[l];

  srand(time(NULL));
  A = generateMatrix(A,l, m );
  B = generateMatrix(B,m,l);
  C = generateMatrixC(C,l,l);

  for (int i = 0; i < n; i++)
  {
    switch (fork()) {
      case 0: { //dijete
        proces(i);
        exit(0);
      }
      case -1: { //greska
        cout << "Fatalna pogreska!" << endl;
        exit(1);
      }
    }
  }
  for (int i = 0; i < job_numb; i++) wait(NULL);
  abort(0);
}`

`

i have try to assign only one value to matrix C  like c[1][1] = 2 in proces function to see if it will write any, but still im getting all zeros on printl.


问:
AWS Lightsail to external mySQL connections failing
I created a new instance (bitnami WordPress) in AWS Lightsail. Everything works fine. I am trying to connect to an external MySQL server (outside of AWS) from this Lightrail instance.

I am using the command:

mysql -u user_name -h xx.xx.xx.xx -p

Unfortunately, I am receiving this error message. I am unsure why the Lightrail instance resolves the external IP (outside of AWS) to the local Lightrail instance.

ERROR 1045 (28000): Access denied for user 'user_name'@'ec2-xx-xx-xx-xx.us-east-2.compute.amazonaws.com' (using password: YES)

I have performed an extensive search and could not find any similar issues.

FWIW, I have tried to add skip_name_resolve to the my.cnf file in vain.

I hope someone has run into this situation and was able to find a solution.

I could open a ticket with AWS; however, given that I have a basic account, I cannot place any support calls with AWS. I appreciate your help in advance.


问:
Is there an efficient way, besides using a double for loop, to generate a LIST of all possible pairs of indices (i, j) given an array so that i <= j?
Just to note - I don't just want the number of all the possible pairs, I need an actual array/list of all possible indices pairs.

I get that you can use a double for loop or generate combinations but the problem is that the time complexity would be O(N^2) and O(k(N! / [(N-k)! * k!])) where k = 2, respectively. So it makes it difficult to generate all possible pairs of indices if you have a large array of say over 1000 elements.

For example, the following worked when I use small arrays but is there anything more efficient to generate this list of [i, j] indices or an algorithm anyone could point me towards that might give me a solution?

Double for loop:

```<code>let pairs = [];
for (let i = 0; i < array.length; i++) {
  for (let j = i; j < array.length; j++) {
    pairs.push([i, j]);
  }
}
</code>```

Combinations using backtracking:

```<code>function findPairs(arr) {
    let result = [];
    backtrack(0, result, arr.length, [], 2);

    for (let i = 0; i < arr.length; i++) {
        result.push([i, i]);
    }

    return result;
}

function backtrack(start, result, len, curr, k = 2) {
    if (curr.length === k) result.push([...curr]);

    for (let i = start; i < len + 1; i++) {
        curr.push(i);
        backtrack(i + 1, result, len, curr, 2);
        curr.pop()
    }

    return result;
}
</code>```

Body:
Just to note - I don't just want the number of all the possible pairs, I need an actual array/list of all possible indices pairs.

I get that you can use a double for loop or generate combinations but the problem is that the time complexity would be O(N^2) and O(k(N! / [(N-k)! * k!])) where k = 2, respectively. So it makes it difficult to generate all possible pairs of indices if you have a large array of say over 1000 elements.

For example, the following worked when I use small arrays but is there anything more efficient to generate this list of [i, j] indices or an algorithm anyone could point me towards that might give me a solution?

Double for loop:

let pairs = [];
for (let i = 0; i < array.length; i++) {
  for (let j = i; j < array.length; j++) {
    pairs.push([i, j]);
  }
}

Combinations using backtracking:

function findPairs(arr) {
    let result = [];
    backtrack(0, result, arr.length, [], 2);

    for (let i = 0; i < arr.length; i++) {
        result.push([i, i]);
    }

    return result;
}

function backtrack(start, result, len, curr, k = 2) {
    if (curr.length === k) result.push([...curr]);

    for (let i = start; i < len + 1; i++) {
        curr.push(i);
        backtrack(i + 1, result, len, curr, 2);
        curr.pop()
    }

    return result;
}


问:
In Unity, a rigidbody automatically integrates all child colliders. How can I have a hitbox on the object/childeren that isn't used by the rigidbody?
In order to be a rigidbody, my pirate ship collider has to be convex (unity gives me errors when it's not). I have a more detailed (non-convex) collider that i want to use for raycasts within the boat, but when i add it as a child object, the rigidbody automatically tries to use it.

Is there a way that i can have a seperate mesh collider as a child of a rigidbody? Any work-arounds?

Putting the detailed mesh on a seperate layer doesn't work. The only thing i can think of is making the ship out of many seperate convex colliders, but this is a solution that i want to avoid, as getting smooth internal curves would require many, many colliders.

Thank you for reading.


问:
pyvmomi : get the list of vms on a esx host
I want to transfer all virtual machines using pyvmomi from one host to another, I can't get a list of virtual machines on one of the esxi hosts?

I just found methods to get a list of all the machines. please help me


问:
Keeping service member up-to-date in other parts of backend application
I have a Spring + Kotlin backend. In this application there exists a service which holds a member of type MutableMap<String, Model>. Here the Key is of type String to represent the objectId of a Mongodb Document and the Model is the Document Entity itself. My goal with this MutableMap is to quickly retrieve the Entity knowing the respective objectId for further processing / business logic. This member of Type MutableMap<String, Model> will get updated fairly regularly over the course of the application lifespan: new Models will get added and unnecessary Models will get removed / deleted via the MongoRepository from my database and therefore should also disappear from this MutableMap.

This Service is responsible for keeping the repository and this MutableMap member up to date. On the other hand I'm planning on using this MutableMap in other Services. My Problem here is, that I don't know how to keep the MutableMap updated in other parts of my application.

What I mean by that is that if for example this MutableMap is the member of ServiceA and I update the member via a method like

ServiceA.addModelToMutableMap(model: Model) {...}

How do I implement the functionality for detecting the change of this member in other Services? How to always have an up-to-date copy of this MutableMap in other Services / parts of my application?

I think that I have made a poor design choice that I'm not aware of, don't know which exact technology/dependency to use, unaware of a specific Spring feature or simply don't know what to google for.


问:
Unable to pick a file on Angular
for some reason I am not able to pick a file.

here is my code

```<code>    <button mat-stroked-button type="button" (click)="filePicker.click()" >Pick Image</button>
    <input type="file" #filePicker>
</code>```

No matter which button I pick it does not work. I also don't get a an error which is weird

I tried the StackOverflow question but I didn't have any luck::

```<code>https://stackoverflow.com/questions/51914566/how-to-choose-file-locally
</code>```

here is the project repository:
https://github.com/casas1010/mean-project

this is the files for the page that I am having issues with:
https://github.com/casas1010/mean-project/tree/main/src/app/posts/post-create

this is the documentation from angular::
https://blog.angular-university.io/angular-file-upload/

idk why its not working :(

Title: Unable to pick a file on Angular

Body:
for some reason I am not able to pick a file.

here is my code

    <button mat-stroked-button type="button" (click)="filePicker.click()" >Pick Image</button>
    <input type="file" #filePicker>

No matter which button I pick it does not work. I also don't get a an error which is weird

I tried the StackOverflow question but I didn't have any luck::

https://stackoverflow.com/questions/51914566/how-to-choose-file-locally

here is the project repository:
https://github.com/casas1010/mean-project

this is the files for the page that I am having issues with:
https://github.com/casas1010/mean-project/tree/main/src/app/posts/post-create

this is the documentation from angular::
https://blog.angular-university.io/angular-file-upload/

idk why its not working :(