问:
Cannot connect to Laravel Websocket over HTTPS
Using Laravel-Websocket and Pusher Replacement.

I have no problem connecting to the same websocket server using http protocol.
But I could not connect using HTTPS.  Can I just use HTTP and not setup SSL in the PHP side?  What is the best solution for this?  Thanks a lot!

NodeJS Code

```<code>const options = {
                wsHost: "xxx",
                wsPort: 6001,
                wssPort: 6001,

                key: "somekey",
                broadcaster: "pusher",
                forceTLS: false,
                disableStats: true,
                namespace: false,
                enabledTransports: ['ws', 'wss'],
            };

const client = new Pusher(options.key, options);
</code>```

laravel config/broadcasting.php

```<code> 'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'encrypted' => true,
                'host' => env('LARAVEL_WEBSOCKETS_HOST'),
                'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
                'scheme' => 'http'
            ],
        ],

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
        ],

        'log' => [
            'driver' => 'log',
        ],

        'null' => [
            'driver' => 'null',
        ],

    ],
</code>```

Body:
Using Laravel-Websocket and Pusher Replacement.

I have no problem connecting to the same websocket server using http protocol.
But I could not connect using HTTPS.  Can I just use HTTP and not setup SSL in the PHP side?  What is the best solution for this?  Thanks a lot!

NodeJS Code

const options = {
                wsHost: "xxx",
                wsPort: 6001,
                wssPort: 6001,

                key: "somekey",
                broadcaster: "pusher",
                forceTLS: false,
                disableStats: true,
                namespace: false,
                enabledTransports: ['ws', 'wss'],
            };

const client = new Pusher(options.key, options);

laravel config/broadcasting.php

 'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'encrypted' => true,
                'host' => env('LARAVEL_WEBSOCKETS_HOST'),
                'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
                'scheme' => 'http'
            ],
        ],

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
        ],

        'log' => [
            'driver' => 'log',
        ],

        'null' => [
            'driver' => 'null',
        ],

    ],


来源: stackexchange

问:
How to predict unseen(upcoming future) stock market data using LSTM model?
I am working on a project which includes making a deep learning model (LSTM) to predict the unseen stock market price , now i am very now to ML ,i am unable to predict the future data.i have coded the basic model,and have trained and tested the model. I have predicted value against the test data set , but to predict the unseen future data.</p>

ContentLicense: CC BY-SA 4.0


问:
Why does to_sql require some column names to be uppercase but not others?
I have a dataframe, whose data I want to append to an existing table within a DB2 database.

The dataframe is pieced together from several variables using this code:

```<code>df = pd.DataFrame([[V_UK_week_ending, V_UK_unique_visitors_tw, V_UK_country, V_UK_key]],columns=['week_ending','unique_visitors_tw','country', 'key'])
</code>```

The dataframe itself looks like this:

```<code>  week_ending unique_visitors_tw country              key
0  2023-01-02            6439376      UK  02/01/2023 - UK
</code>```

This is an overview of the table I'm appending the dataframe to (data comes from SYSCAT.COLUMNS):

```<code> TABSCHEMA TABNAME COLNAME            COLNO TYPENAME LENGTH SCALE
 --------- ------- ------------------ ----- -------- ------ -----
 DMN       SJ_TEST COUNTRY                4 VARCHAR      10     0
 DMN       SJ_TEST KEY                    5 VARCHAR      20     0
 DMN       SJ_TEST UNIQUE_VISITORS_TW     1 INTEGER       4     0
 DMN       SJ_TEST WEEK_ENDING            0 DATE          4     0
</code>```

This is the code I am using to insert the data from the dataframe into the table:

```<code>df.to_sql(V_table, V_conn, schema = V_schema, if_exists = 'append', index = False)
</code>```

This results in the following error:

```<code>sqlalchemy.exc.ProgrammingError: (ibm_db_dbi.ProgrammingError) ibm_db_dbi::ProgrammingError: Binding Error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0206N  "key" is not valid in the context where it is used.  SQLSTATE=42703\r SQLCODE=-206
[SQL: INSERT INTO "DMN"."SJ_TEST" (week_ending, unique_visitors_tw, country, "key") VALUES (?, ?, ?, ?)]
[parameters: ('2023-01-02', '6439376', 'UK', '02/01/2023 - UK')]
</code>```

However, if I change the code setting up the dataframe so that the key column's name is in uppercase, the to_sql statement works fine:

```<code>df = pd.DataFrame([[V_UK_week_ending, V_UK_unique_visitors_tw, V_UK_country, V_UK_key]],columns=['week_ending','unique_visitors_tw','country', 'KEY'])
</code>```

Does anyone know why this is required please? I don't understand why some columns would need to be in uppercase but not others.

Body:
I have a dataframe, whose data I want to append to an existing table within a DB2 database.

The dataframe is pieced together from several variables using this code:

df = pd.DataFrame([[V_UK_week_ending, V_UK_unique_visitors_tw, V_UK_country, V_UK_key]],columns=['week_ending','unique_visitors_tw','country', 'key'])

The dataframe itself looks like this:

  week_ending unique_visitors_tw country              key
0  2023-01-02            6439376      UK  02/01/2023 - UK

This is an overview of the table I'm appending the dataframe to (data comes from SYSCAT.COLUMNS):

 TABSCHEMA TABNAME COLNAME            COLNO TYPENAME LENGTH SCALE
 --------- ------- ------------------ ----- -------- ------ -----
 DMN       SJ_TEST COUNTRY                4 VARCHAR      10     0
 DMN       SJ_TEST KEY                    5 VARCHAR      20     0
 DMN       SJ_TEST UNIQUE_VISITORS_TW     1 INTEGER       4     0
 DMN       SJ_TEST WEEK_ENDING            0 DATE          4     0

This is the code I am using to insert the data from the dataframe into the table:

df.to_sql(V_table, V_conn, schema = V_schema, if_exists = 'append', index = False)

This results in the following error:

sqlalchemy.exc.ProgrammingError: (ibm_db_dbi.ProgrammingError) ibm_db_dbi::ProgrammingError: Binding Error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0206N  "key" is not valid in the context where it is used.  SQLSTATE=42703\r SQLCODE=-206
[SQL: INSERT INTO "DMN"."SJ_TEST" (week_ending, unique_visitors_tw, country, "key") VALUES (?, ?, ?, ?)]
[parameters: ('2023-01-02', '6439376', 'UK', '02/01/2023 - UK')]

However, if I change the code setting up the dataframe so that the key column's name is in uppercase, the to_sql statement works fine:

df = pd.DataFrame([[V_UK_week_ending, V_UK_unique_visitors_tw, V_UK_country, V_UK_key]],columns=['week_ending','unique_visitors_tw','country', 'KEY'])

Does anyone know why this is required please? I don't understand why some columns would need to be in uppercase but not others.


问:
How to get Class Variable Value from Python XML RPC Server
Hello I'm new to stackoverflow and to XMLRPC Server in Python:

I have a class with the following parameters and i registered the class as a instance in xmlrpc server:
The Class:

```<code>class PacificPowerActiveLoad(PacificPowerLowerLevel):
"""Main Class."""
    def __init__(self, **kargs) -> None:
    """_summary."""
        super(PacificPowerActiveLoad, self,).__init__()
        # Parameter
        self.Ip =""
        self.Port = ""
        self.Mode = ""                  # 0: CC, 1: CR, 2: CP, 3: CE
        self.Form = 'Single'            # Single, Split, Three
        self.PhaseSelection = None
        self.Imax = ""
        self.CFSoll = ""
</code>```

Server.py:

```<code>with SimpleXMLRPCServer(('localhost', 8000)) as server:
    server.register_instance(PacificPowerActiveLoad(Ip="localhost",Port="20001"), allow_dotted_names=True)
    server.register_multicall_functions()
    print('Serving XML-RPC on localhost port 8000')
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        print("\\nKeyboard interrupt received, exiting.")
        sys.exit(0)
</code>```

Client.py:

```<code>import xmlrpc.client
Device_1 = xmlrpc.client.ServerProxy("http://localhost:8000")
print(Device_1.Ip)
print(Device_1.Port)
</code>```

When i execute the Client.py. I would expect:

```<code>localhost
20001
</code>```

but i get:

```<code><xmlrpc.client._Method object at 0x00000296D6B73248>
<xmlrpc.client._Method object at 0x00000296D6B73248>
</code>```

Is there a good way to access the variables in the client.py and print the Value?
Thank you for your help

Body:
Hello I'm new to stackoverflow and to XMLRPC Server in Python:

I have a class with the following parameters and i registered the class as a instance in xmlrpc server:
The Class:

class PacificPowerActiveLoad(PacificPowerLowerLevel):
"""Main Class."""
    def __init__(self, **kargs) -> None:
    """_summary."""
        super(PacificPowerActiveLoad, self,).__init__()
        # Parameter
        self.Ip =""
        self.Port = ""
        self.Mode = ""                  # 0: CC, 1: CR, 2: CP, 3: CE
        self.Form = 'Single'            # Single, Split, Three
        self.PhaseSelection = None
        self.Imax = ""
        self.CFSoll = ""

Server.py:

with SimpleXMLRPCServer(('localhost', 8000)) as server:
    server.register_instance(PacificPowerActiveLoad(Ip="localhost",Port="20001"), allow_dotted_names=True)
    server.register_multicall_functions()
    print('Serving XML-RPC on localhost port 8000')
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        print("\\nKeyboard interrupt received, exiting.")
        sys.exit(0)

Client.py:

import xmlrpc.client
Device_1 = xmlrpc.client.ServerProxy("http://localhost:8000")
print(Device_1.Ip)
print(Device_1.Port)

When i execute the Client.py. I would expect:

localhost
20001

but i get:

<xmlrpc.client._Method object at 0x00000296D6B73248>
<xmlrpc.client._Method object at 0x00000296D6B73248>

Is there a good way to access the variables in the client.py and print the Value?
Thank you for your help


问:
ezdxf - kernel crashed when saving as pdf
I am reading a dxf file using ezdxf in python, so that I can display the file and draw some additional lines on it and then export it as a pdf or png. However, the kernel keeps on crashing when I try to display my original file (around 150 MB) using Frontend(ctx, out).draw_layout(doc.modelspace(), finalize=True) and only works for smaller test files (couple of KB). I also see that the code requires really a lot of memory (more than 50 GB) when running the code on the original file. The error message is pretty generic Canceled future for execute_request message before replies were done

Code sample:

```<code>import ezdxf
from ezdxf import colors, recover
from ezdxf.addons.drawing import RenderContext, Frontend
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend
from ezdxf.tools.standards import setup_drawing
from ezdxf.enums import TextEntityAlignment
import matplotlib.pyplot as plt
import sys

dxf_filename = "test.dxf"
try:
    doc = ezdxf.readfile(dxf_filename)
    print("Successfully read the file")
except IOError:
    print(f"Not a DXF file or a generic I/O error.")
    sys.exit(1)
except ezdxf.DXFStructureError:
    print(f"Invalid or corrupted DXF file.")
    sys.exit(2)

fig = plt.figure()
ax = fig.add_axes([0, 0, 1, 1])
ctx = RenderContext(doc)
out = MatplotlibBackend(ax)
Frontend(ctx, out).draw_layout(doc.modelspace(), finalize=True)
fig.savefig('your.png', dpi=600)

</code>```

I am not very familiar with reading dxf files, but I can perfectly open and save it as a PNG or PDF in Adobe Illustrator on my computer. So it must be something that ezdxf is doing that overruns my RAM?

Body:
I am reading a dxf file using ezdxf in python, so that I can display the file and draw some additional lines on it and then export it as a pdf or png. However, the kernel keeps on crashing when I try to display my original file (around 150 MB) using Frontend(ctx, out).draw_layout(doc.modelspace(), finalize=True) and only works for smaller test files (couple of KB). I also see that the code requires really a lot of memory (more than 50 GB) when running the code on the original file. The error message is pretty generic Canceled future for execute_request message before replies were done

Code sample:

import ezdxf
from ezdxf import colors, recover
from ezdxf.addons.drawing import RenderContext, Frontend
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend
from ezdxf.tools.standards import setup_drawing
from ezdxf.enums import TextEntityAlignment
import matplotlib.pyplot as plt
import sys

dxf_filename = "test.dxf"
try:
    doc = ezdxf.readfile(dxf_filename)
    print("Successfully read the file")
except IOError:
    print(f"Not a DXF file or a generic I/O error.")
    sys.exit(1)
except ezdxf.DXFStructureError:
    print(f"Invalid or corrupted DXF file.")
    sys.exit(2)

fig = plt.figure()
ax = fig.add_axes([0, 0, 1, 1])
ctx = RenderContext(doc)
out = MatplotlibBackend(ax)
Frontend(ctx, out).draw_layout(doc.modelspace(), finalize=True)
fig.savefig('your.png', dpi=600)

I am not very familiar with reading dxf files, but I can perfectly open and save it as a PNG or PDF in Adobe Illustrator on my computer. So it must be something that ezdxf is doing that overruns my RAM?


问:
Loading JS files in CakePHP 3
I have a template inside a plugin in my project, that is trying to load a "general" JS file:

```<code><?= $this->Html->script([
    'base.js',
], [
    'fullBase' => true,
]) ?>
</code>```

public/ is the root folder of the whole project, and the bootstrap.ctp template file resides inside the plugin folder:

```<code>/var/www/repo/publi/plugins/MyPlugin/src/Template/Layout/bootstrap.ctp
</code>```

while the base.js file resides in the "general" webroot folder:

```<code>/var/www/repo/public/webroot/js/base.js
</code>```

When I visit the page, this is the error I get:

```<code>GET https://localhost/var/www/repo/public/js/base.js net::ERR_ABORTED 404 (Not Found)
</code>```

This is the output of the $this->Html->script() call:

```<code><script src="/var/www/repo/public/js/webroot/base.js"></script>
</code>```

And this is the content of my .htaccess file:

```<code><IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>
</code>```

But when I add

```<code>dd(WWW_ROOT);
</code>```

at the beginning of my template file, I get the correct output with the path that I would expect:

```<code>/var/www/repo/public/webroot/
</code>```

So, my question is: if the WWW_ROOT constant is correctly configured, why is the script() function loading the base.js file incorrectly?

CakePHP's own documentation even states that

This method of JavaScript file inclusion assumes that the JavaScript file specified resides inside the webroot/js directory:

which is exactly what I'm doing.

Title: Loading JS files in CakePHP 3

Body:
I have a template inside a plugin in my project, that is trying to load a "general" JS file:

<?= $this->Html->script([
    'base.js',
], [
    'fullBase' => true,
]) ?>

public/ is the root folder of the whole project, and the bootstrap.ctp template file resides inside the plugin folder:

/var/www/repo/publi/plugins/MyPlugin/src/Template/Layout/bootstrap.ctp

while the base.js file resides in the "general" webroot folder:

/var/www/repo/public/webroot/js/base.js

When I visit the page, this is the error I get:

GET https://localhost/var/www/repo/public/js/base.js net::ERR_ABORTED 404 (Not Found)

This is the output of the $this->Html->script() call:

And this is the content of my .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

But when I add

dd(WWW_ROOT);

at the beginning of my template file, I get the correct output with the path that I would expect:

/var/www/repo/public/webroot/

So, my question is: if the WWW_ROOT constant is correctly configured, why is the script() function loading the base.js file incorrectly?

CakePHP's own documentation even states that

This method of JavaScript file inclusion assumes that the JavaScript file specified resides inside the webroot/js directory:

which is exactly what I'm doing.


问:
Is it possible to modify the underlying git command of the 'fetch all' button in Git Extensions?
I use Git Extensions

Git Extensions 4.0.1.15887
and Git

Git 2.38.1.windows.1
on windows 11.

The 'Fetch all' button

performs a

git fetch --progress --all

command (I assume),
but I would like to change that to

git fetch --progress --all -4

to enforce the use of an ipv4 connection. Is that possible?

```<code>

I went to all the settings, hoping to find the configuration of the button.
</code>```

Body:
I use Git Extensions

Git Extensions 4.0.1.15887
and Git

Git 2.38.1.windows.1
on windows 11.

The 'Fetch all' button

performs a

git fetch --progress --all

command (I assume),
but I would like to change that to

git fetch --progress --all -4

to enforce the use of an ipv4 connection. Is that possible?

I went to all the settings, hoping to find the configuration of the button.


问:
Powershell to check if .exe is running, if it is running, send email, if it isn't close script
```<code>if(get-process | ?{$_.path -eq "C:\My exes\Test1.exe"}){
    #exe is running. Send email
}
</code>```

Found the above on another thread, hoping somone can add in the email part?

Body:
if(get-process | ?{$_.path -eq "C:\My exes\Test1.exe"}){
    #exe is running. Send email
}

Found the above on another thread, hoping somone can add in the email part?


问:
Codemirror Autocompletion should not hint variables from my javascript code
I am using Codemirror with the auto complete addon.
Work very fine, but I have one problem.
For example, when the user enters a text like "ld" and starts the autocomplete, automatically there are all variables from my JS code starting with ld.

What I want: The auto complete should should show just internal javascript keywords, like:function, while, for and so on. Only things that my nashorn scripting engine can handle in Grails.

Background: The user can enter Javascript code that is executed in Nashorn, so only functions that Nashorn can handle should be shown (no window, no console and so on)

How can I achieve this?


问:
How to show a pdf file from c# code on Win11?
I need to show a PDF file in a browser, by pressing a button in my C# app.
So the browser is eternal to  my app.
On Win 10 I do it like this:

```<code>....
var process = new Process
{
    StartInfo = new ProcessStartInfo
    {
    FileName = FindBrowser(),
    Arguments = $"\"file:///{PDF_File}\""
}
process.Start();
....
private static string FindBrowser()
{
GroupCollection groups;
try
{
   // finding the default browser in the registry is a two-step process:
   using var key = Registry.CurrentUser.OpenSubKey(
   @"SOFTWARE\Microsoft\Windows\Shell\Associations\URLAssociations\http\UserChoice");
   var s = (string) key?.GetValue("ProgId");
   using var command = Registry.ClassesRoot.OpenSubKey($"{s}\\shell\\open\\command");
   var browserCommand = (string) command?.GetValue(null);
   var regexpr = new Regex("^\"([^\"]*)\"");
   groups = regexpr.Match(browserCommand).Groups;
   if (!File.Exists(groups[1].Value))
   {
       throw new FileNotFoundException("NoBrowser");
   }
}
</code>```

but my customer says this does not work on Win 11 (I have no Win 11)
Is there a foolproof way to program this?
I use VS 2019 myself to develop and debug.
My solution works OK there.

Body:
I need to show a PDF file in a browser, by pressing a button in my C# app.
So the browser is eternal to  my app.
On Win 10 I do it like this:

....
var process = new Process
{
    StartInfo = new ProcessStartInfo
    {
    FileName = FindBrowser(),
    Arguments = $"\"file:///{PDF_File}\""
}
process.Start();
....
private static string FindBrowser()
{
GroupCollection groups;
try
{
   // finding the default browser in the registry is a two-step process:
   using var key = Registry.CurrentUser.OpenSubKey(
   @"SOFTWARE\Microsoft\Windows\Shell\Associations\URLAssociations\http\UserChoice");
   var s = (string) key?.GetValue("ProgId");
   using var command = Registry.ClassesRoot.OpenSubKey($"{s}\\shell\\open\\command");
   var browserCommand = (string) command?.GetValue(null);
   var regexpr = new Regex("^\"([^\"]*)\"");
   groups = regexpr.Match(browserCommand).Groups;
   if (!File.Exists(groups[1].Value))
   {
       throw new FileNotFoundException("NoBrowser");
   }
}

but my customer says this does not work on Win 11 (I have no Win 11)
Is there a foolproof way to program this?
I use VS 2019 myself to develop and debug.
My solution works OK there.


问:
Thymeleaf condition to display a list
There is a list and if the list is empty we need to hide the tile in the frontend and if the list is not empty we have to display the tile with list if the list is not empty</p>

Title: Thymeleaf condition to display a list


问:
How to Create job for De-identification template in GCP DLP?
I am new to DLP so may have limited visibility w.r.t to DLP Services.

I have created one DE-IDENTIFY Template for data Masking. I want to use that DE-IDENTIFY Template over a few BigQuery tables but I am not getting any direct way to do that like the INSPECT Template that provides INSPECT Job in DLP itself.

Do I need to write a custom job for all the De-identify use cases? if yes then where I can run that custom logic DataFlow, DataProc, GKE, Cloud Function or else ?

I have checked the Dataflow template but that does not provide any template for Bigquery only. Most of the templates are for data ingestion such as from Cloud Storage to BigQuery. Not for the data already stored in BigQuery.

Is there anything that I am missing? I am using asia-south1 region for the Testing. Please help me to understand the use case of it.


问:
Coingate callback post method data not seen
I am trying to integrate crypto pay with coingate to my nodejs app but the callback post method has a req.body which is empty. Please do anyone have any idea on how to retrieve the order data so that I can use it for another api call. I have looked on the entire req object and couldn't see the order data.</p>


问:
How can I get Clockify to WRITE annual leave to Google Calendar?
I am having trouble with identifying how to get Clockify to write annual leave (time off in the api documentation) to Google Calendar. I have looked through the API documentation but have to admit I haven't had too much experience with API work previously, any help is very much appreciated. :)

I have attempted to use Zapier to get it to work with no coding, but they don't seem to have the correct triggers and actions that I am looking for.


问:
Question: Robustness of Micronaut data sources if target database is not reachable at startup
Say we have configured a data source within application.yml like so:

```<code>datasources:
  default:
    url: [...]
    driverClassName: [...]
    username: [...]
    password: [...]
</code>```

If target database is not reachable, e.g. because of network issues (firewall, etc.), application launch fails with messages like:

```<code>io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [javax.sql.DataSource] could not be loaded: Error instantiating bean of type  [javax.sql.DataSource]
</code>```

In context of e.g. Kubernetes this yields CrashLoopBackOffs, resulting in scheduler's attempts to launch another Pod instance again and again.

Is there a way to configure data sources in such a way that under these circumstances

application launches successfully,

Health Check entity (like io.micronaut.management.health.indicator.jdbc.JdbcIndicator) reports HealthStatus.DOWN,

making Kubernetes' Readiness Probe fail,

so this instance does not receive any traffic,

unless target database becomes reachable.

Thanks for any hint.

Body:
Say we have configured a data source within application.yml like so:

datasources:
  default:
    url: [...]
    driverClassName: [...]
    username: [...]
    password: [...]

If target database is not reachable, e.g. because of network issues (firewall, etc.), application launch fails with messages like:

io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [javax.sql.DataSource] could not be loaded: Error instantiating bean of type  [javax.sql.DataSource]

In context of e.g. Kubernetes this yields CrashLoopBackOffs, resulting in scheduler's attempts to launch another Pod instance again and again.

Is there a way to configure data sources in such a way that under these circumstances

application launches successfully,

Health Check entity (like io.micronaut.management.health.indicator.jdbc.JdbcIndicator) reports HealthStatus.DOWN,

making Kubernetes' Readiness Probe fail,

so this instance does not receive any traffic,

unless target database becomes reachable.

Thanks for any hint.


问:
npm override not fixing vulnerability
This is my vulnerability report :

High            node-fetch is vulnerable to Exposure of Sensitive
Information to an Unauthorized Actor

Package         node-fetch

Patched in      >=2.6.7

Dependency of   react-table-drag-select

Path            react-table-drag-select > react > fbjs > isomorphic-fetch >
node-fetch

More info       https://github.com/advisories/GHSA-r683-j2x4-v87g

I tried to fix it using overrride in my package.json

```<code>{
   "overrides":{
      "isomorphic-fetch":{
         "node-fetch":"2.6.7"
      }
   }
}
</code>```

I have even tried

```<code> {
   "overrides":{
      "react-table-drag-select":{
         "react":{
            "fbjs":{
               "isomorphic-fetch":{
                  "node-fetch":"latest"
               }
            }
         }
      }
   }
}
</code>```

I'm still getting the same vulnerability

Title: npm override not fixing vulnerability

Body:
This is my vulnerability report :

High            node-fetch is vulnerable to Exposure of Sensitive
Information to an Unauthorized Actor

Package         node-fetch

Patched in      >=2.6.7

Dependency of   react-table-drag-select

Path            react-table-drag-select > react > fbjs > isomorphic-fetch >
node-fetch

More info       https://github.com/advisories/GHSA-r683-j2x4-v87g

I tried to fix it using overrride in my package.json

{
   "overrides":{
      "isomorphic-fetch":{
         "node-fetch":"2.6.7"
      }
   }
}

I have even tried

 {
   "overrides":{
      "react-table-drag-select":{
         "react":{
            "fbjs":{
               "isomorphic-fetch":{
                  "node-fetch":"latest"
               }
            }
         }
      }
   }
}

I'm still getting the same vulnerability


问:
Render Issues with custom style in OpenLayers and Safari Browser
I have noticed rendering issues with a simple custom render function, code below.

I render the geometry and some Text. I can see the Text but not the Geometry itself, expect if I zoom in very close. Any idea what is causing this visual error? I'm using OL v7.2.2 and iPhone 13 Mini iOS 16.1.1

This code works on any other Browser on a Windows Machine, and this works also if I use a Style Object (style: new Style({fill: new Fill...

Example: https://jsfiddle.net/of6nvtbk/22/

Relevant Code:

```<code>const interactionLayer = new ol.layer.VectorImage({
    source: featureSource,
    zIndex: Number.MAX_SAFE_INTEGER,
    style: (feature, resolution) => {
      return new ol.style.Style({
        renderer: (pxGeometry, state) => {

          const polygon = new ol.geom.Polygon(pxGeometry);

          const olContext = ol.render.toContext(state.context);

          olContext.setFillStrokeStyle(
            new ol.style.Fill({
              color: "rgba(255,255,0, 1)",
            }),
            new ol.style.Stroke({
              color: "#000",
            }),
          );

          olContext.drawGeometry(polygon);
        },
      });
    },
  });
</code>```

Iphone Screenshots while zooming in:

Edit:

Works without using drawGeometry:

```<code>ctx.beginPath();

ctx.moveTo(pxGeometry[0][0][0], pxGeometry[0][0][1]);

for (let i = 1; i < pxGeometry[0].length; i++) {
    ctx.lineTo(pxGeometry[0][i][0], pxGeometry[0][i][1]);
}
ctx.closePath();
ctx.fill();
</code>```

Body:
I have noticed rendering issues with a simple custom render function, code below.

I render the geometry and some Text. I can see the Text but not the Geometry itself, expect if I zoom in very close. Any idea what is causing this visual error? I'm using OL v7.2.2 and iPhone 13 Mini iOS 16.1.1

This code works on any other Browser on a Windows Machine, and this works also if I use a Style Object (style: new Style({fill: new Fill...

Example: https://jsfiddle.net/of6nvtbk/22/

Relevant Code:

const interactionLayer = new ol.layer.VectorImage({
    source: featureSource,
    zIndex: Number.MAX_SAFE_INTEGER,
    style: (feature, resolution) => {
      return new ol.style.Style({
        renderer: (pxGeometry, state) => {

          const polygon = new ol.geom.Polygon(pxGeometry);

          const olContext = ol.render.toContext(state.context);

          olContext.setFillStrokeStyle(
            new ol.style.Fill({
              color: "rgba(255,255,0, 1)",
            }),
            new ol.style.Stroke({
              color: "#000",
            }),
          );

          olContext.drawGeometry(polygon);
        },
      });
    },
  });

Iphone Screenshots while zooming in:

Edit:

Works without using drawGeometry:

ctx.beginPath();

ctx.moveTo(pxGeometry[0][0][0], pxGeometry[0][0][1]);

for (let i = 1; i < pxGeometry[0].length; i++) {
    ctx.lineTo(pxGeometry[0][i][0], pxGeometry[0][i][1]);
}
ctx.closePath();
ctx.fill();


问:
Items disappear when I click in an empty area
I have an item search system. But when I find the item(s) I want and click in an empty area, the item(s) disappear. What is the error?

```<code>    return GestureDetector(
  onTap: () {
    FocusScopeNode currentFocus = FocusScope.of(context);

    if (!currentFocus.hasPrimaryFocus) {
      currentFocus.unfocus();
    }
  },
  child: MaterialApp(
    debugShowCheckedModeBanner: false,
    home: Obx(
      () => Scaffold(
        resizeToAvoidBottomInset: false,
        backgroundColor: const Color.fromARGB(255, 15, 15, 15),
        appBar: AppBar(
            elevation: 0,
            toolbarHeight: 90,
            backgroundColor: Colors.transparent,
            title: TextField(
              controller: findPressureController,
              keyboardType: TextInputType.text,
              textInputAction: TextInputAction.done,
              onChanged: (value) {
                List newList = [];

                if (value.isNotEmpty) {
                  for (var element in pressures) {
                    if (element.pressure.contains(value) ||
                        element.date.toString().contains(value)) {
                      newList.add(element);
                    }
                  }
                  items.value = newList;
                } else {
                  items.value = pressures;
                }
              },
              decoration: InputDecoration(
                  hintText: 'Search pressure or date...',
                  hintStyle: GoogleFonts.roboto(
                      color: Colors.white.withOpacity(0.5),
                      fontSize: 20,
                      fontWeight: FontWeight.w700),
                  enabledBorder: OutlineInputBorder(
                      borderRadius:
                          const BorderRadius.all(Radius.circular(15.0)),
                      borderSide: BorderSide(
                          width: 2.0,
                          color: const Color.fromARGB(255, 99, 99, 99)
                              .withOpacity(0.4))),
                  focusedBorder: const OutlineInputBorder(
                      borderRadius: BorderRadius.all(Radius.circular(15.0)),
                      borderSide: BorderSide(
                          width: 2.0,
                          color: Color.fromARGB(255, 99, 99, 99)))),
              style: GoogleFonts.roboto(
                  color: Colors.white.withOpacity(0.7),
                  fontSize: 20,
                  fontWeight: FontWeight.w700),
            )),
        body: Padding(
          padding: const EdgeInsets.only(bottom: 15.0),
          child: ListView.separated(
            itemCount: items.length,
            itemBuilder: (context, index) {
              return pressureItem(index);
            },
            separatorBuilder: (context, index) =>
                const SizedBox(height: 15.0),
          ),
        ),
      ),
    ),
  ),
);
</code>```

Body:
I have an item search system. But when I find the item(s) I want and click in an empty area, the item(s) disappear. What is the error?

    return GestureDetector(
  onTap: () {
    FocusScopeNode currentFocus = FocusScope.of(context);

    if (!currentFocus.hasPrimaryFocus) {
      currentFocus.unfocus();
    }
  },
  child: MaterialApp(
    debugShowCheckedModeBanner: false,
    home: Obx(
      () => Scaffold(
        resizeToAvoidBottomInset: false,
        backgroundColor: const Color.fromARGB(255, 15, 15, 15),
        appBar: AppBar(
            elevation: 0,
            toolbarHeight: 90,
            backgroundColor: Colors.transparent,
            title: TextField(
              controller: findPressureController,
              keyboardType: TextInputType.text,
              textInputAction: TextInputAction.done,
              onChanged: (value) {
                List newList = [];

                if (value.isNotEmpty) {
                  for (var element in pressures) {
                    if (element.pressure.contains(value) ||
                        element.date.toString().contains(value)) {
                      newList.add(element);
                    }
                  }
                  items.value = newList;
                } else {
                  items.value = pressures;
                }
              },
              decoration: InputDecoration(
                  hintText: 'Search pressure or date...',
                  hintStyle: GoogleFonts.roboto(
                      color: Colors.white.withOpacity(0.5),
                      fontSize: 20,
                      fontWeight: FontWeight.w700),
                  enabledBorder: OutlineInputBorder(
                      borderRadius:
                          const BorderRadius.all(Radius.circular(15.0)),
                      borderSide: BorderSide(
                          width: 2.0,
                          color: const Color.fromARGB(255, 99, 99, 99)
                              .withOpacity(0.4))),
                  focusedBorder: const OutlineInputBorder(
                      borderRadius: BorderRadius.all(Radius.circular(15.0)),
                      borderSide: BorderSide(
                          width: 2.0,
                          color: Color.fromARGB(255, 99, 99, 99)))),
              style: GoogleFonts.roboto(
                  color: Colors.white.withOpacity(0.7),
                  fontSize: 20,
                  fontWeight: FontWeight.w700),
            )),
        body: Padding(
          padding: const EdgeInsets.only(bottom: 15.0),
          child: ListView.separated(
            itemCount: items.length,
            itemBuilder: (context, index) {
              return pressureItem(index);
            },
            separatorBuilder: (context, index) =>
                const SizedBox(height: 15.0),
          ),
        ),
      ),
    ),
  ),
);


问:
How to capture SIGTERM in Linux .NET Hosted service
I have a process which I'm porting from Windows to Linux, and I need it to restart relatively promptly when I call systemctl restart service.  Unfortunately, it hangs for the 90 second timeout which is unacceptable.

I've tried several things without effect.  Notably, I have added a handler for Domain.CurrentDomain.ProcessExit in my Program.cs file, but that handler never gets hit when I send that command, or any other as far as I can tell.  I have reviewed the answers for this question, this question, and this question.  I am using IHostBuilder to do this, but I am not in a container.  I'm running on Debian 11.  I have a background service which implements ExecuteAsync, but it has never served to shut down the service.  Even running it from the console and using Ctrl-C doesn't result in the signal handler being called (and in fact doesn't actually terminate the process, even giving it the usual 90 second delay).  What am I missing?

This is my Main function and its helpers.  When I manually set kill to true via debugger, the program exits (albeit ungracefully).  Letting the system run without the exception results in the same hanging behavior.  Clearly one of the many threads is hanging onto resources, but they should be guarded with cancellation tokens, which as previously stated are not working.

public static async Task Main(string[] args)
        {
            IHost builder = CreateHostBuilder(args).Build();
            bool kill = false;

            void OnCurrentDomainOnProcessExit(object sender, EventArgs args)
            {
                kill = true;
            }

            AppDomain.CurrentDomain.ProcessExit +=
                OnCurrentDomainOnProcessExit;
            await builder.StartAsync();
            while (!kill)
            {
                Thread.Sleep(1000);
            }
            await builder.StopAsync(TimeSpan.FromSeconds(10));
            throw new Exception("Received SIGTERM");
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .UseSystemd()
                .UseConsoleLifetime()
                .ConfigureServices(ConfigureServices);

        private static void ConfigureServices(HostBuilderContext _, IServiceCollection services)
        {
            services.AddLogging();
            services.AddSingleton<ITheSingleton, TheSingleton>();
            services.AddHostedService<ProcessWorker>();
        }
```
<p>Here's my simple implementation of a BackgroundService:</p>
<pre class="lang-cs prettyprint-override"><code>    public class ProcessWorker: BackgroundService
    {
        ITheProcess _process;
        public ProcessWorker(ITheProcess process)
        {
            _process = process;
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
                await Task.Delay(1000, stoppingToken);
            }
        }
</code>```

Body:
I have a process which I'm porting from Windows to Linux, and I need it to restart relatively promptly when I call systemctl restart service.  Unfortunately, it hangs for the 90 second timeout which is unacceptable.

I've tried several things without effect.  Notably, I have added a handler for Domain.CurrentDomain.ProcessExit in my Program.cs file, but that handler never gets hit when I send that command, or any other as far as I can tell.  I have reviewed the answers for this question, this question, and this question.  I am using IHostBuilder to do this, but I am not in a container.  I'm running on Debian 11.  I have a background service which implements ExecuteAsync, but it has never served to shut down the service.  Even running it from the console and using Ctrl-C doesn't result in the signal handler being called (and in fact doesn't actually terminate the process, even giving it the usual 90 second delay).  What am I missing?

This is my Main function and its helpers.  When I manually set kill to true via debugger, the program exits (albeit ungracefully).  Letting the system run without the exception results in the same hanging behavior.  Clearly one of the many threads is hanging onto resources, but they should be guarded with cancellation tokens, which as previously stated are not working.

public static async Task Main(string[] args)
        {
            IHost builder = CreateHostBuilder(args).Build();
            bool kill = false;

            void OnCurrentDomainOnProcessExit(object sender, EventArgs args)
            {
                kill = true;
            }

            AppDomain.CurrentDomain.ProcessExit +=
                OnCurrentDomainOnProcessExit;
            await builder.StartAsync();
            while (!kill)
            {
                Thread.Sleep(1000);
            }
            await builder.StopAsync(TimeSpan.FromSeconds(10));
            throw new Exception("Received SIGTERM");
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .UseSystemd()
                .UseConsoleLifetime()
                .ConfigureServices(ConfigureServices);

        private static void ConfigureServices(HostBuilderContext _, IServiceCollection services)
        {
            services.AddLogging();
            services.AddSingleton<ITheSingleton, TheSingleton>();
            services.AddHostedService<ProcessWorker>();
        }

Here's my simple implementation of a BackgroundService:

    public class ProcessWorker: BackgroundService
    {
        ITheProcess _process;
        public ProcessWorker(ITheProcess process)
        {
            _process = process;
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
                await Task.Delay(1000, stoppingToken);
            }
        }


问:
Why does building libgcc require crti.o and -lc?
To build a full libgcc with libc support, you need the libc headers, according to these guides (see also the --without-headers option in gcc configuration doc):

https://wiki.osdev.org/Hosted_GCC_Cross-Compiler
https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Creating_a_cross-compiler#Cross-compiler_internals

So I tried it, and I get linker errors about crti.o not found and -lc not found. Then, I found this guide https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/, that installs only the crti.o files and a fake libc. So why does building libgcc need them? As I understand it, libraries don't need the C runtime files. Also, in step 5., when building libgcc, how does make know where to find the headers and runtime libraries, since --with-sysroot was never specified in the configure step. I know I can build a degraded libgcc at first, but I'd just like to understand why I need more than the headers to build a full libgcc.


问:
How to copy an image to clipboard - Javascript & React
Im trying the new Clipboard API in a project, just for studies

` //copy an image

```<code>const response = await fetch('../images/PE_1.png')

const blob = await response.blob()

await navigator.clipboard.write([new ClipboardItem({'image/png' : blob})])`
</code>```

How do I implement the image I wanna copy and connect it to a button to make the feature 'copy image to clipboard' work out?

I want to make something to copy the image when I click the button and then paste it using Ctrl+V in Paint or Photoshop

I dont have experience using APIs, so sorry if I didnt explain my doubt in the best way possible

Thanks

Body:
Im trying the new Clipboard API in a project, just for studies

` //copy an image

const response = await fetch('../images/PE_1.png')

const blob = await response.blob()

await navigator.clipboard.write([new ClipboardItem({'image/png' : blob})])`

How do I implement the image I wanna copy and connect it to a button to make the feature 'copy image to clipboard' work out?

I want to make something to copy the image when I click the button and then paste it using Ctrl+V in Paint or Photoshop

I dont have experience using APIs, so sorry if I didnt explain my doubt in the best way possible

Thanks


问:
Error: Minified React error #130 in production react app built using vite
So I keep getting this error when I deploy my react app to github pages and this error only shows in production and the app is working okay in the development mode and shows no errors</p>
```<code>Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=object&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
</code>```

Body:
So I keep getting this error when I deploy my react app to github pages and this error only shows in production and the app is working okay in the development mode and shows no errors

Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=object&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.


问:
vscode/protractor unbound breakpoints
I'm trying to debug a Protractor e2e test of an Angular application. I want to start from the e2e test and stop in the application.
I set a breakpoint in the e2e test and one in an Angular component (which should be hit when running the test).

Before launching debug, both breakpoints are bound, but on debug launch the application breakpoint becomes unbound. The e2e breakpoint is hit but not the one in the Angular component.

I've tried to add sourceMap:true in my various tsconfig.json files and in launch configuration, no luck.

I compile from command line (npm run ng serve) which works when I debug e2e tests only or my application only. No .map files are generated.

I want to debug in VSCode, not in Chrome.

Launch configuration:

```<code>        {
            "name": "Launch e2e current file",
            "type": "node",
            "request": "launch",
            "stopOnEntry": false,
            "program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
            "args": [
                "${workspaceRoot}/protractor.conf.js",
                "--specs=${file}"
            ],
            "cwd": "${workspaceRoot}",
            "sourceMaps": true,
            "outFiles": [
                "${workspaceRoot}/dist/out-tsc-e2e/*.js"
            ],
            "skipSourceMapSupport": true
        }
</code>```

Thank you.

Edit:

Here is a sample project: https://gitlab.com/group11804/project1.git

Run npm ci, npm run start-dev, in VSCode add breakpoints in app.e2e-spec.ts (test1 it()) and AppComponent.onClick() (app.component.ts), select Launch e2e current file launch configuration and hit F5.

Breakpoint in AppComponent.onClick() is not honored, debugger does not stop on it.

Title: vscode/protractor unbound breakpoints

Body:
I'm trying to debug a Protractor e2e test of an Angular application. I want to start from the e2e test and stop in the application.
I set a breakpoint in the e2e test and one in an Angular component (which should be hit when running the test).

Before launching debug, both breakpoints are bound, but on debug launch the application breakpoint becomes unbound. The e2e breakpoint is hit but not the one in the Angular component.

I've tried to add sourceMap:true in my various tsconfig.json files and in launch configuration, no luck.

I compile from command line (npm run ng serve) which works when I debug e2e tests only or my application only. No .map files are generated.

I want to debug in VSCode, not in Chrome.

Launch configuration:

        {
            "name": "Launch e2e current file",
            "type": "node",
            "request": "launch",
            "stopOnEntry": false,
            "program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
            "args": [
                "${workspaceRoot}/protractor.conf.js",
                "--specs=${file}"
            ],
            "cwd": "${workspaceRoot}",
            "sourceMaps": true,
            "outFiles": [
                "${workspaceRoot}/dist/out-tsc-e2e/*.js"
            ],
            "skipSourceMapSupport": true
        }

Thank you.

Edit:

Here is a sample project: https://gitlab.com/group11804/project1.git

Run npm ci, npm run start-dev, in VSCode add breakpoints in app.e2e-spec.ts (test1 it()) and AppComponent.onClick() (app.component.ts), select Launch e2e current file launch configuration and hit F5.

Breakpoint in AppComponent.onClick() is not honored, debugger does not stop on it.


问:
How to match the JSON Response differences between Jackson 1 and Jackson 2 for Weblogic 11G to 12C migration
I might be late to the party. Now we are fixing the TechDebt by migrating application from Weblogic 11G to 12C. As part of it we had to change from Jersey 1.19 to Jersey 2.26(as 12C supports it) which in turn requires us to move to Jackson 2.9.6 from Jackson 1.9.2(guessing) internally. Also I've migrated Javaee-api from 6.0 to 7.0. It is an EJB application with LOCAL implementation.

P.s.: Same Request/Response POJO is used for JSON and SOAP services with @XmlRootElement annotation

Now we are started seeing the difference between 11G and 12C responses like the few below,

"true" -> true

"2" -> 2

{ "list1" : [ { "foo": "bar",..}, {"foo1": "bar1",..}] } -> [ {"type": "list1", "foo": "bar"..}, {"type": "list1", "foo1": "bar1",..}

Getting null valued key fields after migrated whereas it wasn't coming earlier

etc.

Is there any documentation about what are all such changes(complete set of changes) has been introduced and its respective fixes? I couldn't find any such documentation out of the internet.

Most of the response changes that are introduced in Jersey 2 seems logical only. However we have to match the 11G response to avoid downstream impact. So we are trying to google the individual issues and fixing it with Serialization/Deserialization.Feature or by adding custom serializer or by adding JsonGenerator according to the suggestion.

As my application is vast and can't test it end to end with each REST endpoints(due to Business SME unavailability), we have to handle all corner cases without escaping any scenarios. So if I have the documentation or the list of changes I can go and find the occurrences in the code and address those.


问:
encrypted file is converted to buffer on IPFS
I'm encrypting a a text file locally using the crypto module from node.js and upload the file to IPFS. I'm trying to then download the file and decrypt it. But once I upload the encrypted file to IPFS, it seems to change to a buffer.

It looks somewhat like this before upload (I only copied the first line):

```<code>N�&��6-d�9L% 9���E��k�ir�C��ڤ|%B5-(���i�
...
...
</code>```

And it looks like this after download:

```<code>{"type":"Buffer","data":[1,78,211,38,190,164,54,25,...])
</code>```

I tried to convert it to multiple encodings, but that doesn't seem to solve anything. Is there a way to upload it in a different format (which stays the same on IPFS) or is there a way to convert the buffer back and decrypt it?

This is the code I use for encryption:

```<code>    export const encrypt = (buffer, key) => {
    const algorithm = 'aes-256-ctr';

    const iv = crypto.randomBytes(16);

    const cipher = crypto.createCipheriv(algorithm, key, iv);

    const result = Buffer.concat([iv, cipher.update(buffer), cipher.final()]);
    return result;
};
</code>```

Body:
I'm encrypting a a text file locally using the crypto module from node.js and upload the file to IPFS. I'm trying to then download the file and decrypt it. But once I upload the encrypted file to IPFS, it seems to change to a buffer.

It looks somewhat like this before upload (I only copied the first line):

N�&��6-d�9L% 9���E��k�ir�C��ڤ|%B5-(���i�
...
...

And it looks like this after download:

{"type":"Buffer","data":[1,78,211,38,190,164,54,25,...])

I tried to convert it to multiple encodings, but that doesn't seem to solve anything. Is there a way to upload it in a different format (which stays the same on IPFS) or is there a way to convert the buffer back and decrypt it?

This is the code I use for encryption:

    export const encrypt = (buffer, key) => {
    const algorithm = 'aes-256-ctr';

    const iv = crypto.randomBytes(16);

    const cipher = crypto.createCipheriv(algorithm, key, iv);

    const result = Buffer.concat([iv, cipher.update(buffer), cipher.final()]);
    return result;
};


问:
Json_table duplicate result data
Hello I just prepare the simplest case of my problem

```<code>select *
from
 orders,
 json_table(
  orders.items, '$[*]'
  columns(
    startDate datetime path '$.startDate'
  )
 ) as items
where
 (:todayStart is null or
 datediff(items.startDate, now()) = 0)

</code>```

so generally query should return orders but when I pass value :todayStart then I search in orders.items array to any element in array has same startDate,
but problem is when :todayStart is null then query return duplicates values from orders like this:

So I think I should maybe run json_table only when :todayStart is not null (syntax error always), anyone have ide why json_table duplicate data?
Thanks!

Title: Json_table duplicate result data

Body:
Hello I just prepare the simplest case of my problem

select *
from
 orders,
 json_table(
  orders.items, '$[*]'
  columns(
    startDate datetime path '$.startDate'
  )
 ) as items
where
 (:todayStart is null or
 datediff(items.startDate, now()) = 0)

so generally query should return orders but when I pass value :todayStart then I search in orders.items array to any element in array has same startDate,
but problem is when :todayStart is null then query return duplicates values from orders like this:

So I think I should maybe run json_table only when :todayStart is not null (syntax error always), anyone have ide why json_table duplicate data?
Thanks!


问:
Passing "*" through command line arguments in C lists all files in directory
I'm trying to pass 3 strings from command line argument, the purpose is to pass a mathematical equation as strings that then get converted into int and math operator.

When I run ./program 1 + 1, I get: argv[0]: ./program , argv[1]: 1, argv[2]: +, argv[3]: 1 as expected.
But when I run ./program 1 * 1 instead argv[2] causes the following to occur:

argv[1] = 1 argv[2] = file_01 argv[3] = file_02 argv[4] = file_03 argv[5] = file_04 argv[6] = file_05 argv[7] = file_06 argv[8] = 1

the files are in the same folder as the executable of the program.

So Im having trouble passing * through command line.

printf("Value stored in argv [2]:%c\n", *argv[2]);

the result is
Value stored in argv[2]:C


问:
Updating records in Django based on date
I have a model in Django called Marketplaces, which has attributes Name, Status and date. The default value for Status is "Open". I want it so that the Status of a Marketplace object is updated from "Open" to "Completed" after the date has passed.

models.py:

```<code>class EventStatus(models.TextChoices):
    Open = "Open"
    Closed = "Closed"
    Completed = "Completed"
    Archived = "Archived"

class Marketplace(models.Model):
    Creator = models.ForeignKey(User, on_delete=models.CASCADE)
    Name = models.CharField(max_length=100)
    date = models.DateTimeField(default=timezone.now)
    Status = models.CharField(max_length=9, choices=EventStatus.choices, default=EventStatus.Open)

    def __str__(self):
        return self.Speaking_Event_Name

    def status(self):
        return EventStatus.Completed if timezone.now() > self.date else self.Status
</code>```

I tried creating a function for it, and it does not seem to work. I am unsure if I am in the correct path or not and I have been stuck for a week.

Body:
I have a model in Django called Marketplaces, which has attributes Name, Status and date. The default value for Status is "Open". I want it so that the Status of a Marketplace object is updated from "Open" to "Completed" after the date has passed.

models.py:

class EventStatus(models.TextChoices):
    Open = "Open"
    Closed = "Closed"
    Completed = "Completed"
    Archived = "Archived"

class Marketplace(models.Model):
    Creator = models.ForeignKey(User, on_delete=models.CASCADE)
    Name = models.CharField(max_length=100)
    date = models.DateTimeField(default=timezone.now)
    Status = models.CharField(max_length=9, choices=EventStatus.choices, default=EventStatus.Open)

    def __str__(self):
        return self.Speaking_Event_Name

    def status(self):
        return EventStatus.Completed if timezone.now() > self.date else self.Status

I tried creating a function for it, and it does not seem to work. I am unsure if I am in the correct path or not and I have been stuck for a week.


问:
ffmpeg doesn't write file in docker
Goal - Generate video file from PNGs.

```<code>command: ffmpeg
args: [
  "-nostdin",
  "-v",
  "error",
  "-stats",
  "-hide_banner",
  "-y",
  "-f",
  "lavfi",
  "-i",
  "color=c=black:size=1080x1350",
  "-f",
  "image2pipe",
  "-c:v",
  "png",
  "-r",
  "25",
  "-i",
  "-",
  "-filter_complex",
  "[0:v][1:v]overlay[o];[o]scale=1080:-2:flags=bicubic[out]",
  "-map",
  "[out]",
  "-c:v",
  "libx264",
  "-profile:v",
  "main",
  "-preset",
  "medium",
  "-crf",
  "20",
  "-movflags",
  "faststart",
  "-pix_fmt",
  "yuv420p",
  "-r",
  "25",
  "-frames:v",
  "175",
  "/Users/tk/projects/lottie-to-mp4/files/xv-DIcVz0rYPZjXalgrnzmkPbqHLe9_generated.mp4"
]
</code>```

Works in local machine (MAC)
Doesn't work in docker.

After ffmpeg finishes I make a log

```<code>fs.statSync(videoFilePath).size
</code>```

In local the log gives 3286531, but in docker it's alway 48.

I create path to video like this:

```<code>const relevantPath = "../../files";
const videoFilePath = path.resolve(__dirname, relevantPath, `${ generatedFileName }_generated.mp4`);
</code>```

Title: ffmpeg doesn't write file in docker

Body:
Goal - Generate video file from PNGs.

command: ffmpeg
args: [
  "-nostdin",
  "-v",
  "error",
  "-stats",
  "-hide_banner",
  "-y",
  "-f",
  "lavfi",
  "-i",
  "color=c=black:size=1080x1350",
  "-f",
  "image2pipe",
  "-c:v",
  "png",
  "-r",
  "25",
  "-i",
  "-",
  "-filter_complex",
  "[0:v][1:v]overlay[o];[o]scale=1080:-2:flags=bicubic[out]",
  "-map",
  "[out]",
  "-c:v",
  "libx264",
  "-profile:v",
  "main",
  "-preset",
  "medium",
  "-crf",
  "20",
  "-movflags",
  "faststart",
  "-pix_fmt",
  "yuv420p",
  "-r",
  "25",
  "-frames:v",
  "175",
  "/Users/tk/projects/lottie-to-mp4/files/xv-DIcVz0rYPZjXalgrnzmkPbqHLe9_generated.mp4"
]

Works in local machine (MAC)
Doesn't work in docker.

After ffmpeg finishes I make a log

fs.statSync(videoFilePath).size

In local the log gives 3286531, but in docker it's alway 48.

I create path to video like this:

const relevantPath = "../../files";
const videoFilePath = path.resolve(__dirname, relevantPath, `${ generatedFileName }_generated.mp4`);


问:
Passing data between different components. vue 3.2
I am trying to refresh component data from another component.

I have components folder and Pages folder where I use this components.

component A

component B

component C

In component A I send post qvuery.

```<code>
<script setup>

import {ref} from "vue";

let props = defineProps({
    param: Array,
});

function sendPost(){
axios.post('url',{param}).then(function (response) {
    if (response.data.success) {

/*response data send to component B*/

    } else {
        //show warning
    }
}).catch(function (error){

})
}
</script>
</code>```

Then I want to send data from response to component B. What I need to do please to achieve it ? I want dynamicaly refresh component B without page reload.

I try to use defineEmits, but it dose not help.

Component 1.

```<code><template>
    <MainLayout title="Access Groups" :sidebar="true">
        <main class="main main-p">
            <div class="main-content">
                <div class="main-head">
                    <ul class="breadcrumbs">
                        <li class="breadcrumbs-item">
                            <a href="#" class="breadcrumbs-link">
                                <i class="ico-home"></i>
                            </a>
                        </li>
                        <li class="breadcrumbs-item">
                            <a href="#" class="breadcrumbs-link">Settings</a>
                        </li>
                        <li class="breadcrumbs-item">
                            <a href="#" class="breadcrumbs-link">Assets groups</a>
                        </li>
                    </ul>
                    <h1 class="main-head__title">Access Groups</h1>
                </div>
                <div class="main-actions">
                    <div class="main-actions__wrap">
                        <div class="main-actions__btns">
                            <a href="#modalCreateAccessNewGroup" class="btn btn-bordered" data-toggle="modal">
                                <i class="ico-plus"></i>
                                Create group
                            </a>
                            <button class="btn btn-light">
                                Delete
                                <i class="ico-delete"></i>
                            </button>
                        </div>
                    </div>
                </div>
                <div class="main-body">
                    <div class="table">
                        <div class="table-head">
                            <div class="table-head__wrap">
                                <div class="table-head__item table-head__item-checkbox">
                                    <div class="checkbox">
                                        <input type="checkbox" class="checkbox-input" id="checkboxGroupNameAll">
                                        <label for="checkboxGroupNameAll" class="checkbox-label"></label>
                                    </div>
                                </div>
                                <div class="table-head__item">Group name</div>
                                <div class="table-head__item table-head__item-btn"></div>
                                <div class="table-head__item table-head__item-btn"></div>
                            </div>
                        </div>
                        <div class="table-body">
                            <div class="table-body__wrap">
                                <AccessGroup :access_groups="access_groups" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </MainLayout>
    <CreateNewAccessGroupModal :permissions_param="permissions_param" />
</template>
</code>```

Component 2.

```<code><template>
    <div class="modal fade" id="modalCreateAccessNewGroup" tabindex="-1" role="dialog" aria-labelledby="modalCreateNewGroup" aria-hidden="true" data-backdrop="static">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h3 class="modal-title">Create new group</h3>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <i class="ico-close"></i>
                    </button>
                </div>

                <form @submit.prevent="createNewAccessGroup">
                    <div class="modal-body">
                        <div class="modal-box">
                            <div class="modal-hold">
                                <div class="input">
                                    <label class="input-label">Group name:</label>
                                    <div class="input-box">
                                        <input v-model="group_name" type="text" class="input-field">
                                        <span class="invalid-feedback">Required field</span>
                                    </div>
                                </div>
                                <div class="input">
                                    <label class="input-label">Description:</label>
                                    <div class="input-box">
                                        <input v-model="description" type="text" class="input-field">
                                        <span class="invalid-feedback">Required field</span>
                                    </div>
                                </div>
                            </div>
                            <div class="attribute">
                                <div class="attribute-head">Permissions</div>
                                <div v-for="(permission, index) in permissions_param" :key="index" class="attribute-body">
                                    <div class="attribute-row">
                                        <div class="checkbox">
                                            <input v-model="permissions" :value="index" type="checkbox" class="checkbox-input" :id="index">
                                            <label :for="index" class="checkbox-label"></label>
                                        </div>
                                        {{permission.label}}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer modal-footer__end">
                        <div class="modal-text">
                            By clicking save button API key for the group will be generated
                        </div>
                        <button id="close" class="btn btn-m-secondary" data-dismiss="modal">Cancel</button>
                        <button class="btn btn-m-primary">Save Changes</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

</template>
</code>```

Component 3

```<code><template>
    <div v-for="(access_group, index) in access_groups" :key="index" class="table-row">
        <div class="table-row__item table-row__item-checkbox">
            <div class="checkbox">
                <input type="checkbox" class="checkbox-input" id="checkboxGroupName1">
                <label for="checkboxGroupName1" class="checkbox-label"></label>
            </div>
        </div>
        <div class="table-row__item">
            <span class="table-row__item-box">{{access_group.group_name}}</span>
        </div>

        <div class="table-row__item table-row__item-btn">
            <a href="#modalViewUsers" class="btn btn-m-secondary"
               data-toggle="modal">Users</a>
        </div>
        <div class="table-row__item table-row__item-btn">
            <a href="#modalEditAccessGroup" class="btn btn-m-secondary" data-toggle="modal">
                Details
                <i class="ico-edit"></i>
            </a>
        </div>
    </div>
    <EditAccessGroupModal/>
    <ViewAccessGroupUsersModal/>
</template>
</code>```

Body:
I am trying to refresh component data from another component.

I have components folder and Pages folder where I use this components.

component A

component B

component C

In component A I send post qvuery.

Then I want to send data from response to component B. What I need to do please to achieve it ? I want dynamicaly refresh component B without page reload.

I try to use defineEmits, but it dose not help.

Component 1.

<template>
    <MainLayout title="Access Groups" :sidebar="true">

                            Settings

                            Assets groups

Access Groups

                                Create group

                            <button class="btn btn-light">
                                Delete

                            </button>

                                        <input type="checkbox" class="checkbox-input" id="checkboxGroupNameAll">

Group name

                                <AccessGroup :access_groups="access_groups" />

    </MainLayout>
    <CreateNewAccessGroupModal :permissions_param="permissions_param" />
</template>

Component 2.

<template>

Create new group

                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">

                    </button>

                <form @submit.prevent="createNewAccessGroup">

                                    Group name:

                                        <input v-model="group_name" type="text" class="input-field">
                                        Required field

                                    Description:

                                        <input v-model="description" type="text" class="input-field">
                                        Required field

Permissions

                                            <input v-model="permissions" :value="index" type="checkbox" class="checkbox-input" :id="index">

                                        {{permission.label}}

                            By clicking save button API key for the group will be generated

                        <button id="close" class="btn btn-m-secondary" data-dismiss="modal">Cancel</button>
                        <button class="btn btn-m-primary">Save Changes</button>

                </form>

</template>

Component 3

<template>

                <input type="checkbox" class="checkbox-input" id="checkboxGroupName1">

            {{access_group.group_name}}

            Users

                Details

    <EditAccessGroupModal/>
    <ViewAccessGroupUsersModal/>
</template>


问:
Existing Port running on starting Postgres App(MacOS)
After restart/shutdown, my postgres App is saying that i'm already running on 5432 port, i am manually quitting those processes in Activity monitor and then starting postgres! How should i permanently shutdown that 5432 port and after shutdown or restart i should skip killing those processes in activity monitor and start over.

I tried manually executing commands and killing those processes everytime..another server is using 5432 port


问:
How to access spartacus cdc gigya data?
I am using Spartacus 4.3.

I apologize if this is a stupid question as I'm still quite new to Spartacus and SAP.

I've set up gigya SAP Customer Data Cloud Integration as described here https://sap.github.io/spartacus-docs/cdc-integration/.

The service is using accounts.getAccountInfo REST as I can see the request being made in my Network tab.

I need to access the data object from the request response, which I cannot find in any Spartacus service.

My problem is that I cannot find where the request is being made from, and I cannot access the data object.

I've tried creating an adapter to make another request, but I am getting a 403 error. I don't think this would be a good solution anyways.

I've also tried using the gigya object on the window to call `window.gigya.accounts.getAccountInfo()`. This function makes a request to the endpoint, but does not return it's response. I also don't think it's a great solution either, since it makes a new request.

Any help would be really appreciated as I've been really stuck with this one...

Title: How to access spartacus cdc gigya data?


问:
ld creates elf segments with wrong permissions
I'm writing a bare-metal aarch64 program (toolchain aarch64-unknown-elf-) which I'm building using the following linker script:

```<code>SECTIONS {
    .text :  {
        *(.text*)
    }

    .rodata ALIGN(CONSTANT(COMMONPAGESIZE)) :  {
        *(.rodata*)
    }

    .data ALIGN(CONSTANT(COMMONPAGESIZE)) : {
        *(.data .data.*)
    }

    .bss (NOLOAD) :  {
        __bss_start = .;
        *(.bss*)
        *(COMMON)
        __bss_end = .;
    }
}
</code>```

Using readelf to analyze the final executable I get the following sections and segments (i.e. program headers):

```<code>There are 19 section headers, starting at offset 0xa4f58:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        0000000000000000 010000 00f600 00  AX  0   0 2048
  [ 2] .rodata           PROGBITS        0000000000010000 020000 0079f9 00   A  0   0 4096
  [ 3] .data             PROGBITS        0000000000018000 028000 001160 00  WA  0   0  8
  [ 4] .bss              NOBITS          0000000000019160 029160 002320 00  WA  0   0  8
  [ 5] .debug_info       PROGBITS        0000000000000000 029160 02d080 00      0   0  1
  [ 6] .debug_abbrev     PROGBITS        0000000000000000 0561e0 009f28 00      0   0  1
  [ 7] .debug_loclists   PROGBITS        0000000000000000 060108 016841 00      0   0  1
  [ 8] .debug_aranges    PROGBITS        0000000000000000 076950 0013c0 00      0   0 16
  [ 9] .debug_macro      PROGBITS        0000000000000000 077d10 003b67 00      0   0  1
  [10] .debug_line       PROGBITS        0000000000000000 07b877 00f6be 00      0   0  1
  [11] .debug_str        PROGBITS        0000000000000000 08af35 00eaeb 01  MS  0   0  1
  [12] .debug_line_str   PROGBITS        0000000000000000 099a20 0027db 01  MS  0   0  1
  [13] .comment          PROGBITS        0000000000000000 09c1fb 000057 01  MS  0   0  1
  [14] .debug_frame      PROGBITS        0000000000000000 09c258 002a40 00      0   0  8
  [15] .debug_rnglists   PROGBITS        0000000000000000 09ec98 0016a0 00      0   0  1
  [16] .symtab           SYMTAB          0000000000000000 0a0338 003a80 18     17 372  8
  [17] .strtab           STRTAB          0000000000000000 0a3db8 0010d5 00      0   0  1
  [18] .shstrtab         STRTAB          0000000000000000 0a4e8d 0000c7 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x0
There is 1 program header, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  LOAD           0x010000 0x0000000000000000 0x0000000000000000 0x019160 0x01b480 RWE 0x10000

 Section to Segment mapping:
  Segment Sections...
   00     .text .rodata .data .bss
</code>```

My issue here is that the linker is merging sections with different permissions in a single segment with all permissions, even when I'm guaranteeing that the data sections are in a separate pages (by aligning them accordingly).

I experimented with different sizes for the alignment of the data section using hugepages (of 2MiB). Here I already get three segments with the correct permissions:

```<code>There are 19 section headers, starting at offset 0xacf58:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        0000000000000000 010000 00f600 00  AX  0   0 2048
  [ 2] .rodata           PROGBITS        0000000000200000 020000 0079f9 00   A  0   0 4096
  [ 3] .data             PROGBITS        0000000000400000 030000 001160 00  WA  0   0  8
  [ 4] .bss              NOBITS          0000000000401160 031160 002320 00  WA  0   0  8
  [ 5] .debug_info       PROGBITS        0000000000000000 031160 02d080 00      0   0  1
  [ 6] .debug_abbrev     PROGBITS        0000000000000000 05e1e0 009f28 00      0   0  1
  [ 7] .debug_loclists   PROGBITS        0000000000000000 068108 016841 00      0   0  1
  [ 8] .debug_aranges    PROGBITS        0000000000000000 07e950 0013c0 00      0   0 16
  [ 9] .debug_macro      PROGBITS        0000000000000000 07fd10 003b67 00      0   0  1
  [10] .debug_line       PROGBITS        0000000000000000 083877 00f6be 00      0   0  1
  [11] .debug_str        PROGBITS        0000000000000000 092f35 00eaeb 01  MS  0   0  1
  [12] .debug_line_str   PROGBITS        0000000000000000 0a1a20 0027db 01  MS  0   0  1
  [13] .comment          PROGBITS        0000000000000000 0a41fb 000057 01  MS  0   0  1
  [14] .debug_frame      PROGBITS        0000000000000000 0a4258 002a40 00      0   0  8
  [15] .debug_rnglists   PROGBITS        0000000000000000 0a6c98 0016a0 00      0   0  1
  [16] .symtab           SYMTAB          0000000000000000 0a8338 003a80 18     17 372  8
  [17] .strtab           STRTAB          0000000000000000 0abdb8 0010d5 00      0   0  1
  [18] .shstrtab         STRTAB          0000000000000000 0ace8d 0000c7 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x0
There are 3 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  LOAD           0x010000 0x0000000000000000 0x0000000000000000 0x00f600 0x00f600 R E 0x10000
  LOAD           0x020000 0x0000000000200000 0x0000000000200000 0x0079f9 0x0079f9 R   0x10000
  LOAD           0x030000 0x0000000000400000 0x0000000000400000 0x001160 0x003480 RW  0x10000

 Section to Segment mapping:
  Segment Sections...
   00     .text
   01     .rodata
   02     .data .bss
</code>```

My main question would be what are the rules or heuristics for ld to decide when to create a different section? My thinking was granularity of protection (i.e. page size) and permissions, but maybe I'm wrong. I've tried to dig a bit through the code, but it goes a bit over my head. Don't loaders use the segment information to load and set permissions? If so, this could result in setting the wrong permissions (in page tables or whatever).

Body:
I'm writing a bare-metal aarch64 program (toolchain aarch64-unknown-elf-) which I'm building using the following linker script:

SECTIONS {
    .text :  {
        *(.text*)
    }

    .rodata ALIGN(CONSTANT(COMMONPAGESIZE)) :  {
        *(.rodata*)
    }

    .data ALIGN(CONSTANT(COMMONPAGESIZE)) : {
        *(.data .data.*)
    }

    .bss (NOLOAD) :  {
        __bss_start = .;
        *(.bss*)
        *(COMMON)
        __bss_end = .;
    }
}

Using readelf to analyze the final executable I get the following sections and segments (i.e. program headers):

There are 19 section headers, starting at offset 0xa4f58:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        0000000000000000 010000 00f600 00  AX  0   0 2048
  [ 2] .rodata           PROGBITS        0000000000010000 020000 0079f9 00   A  0   0 4096
  [ 3] .data             PROGBITS        0000000000018000 028000 001160 00  WA  0   0  8
  [ 4] .bss              NOBITS          0000000000019160 029160 002320 00  WA  0   0  8
  [ 5] .debug_info       PROGBITS        0000000000000000 029160 02d080 00      0   0  1
  [ 6] .debug_abbrev     PROGBITS        0000000000000000 0561e0 009f28 00      0   0  1
  [ 7] .debug_loclists   PROGBITS        0000000000000000 060108 016841 00      0   0  1
  [ 8] .debug_aranges    PROGBITS        0000000000000000 076950 0013c0 00      0   0 16
  [ 9] .debug_macro      PROGBITS        0000000000000000 077d10 003b67 00      0   0  1
  [10] .debug_line       PROGBITS        0000000000000000 07b877 00f6be 00      0   0  1
  [11] .debug_str        PROGBITS        0000000000000000 08af35 00eaeb 01  MS  0   0  1
  [12] .debug_line_str   PROGBITS        0000000000000000 099a20 0027db 01  MS  0   0  1
  [13] .comment          PROGBITS        0000000000000000 09c1fb 000057 01  MS  0   0  1
  [14] .debug_frame      PROGBITS        0000000000000000 09c258 002a40 00      0   0  8
  [15] .debug_rnglists   PROGBITS        0000000000000000 09ec98 0016a0 00      0   0  1
  [16] .symtab           SYMTAB          0000000000000000 0a0338 003a80 18     17 372  8
  [17] .strtab           STRTAB          0000000000000000 0a3db8 0010d5 00      0   0  1
  [18] .shstrtab         STRTAB          0000000000000000 0a4e8d 0000c7 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x0
There is 1 program header, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  LOAD           0x010000 0x0000000000000000 0x0000000000000000 0x019160 0x01b480 RWE 0x10000

 Section to Segment mapping:
  Segment Sections...
   00     .text .rodata .data .bss

My issue here is that the linker is merging sections with different permissions in a single segment with all permissions, even when I'm guaranteeing that the data sections are in a separate pages (by aligning them accordingly).

I experimented with different sizes for the alignment of the data section using hugepages (of 2MiB). Here I already get three segments with the correct permissions:

There are 19 section headers, starting at offset 0xacf58:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        0000000000000000 010000 00f600 00  AX  0   0 2048
  [ 2] .rodata           PROGBITS        0000000000200000 020000 0079f9 00   A  0   0 4096
  [ 3] .data             PROGBITS        0000000000400000 030000 001160 00  WA  0   0  8
  [ 4] .bss              NOBITS          0000000000401160 031160 002320 00  WA  0   0  8
  [ 5] .debug_info       PROGBITS        0000000000000000 031160 02d080 00      0   0  1
  [ 6] .debug_abbrev     PROGBITS        0000000000000000 05e1e0 009f28 00      0   0  1
  [ 7] .debug_loclists   PROGBITS        0000000000000000 068108 016841 00      0   0  1
  [ 8] .debug_aranges    PROGBITS        0000000000000000 07e950 0013c0 00      0   0 16
  [ 9] .debug_macro      PROGBITS        0000000000000000 07fd10 003b67 00      0   0  1
  [10] .debug_line       PROGBITS        0000000000000000 083877 00f6be 00      0   0  1
  [11] .debug_str        PROGBITS        0000000000000000 092f35 00eaeb 01  MS  0   0  1
  [12] .debug_line_str   PROGBITS        0000000000000000 0a1a20 0027db 01  MS  0   0  1
  [13] .comment          PROGBITS        0000000000000000 0a41fb 000057 01  MS  0   0  1
  [14] .debug_frame      PROGBITS        0000000000000000 0a4258 002a40 00      0   0  8
  [15] .debug_rnglists   PROGBITS        0000000000000000 0a6c98 0016a0 00      0   0  1
  [16] .symtab           SYMTAB          0000000000000000 0a8338 003a80 18     17 372  8
  [17] .strtab           STRTAB          0000000000000000 0abdb8 0010d5 00      0   0  1
  [18] .shstrtab         STRTAB          0000000000000000 0ace8d 0000c7 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x0
There are 3 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  LOAD           0x010000 0x0000000000000000 0x0000000000000000 0x00f600 0x00f600 R E 0x10000
  LOAD           0x020000 0x0000000000200000 0x0000000000200000 0x0079f9 0x0079f9 R   0x10000
  LOAD           0x030000 0x0000000000400000 0x0000000000400000 0x001160 0x003480 RW  0x10000

 Section to Segment mapping:
  Segment Sections...
   00     .text
   01     .rodata
   02     .data .bss

My main question would be what are the rules or heuristics for ld to decide when to create a different section? My thinking was granularity of protection (i.e. page size) and permissions, but maybe I'm wrong. I've tried to dig a bit through the code, but it goes a bit over my head. Don't loaders use the segment information to load and set permissions? If so, this could result in setting the wrong permissions (in page tables or whatever).


问:
Mkey state activate via WinTitle?
I’m using Logitech G13 & G510s, each device have M1-M2-M3 banks, and I want set auto activation each bank to specific WinTitle.

Solution1: I’m thinking of using AHK to monitor WinTitle, and send MKey state to LGS.
But I’m. It sure is it possible.

Solution2: use LGS script to monitor WinTitle - also, if it possible
Any ideas would be appreciated

I'm newbie to LGS scripting, so just starting discover it

Title: Mkey state activate via WinTitle?


问:
Install homebrew manually m1 macos
I use macos Monterey 12.5 with M1 processor.

Due to some reasons - proxy,blocked: "raw.githubusercontent.com/Homebrew/i"  -I try install manually homebrew from terminal

by the commands

1)

```<code>su <MyAdminUser>
</code>```

, password prompt comes and login is successfully

2)
<MyAdminUser>@<latopdevicenumber % NONINTERACTIVE=1 /bin/bash -k /Users//install.sh
--> source from https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh.

The error output is:

declare -x USER=""
==> Checking for sudo access (which may request your password)...
Need sudo access on macOS (e.g. the user MyAdminUser needs to be an Administrator)!

1)
I added the settings from: Homebrew install - sudo? for

```<code># root and users in group wheel can run anything on any machine as any user
root            ALL = (ALL) ALL
%admin          ALL = (ALL) NOPASSWD: ALL
<MyAdminUser>        ALL = (ALL) ALL
..
#includedir /private/etc/sudoers.d
</code>```

So it should work, as I understand.

With the root user, the same error appears.

Do you have any ideas ?

Thanks in advance.

Title: Install homebrew manually m1 macos

Body:
I use macos Monterey 12.5 with M1 processor.

Due to some reasons - proxy,blocked: "raw.githubusercontent.com/Homebrew/i"  -I try install manually homebrew from terminal

by the commands

1)

su <MyAdminUser>

, password prompt comes and login is successfully

2)
<MyAdminUser>@<latopdevicenumber % NONINTERACTIVE=1 /bin/bash -k /Users//install.sh
--> source from https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh.

The error output is:

declare -x USER=""
==> Checking for sudo access (which may request your password)...
Need sudo access on macOS (e.g. the user MyAdminUser needs to be an Administrator)!

1)
I added the settings from: Homebrew install - sudo? for

# root and users in group wheel can run anything on any machine as any user
root            ALL = (ALL) ALL
%admin          ALL = (ALL) NOPASSWD: ALL
<MyAdminUser>        ALL = (ALL) ALL
..
#includedir /private/etc/sudoers.d

So it should work, as I understand.

With the root user, the same error appears.

Do you have any ideas ?

Thanks in advance.


问:
C# TCP client Socket talk to specific client
I am trying to understand how I can interact with a specific client from server side.

```<code>private void StartListen()
        {
            //Creating a TCP Connection and listening to the port
            tcpListener = new TcpListener(System.Net.IPAddress.Any, 6666);
            tcpListener.Start();
            toolStripStatusLabel1.Text = "Listening on port 6666 ...";
            int counter = 0;
            appStatus = 0;

            while (true)
            {
                try
                {
                    client = tcpListener.AcceptTcpClient();
                    counter++;
                    clientList.Add(client);
                    IPEndPoint ipend = (IPEndPoint)client.Client.RemoteEndPoint;
                    //Updating status of connection
                    toolStripStatusLabel1.Text = "Connected from " + IPAddress.Parse(ipend.Address.ToString());
                    appStatus = 1;
                    Debug.WriteLine("list of clients"+clientList);

                    th_outPutStream = new Thread(delegate () { outPutStream(client); });
                    th_outPutStream.Start();
                    th_inPutStream = new Thread(delegate () { inPutStream(client); });
                    th_inPutStream.Start();
                    th_checkConnection = new Thread(checkConnection);
                    th_checkConnection.Start();
                }
                catch (Exception err)
                {
                    {
                        Cleanup();
                    }
                }
            }
        }
</code>```

From the above query, when a client connects to a server, i store it in the following list List<TcpClient> clientList = new List<TcpClient>(); like so clientList.Add(client);

My question is, if in the example that I am connected to two clients, but want to send a message to only the second client, how can I do so?

Could I apply the following thread-safe List<T> to apply new clients to the list?

```<code>clientList.AsParallel().ForAll(item => clientList.Add(client));
</code>```

Or would locking be required?

Body:
I am trying to understand how I can interact with a specific client from server side.

private void StartListen()
        {
            //Creating a TCP Connection and listening to the port
            tcpListener = new TcpListener(System.Net.IPAddress.Any, 6666);
            tcpListener.Start();
            toolStripStatusLabel1.Text = "Listening on port 6666 ...";
            int counter = 0;
            appStatus = 0;

            while (true)
            {
                try
                {
                    client = tcpListener.AcceptTcpClient();
                    counter++;
                    clientList.Add(client);
                    IPEndPoint ipend = (IPEndPoint)client.Client.RemoteEndPoint;
                    //Updating status of connection
                    toolStripStatusLabel1.Text = "Connected from " + IPAddress.Parse(ipend.Address.ToString());
                    appStatus = 1;
                    Debug.WriteLine("list of clients"+clientList);

                    th_outPutStream = new Thread(delegate () { outPutStream(client); });
                    th_outPutStream.Start();
                    th_inPutStream = new Thread(delegate () { inPutStream(client); });
                    th_inPutStream.Start();
                    th_checkConnection = new Thread(checkConnection);
                    th_checkConnection.Start();
                }
                catch (Exception err)
                {
                    {
                        Cleanup();
                    }
                }
            }
        }

From the above query, when a client connects to a server, i store it in the following list List<TcpClient> clientList = new List<TcpClient>(); like so clientList.Add(client);

My question is, if in the example that I am connected to two clients, but want to send a message to only the second client, how can I do so?

Could I apply the following thread-safe List<T> to apply new clients to the list?

clientList.AsParallel().ForAll(item => clientList.Add(client));

Or would locking be required?


问:
compare string and find result with string replace not working
I am trying to compare two strings in PHP. But I don't know why it is not working.

```<code>    <?php
$string1="what is the highest peak in the world";
$string2="The highest peak of World is";
$find_ans=1;
compare_string($string1,$string2,$find_ans);

function compare_string($str1,$str2,$find_ans)
{
    $str1=strtolower($str1);
    $str2=strtolower($str2);
    $skip_word="a,an,the,what,when,where,who,whom,which,whose,why,how,are,am,is,was,were,has,have,had";
    $word_arr=explode(",",$skip_word);
    $new_str1=str_replace($word_arr,'',$str1);
    $new_str2=str_replace($word_arr,'',$str2);
    echo $new_str1.'<br/>';
    echo $new_str2.'<br/>';
    $sim = similar_text($new_str1, $new_str2, $perc);
    echo $perc.'<br/>';
}
?>
</code>```

The similar_text returned 70.769230769231 if I use resort, but it returned 83.333333333333 if I removed rsort. Here str_replace is not working.$new_str1 and $new_str2 print the same result as before.

UPDATE

I want to get results from $string1 and $string2 as "highest peak world" after doing str_replace.
But the problem is that if I change the strings as

```<code>$string1="what is the highest peak in india";
    $string2="The highest peak of india is";
</code>```

Then the result is "highest peak dia" But not "highest peak India".

It was my mistake:  $new_str1 and $new_str2 print the same result as before.

Body:
I am trying to compare two strings in PHP. But I don't know why it is not working.

    <?php
$string1="what is the highest peak in the world";
$string2="The highest peak of World is";
$find_ans=1;
compare_string($string1,$string2,$find_ans);

function compare_string($str1,$str2,$find_ans)
{
    $str1=strtolower($str1);
    $str2=strtolower($str2);
    $skip_word="a,an,the,what,when,where,who,whom,which,whose,why,how,are,am,is,was,were,has,have,had";
    $word_arr=explode(",",$skip_word);
    $new_str1=str_replace($word_arr,'',$str1);
    $new_str2=str_replace($word_arr,'',$str2);
    echo $new_str1.'
';
    echo $new_str2.'
';
    $sim = similar_text($new_str1, $new_str2, $perc);
    echo $perc.'
';
}
?>

The similar_text returned 70.769230769231 if I use resort, but it returned 83.333333333333 if I removed rsort. Here str_replace is not working.$new_str1 and $new_str2 print the same result as before.

UPDATE

I want to get results from $string1 and $string2 as "highest peak world" after doing str_replace.
But the problem is that if I change the strings as

$string1="what is the highest peak in india";
    $string2="The highest peak of india is";

Then the result is "highest peak dia" But not "highest peak India".

It was my mistake:  $new_str1 and $new_str2 print the same result as before.


问:
Plotting with Python Seaborn and Matplotlib

I have a problem with plotting this time series of the S&P500.

First I sorted the pandas DataFrame in ascending order by the date and then I used the Seaborn lineplot, which supposedly works fine with plotting time series. But in all examples I saw on the internet as well as in the documentation of seaborn this error did not occur. Here, as you can see, the y-axis is not consistent in that it is ascending as it goes up. I tried to fix/set the y-axis but then the plot vanished completely..

I am relatively new to plotting with seaborn and could't resolve the issue on my own. Maybe it is just a silly error I am doing but can anyone please help me setting the y axis right, I'd appreciate that! The y-Axis should start somewhere in the early 3000s and go up to 4000. How is that to be done?