问:
ActiveMQ single message consumed by multiple consumers
We are facing an issue where one message is consumed by two consumers from same queue. We want to restrict one message so that it can only be consumed by one consumer.

There is one producer application pushing the messages to queue named "Aeon," and the listener of this queue is dedicated to inserting a record. If the record already exists it will send a message to an "update" queue.

For the "update" queue we are running concurrently 10 consumers (same listener class with 10 threads configured).

Example:

Producer sends messages A1 to A10 to the "update" queue, message A6 is consumed by two consumers, and it hurts our business flow. We want to make sure that same message can not be consumed by two consumers.
Has any one faced this issue, and, if so, how did you fix it?

Consume code :

```<code>    @Autowired
ReconMessageProcessor reconMessageProcessor;
@Value("${recondataProcessorRunEnable}")
public Boolean recondataProcessorRunEnable = true;

public void onMessage(Message pMessage) {
    if (recondataProcessorRunEnable) {
        try {
            logger.info("RetryReconDataInsertMessageListener pMessage.getJMSCorrelationID() -->  " + pMessage.getJMSCorrelationID());
            logger.info("RetryReconDataInsertMessageListener pMessage.getJMSMessageID() -->  " + pMessage.getJMSMessageID());
            MessageEntity message = (MessageEntity)((ActiveMQObjectMessage) pMessage).getObject();
            String jsonMessage = message.getJsonString();
            reconMessageProcessor.processMessage(jsonMessage, "RetryReconDataInsertMessageListener");

        } catch (Exception e) {
            //send mail about recon message receive failure
            logger.error("Exception has occured while executing ReconMessageListener. Error details is : " +
                e.getMessage());
            e.printStackTrace();
        }
    } else {
        logger.info(" Value of recondataProcessorRunEnable is " + recondataProcessorRunEnable + " at property file. Please set it to true to enable recondataProcessor run");
    }

}
</code>```

Body:
We are facing an issue where one message is consumed by two consumers from same queue. We want to restrict one message so that it can only be consumed by one consumer.

There is one producer application pushing the messages to queue named "Aeon," and the listener of this queue is dedicated to inserting a record. If the record already exists it will send a message to an "update" queue.

For the "update" queue we are running concurrently 10 consumers (same listener class with 10 threads configured).

Example:

Producer sends messages A1 to A10 to the "update" queue, message A6 is consumed by two consumers, and it hurts our business flow. We want to make sure that same message can not be consumed by two consumers.
Has any one faced this issue, and, if so, how did you fix it?

Consume code :

    @Autowired
ReconMessageProcessor reconMessageProcessor;
@Value("${recondataProcessorRunEnable}")
public Boolean recondataProcessorRunEnable = true;

public void onMessage(Message pMessage) {
    if (recondataProcessorRunEnable) {
        try {
            logger.info("RetryReconDataInsertMessageListener pMessage.getJMSCorrelationID() -->  " + pMessage.getJMSCorrelationID());
            logger.info("RetryReconDataInsertMessageListener pMessage.getJMSMessageID() -->  " + pMessage.getJMSMessageID());
            MessageEntity message = (MessageEntity)((ActiveMQObjectMessage) pMessage).getObject();
            String jsonMessage = message.getJsonString();
            reconMessageProcessor.processMessage(jsonMessage, "RetryReconDataInsertMessageListener");

        } catch (Exception e) {
            //send mail about recon message receive failure
            logger.error("Exception has occured while executing ReconMessageListener. Error details is : " +
                e.getMessage());
            e.printStackTrace();
        }
    } else {
        logger.info(" Value of recondataProcessorRunEnable is " + recondataProcessorRunEnable + " at property file. Please set it to true to enable recondataProcessor run");
    }

}


来源: stackexchange

问:
dlopen error:undefined symbol: __aeabi_uldivmod
I want to make a dynamic library and open it in a program using dlopen,my library(lib.c) code is:

```<code>#include <stdio.h>

static unsigned long long n = 0ULL;

int test_func(void)
{
        unsigned long long tmp = 0;
        tmp += n / 1000000000ULL;
        tmp += n % 1000000000ULL;
        return tmp;
}
</code>```

my main program(test.c) code:

```<code>#include <stdio.h>
#include <dlfcn.h>

int main(void)
{
        void *h = NULL;
        h = dlopen("./lib.so", RTLD_NOW | RTLD_GLOBAL);
        if (!h) {
                printf("%s\n", dlerror());
        }

        return 0;
}
</code>```

I use gcc create dynamic library,it works

gcc -c -o lib.o lib.c
gcc --shared lib.o -o lib.so
gcc test.c -ldl
./a.out
```
<p>But,when I use ld crete dynamic library, it says <code>undefined symbol: __aeabi_uldivmod</code> when I execute a.out</p>
```ld --shared lib.o -o lib.so
./a.out
./lib.so: undefined symbol: __aeabi_uldivmod
```
```I use readelf find the difference
use gcc:

```
<p>readelf -a lib.so | grep uldivmod
56: 00000000     0 FILE    LOCAL  DEFAULT  ABS _aeabi_uldivmod.o
67: 000004ec     0 FUNC    LOCAL  DEFAULT   11 __aeabi_uldivmod</p>
```
use ld:

```
<p>readelf -a lib.so | grep uldivmod
0001100c  00000316 R_ARM_JUMP_SLOT   00000000   __aeabi_uldivmod
3: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __aeabi_uldivmod
25: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __aeabi_uldivmod</p>
```
why? and how can I use the **ld** command to get the results I want?
I look forward to your reply. Thank you

```

ContentLicense: CC BY-SA 4.0

Body:
I want to make a dynamic library and open it in a program using dlopen,my library(lib.c) code is:

#include <stdio.h>

static unsigned long long n = 0ULL;

int test_func(void)
{
        unsigned long long tmp = 0;
        tmp += n / 1000000000ULL;
        tmp += n % 1000000000ULL;
        return tmp;
}

my main program(test.c) code:

#include <stdio.h>
#include <dlfcn.h>

int main(void)
{
        void *h = NULL;
        h = dlopen("./lib.so", RTLD_NOW | RTLD_GLOBAL);
        if (!h) {
                printf("%s\n", dlerror());
        }

        return 0;
}

I use gcc create dynamic library,it works

gcc -c -o lib.o lib.c
gcc --shared lib.o -o lib.so
gcc test.c -ldl
./a.out

But,when I use ld crete dynamic library, it says undefined symbol: __aeabi_uldivmod when I execute a.out

ld --shared lib.o -o lib.so
./a.out
./lib.so: undefined symbol: __aeabi_uldivmod

I use readelf find the difference
use gcc:

readelf -a lib.so | grep uldivmod
56: 00000000     0 FILE    LOCAL  DEFAULT  ABS _aeabi_uldivmod.o
67: 000004ec     0 FUNC    LOCAL  DEFAULT   11 __aeabi_uldivmod

use ld:

readelf -a lib.so | grep uldivmod
0001100c  00000316 R_ARM_JUMP_SLOT   00000000   __aeabi_uldivmod
3: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __aeabi_uldivmod
25: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __aeabi_uldivmod

why? and how can I use the **ld** command to get the results I want?
I look forward to your reply. Thank you


问:
How can I display an entire message field in Cloudwatch Log Insights, regardless of its length?
Currently, when looking through Insights we have several messages that we'll need to look through but it's not out of the ordinary for some of these messages to be 1000+ characters long. Because of the type of data we process, a lot of times we won't know exactly what we're looking for until we see it.

So, let's say that my query gives me 6 results back and all of these results have a message field that's just really long. Is there a way to "word wrap" the results, or show the entire message there on the screen?

I've tried a few things, but honestly nothing has made any difference. The only thing I've found that works is to just select the entire message and then go look at it in Notepad or something. This isn't the worst thing in the world, it'd just make life a little bit easier if I can look at all of the message at one time within the results.


问:
Installing packages for SPSS
Hello I want to create python script to work on spss but according to I must deal with the following modules

```<code>import spssaux, spss, spssdata, operator
</code>```

but when installing it in my version in windows you get the following error

ERROR: Could not find a version that satisfies the requirement Spss (from versions: none)

ERROR: No matching distribution found for Spss

The version of Python I use is : Python 3.11.1

If someone could guide me with those modules or others to replace it would be great. Thank you all very much

Title: Installing packages for SPSS

Body:
Hello I want to create python script to work on spss but according to I must deal with the following modules

import spssaux, spss, spssdata, operator

but when installing it in my version in windows you get the following error

ERROR: Could not find a version that satisfies the requirement Spss (from versions: none)

ERROR: No matching distribution found for Spss

The version of Python I use is : Python 3.11.1

If someone could guide me with those modules or others to replace it would be great. Thank you all very much


问:
Issue with OAuth1 LinkedIn API call within GoogleSheets
I am currently running a script which calls the LinkedIn API using a custom function called IMPORTJSON .
The overall content of the cell looks something like this:

```<code>=ImportJSON(https://api.linkedin.com/v2/shares?q=owners&owners=[.....])
</code>```

The error I get is the following (Image attached):

Library with identifier OAuth1 is missing (perhaps it was deleted, or you don't have read access?) (line 0).

Now the weird thing is that it doesn't always happen. If I run the script again the data sometimes appears correctly.

Here is what my script does in case this might have some impact:

```<code>sheet.getRange("A1").setValue('=ImportJSON("' + url + '","/elements/created/time","noInherit")');
</code>```

Any help is appreciated!

Thank you,

I know the code itself works since the data comes from time to time

I've tried adding sleep timers

I've tried removing and re-adding the OAuth1 Library from Google Script...although even when I remove it the code sometimes work anyways so it doesn't even look like I need it?

I use the same approach for other for Facebook and Twitter and I have no issues with those

Body:
I am currently running a script which calls the LinkedIn API using a custom function called IMPORTJSON .
The overall content of the cell looks something like this:

=ImportJSON(https://api.linkedin.com/v2/shares?q=owners&owners=[.....])

The error I get is the following (Image attached):

Library with identifier OAuth1 is missing (perhaps it was deleted, or you don't have read access?) (line 0).

Now the weird thing is that it doesn't always happen. If I run the script again the data sometimes appears correctly.

Here is what my script does in case this might have some impact:

sheet.getRange("A1").setValue('=ImportJSON("' + url + '","/elements/created/time","noInherit")');

Any help is appreciated!

Thank you,

I know the code itself works since the data comes from time to time

I've tried adding sleep timers

I've tried removing and re-adding the OAuth1 Library from Google Script...although even when I remove it the code sometimes work anyways so it doesn't even look like I need it?

I use the same approach for other for Facebook and Twitter and I have no issues with those


问:
Show progress percentage of cache.add() in Service Worker

In AngularJS 1.5, I replaced ServiceWorker instead of ApplicationCache(because of deprecation)

In ApplicationCache version, there was a dialog box showing progress

applicationCache.addEventListener('progress', function (e) { ... }

I would like to do same way in ServiceWorker version, however, I couldn't find the solution of showing progress dialog in SW(there is no progress event in SW)

I've found the following similar questions but they don't solve

Show progress while caching files using a service worker

service worker cache progress

Is there anyone who've got the way to show the progress of caching file in ServiceWorker?
Thanks a lot in advance !!!


问:
How to change the layer colour in google earth engine
I am working on a Google Earth Engine app where I would like to allow the user to draw an area of interest polygon (AOI). After drawing, the AOI polygon should only show the boundary colour and no fill color so that the map under AOI polygon can be viewed. I do not know how to make the polygon with no fill color. Could you please help me with this? Below is my code:

```<code>var drawingTools = Map.drawingTools();
drawingTools.setShown(false);
while (drawingTools.layers().length() > 0) {
  var layer = drawingTools.layers().get(0);
  drawingTools.layers().remove(layer);
}
var dummyGeometry =
    ui.Map.GeometryLayer({geometries: null, name: 'grid', color: 'green'});

drawingTools.layers().add(dummyGeometry);
function clearGeometry() {
  var layers = drawingTools.layers();
  layers.get(0).geometries().remove(layers.get(0).geometries().get(0));
}
function drawRectangle() {
  clearGeometry();
  drawingTools.setShape('rectangle');
  drawingTools.draw();
}

function drawPolygon() {
  clearGeometry();
  drawingTools.setShape('polygon');
  drawingTools.draw();
}

var symbol = {
  rectangle: '⬛',
  polygon: '',
  point: '',
};
/*
* Panel setup
*/
var controlPanel = ui.Panel({
  widgets: [
    ui.Label('1. Select a drawing mode.'),
    ui.Button({
      label: symbol.rectangle + ' Rectangle',
      onClick: drawRectangle,
      style: {stretch: 'horizontal'}
    }),
    ui.Button({
      label: symbol.polygon + ' Polygon',
      onClick: drawPolygon,
      style: {stretch: 'horizontal'}
    }),
  ],
  layout: null,
});

var main_panel = ui.Panel({style:{position: 'top-left'}});
main_panel.add(controlPanel);
Map.add(main_panel);
</code>```

Thank you.

Body:
I am working on a Google Earth Engine app where I would like to allow the user to draw an area of interest polygon (AOI). After drawing, the AOI polygon should only show the boundary colour and no fill color so that the map under AOI polygon can be viewed. I do not know how to make the polygon with no fill color. Could you please help me with this? Below is my code:

var drawingTools = Map.drawingTools();
drawingTools.setShown(false);
while (drawingTools.layers().length() > 0) {
  var layer = drawingTools.layers().get(0);
  drawingTools.layers().remove(layer);
}
var dummyGeometry =
    ui.Map.GeometryLayer({geometries: null, name: 'grid', color: 'green'});

drawingTools.layers().add(dummyGeometry);
function clearGeometry() {
  var layers = drawingTools.layers();
  layers.get(0).geometries().remove(layers.get(0).geometries().get(0));
}
function drawRectangle() {
  clearGeometry();
  drawingTools.setShape('rectangle');
  drawingTools.draw();
}

function drawPolygon() {
  clearGeometry();
  drawingTools.setShape('polygon');
  drawingTools.draw();
}

var symbol = {
  rectangle: '⬛',
  polygon: '',
  point: '',
};
/*
* Panel setup
*/
var controlPanel = ui.Panel({
  widgets: [
    ui.Label('1. Select a drawing mode.'),
    ui.Button({
      label: symbol.rectangle + ' Rectangle',
      onClick: drawRectangle,
      style: {stretch: 'horizontal'}
    }),
    ui.Button({
      label: symbol.polygon + ' Polygon',
      onClick: drawPolygon,
      style: {stretch: 'horizontal'}
    }),
  ],
  layout: null,
});

var main_panel = ui.Panel({style:{position: 'top-left'}});
main_panel.add(controlPanel);
Map.add(main_panel);

Thank you.


问:
How to Setup WordPress Domain Mapping from subfolder multisite subsite
I have a wordpress multisite installed in a subfolder like so

```<code>example.com/wp/ (main site)
example.com/wp/subsite1
example.com/wp/subsite2
example.com/wp/subsite3
</code>```

I have tried to map a domain to one of the subsites, but this does not seem to work. I understand that Before WordPress 4.5, domain mapping required a domain mapping plugin like WordPress MU Domain Mapping. However, In WordPress 4.5+, domain mapping is a native feature.

But it's not working in the above scenario.  Is this a DNS thing because the multisite install is in a subfolder or what?

Body:
I have a wordpress multisite installed in a subfolder like so

example.com/wp/ (main site)
example.com/wp/subsite1
example.com/wp/subsite2
example.com/wp/subsite3

I have tried to map a domain to one of the subsites, but this does not seem to work. I understand that Before WordPress 4.5, domain mapping required a domain mapping plugin like WordPress MU Domain Mapping. However, In WordPress 4.5+, domain mapping is a native feature.

But it's not working in the above scenario.  Is this a DNS thing because the multisite install is in a subfolder or what?


问:
why my setup in mysql in vs code is not working?
So basically, I'm following this tutorial.
LINK.

wherein I setup the MySQL Localhost first in the Vscode after that I will to the cmd part
and do this mysql -u root -p

After that I have to input my password in my MySQL...but I don't know if the password is already created or should I have created it in the tutorial. I just type the password in Vscode process "mathlearnerxx" but it doesn't work. Does the MySQL password is what you already done before install in the MySQL before?? I don't remember my password when I follow a tutorial about setup the MySQL.

Anyways after the error of password I input "mathlearnerxx". It gives me something like this

```<code>mysql -u root -p
Enter password: *************
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
</code>```

which I basically followed in tutorial.

Can anyone help me with this? I have some project to done thanks :)

Body:
So basically, I'm following this tutorial.
LINK.

wherein I setup the MySQL Localhost first in the Vscode after that I will to the cmd part
and do this mysql -u root -p

After that I have to input my password in my MySQL...but I don't know if the password is already created or should I have created it in the tutorial. I just type the password in Vscode process "mathlearnerxx" but it doesn't work. Does the MySQL password is what you already done before install in the MySQL before?? I don't remember my password when I follow a tutorial about setup the MySQL.

Anyways after the error of password I input "mathlearnerxx". It gives me something like this

mysql -u root -p
Enter password: *************
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

which I basically followed in tutorial.

Can anyone help me with this? I have some project to done thanks :)


问:
How is a brute force crossword solver in P?
I'm currently learning theory of computation and the Poly Time Complexity class and describing a  brute force algorithm that sucessfully fills out a 5x5 crossword puzzle. The way I describe the algorithm is that it simply fills out the puzzle with the letter A first then replaces the first spot with each letter from B to Z, checking at each step if the puzzle is correct. It repeats this for every combination of every letter in every square. What would the runtime of an algorithm like this be described and how could it possibly still be in poly time?

Thinking about a brute force algorithm like this, I would expect it to be exponential.


问:
How to insert streaming data into snowflake using talend
How to load the data into snowflake using talend, input am getting streaming data from kafka</p>


问:
Javascript - document.write with HTML tags throws "ILLEGAL" status
JS Code

```<code>    document.write('
          <b>Version:</b> 2.11<br>
          <b>Author:</b> Alex Toucan<br><br>
          <p>® <script src="/static/year.js"></script> AT Products LLC</p>
');
</code>```

Console

```<code>Uncaught SyntaxError: Unexpected token ILLEGAL
</code>```

I'm quite new to the web side of JavaScript, and I have been attempting to get this to work,  which was unsuccessful. What can I do to improve my code?

Body:
JS Code

    document.write('
          Version: 2.11

          Author: Alex Toucan

®  AT Products LLC

');

Console

Uncaught SyntaxError: Unexpected token ILLEGAL

I'm quite new to the web side of JavaScript, and I have been attempting to get this to work,  which was unsuccessful. What can I do to improve my code?


问:
How to use powershell/c# to open the specific module in the application
I wanted to open a module of the specific application.

For example, the application is abc.exe. And it is currently at Home Page.

And I wanted it to navigate to the page/module with title : Reporting modules,

What is the code can I use to navigate to the specific modules?

PowerShell can do it? If can't how about the c#?

Power shell code to navigate the specific module of the application.


问:
Is there any way to get how long the chrome browser open using CHROME API?
What I want to achieve is, if the chrome browser already open in several minutes I want to run chrome.storage.sync.clear();

Now I have code when the chrome opens the chrome.storage.sync.clear(); is run.

Here is my code:

```<code>chrome.runtime.onStartup.addListener(function () {
    chrome.storage.sync.clear();
});
</code>```

but now i want to if the chrome browser is already open in 2 minutes the chrome.storage.sync.clear(); is run

Body:
What I want to achieve is, if the chrome browser already open in several minutes I want to run chrome.storage.sync.clear();

Now I have code when the chrome opens the chrome.storage.sync.clear(); is run.

Here is my code:

chrome.runtime.onStartup.addListener(function () {
    chrome.storage.sync.clear();
});

but now i want to if the chrome browser is already open in 2 minutes the chrome.storage.sync.clear(); is run


问:
Display textbox value from form 2 to form 1 without making a new window
So I have a presentation game where the answers would be revealed/displayed in Form1 when you click a button from Form2, The answers are displayed with TextBox Winform, But when you click the button from form2 it doesnt change the text of the display textbox, I had already searched in the internet for this problem it solved it but I do not want to make a new window as only the display window will be displayed at on the projector.

Form 1:

```<code>public void revealItems(int ItemNo)
{
    Items zItems = JsonSerializer.Deserialize<Items>(File.ReadAllText(loadJson()));
    switch (ItemNo)
    {
        case 1:
            Item1.Text = zItems.ItemArray[0];
            Score1.Text = zItems.ScoreArray[0];
            InitializeComponent();
            break;
    }

</code>```

Form 2:

```<code>public void btnAward1_Click(object sender, EventArgs e)
{
    var frm = new Form1();
    frm.revealItems(1);
}
</code>```

Body:
So I have a presentation game where the answers would be revealed/displayed in Form1 when you click a button from Form2, The answers are displayed with TextBox Winform, But when you click the button from form2 it doesnt change the text of the display textbox, I had already searched in the internet for this problem it solved it but I do not want to make a new window as only the display window will be displayed at on the projector.

Form 1:

public void revealItems(int ItemNo)
{
    Items zItems = JsonSerializer.Deserialize<Items>(File.ReadAllText(loadJson()));
    switch (ItemNo)
    {
        case 1:
            Item1.Text = zItems.ItemArray[0];
            Score1.Text = zItems.ScoreArray[0];
            InitializeComponent();
            break;
    }

Form 2:

public void btnAward1_Click(object sender, EventArgs e)
{
    var frm = new Form1();
    frm.revealItems(1);
}


问:
How do I fix this syntax error with sql_check?
this is my second project I'm working on in R and I ran into this error message and don't know how to get through this. Any help is appreciated, thanks in advance!

At first I kept getting %>% can't be found, so I reinstalled dplyr and it worked. Now I'm unsure how to get past this message.


问:
How to enable right click on image in Flutter Inappwebview?
I tried to make Google Image Webview, and I want to copy the image URL but when I tried Tap Long Press there is not appear, I tried this but it's doesn't work, any solutions?</p>
```<code>return Scaffold(
            appBar: AppBar(title: Text('Web View')),
            body: webview.InAppWebView(
                initialUrlRequest: webview.URLRequest(url: Uri.parse('https://www.google.co.id/imghp?hl=id&authuser=0&ogbl')),
                initialOptions: InAppWebViewGroupOptions(
                  crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true, useOnLoadResource: true, useOnDownloadStart: true),
                ),
                onWebViewCreated: (controller) {
                  webViewController = controller;
                },
                gestureRecognizers: {Factory<OneSequenceGestureRecognizer>(() => LongPressGestureRecognizer())},
                onLoadStart: (controller, url) {},
                onLoadStop: (controller, url) async {},
                onLoadError: (controller, url, code, message) {},
);
</code>```

Body:
I tried to make Google Image Webview, and I want to copy the image URL but when I tried Tap Long Press there is not appear, I tried this but it's doesn't work, any solutions?

return Scaffold(
            appBar: AppBar(title: Text('Web View')),
            body: webview.InAppWebView(
                initialUrlRequest: webview.URLRequest(url: Uri.parse('https://www.google.co.id/imghp?hl=id&authuser=0&ogbl')),
                initialOptions: InAppWebViewGroupOptions(
                  crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true, useOnLoadResource: true, useOnDownloadStart: true),
                ),
                onWebViewCreated: (controller) {
                  webViewController = controller;
                },
                gestureRecognizers: {Factory<OneSequenceGestureRecognizer>(() => LongPressGestureRecognizer())},
                onLoadStart: (controller, url) {},
                onLoadStop: (controller, url) async {},
                onLoadError: (controller, url, code, message) {},
);


问:
how to use google speech API to convert audio files to string?
I am trying to use Google Speech API to convert audio files to strings but I can't make it work when I try to transcribe an audio file that is uploaded by my form element.

```<code><Form onSubmit={handleSubmit}>
        <input type="file" ref={audioFileRef} />
        <Button>Import</Button>
</Form>
</code>```

This is my fetch:

```<code>fetch(path, {
      method: "POST",
      headers: {
        "Content-Type": "audio/wave",
      },
      body: formData,
    })
</code>```

This is the server:

```<code>async function main(content) {
  const client = new speech.SpeechClient();

  const config = {
    encoding: "LINEAR16",
    sampleRateHertz: 16000,
    languageCode: "en-US",
  };

  const audio = {
    uri: content,
  };

  const request = {
    audio: audio,
    config: config,
  };

  const [response] = await client.recognize(request);

  return await response.results
    .map((result) => result.alternatives[0].transcript)
    .join("\n");
}

app.post("/import-audio", async (req, res) => {
  const transcription = main(req.body);
  transcription.then(console.log).catch(console.error);
});
</code>```

I am trying to transcribe the audio file from the form element

Body:
I am trying to use Google Speech API to convert audio files to strings but I can't make it work when I try to transcribe an audio file that is uploaded by my form element.

<Form onSubmit={handleSubmit}>
        <input type="file" ref={audioFileRef} />
        <Button>Import</Button>
</Form>

This is my fetch:

fetch(path, {
      method: "POST",
      headers: {
        "Content-Type": "audio/wave",
      },
      body: formData,
    })

This is the server:

async function main(content) {
  const client = new speech.SpeechClient();

  const config = {
    encoding: "LINEAR16",
    sampleRateHertz: 16000,
    languageCode: "en-US",
  };

  const audio = {
    uri: content,
  };

  const request = {
    audio: audio,
    config: config,
  };

  const [response] = await client.recognize(request);

  return await response.results
    .map((result) => result.alternatives[0].transcript)
    .join("\n");
}

app.post("/import-audio", async (req, res) => {
  const transcription = main(req.body);
  transcription.then(console.log).catch(console.error);
});

I am trying to transcribe the audio file from the form element


问:
How does object.function.function.function etc work in Pyspark
I'm new to python and pyspark. In pySpark, in order to create a dataframe from csv we use spark.read.format('csv').load('path'). From my understanding spark is an object which has a method read. read returns a class which has other methods like format, load, option etc in it. The part that is confusing to me is how are we using multiple methods from the same read object one after the other? How does this work? I would really appreciate if someone can explain how it works behind the scenes. thanks!</p>


问:
Plotting a simple linear relation with pre-determined errors on both coefficients as confidence bands in Python?
I'm trying to plot in Python an already existing relation to compare it's errors to my own data. The relation is of the simple form y = ax + b. I have been given the standard deviation on a (da) and on b (db). I'd like to create a plot where all possible linear relations within one standard deviation of the given coefficients are visible as shaded regions (confidence bands).

I figured I could use the matplotlib.pyplot.fill_between(x, y-dy, y+dy) somehow, but I'm a little confused as to how exactly define the upper and lower bounds. I think it might be best to create two separate confidence bands. One for negative numbers and one for positive ones, as the upper bound/lower should change at that point?


问:
Constructor doesn't seem to recognize an object from a different class, tries to call constructor of that class
I'm trying to pass an object userArtist into the constructor of a different class Artwork and instead of passing that object along it almost seems to call the default constructor of class Artist.

These are my files:

main.cpp

```<code>#include "Artist.h"
#include "Artwork.h"
#include <iostream>
#include <string>
using namespace std;

int main() {
   string userTitle, userArtistName;
   int yearCreated, userBirthYear, userDeathYear;

   getline(cin, userArtistName);
   cin >> userBirthYear;
   cin.ignore();
   cin >> userDeathYear;
   cin.ignore();
   getline(cin, userTitle);
   cin >> yearCreated;
   cin.ignore();

   Artist userArtist =  Artist(userArtistName, userBirthYear, userDeathYear);

   Artwork newArtwork = Artwork(userTitle, yearCreated, userArtist);

   newArtwork.PrintInfo();
}
</code>```

Artist.h

```<code>#ifndef ARTISTH
#define ARTISTH
#include <iostream>
#include <string>
using namespace std;

class Artist{
   public:
      Artist();

      Artist(string artistName, int birthYear, int deathYear);

      string GetName() const;

      int GetBirthYear() const;

      int GetDeathYear() const;

      void PrintInfo() const;

   private:
      // TODO: Declare private data members - artistName, birthYear, deathYear
      string artistName;

      int birthYear;

      int deathYear;
};

#endif
</code>```

Artist.cpp

```<code>#include "Artist.h"
#include <iostream>
#include <string>
using namespace std;

/*Artist::Artist()
{
   artistName = "unknown";
   birthYear = -1;
   deathYear = -1;
}
*/
Artist::Artist(string artistName, int birthYear, int deathYear)
{
   artistName = artistName;
   birthYear = birthYear;
   deathYear = deathYear;
}

string Artist::GetName() const
{
   return artistName;
}

int Artist::GetDeathYear() const
{
   return deathYear;
}

int Artist::GetBirthYear() const
{
   return birthYear;
}

void Artist::PrintInfo() const
{
   cout << "Artist : " << artistName << " (";
   if (birthYear < 0)
   {
      cout << "unknown)";
   }
   else if (deathYear < 0)
   {
      cout << birthYear << " to present)";
   }
   else
   {
      cout << birthYear << " to " << deathYear << "0";
   }
}
</code>```

Artwork.h

```<code>#ifndef ARTWORKH
#define ARTWORKH
#include <iostream>
#include <string>
using namespace std;
#include "Artist.h"

class Artwork{
   public:
      Artwork();

      Artwork(string title, int yearCreated, Artist userArtist);

      string GetTitle();

      int GetYearCreated();

      void PrintInfo();

   private:
      string title;

      int yearCreated;
      // TODO: Declare private data members - title, yearCreated

      Artist userArtist;
      // TODO: Declare private data member artist of type Artist

};

#endif
</code>```

Artwork.cpp

```<code>#include "Artwork.h"
#include "Artist.h"
#include <iostream>
#include <string>
using namespace std;

Artwork::Artwork(string title, int yearCreated, Artist userArtist)
{
   title = title;
   yearCreated = yearCreated;
   userArtist = userArtist;
}

// TODO: Define second constructor to initialize
//       private fields (title, yearCreated, artist)

// TODO: Define get functions: GetTitle(), GetYearCreated()

void Artwork::PrintInfo()
{
   cout << userArtist.GetName();
}
//       Call the PrintInfo() function in the Artist class to print an artist's information
</code>```

When I removed the default constructor of class Artist the compiler threw this message:

/usr/bin/ld: /tmp/cc6JxxRm.o: in function >Artwork::Artwork(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, Artist)':
Artwork.cpp:(.text+0x34): undefined reference to Artist::Artist()' collect2: error: ld returned 1 exit status

It's almost as if the Artwork class can't recognize that userArtist already exists.

Body:
I'm trying to pass an object userArtist into the constructor of a different class Artwork and instead of passing that object along it almost seems to call the default constructor of class Artist.

These are my files:

main.cpp

#include "Artist.h"
#include "Artwork.h"
#include <iostream>
#include <string>
using namespace std;

int main() {
   string userTitle, userArtistName;
   int yearCreated, userBirthYear, userDeathYear;

   getline(cin, userArtistName);
   cin >> userBirthYear;
   cin.ignore();
   cin >> userDeathYear;
   cin.ignore();
   getline(cin, userTitle);
   cin >> yearCreated;
   cin.ignore();

   Artist userArtist =  Artist(userArtistName, userBirthYear, userDeathYear);

   Artwork newArtwork = Artwork(userTitle, yearCreated, userArtist);

   newArtwork.PrintInfo();
}

Artist.h

#ifndef ARTISTH
#define ARTISTH
#include <iostream>
#include <string>
using namespace std;

class Artist{
   public:
      Artist();

      Artist(string artistName, int birthYear, int deathYear);

      string GetName() const;

      int GetBirthYear() const;

      int GetDeathYear() const;

      void PrintInfo() const;

   private:
      // TODO: Declare private data members - artistName, birthYear, deathYear
      string artistName;

      int birthYear;

      int deathYear;
};

#endif

Artist.cpp

#include "Artist.h"
#include <iostream>
#include <string>
using namespace std;

/*Artist::Artist()
{
   artistName = "unknown";
   birthYear = -1;
   deathYear = -1;
}
*/
Artist::Artist(string artistName, int birthYear, int deathYear)
{
   artistName = artistName;
   birthYear = birthYear;
   deathYear = deathYear;
}

string Artist::GetName() const
{
   return artistName;
}

int Artist::GetDeathYear() const
{
   return deathYear;
}

int Artist::GetBirthYear() const
{
   return birthYear;
}

void Artist::PrintInfo() const
{
   cout << "Artist : " << artistName << " (";
   if (birthYear < 0)
   {
      cout << "unknown)";
   }
   else if (deathYear < 0)
   {
      cout << birthYear << " to present)";
   }
   else
   {
      cout << birthYear << " to " << deathYear << "0";
   }
}

Artwork.h

#ifndef ARTWORKH
#define ARTWORKH
#include <iostream>
#include <string>
using namespace std;
#include "Artist.h"

class Artwork{
   public:
      Artwork();

      Artwork(string title, int yearCreated, Artist userArtist);

      string GetTitle();

      int GetYearCreated();

      void PrintInfo();

   private:
      string title;

      int yearCreated;
      // TODO: Declare private data members - title, yearCreated

      Artist userArtist;
      // TODO: Declare private data member artist of type Artist

};

#endif

Artwork.cpp

#include "Artwork.h"
#include "Artist.h"
#include <iostream>
#include <string>
using namespace std;

Artwork::Artwork(string title, int yearCreated, Artist userArtist)
{
   title = title;
   yearCreated = yearCreated;
   userArtist = userArtist;
}

// TODO: Define second constructor to initialize
//       private fields (title, yearCreated, artist)

// TODO: Define get functions: GetTitle(), GetYearCreated()

void Artwork::PrintInfo()
{
   cout << userArtist.GetName();
}
//       Call the PrintInfo() function in the Artist class to print an artist's information

When I removed the default constructor of class Artist the compiler threw this message:

/usr/bin/ld: /tmp/cc6JxxRm.o: in function >Artwork::Artwork(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, Artist)':
Artwork.cpp:(.text+0x34): undefined reference to Artist::Artist()' collect2: error: ld returned 1 exit status

It's almost as if the Artwork class can't recognize that userArtist already exists.


问:
IndexedDB does not add values to indexes, only to the main object
I am managing to insert values in the database, but they are not going to the indexes, only in the main object, why does this happen and how to correct it?

In the code I don't notice anything wrong, because the keys are in the interface and being used both in object creation and data insertion.

MY CODE:

```<code>import { IGetResult } from 'contract/Interfaces';

interface IMetamask {
    wallet: string;
}

type TypeStoreName = 'infura' | 'metamask';
type TypeIndexName = 'electoralResult' | 'user';
type TypeInfuraKeyPaths = ['candidates', 'abstentionVotes', 'confirmedVotes', 'totalConfirmedVotes'];
type TypeMetamaskKeyPaths = ['wallet'];
type TypePromiseData = IGetResult | IMetamask;

interface IPromiseData {
    infuraData?: IGetResult | null;
    metamaskData?: IMetamask | null;
}

export default function useIndexedDB() {
    const getOpenDBRequest = () => window.indexedDB.open('DAppDatabase', 1);

    const getData = (storeName: TypeStoreName, indexName: TypeIndexName) =>
        new Promise<IPromiseData>((resolve, reject) => {
            const DB_REQUEST = getOpenDBRequest();

            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);
            DB_REQUEST.onsuccess = () => {
                const TRANSACTION = DB_REQUEST.result.transaction(storeName, 'readonly');
                const TRANSACTION_STORE = TRANSACTION.objectStore(storeName);
                TRANSACTION_STORE.index(indexName);

                const TRANSACTION_GET_STORE = TRANSACTION_STORE.getAll();
                TRANSACTION_GET_STORE.onerror = () => reject();
                TRANSACTION_GET_STORE.onsuccess = () => {
                    resolve({
                        ...(storeName === 'infura' && { infuraData: TRANSACTION_GET_STORE?.result[0] || null }),
                        ...(storeName === 'metamask' && { metamaskData: TRANSACTION_GET_STORE?.result[0] || null }),
                    });
                };
            };
        });

    const updateData = (newData: TypePromiseData, storeName: TypeStoreName, indexName: TypeIndexName) =>
        new Promise<IPromiseData>((resolve, reject) => {
            const DB_REQUEST = getOpenDBRequest();

            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);
            DB_REQUEST.onsuccess = () => {
                const TRANSACTION = DB_REQUEST.result.transaction(storeName, 'readwrite');
                const TRANSACTION_STORE = TRANSACTION.objectStore(storeName);

                TRANSACTION_STORE.index(indexName);
                TRANSACTION_STORE.put({ ...newData, id: 0 });

                Promise.all([getData('infura', 'electoralResult'), getData('metamask', 'user')])
                    .then(response => {
                        resolve({
                            infuraData: response[0].infuraData as IGetResult | null,
                            metamaskData: response[1].metamaskData as IMetamask | null,
                        });
                    })
                    .catch((error: DOMException) => reject(error));
            };
        });

    const createDB = (database: IDBDatabase, storeName: TypeStoreName, indexName: TypeIndexName) => {
        const STORE_OPTIONS = { keyPath: 'id', autoIncrement: false };
        const INDEX_OPTIONS = { unique: true };
        const KEY_PATH: TypeInfuraKeyPaths | TypeMetamaskKeyPaths =
            storeName === 'infura' ? ['candidates', 'abstentionVotes', 'confirmedVotes', 'totalConfirmedVotes'] : ['wallet'];

        database.createObjectStore(storeName, STORE_OPTIONS).createIndex(indexName, KEY_PATH, INDEX_OPTIONS);
    };

    const connect = () =>
        new Promise<IPromiseData>((resolve, reject) => {
            const DB_REQUEST = getOpenDBRequest();

            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);

            DB_REQUEST.onupgradeneeded = () => {
                createDB(DB_REQUEST.result, 'infura', 'electoralResult');
                createDB(DB_REQUEST.result, 'metamask', 'user');
            };

            DB_REQUEST.onsuccess = () => {
                Promise.all([getData('infura', 'electoralResult'), getData('metamask', 'user')])
                    .then(response => {
                        resolve({
                            ...response[0],
                            ...response[1],
                        });
                    })
                    .catch((error: DOMException) => reject(error));
            };
        });

    return {
        connect,
        getData,
        updateData,
    };
}ew Promise<IPromiseData>((resolve, reject) => {
            const DB_REQUEST = getOpenDBRequest();

            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);

            DB_REQUEST.onupgradeneeded = () => {
                createDB(DB_REQUEST.result, 'infura', 'electoralResult');
                createDB(DB_REQUEST.result, 'metamask', 'user');
            };

            DB_REQUEST.onsuccess = () => {
                Promise.all([getData('infura', 'electoralResult'), getData('metamask', 'user')])
                    .then(response => {
                        resolve({
                            ...response[0],
                            ...response[1],
                        });
                    })
                    .catch((error: DOMException) => reject(error));
            };
        });

    return {
        connect,
        getData,
        updateData,
    };
}
</code>```

Body:
I am managing to insert values in the database, but they are not going to the indexes, only in the main object, why does this happen and how to correct it?

In the code I don't notice anything wrong, because the keys are in the interface and being used both in object creation and data insertion.

MY CODE:

import { IGetResult } from 'contract/Interfaces';

interface IMetamask {
    wallet: string;
}

type TypeStoreName = 'infura' | 'metamask';
type TypeIndexName = 'electoralResult' | 'user';
type TypeInfuraKeyPaths = ['candidates', 'abstentionVotes', 'confirmedVotes', 'totalConfirmedVotes'];
type TypeMetamaskKeyPaths = ['wallet'];
type TypePromiseData = IGetResult | IMetamask;

interface IPromiseData {
    infuraData?: IGetResult | null;
    metamaskData?: IMetamask | null;
}

export default function useIndexedDB() {
    const getOpenDBRequest = () => window.indexedDB.open('DAppDatabase', 1);

    const getData = (storeName: TypeStoreName, indexName: TypeIndexName) =>
        new Promise<IPromiseData>((resolve, reject) => {
            const DB_REQUEST = getOpenDBRequest();

            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);
            DB_REQUEST.onsuccess = () => {
                const TRANSACTION = DB_REQUEST.result.transaction(storeName, 'readonly');
                const TRANSACTION_STORE = TRANSACTION.objectStore(storeName);
                TRANSACTION_STORE.index(indexName);

                const TRANSACTION_GET_STORE = TRANSACTION_STORE.getAll();
                TRANSACTION_GET_STORE.onerror = () => reject();
                TRANSACTION_GET_STORE.onsuccess = () => {
                    resolve({
                        ...(storeName === 'infura' && { infuraData: TRANSACTION_GET_STORE?.result[0] || null }),
                        ...(storeName === 'metamask' && { metamaskData: TRANSACTION_GET_STORE?.result[0] || null }),
                    });
                };
            };
        });

    const updateData = (newData: TypePromiseData, storeName: TypeStoreName, indexName: TypeIndexName) =>
        new Promise<IPromiseData>((resolve, reject) => {
            const DB_REQUEST = getOpenDBRequest();

            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);
            DB_REQUEST.onsuccess = () => {
                const TRANSACTION = DB_REQUEST.result.transaction(storeName, 'readwrite');
                const TRANSACTION_STORE = TRANSACTION.objectStore(storeName);

                TRANSACTION_STORE.index(indexName);
                TRANSACTION_STORE.put({ ...newData, id: 0 });

                Promise.all([getData('infura', 'electoralResult'), getData('metamask', 'user')])
                    .then(response => {
                        resolve({
                            infuraData: response[0].infuraData as IGetResult | null,
                            metamaskData: response[1].metamaskData as IMetamask | null,
                        });
                    })
                    .catch((error: DOMException) => reject(error));
            };
        });

    const createDB = (database: IDBDatabase, storeName: TypeStoreName, indexName: TypeIndexName) => {
        const STORE_OPTIONS = { keyPath: 'id', autoIncrement: false };
        const INDEX_OPTIONS = { unique: true };
        const KEY_PATH: TypeInfuraKeyPaths | TypeMetamaskKeyPaths =
            storeName === 'infura' ? ['candidates', 'abstentionVotes', 'confirmedVotes', 'totalConfirmedVotes'] : ['wallet'];

        database.createObjectStore(storeName, STORE_OPTIONS).createIndex(indexName, KEY_PATH, INDEX_OPTIONS);
    };

    const connect = () =>
        new Promise<IPromiseData>((resolve, reject) => {
            const DB_REQUEST = getOpenDBRequest();

            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);

            DB_REQUEST.onupgradeneeded = () => {
                createDB(DB_REQUEST.result, 'infura', 'electoralResult');
                createDB(DB_REQUEST.result, 'metamask', 'user');
            };

            DB_REQUEST.onsuccess = () => {
                Promise.all([getData('infura', 'electoralResult'), getData('metamask', 'user')])
                    .then(response => {
                        resolve({
                            ...response[0],
                            ...response[1],
                        });
                    })
                    .catch((error: DOMException) => reject(error));
            };
        });

    return {
        connect,
        getData,
        updateData,
    };
}ew Promise<IPromiseData>((resolve, reject) => {
            const DB_REQUEST = getOpenDBRequest();

            DB_REQUEST.onerror = () => reject(DB_REQUEST.error);

            DB_REQUEST.onupgradeneeded = () => {
                createDB(DB_REQUEST.result, 'infura', 'electoralResult');
                createDB(DB_REQUEST.result, 'metamask', 'user');
            };

            DB_REQUEST.onsuccess = () => {
                Promise.all([getData('infura', 'electoralResult'), getData('metamask', 'user')])
                    .then(response => {
                        resolve({
                            ...response[0],
                            ...response[1],
                        });
                    })
                    .catch((error: DOMException) => reject(error));
            };
        });

    return {
        connect,
        getData,
        updateData,
    };
}


问:
The security token included in the request is invalid
I am trying to use localstack cognito with amplify.

I can login to cognito successful.

I also want to implement Social sign-in too.

First I create a profile locastack with key and secret

aws configure --profile localstack

then
export AWS_ACCESS_KEY_ID=dummy
export AWS_SECRET_ACCESS_KEY=dummy
aws --endpointurl http://localhost:4566 kinesis list-streams

and I run

amplifylocal init
Note: It is recommended to run this command from the root of your app directory
? Enter a name for the project localstack
The following configuration will be applied:

Project information
| Name: localstack
| Environment: dev
| Default editor: Visual Studio Code
| App type: javascript
| Javascript framework: none
| Source Directory Path: src
| Distribution Directory Path: dist
| Build Command: npm run-script build
| Start Command: npm run-script start

? Initialize the project with the above configuration? Yes
Using default provider awscloudformation
? Select the authentication method you want to use: AWS profile

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

? Please choose the profile you want to use localstack
 The security token included in the request is invalid.

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

I also try to run docker-compose with
environment:

HOSTNAME=localhost

DEBUG=1

PERSISTENCE="disabled"

LAMBDA_EXECUTOR=docker

LOCALSTACK_API_KEY=4pwo1o14g2

DOCKER_HOST=unix:///var/run/docker.sock

USE_SSL=false

DISABLE_CORS_CHECKS=1

SKIP_SSL_CERT_DOWNLOAD=1

DEFAULT_REGION=us-east-1

AWS_ACCESS_KEY_ID=dummy

AWS_SECRET_ACCESS_KEY=dummy

AWS_DEFAULT_REGION=us-east-1

I got the same result.

Any advices
Thanks

amplifylocal init

Result
Please choose the profile you want to use localstack
 The security token included in the request is invalid.

expected
run amplifylocal add auth


问:
What is wrong with my SQL RESTORE statement?
I am trying to recover a database for a customer who has been depending on MS Dynamics for a long time. His Server 2003 data drive failed irrevocably, but he had a recent backup of the his Server Essentials 2005 database. His C drive held the programs.

The object is to get his MS Dynamics working again so that he can add the transactions for the last month and then export all required tables to the company that's putting his company in the cloud (I don't know what the final interface might be but probably not Dynamics.)

On another computer, as a test, I recovered the .BAK file to a 2012 Server Essentials - but without reference to his original programs.  So I know that his tables and views exist (I am not a SQL Developer but a generalist so his 200 tables are not something I know how to deal with).

Anyway, after creating a data drive and putting back all folders items backed up, I tried running the RESTORE command and got several errors.  I'm going to skip the first try or so, because I've been figuring this out with the help of others.

So, I used the following:

```<code>RESTORE FILELISTONLY FROM DISK='D:\One Stop Backup\OSD_NOv8-2022.bak'
</code>```

Results

```<code>GPSOSDDat.mdf D:\ONE STOP\MSSQL\GPSOSDDat.mdf
GPSOSDLog.ldf D:\ONE STOP\MSSQL\GPSOSDLog.ldf
</code>```

Now I adjusted the script (I also created the folder D:\ONE STOP\MSSQL):

```<code>RESTORE DATABASE [OSD]
FROM DISK = 'D:\One Stop Backup\OSD_Nov8-2022.bak'
WITH MOVE 'GPSOSDdat.mdf' TO 'D:\ONE STOP\MSSQL\GPSOSDDat.mdf',
MOVE 'GPSOSDLog' TO 'D:\ONE STOP\MSSQL\GPSODLog.ldf',
REPLACE,
STATS=10
GO
</code>```

Result:

Msg 3234, Level 16, State 2, Line 1

Msg 3013, Level 16, State 1, Line 1

The item 'GPSOSDLog' is the only item I made up in order to stay with the formula I found on this forum. It seemed that the formula used the name of the .LDF file without the extension. I don't know if this makes a difference. Also, it seems like the errors are about "Line 1"  and OSD is the name of the database according to the dropdown in SQL Server Management Studio.

Any ideas as to what the problem might be?

Body:
I am trying to recover a database for a customer who has been depending on MS Dynamics for a long time. His Server 2003 data drive failed irrevocably, but he had a recent backup of the his Server Essentials 2005 database. His C drive held the programs.

The object is to get his MS Dynamics working again so that he can add the transactions for the last month and then export all required tables to the company that's putting his company in the cloud (I don't know what the final interface might be but probably not Dynamics.)

On another computer, as a test, I recovered the .BAK file to a 2012 Server Essentials - but without reference to his original programs.  So I know that his tables and views exist (I am not a SQL Developer but a generalist so his 200 tables are not something I know how to deal with).

Anyway, after creating a data drive and putting back all folders items backed up, I tried running the RESTORE command and got several errors.  I'm going to skip the first try or so, because I've been figuring this out with the help of others.

So, I used the following:

RESTORE FILELISTONLY FROM DISK='D:\One Stop Backup\OSD_NOv8-2022.bak'

Results

GPSOSDDat.mdf D:\ONE STOP\MSSQL\GPSOSDDat.mdf
GPSOSDLog.ldf D:\ONE STOP\MSSQL\GPSOSDLog.ldf

Now I adjusted the script (I also created the folder D:\ONE STOP\MSSQL):

RESTORE DATABASE [OSD]
FROM DISK = 'D:\One Stop Backup\OSD_Nov8-2022.bak'
WITH MOVE 'GPSOSDdat.mdf' TO 'D:\ONE STOP\MSSQL\GPSOSDDat.mdf',
MOVE 'GPSOSDLog' TO 'D:\ONE STOP\MSSQL\GPSODLog.ldf',
REPLACE,
STATS=10
GO

Result:

Msg 3234, Level 16, State 2, Line 1

Msg 3013, Level 16, State 1, Line 1

The item 'GPSOSDLog' is the only item I made up in order to stay with the formula I found on this forum. It seemed that the formula used the name of the .LDF file without the extension. I don't know if this makes a difference. Also, it seems like the errors are about "Line 1"  and OSD is the name of the database according to the dropdown in SQL Server Management Studio.

Any ideas as to what the problem might be?


问:
Can you make dynamic key class reponse in nestjs?
I want to make a class to return my statistics data with dynamic keys.
My desired response is something like this:

```<code>{
  "2022-01-01": {
    pageView: {/* */},
    user: {/* */}
  },
  "2022-01-02": {
    pageView: {/* */},
    user: {/* */}
  },

}
</code>```

I have tried below:

```<code>@ObjectType()
export class Statistics {
  @Field()
  pageView: PageViewStats

  @Field()
  user: UserStats
}

@ObjectType()
export class StatisticsByDate {
  @Field()
  [date: String]: Statistics
}
</code>```

But this prompts:

```<code>Decorators are not valid here.
@Field()
</code>```

I can make this into a type or interface but then this I am forced to return as Object which means I can't filter my response using gql

```<code>@Query(() => Object, { name: 'myQuery' })
async getPlaceStatistics(@Args('input') input: GetStatisticsInput): Promise<StatisticsByDate> { }
</code>```

Body:
I want to make a class to return my statistics data with dynamic keys.
My desired response is something like this:

{
  "2022-01-01": {
    pageView: {/* */},
    user: {/* */}
  },
  "2022-01-02": {
    pageView: {/* */},
    user: {/* */}
  },

}

I have tried below:

@ObjectType()
export class Statistics {
  @Field()
  pageView: PageViewStats

  @Field()
  user: UserStats
}

@ObjectType()
export class StatisticsByDate {
  @Field()
  [date: String]: Statistics
}

But this prompts:

Decorators are not valid here.
@Field()

I can make this into a type or interface but then this I am forced to return as Object which means I can't filter my response using gql

@Query(() => Object, { name: 'myQuery' })
async getPlaceStatistics(@Args('input') input: GetStatisticsInput): Promise<StatisticsByDate> { }


问:
Control Flow Graph & Cyclomatic Complexity for the following code
I have to find the CFG and complexity for this code, but I'm kind of confused by conflicting results. Would appreciate some opinions and help if possible. Here's the code snippet:

```<code>public function checkCredentials() { // 0

if (username.length < 5 || username.length > 15) { // 1
    return; // 2
}

if (password.length < 5 || password.length > 12) { // 3
    return; // 4
}

foreach(users as user) { // 5
    if (user.username === username) { // 6
        return; // 7
    }
}

if (phonenumber.length < 7) { // 8
    return; // 9
}
</code>```

And here's the Control Flow Graph I have come up with..

Is the Control Flow Graph accurate? If so - what's the Cyclomatic Complexity? Sometimes I think it's 4. But when I count the edges - nodes + 2 - it's a separate story.

Would really appreciate some clearance here. Thank you.

Body:
I have to find the CFG and complexity for this code, but I'm kind of confused by conflicting results. Would appreciate some opinions and help if possible. Here's the code snippet:

public function checkCredentials() { // 0

if (username.length < 5 || username.length > 15) { // 1
    return; // 2
}

if (password.length < 5 || password.length > 12) { // 3
    return; // 4
}

foreach(users as user) { // 5
    if (user.username === username) { // 6
        return; // 7
    }
}

if (phonenumber.length < 7) { // 8
    return; // 9
}

And here's the Control Flow Graph I have come up with..

Is the Control Flow Graph accurate? If so - what's the Cyclomatic Complexity? Sometimes I think it's 4. But when I count the edges - nodes + 2 - it's a separate story.

Would really appreciate some clearance here. Thank you.


问:
NGINX requests made by crawlers should be proxied to the API server
I've been trying to achieve the following:

My company has a SPA web app without SSR that needs to be able to show dynamic metatags when sharing certain links in social networks (eg WhatsApp, Telegram), however, due to the nature of SPAs, this is not possible since it always shows the metatags present in the index.html file.

The server uses NGINX, so, I've tried using different configurations in the Nginx/sites-enabled/SITE_URL file such as (kind of) what's explained on the accepted answer here.

To detect if the request is being made by a crawler I'm using this approach and it seems to be working just fine, the thing is, no matter what I do, even using this site to test the locations in the file, it won't work.

We also use Cloudflare and I've enabled Development mode to avoid getting cached content.

For additional details, the frontend page is /user/:username/post/:datetime. The backend is a different project that contains an endpoint with the exact same format (thus why I've tried using proxy_pass).

Does anyone have any working examples of something like this?


问:
Could not find method allprojects() for arguments
Hi guys i have an error in my projects in my build.gradle  this is the error

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

Where:
Script 'C:\Users\user\myproject\android\app\build.gradle' line: 17

What went wrong:
A problem occurred evaluating script.

Could not find method allprojects() for arguments [build_4o0103g0wss634gapdtja9uc3$_run_closure1@745cd69] on settings 'myproject' of type org.gradle.initialization.DefaultSettings.

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 13s
Exception: Gradle task assembleDebug failed with exit code 1

I tried to delete the line but the error keep show

this my buil.gradle

```<code>buildscript {
    ext.kotlin_version = '1.7.20'
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"}

    }

        dependencies {
            classpath 'com.android.tools.build:gradle:7.3.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:4.3.10'
        }
    }

    allprojects {
        repositories {
            google()
            maven {
                url "https://maven.google.com"
            }
        }
    }

    rootProject.buildDir = 'C:/Users/Napoleon/AndroidStudioProjects'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
        project.evaluationDependsOn(':apps')
    }

    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
        localPropertiesFile.withReader('UTF-8') { reader ->
            localProperties.load(reader)
        }
    }

    def flutterRoot = localProperties.getProperty('flutter.sdk')
    if (flutterRoot == null) {
        throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    }

    def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
    if (flutterVersionCode == null) {
        flutterVersionCode = '1'
    }

    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
        flutterVersionName = '1.0'
    }

    apply plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

    apply plugin: 'com.android.application'

    apply plugin: 'com.google.gms.google-services'

    apply plugin: 'mavenCentral'

    android {
        compileSdkVersion 30

        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }

        lintOptions {
            enable 'InvalidPackage'
        }

        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.example.queuing_system"
            // minSdkVersion 24
            minSdkVersion 20 +
                    targetSdkVersion 30
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
        }

        /*signingConfigs {
         release {
             keyAlias keystoreProperties['keyAlias']
             keyPassword keystoreProperties['keyPassword']
             storeFile file(keystoreProperties['storeFile'])
             storePassword keystoreProperties['storePassword']
         }
     }*/

        buildTypes {
            release {
                /// signingConfig signingConfigs.release use debug mode instead so `flutter run --release` works.
                signingConfig signingConfigs.release

                shrinkResources true
                minifyEnabled true
                useProguard true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            }
        }

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }

        flutter {
            source '../..'
        }

        apply plugin: 'com.google.gms.google-services'
    }

</code>```

Body:
Hi guys i have an error in my projects in my build.gradle  this is the error

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

Where:
Script 'C:\Users\user\myproject\android\app\build.gradle' line: 17

What went wrong:
A problem occurred evaluating script.

Could not find method allprojects() for arguments [build_4o0103g0wss634gapdtja9uc3$_run_closure1@745cd69] on settings 'myproject' of type org.gradle.initialization.DefaultSettings.

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 13s
Exception: Gradle task assembleDebug failed with exit code 1

I tried to delete the line but the error keep show

this my buil.gradle

buildscript {
    ext.kotlin_version = '1.7.20'
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"}

    }

        dependencies {
            classpath 'com.android.tools.build:gradle:7.3.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:4.3.10'
        }
    }

    allprojects {
        repositories {
            google()
            maven {
                url "https://maven.google.com"
            }
        }
    }

    rootProject.buildDir = 'C:/Users/Napoleon/AndroidStudioProjects'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
        project.evaluationDependsOn(':apps')
    }

    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
        localPropertiesFile.withReader('UTF-8') { reader ->
            localProperties.load(reader)
        }
    }

    def flutterRoot = localProperties.getProperty('flutter.sdk')
    if (flutterRoot == null) {
        throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    }

    def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
    if (flutterVersionCode == null) {
        flutterVersionCode = '1'
    }

    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
        flutterVersionName = '1.0'
    }

    apply plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

    apply plugin: 'com.android.application'

    apply plugin: 'com.google.gms.google-services'

    apply plugin: 'mavenCentral'

    android {
        compileSdkVersion 30

        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }

        lintOptions {
            enable 'InvalidPackage'
        }

        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.example.queuing_system"
            // minSdkVersion 24
            minSdkVersion 20 +
                    targetSdkVersion 30
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
        }

        /*signingConfigs {
         release {
             keyAlias keystoreProperties['keyAlias']
             keyPassword keystoreProperties['keyPassword']
             storeFile file(keystoreProperties['storeFile'])
             storePassword keystoreProperties['storePassword']
         }
     }*/

        buildTypes {
            release {
                /// signingConfig signingConfigs.release use debug mode instead so `flutter run --release` works.
                signingConfig signingConfigs.release

                shrinkResources true
                minifyEnabled true
                useProguard true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            }
        }

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }

        flutter {
            source '../..'
        }

        apply plugin: 'com.google.gms.google-services'
    }


问:
How to avoid inputting $CATALINA_HOME and $CATALINA_BASE interactively?
*** 2 values are required. ***

Apache Tomcat $CATALINA_HOME (/opt/tomcat/): ??

Apache Tomcat $CATALINA_BASE (/opt/tomcat/): ??

Do not know what input I need to provide here, can someone help me here.

This is related to CIS-CAT Scan which we use for Hardening. while running Apache Tomcat it is asking for above two values.


问:
how to rearrange poorly constructed table in excel
I have this sample dataset that i downloaded from here to practice data cleaning. refer below pictures
.

I have no idea how to efficiently rearrange the table from the 1st picture to the 2nd picture. what would be the best approach? can someone help me thank you so muchh!

Note: the 2nd picture was already prepared for us


问:
Is there any document for python API of Frida
I use Frida to do some work on android,but I didn't find document of python API,just some JavaScript API in website of Frida

I want to learn about details of python API of Frida


问:
property 'prototype' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value
I want interception object with proxy，but I can’t understand why I report an error

function createReactiveObject(target) {
      if (!isObject(target)) {
        return target;
      }
      return new Proxy(target, {
        get(target, key, receiver) {
          const result = Reflect.get(target, key, receiver);
          if (isObject(result)) {
            return createReactiveObject(result);
          }
          return result;
        },
        set() {
          return false;
        }
      });
    }
```
<pre class="lang-js prettyprint-override"><code>    const obj = {
      a: {
        t: 1
      }
    }
    const testObj = this.createReactiveObject(obj);
    console.log(testObj.constructor.prototype);

// "TypeError: 'get' on proxy: property 'prototype' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected '#<Object>' but got '#<Object>')"
</code>```

I want to know why And how to avoid this

Body:
I want interception object with proxy，but I can’t understand why I report an error

function createReactiveObject(target) {
      if (!isObject(target)) {
        return target;
      }
      return new Proxy(target, {
        get(target, key, receiver) {
          const result = Reflect.get(target, key, receiver);
          if (isObject(result)) {
            return createReactiveObject(result);
          }
          return result;
        },
        set() {
          return false;
        }
      });
    }

    const obj = {
      a: {
        t: 1
      }
    }
    const testObj = this.createReactiveObject(obj);
    console.log(testObj.constructor.prototype);

// "TypeError: 'get' on proxy: property 'prototype' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected '#<Object>' but got '#<Object>')"

I want to know why And how to avoid this


问:
When operating within the framework known as "Yocto", how do I build source from within a monorepo, without storing it in the 'files' subdir?
I have a mono-repository ("monorepo") that contains the C++ source code for my application, as well as a tree of OE/Yocto files and directories that form the bitbake recipes required to build my final image.

I wish to build and install my application into the image, but as far as I can tell, the Yocto philosophy is that source code is "fetched" (e.g. via git), from an external place, before it is built. But in my case the source code resides in the same repository. It doesn't seem to make sense to me that the entire repository is downloaded again, by bitbake, just to fetch the source for this application, so I'm looking for a better way.

I'm familiar with the idea of putting all the source in the files/ subdirectory, alongside the recipe itself. The issue I have with that is that I don't want to keep the source in the Yocto layer's recipe tree. It can be built with the SDK, for example, or even with other completely unrelated toolchains, so it should not be buried within a Yocto layer. It has its own life, outside Yocto.

I'm also familiar with the EXTERNALSRC directive, that can be used to "point" to the source code with a relative path from the build directory. For example:

```<code>EXTERNALSRC = "${TOPDIR}/../../src/myproject"
</code>```

However, this is frequently not recommended as a "production" mechanism due to path issues, and it also disables devtool:

ERROR: externalsrc is currently enabled for the myproject recipe. This prevents the normal do_patch task from working. You will need to disable this first.

So I'm looking for a recommendation on how to handle compiling an application that resides in the same repository as the recipe, without putting it in files/.

EDIT: I tried something along these lines:

```<code>SRC_URI = "file://${TOPDIR}/../../src/myproject/main.c \
           file://${TOPDIR}/../../src/myproject/Makefile \
        "
</code>```

This did not compile, but with devtool modify myproject I was able to see that it has in fact copied the source into the build directory. The problem is that it's replicated the entire directory structure from the root all the way up to the original source directory, so my source is now sitting in a location like this:

```<code>/home/david/monorepo/yocto/build/workspace/sources/myproject/home/david/monorepo/src/myproject
</code>```

do_compile will need to determine and set that working directory before it will compile.

This means that the path will change depending on the user and the location of where they've checked out the monorepo. This almost works, but doesn't seem usable as-is. Is there a way to modify where bitbake's "file" fetcher puts the source when given an absolute path?

EDIT 2:

I may have found a way that works with bitbake and devtool:

```<code>FILESEXTRAPATHS_prepend := "${TOPDIR}/../../src/myproject:"
SRC_URI = "file://main.c \
           file://Makefile \
        "
</code>```

This seems to set up the devtool directory in a much saner way (no replication of the directory tree, just symlinks to the files in oe-local-files/* directory), and the bitbake recipe also builds and installs correctly.

Is this the right way to do it?

EDIT 3: Perhaps not, as FILESEXTRAPATHS is only intended to be modified by .bbappend recipes, not base .bb recipes - any comment on that?

Best practices dictate that you accomplish this by using FILESEXTRAPATHS from within a .bbappend file [source].

EDIT 4: PierreOlivier suggests using a relative symlink in the files/ directory to the application's source directory, so that SRC_URI can find the source as if it was actually present in files/. From what I can tell with my own experiments, this does seem to work, and devtool works with this also.

Are there any implications of this approach that I should be aware of?

Body:
I have a mono-repository ("monorepo") that contains the C++ source code for my application, as well as a tree of OE/Yocto files and directories that form the bitbake recipes required to build my final image.

I wish to build and install my application into the image, but as far as I can tell, the Yocto philosophy is that source code is "fetched" (e.g. via git), from an external place, before it is built. But in my case the source code resides in the same repository. It doesn't seem to make sense to me that the entire repository is downloaded again, by bitbake, just to fetch the source for this application, so I'm looking for a better way.

I'm familiar with the idea of putting all the source in the files/ subdirectory, alongside the recipe itself. The issue I have with that is that I don't want to keep the source in the Yocto layer's recipe tree. It can be built with the SDK, for example, or even with other completely unrelated toolchains, so it should not be buried within a Yocto layer. It has its own life, outside Yocto.

I'm also familiar with the EXTERNALSRC directive, that can be used to "point" to the source code with a relative path from the build directory. For example:

EXTERNALSRC = "${TOPDIR}/../../src/myproject"

However, this is frequently not recommended as a "production" mechanism due to path issues, and it also disables devtool:

ERROR: externalsrc is currently enabled for the myproject recipe. This prevents the normal do_patch task from working. You will need to disable this first.

So I'm looking for a recommendation on how to handle compiling an application that resides in the same repository as the recipe, without putting it in files/.

EDIT: I tried something along these lines:

SRC_URI = "file://${TOPDIR}/../../src/myproject/main.c \
           file://${TOPDIR}/../../src/myproject/Makefile \
        "

This did not compile, but with devtool modify myproject I was able to see that it has in fact copied the source into the build directory. The problem is that it's replicated the entire directory structure from the root all the way up to the original source directory, so my source is now sitting in a location like this:

/home/david/monorepo/yocto/build/workspace/sources/myproject/home/david/monorepo/src/myproject

do_compile will need to determine and set that working directory before it will compile.

This means that the path will change depending on the user and the location of where they've checked out the monorepo. This almost works, but doesn't seem usable as-is. Is there a way to modify where bitbake's "file" fetcher puts the source when given an absolute path?

EDIT 2:

I may have found a way that works with bitbake and devtool:

FILESEXTRAPATHS_prepend := "${TOPDIR}/../../src/myproject:"
SRC_URI = "file://main.c \
           file://Makefile \
        "

This seems to set up the devtool directory in a much saner way (no replication of the directory tree, just symlinks to the files in oe-local-files/* directory), and the bitbake recipe also builds and installs correctly.

Is this the right way to do it?

EDIT 3: Perhaps not, as FILESEXTRAPATHS is only intended to be modified by .bbappend recipes, not base .bb recipes - any comment on that?

Best practices dictate that you accomplish this by using FILESEXTRAPATHS from within a .bbappend file [source].

EDIT 4: PierreOlivier suggests using a relative symlink in the files/ directory to the application's source directory, so that SRC_URI can find the source as if it was actually present in files/. From what I can tell with my own experiments, this does seem to work, and devtool works with this also.

Are there any implications of this approach that I should be aware of?


问:
 element not clickable
I am creating a drop-down menu in line with various online tutorials such as:

https://www.codewall.co.uk/create-a-dropdown-navigation-menu-with-details-summary/

However, when I reproduce this code (including copy-paste), the menu items fail to be clickable. I would like the items (i.e. ) to be clickable links when the  element is expanded.

It might be important that I am using the Cargo website builder, but I have not run into any CSS/HTML/JS issues that couldn't work.

I tried code from multiple sites, as well as typing it myself—it's very simple.

```<code><details>
    <summary>
        menu name
    </summary>
        <a href="item 1" rel="history">item 1</a><br>
        <a href="item 2" rel="history">item 2</a><br>
        <a href="item 3" rel="history">item 3</a><br>
        <a href="#">ALL OTHER PIES</a>
</details>
</code>```

Title: <Details> element not clickable

Body:
I am creating a drop-down menu in line with various online tutorials such as:

https://www.codewall.co.uk/create-a-dropdown-navigation-menu-with-details-summary/

However, when I reproduce this code (including copy-paste), the menu items fail to be clickable. I would like the items (i.e. ) to be clickable links when the  element is expanded.

It might be important that I am using the Cargo website builder, but I have not run into any CSS/HTML/JS issues that couldn't work.

I tried code from multiple sites, as well as typing it myself—it's very simple.

        menu name

        item 1

        item 2

        item 3

        ALL OTHER PIES


问:
Ray Python code raise KeyboardInterrupt error, and if-else statement error did not worked
My if condition does not work and let some code passing throught.
Here is the condition and print statement for debug.

```<code>def _run_remote_experiment(self, object_ids: List, id_config_mapping: Dict, pretrain_dict: Dict, exploring_feature):
    multi_runner_limit = 3
    if len(object_ids) < multi_runner_limit:
        obj_refs = self.run_experiment()
        object_ids.append(obj_refs)
        id_config_mapping[obj_refs] = config_copy(self.config)

    # control the number of concurrent tasks
    if len(object_ids) >= multi_runner_limit:
        try:
            print(f"Starting code that may raise KeyboardInterrupt...{len(object_ids)}")
            done_id, object_ids[:] = ray.wait(object_ids, num_returns=1)
            print("Code finished executing.")
        except KeyboardInterrupt:
            done_id, object_ids[:] = ray.wait(object_ids, num_returns=1)
            print(f"Received keyboard interrupt. Exiting gracefully.{len(object_ids)}")
        # done_id, object_ids[:] = ray.wait(object_ids, num_returns=1) <-- original code that doesn't worked
        output_list = ray.get(done_id[0])
</code>```

I originally only have the commented out line, which did not worked. I change the line to try-except part and it worked. Below is the excerpt from my output.

pid=23544) [INFO 11:38:23] [ml logger] === Start training on validation data ===
pid=23544) [INFO 11:38:23] [ml logger] Start round validation
pid=22612) [INFO 11:38:23] [ml logger] [round validation] train 1/1 epoch : loss 0.171, interval_acc 0.000, mse 0.171,
pid=22612) [INFO 11:38:23] [ml logger] [round validation] valid 1/1 epoch : loss 0.035, interval_acc 0.000, mse 0.035,
Received keyboard interrupt. Exiting gracefully.2
[INFO 11:38:23] [ml logger] 51/351 ['log_close', 'm1_end', 'pbr']
[INFO 11:38:23] [ml logger] Write configuration
Starting code that may raise KeyboardInterrupt...3
pid=22612) [INFO 11:38:23] [ml logger]  === Saving last model before training on the Test data ===

It is hard to understand why such print statement(bold line) can be come out, where

```<code>len(object_ids) = 2
</code>```

cannot be pass the if condition.

Also, I never touched Keyboard while the program running. This happend repetitively every time.

```<code>print(f"Received keyboard interrupt. Exiting gracefully.{len(object_ids)}")
</code>```

never work as I never type ctrl+c.

Also, above code can only yield
Received keyboard interrupt. Exiting gracefully.0
Received keyboard interrupt. Exiting gracefully.1
Received keyboard interrupt. Exiting gracefully.2

Body:
My if condition does not work and let some code passing throught.
Here is the condition and print statement for debug.

def _run_remote_experiment(self, object_ids: List, id_config_mapping: Dict, pretrain_dict: Dict, exploring_feature):
    multi_runner_limit = 3
    if len(object_ids) < multi_runner_limit:
        obj_refs = self.run_experiment()
        object_ids.append(obj_refs)
        id_config_mapping[obj_refs] = config_copy(self.config)

    # control the number of concurrent tasks
    if len(object_ids) >= multi_runner_limit:
        try:
            print(f"Starting code that may raise KeyboardInterrupt...{len(object_ids)}")
            done_id, object_ids[:] = ray.wait(object_ids, num_returns=1)
            print("Code finished executing.")
        except KeyboardInterrupt:
            done_id, object_ids[:] = ray.wait(object_ids, num_returns=1)
            print(f"Received keyboard interrupt. Exiting gracefully.{len(object_ids)}")
        # done_id, object_ids[:] = ray.wait(object_ids, num_returns=1) <-- original code that doesn't worked
        output_list = ray.get(done_id[0])

I originally only have the commented out line, which did not worked. I change the line to try-except part and it worked. Below is the excerpt from my output.

pid=23544) [INFO 11:38:23] [ml logger] === Start training on validation data ===
pid=23544) [INFO 11:38:23] [ml logger] Start round validation
pid=22612) [INFO 11:38:23] [ml logger] [round validation] train 1/1 epoch : loss 0.171, interval_acc 0.000, mse 0.171,
pid=22612) [INFO 11:38:23] [ml logger] [round validation] valid 1/1 epoch : loss 0.035, interval_acc 0.000, mse 0.035,
Received keyboard interrupt. Exiting gracefully.2
[INFO 11:38:23] [ml logger] 51/351 ['log_close', 'm1_end', 'pbr']
[INFO 11:38:23] [ml logger] Write configuration
Starting code that may raise KeyboardInterrupt...3
pid=22612) [INFO 11:38:23] [ml logger]  === Saving last model before training on the Test data ===

It is hard to understand why such print statement(bold line) can be come out, where

len(object_ids) = 2

cannot be pass the if condition.

Also, I never touched Keyboard while the program running. This happend repetitively every time.

print(f"Received keyboard interrupt. Exiting gracefully.{len(object_ids)}")

never work as I never type ctrl+c.

Also, above code can only yield
Received keyboard interrupt. Exiting gracefully.0
Received keyboard interrupt. Exiting gracefully.1
Received keyboard interrupt. Exiting gracefully.2


问:
How to set OpenAPI query parameter as array
I use openapi v2.
I read this document https://swagger.io/docs/specification/serialization/ .
I want to define path that take array and 1 value query parameter like below.(userIds and groupId)

```<code>/users{?userIds}{groupId}
</code>```

But I call this url like below, it's return 404.

```<code>const url = '/user?userIds=10,11&groupId=1'
</code>```

How to define it?

Body:
I use openapi v2.
I read this document https://swagger.io/docs/specification/serialization/ .
I want to define path that take array and 1 value query parameter like below.(userIds and groupId)

/users{?userIds}{groupId}

But I call this url like below, it's return 404.

const url = '/user?userIds=10,11&groupId=1'

How to define it?


问:
Two hex editors different values
For the same file, one hex editor shows 3A303230 where the other shows B03F0020 for the same location. I know those are the same but I don't understand how to convert one to the other?</p>

Title: Two hex editors different values