问:
Azure Storage API GET table query not authenticating: Server failed to authenticate the request. Make sure the value of Authorization header is
I am writing some code (dotnet C#) to interface with the Azure storage API. I have successfully managed to get the Create Table functionality working with help from this post.

I am now trying to query the existence of a single table as highlighted in the Microsoft docs:

Query a single table

Here are my authorization signature and my http request:

```<code>**Signature:**

GET\n
\n
application/json\n
Thu, 08 Dec 2022 11:23:19 GMT\n
/MyStorageAccountName/Tables\n
/MyStorageAccountName/MyTableName\n

>Request Message:

Method:
  GET,
RequestUri:
  'https://MyStorageAccountName.table.core.windows.net/Tables('MyTableName')',
Version:
  1.1,
Content:
  <null>,
Headers:
  x-ms-date: Thu, 08 Dec 2022 11:23:19 GMT
  Accept: application/json; odata=nometadata
  x-ms-version: 2015-04-05
  Accept-Charset: UTF-8
  MaxDataServiceVersion: 3.0;NetFx
  DataServiceVersion: 1.0;NetFx
  Authorization: SharedKey MyStorageAccountName:XXXgzOBdHA65fVYYYa5pkjgxeayB/bSxZZZbwo=

------------------------------------------------------------------------------------------------
</code>```

However no matter what I try I always receive the following response:

StatusCode: Forbidden
Error: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

I have followed the Microsoft docs instruction on how to formulate the auth signature:
Table service (shared key authorization)

I have noted from other posts that the Content-MDS is optional but if included it must also be included in the content header:

```<code>  //request.Content.Headers.ContentMD5 = Convert.FromBase64String(CreateMD5(payload));
</code>```

As this is a GET request and I have no content I have left out the MD5 in the auth signature and just added a \n newline.

I have search for many hours and try tweaking the auth signature but the error remains the same.

Any advice would be very much appreciated as although the error is telling me that there is an issue with my authentication signature it is not giving me an indication of why and as far as I can see it looks correct.
Thanks in advance to all contributors.

```<code></code>```

Body:
I am writing some code (dotnet C#) to interface with the Azure storage API. I have successfully managed to get the Create Table functionality working with help from this post.

I am now trying to query the existence of a single table as highlighted in the Microsoft docs:

Query a single table

Here are my authorization signature and my http request:

**Signature:**

GET\n
\n
application/json\n
Thu, 08 Dec 2022 11:23:19 GMT\n
/MyStorageAccountName/Tables\n
/MyStorageAccountName/MyTableName\n

>Request Message:

Method:
  GET,
RequestUri:
  'https://MyStorageAccountName.table.core.windows.net/Tables('MyTableName')',
Version:
  1.1,
Content:
  <null>,
Headers:
  x-ms-date: Thu, 08 Dec 2022 11:23:19 GMT
  Accept: application/json; odata=nometadata
  x-ms-version: 2015-04-05
  Accept-Charset: UTF-8
  MaxDataServiceVersion: 3.0;NetFx
  DataServiceVersion: 1.0;NetFx
  Authorization: SharedKey MyStorageAccountName:XXXgzOBdHA65fVYYYa5pkjgxeayB/bSxZZZbwo=

------------------------------------------------------------------------------------------------

However no matter what I try I always receive the following response:

StatusCode: Forbidden
Error: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

I have followed the Microsoft docs instruction on how to formulate the auth signature:
Table service (shared key authorization)

I have noted from other posts that the Content-MDS is optional but if included it must also be included in the content header:

  //request.Content.Headers.ContentMD5 = Convert.FromBase64String(CreateMD5(payload));

As this is a GET request and I have no content I have left out the MD5 in the auth signature and just added a \n newline.

I have search for many hours and try tweaking the auth signature but the error remains the same.

Any advice would be very much appreciated as although the error is telling me that there is an issue with my authentication signature it is not giving me an indication of why and as far as I can see it looks correct.
Thanks in advance to all contributors.


来源: stackexchange

问:
Slow starting of Java app after adding GC parameters
since i want to take data from the GC of the JVM the following parameters were added in the custom_wrapper.conf

```<code>wrapper.java.additional.306=-Xlog:gc:utctime
wrapper.java.additional.307=-verbose:gc
wrapper.java.additional.308=-Xlog:gc*
wrapper.java.additional.309=-Xloggc:/opt/java/logs/gc-%t.log
wrapper.java.additional.310=-Xlog::::filecount=5,filesize=2M
</code>```

After adding those parameters the application is starting dramatically slow - around 20mins.
Before those paramaters normal start was around 2 mins.

Do i made some mistakes with adding the parameters or this is a normal behavior?

ContentLicense: CC BY-SA 4.0

Body:
since i want to take data from the GC of the JVM the following parameters were added in the custom_wrapper.conf

wrapper.java.additional.306=-Xlog:gc:utctime
wrapper.java.additional.307=-verbose:gc
wrapper.java.additional.308=-Xlog:gc*
wrapper.java.additional.309=-Xloggc:/opt/java/logs/gc-%t.log
wrapper.java.additional.310=-Xlog::::filecount=5,filesize=2M

After adding those parameters the application is starting dramatically slow - around 20mins.
Before those paramaters normal start was around 2 mins.

Do i made some mistakes with adding the parameters or this is a normal behavior?


问:
Not able to connect to AKS Cluster from GitLab
Please help me here, I am not able to login to AKS Cluster from GitLab.

I am getting the below error.

I have tried to connect to AKS Cluster, by creating GitLab Agent.

But still I am not able to login.


问:
How to include columns with strings in Pandas resample
I have daily data from capital trades and I would like to resample and get the weekly value of buys and sells for each stock
here is the data

I have tried

```<code>df = trades.set_index("Date")
# df.index = df.index - pd.tseries.frequencies.to_offset("7D")
df = df.resample("W").agg({"Value": sum}).reset_index()
df
</code>```

and

```<code>df = trades.set_index("Date")
# df.index = df.index - pd.tseries.frequencies.to_offset("7D")
df = df.resample("W").agg({"Value": sum, 'Ticker': '-'.join}).reset_index()
df
</code>```

but I cannot get the Ticker column correctly

Body:
I have daily data from capital trades and I would like to resample and get the weekly value of buys and sells for each stock
here is the data

I have tried

df = trades.set_index("Date")
# df.index = df.index - pd.tseries.frequencies.to_offset("7D")
df = df.resample("W").agg({"Value": sum}).reset_index()
df

and

df = trades.set_index("Date")
# df.index = df.index - pd.tseries.frequencies.to_offset("7D")
df = df.resample("W").agg({"Value": sum, 'Ticker': '-'.join}).reset_index()
df

but I cannot get the Ticker column correctly


问:
Adjust row height in KivyMD data table
How do I adjust the height of a row in a Data Table that is generated in KivyMD? Changing the font size doesn't do the trick.</p>

Title: Adjust row height in KivyMD data table


问:
How to have both Total record count and records returned in the same SQL query
I want to create a SQL query which will return both the total count from the table and max records; i.e. the sql will return only the maxrecords at a time like 20 records in one fetch and when user click on next page the table will display next 20 records.

I have the orderby in the end of the query, when I try to get total count I get only 20 records even when there are 1000 records in the table.

```<code>ORDER BY @TableSort
OFFSET @StartIndex ROWS FETCH NEXT @MaxRecords ROWS ONLY
</code>```

Can someone provide any suggestions on how to achieve this?

Body:
I want to create a SQL query which will return both the total count from the table and max records; i.e. the sql will return only the maxrecords at a time like 20 records in one fetch and when user click on next page the table will display next 20 records.

I have the orderby in the end of the query, when I try to get total count I get only 20 records even when there are 1000 records in the table.

ORDER BY @TableSort
OFFSET @StartIndex ROWS FETCH NEXT @MaxRecords ROWS ONLY

Can someone provide any suggestions on how to achieve this?


问:
Market Basket Analysis Association_rules - ValueError: cannot call `vectorize` on size 0 inputs unless `otypes` is set
I am currently running a market basket analysis on my dataset.

When I run my association_rules I get an error.

```<code>rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1)
rules.head()
</code>```
```<code>ValueError                                Traceback (most recent call last)
<ipython-input-47-60252dc62442> in <module>
----> 1 rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1)
      2 rules.head()

3 frames
/usr/local/lib/python3.8/dist-packages/numpy/lib/function_base.py in _get_ufunc_and_otypes(self, func, args)
   2195             args = [asarray(arg) for arg in args]
   2196             if builtins.any(arg.size == 0 for arg in args):
-> 2197                 raise ValueError('cannot call `vectorize` on size 0 inputs '
   2198                                  'unless `otypes` is set')
   2199

ValueError: cannot call `vectorize` on size 0 inputs unless `otypes` is set
</code>```

In my dataset their is alot of 0's, I am currently looking into this to see if it is effecting my results.

Body:
I am currently running a market basket analysis on my dataset.

When I run my association_rules I get an error.

rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1)
rules.head()

ValueError                                Traceback (most recent call last)
<ipython-input-47-60252dc62442> in <module>
----> 1 rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1)
      2 rules.head()

3 frames
/usr/local/lib/python3.8/dist-packages/numpy/lib/function_base.py in _get_ufunc_and_otypes(self, func, args)
   2195             args = [asarray(arg) for arg in args]
   2196             if builtins.any(arg.size == 0 for arg in args):
-> 2197                 raise ValueError('cannot call `vectorize` on size 0 inputs '
   2198                                  'unless `otypes` is set')
   2199

ValueError: cannot call `vectorize` on size 0 inputs unless `otypes` is set

In my dataset their is alot of 0's, I am currently looking into this to see if it is effecting my results.


问:
How to modify instance Volume Type of my Spot Fleet
I have a spot fleet request running with instance volume type as gp2 I need to change instance volume type to gp3 of my spot fleet so whenever a new instance comes up it would have gp3 instance volume type. can someone help how to do this

Thanks

I have tried modifying the spot fleet request but its only allowing to change the target capacity but there no options to change volume type


问:
Find max value in a cell with pandas
I have a dataframe with Pandas like this:

Dataframe

Now how can i find which day and which country have the most new covid case overall. Thanks

Country A -- 5309 case -- 12/12/2021
the answer should be like this

Title: Find max value in a cell with pandas


问:
What is the minimum Spring version where KafkaListenerContainers(any kind) are supported?
I recently had to add a Kafka consumer on a legacy app (sitting on Spring 3.2.5) and when I try to put in a CMLC config it doesn't recognize most of the classes.

My only solution was to run a thread that would poll for messages in an infinite loop and process messages. Can anybody tell me what is the minimum Spring version where a Listener implementation is supported or am I doing sth wrong?

EDIT: I do see that min compile dependency is Spring 4.2.6

https://mvnrepository.com/artifact/org.springframework.kafka/spring-kafka/1.0.0.RELEASE


问:
How do i get the gaps coloured Tkinter?
There are gaps around the labels

How do I fix this? Yes, I realize my code is very messy.

ttk.Label(frm, text="Monday:                ",background = '#408EC6',borderwidth=5,border=5).grid(column=0, row=0)
ttk.Label(frm, text="Tuesday:                ",background = '#408EC6').grid(column=1, row=0)
ttk.Label(frm, text="Wednesday:                ",background = '#408EC6').grid(column=2, row=0)
ttk.Label(frm, text="Thursday:                ",background = '#408EC6').grid(column=3, row=0)
ttk.Label(frm, text="Friday:                ",background = '#408EC6').grid(column=4, row=0)
ttk.Label(frm, text="Saturday:                ",background = '#408EC6').grid(column=5, row=0)
ttk.Label(frm, text="Sunday:                ",background = '#408EC6').grid(column=6, row=0)
ttk.Button(frm, text="Quit", command=weekList.destroy).grid(column=7, row=0)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=3)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=4)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=5)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=6)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=7)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=8)

ttk.Checkbutton(frm, text="", var=mondayChange).grid(column=0, row=12)
ttk.Checkbutton(frm, text="", var=tuesdayChange).grid(column=1, row=12)
ttk.Checkbutton(frm, text="", var=wednesdayChange).grid(column=2, row=12)
ttk.Checkbutton(frm, text="", var=thursdayChange).grid(column=3, row=12)
ttk.Checkbutton(frm, text="", var=fridayChange).grid(column=4, row=12)
ttk.Checkbutton(frm, text="", var=saturdayChange).grid(column=5, row=12)
ttk.Checkbutton(frm, text="", var=sundayChange).grid(column=6, row=12)
ttk.Button(frm, text="Change\nSelected\n   days", command=lambda:changeMeal(week)).grid(column=7, row=1)

ttk.Label(frm,text="Name of the meal:").grid(column=8,row=0)
ttk.Entry(frm,width=15,textvariable = mealName).grid(column=8,row=1)
ttk.Label(frm,text="How many\ningredients?").grid(column=8,row=2)
ttk.Spinbox(frm, from_=1, to=20,width=4,textvariable=spinValue).grid(column=8,row=3)
ttk.Button(frm, text="Add a meal", command=lambda:makeMeal(spinValue.get(),mealName.get())).grid(column=8,row=4)
```
<p>I tried using the background function in the label but that still leaves gaps.
Each one of the lines is a separate label except the name of the meal which is 2 lines.</p>
<pre class="lang-py prettyprint-override"><code>ttk.Label(frm, text="\n Ingredients:",background = '#408EC6').grid(column=I, row=2)
</code>```

Title: How do i get the gaps coloured Tkinter?

Body:
There are gaps around the labels

How do I fix this? Yes, I realize my code is very messy.

ttk.Label(frm, text="Monday:                ",background = '#408EC6',borderwidth=5,border=5).grid(column=0, row=0)
ttk.Label(frm, text="Tuesday:                ",background = '#408EC6').grid(column=1, row=0)
ttk.Label(frm, text="Wednesday:                ",background = '#408EC6').grid(column=2, row=0)
ttk.Label(frm, text="Thursday:                ",background = '#408EC6').grid(column=3, row=0)
ttk.Label(frm, text="Friday:                ",background = '#408EC6').grid(column=4, row=0)
ttk.Label(frm, text="Saturday:                ",background = '#408EC6').grid(column=5, row=0)
ttk.Label(frm, text="Sunday:                ",background = '#408EC6').grid(column=6, row=0)
ttk.Button(frm, text="Quit", command=weekList.destroy).grid(column=7, row=0)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=3)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=4)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=5)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=6)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=7)
ttk.Label(frm, text="             ",background = '#408EC6').grid(column=0, row=8)

ttk.Checkbutton(frm, text="", var=mondayChange).grid(column=0, row=12)
ttk.Checkbutton(frm, text="", var=tuesdayChange).grid(column=1, row=12)
ttk.Checkbutton(frm, text="", var=wednesdayChange).grid(column=2, row=12)
ttk.Checkbutton(frm, text="", var=thursdayChange).grid(column=3, row=12)
ttk.Checkbutton(frm, text="", var=fridayChange).grid(column=4, row=12)
ttk.Checkbutton(frm, text="", var=saturdayChange).grid(column=5, row=12)
ttk.Checkbutton(frm, text="", var=sundayChange).grid(column=6, row=12)
ttk.Button(frm, text="Change\nSelected\n   days", command=lambda:changeMeal(week)).grid(column=7, row=1)

ttk.Label(frm,text="Name of the meal:").grid(column=8,row=0)
ttk.Entry(frm,width=15,textvariable = mealName).grid(column=8,row=1)
ttk.Label(frm,text="How many\ningredients?").grid(column=8,row=2)
ttk.Spinbox(frm, from_=1, to=20,width=4,textvariable=spinValue).grid(column=8,row=3)
ttk.Button(frm, text="Add a meal", command=lambda:makeMeal(spinValue.get(),mealName.get())).grid(column=8,row=4)

I tried using the background function in the label but that still leaves gaps.
Each one of the lines is a separate label except the name of the meal which is 2 lines.

ttk.Label(frm, text="\n Ingredients:",background = '#408EC6').grid(column=I, row=2)


问:
Decentraland - API get Profile data request
I'm looking to read my profile details from decentraland profiles api.

Every time I entry to decentraland web game (https://play.decentraland.org) , I find new random avatar. (but I find my name)

So, when I entry to decentraland account/market page with the same address, I found that I'm connecting just as a guest and can't see my name or my bio (https://account.decentraland.org/).

The problem is because this api comes empty.

I check my avatar using this api
https://peer.decentral.io/lambdas//profiles/0x983d62d8a3d3502f40ec3102e8fa68006307c217

or this:

https://peer-ec1.decentraland.org/lambdas/profiles?id=0x983d62d8a3d3502f40ec3102e8fa68006307c217

result - I get this empty message:

What I tried

I'm sure that this is the right address

I tried to clear cache.

to change my browser (Chrome and  FireFox).

to create another account.

Tried to re-installing metamask

logging in the desktop application

but same issue!

What I expect to happen.

I'm expecting something like that:

For more details or screenshots, see this:

https://github.com/decentraland/issues/issues/571

Wallet => Metamask


问:
How to improve performance for group aggregation in mongoDB
We have a collection with 17 millions of documents with around 40 fields inside. I am grouping it by "State" and I want to have the average for latitude, longitude and count of document in each state.

```<code>db.collection.aggregate(
  [{$group:
    {_id:"$State",
      avgLat: {$avg: "$Latitude"},
      avgLon:{$avg: "$Longitude"},
      count: {$sum:1}}
    }
  ])
</code>```

That query takes around 40 seconds.
I am missing anything? The worst case scenario is that there won't be any filter upon the data, so no $match pipeline stage.
I've read that there is cap for aggregation with 100MB of ram. Is it possible that's the reason for slow computation of this query?
The version of mongoDB is: 6.0.2

I have added separate indexes for Latitude, Longitude and state, but that did not improved anything.
What can I change, maybe some configuration?
I am trying to have the time decreased to below 3 seconds, it is supposed to be in web API.

Body:
We have a collection with 17 millions of documents with around 40 fields inside. I am grouping it by "State" and I want to have the average for latitude, longitude and count of document in each state.

db.collection.aggregate(
  [{$group:
    {_id:"$State",
      avgLat: {$avg: "$Latitude"},
      avgLon:{$avg: "$Longitude"},
      count: {$sum:1}}
    }
  ])

That query takes around 40 seconds.
I am missing anything? The worst case scenario is that there won't be any filter upon the data, so no $match pipeline stage.
I've read that there is cap for aggregation with 100MB of ram. Is it possible that's the reason for slow computation of this query?
The version of mongoDB is: 6.0.2

I have added separate indexes for Latitude, Longitude and state, but that did not improved anything.
What can I change, maybe some configuration?
I am trying to have the time decreased to below 3 seconds, it is supposed to be in web API.


问:
Not able to view pdf in tkPDFViewer
To display pdf in tkinterviewer

I have tried to display pdf in tkinterViewer but it is throwing below exception

```<code>Exception in thread Thread-1:
Traceback (most recent call last):
   File "/home/shana/anaconda3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
     self.run()
   File "/home/shana/anaconda3/lib/python3.8/threading.py", line 870, in run
     self._target(*self._args, **self._kwargs)
   File "/home/shana/anaconda3/lib/python3.8/site-packages/tkPDFViewer/tkPDFViewer.py", line 46, in add_img
     pix = page.getPixmap()
 AttributeError: 'Page' object has no attribute 'getPixmap'
</code>```

To display pdf in tkinterViewer

Title: Not able to view pdf in tkPDFViewer

Body:
To display pdf in tkinterviewer

I have tried to display pdf in tkinterViewer but it is throwing below exception

Exception in thread Thread-1:
Traceback (most recent call last):
   File "/home/shana/anaconda3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
     self.run()
   File "/home/shana/anaconda3/lib/python3.8/threading.py", line 870, in run
     self._target(*self._args, **self._kwargs)
   File "/home/shana/anaconda3/lib/python3.8/site-packages/tkPDFViewer/tkPDFViewer.py", line 46, in add_img
     pix = page.getPixmap()
 AttributeError: 'Page' object has no attribute 'getPixmap'

To display pdf in tkinterViewer


问:
Visibility Detector flutter
I am using visibility detector in flutter to check for 100% visibility of a widget. But even when the widget is behind a fixed app bar the visibility detector considers it to be 100% visible. What is the solution for considering it to be visible only when its below navigation bar?</p>

Title: Visibility Detector flutter


问:
How to make three quivers perpendicular?
I have created three quivers that are supposed to be perpendicular, two of them should be in the plane of the circle and one perpendicular to the cirle. I've managed to make the latter, but cannot figure out how to make the green one perpendicular to the blue one and parallel to the plane of the circle. Any help? Here's the code:</p>
```<code>points = [x, y, z]
points = np.transpose(points)
n = len(points)

# Calculate the first and second derivative of the points
dX = np.apply_along_axis(np.gradient, axis=0, arr=points)
ddX = np.apply_along_axis(np.gradient, axis=0, arr=dX)

# Normalize all tangents
f = lambda m: m / np.linalg.norm(m)
T = np.apply_along_axis(f, axis=1, arr=dX)

# Calculate and normalize all binormals
B = np.cross(dX, ddX)
B = np.apply_along_axis(f, axis=1, arr=B)
# Calculate all normals
N = np.cross(B, T)

for t in range(len(theta)):
    fig = plt.figure('Parametrinai blynai')
    ax = fig.add_subplot(111, projection='3d')
    #ax.clear()
    ax.plot(x[1:t], y[1:t], z[1:t], '-r', linewidth=2)
    ax.azim = 0
    ax.dist = 10
    ax.elev = 25

    ax.set_xlabel('X', fontweight='bold', fontsize=14)
    ax.set_ylabel('Y', fontweight='bold', fontsize=14)
    ax.set_zlabel('Z', fontweight='bold', fontsize=14)
    ax.set_xlim([-20, 20])
    ax.set_ylim([-20, 20])
    ax.set_zlim([-20, 20])
    #plt.title('Parametrinis blynas', fontweight='bold', fontsize=16)

    #plotting the three quivers following the point

    ax.quiver(x[t], y[t], z[t], emp * T[t,0], emp * T[t,1], emp * T[t,2], color='r')#red
    ax.quiver(x[t], y[t], z[t], 1 * x1[t], 1 * y1[t], 1 * z1[t], color='b')#blue
    ax.quiver(x[t], y[t], z[t], 1 * N[t, 0], emp * N[t, 1], emp * N[t, 2], color='g')#green

    ax.quiver(0, 0, 5, 1*x1[t], 1*y1[t], 1*z1[t], color='k')#black
</code>```

Body:
I have created three quivers that are supposed to be perpendicular, two of them should be in the plane of the circle and one perpendicular to the cirle. I've managed to make the latter, but cannot figure out how to make the green one perpendicular to the blue one and parallel to the plane of the circle. Any help? Here's the code:

points = [x, y, z]
points = np.transpose(points)
n = len(points)

# Calculate the first and second derivative of the points
dX = np.apply_along_axis(np.gradient, axis=0, arr=points)
ddX = np.apply_along_axis(np.gradient, axis=0, arr=dX)

# Normalize all tangents
f = lambda m: m / np.linalg.norm(m)
T = np.apply_along_axis(f, axis=1, arr=dX)

# Calculate and normalize all binormals
B = np.cross(dX, ddX)
B = np.apply_along_axis(f, axis=1, arr=B)
# Calculate all normals
N = np.cross(B, T)

for t in range(len(theta)):
    fig = plt.figure('Parametrinai blynai')
    ax = fig.add_subplot(111, projection='3d')
    #ax.clear()
    ax.plot(x[1:t], y[1:t], z[1:t], '-r', linewidth=2)
    ax.azim = 0
    ax.dist = 10
    ax.elev = 25

    ax.set_xlabel('X', fontweight='bold', fontsize=14)
    ax.set_ylabel('Y', fontweight='bold', fontsize=14)
    ax.set_zlabel('Z', fontweight='bold', fontsize=14)
    ax.set_xlim([-20, 20])
    ax.set_ylim([-20, 20])
    ax.set_zlim([-20, 20])
    #plt.title('Parametrinis blynas', fontweight='bold', fontsize=16)

    #plotting the three quivers following the point

    ax.quiver(x[t], y[t], z[t], emp * T[t,0], emp * T[t,1], emp * T[t,2], color='r')#red
    ax.quiver(x[t], y[t], z[t], 1 * x1[t], 1 * y1[t], 1 * z1[t], color='b')#blue
    ax.quiver(x[t], y[t], z[t], 1 * N[t, 0], emp * N[t, 1], emp * N[t, 2], color='g')#green

    ax.quiver(0, 0, 5, 1*x1[t], 1*y1[t], 1*z1[t], color='k')#black


问:
matplotlib host_subplot() and artist.remove()
I am facing an annoying issue in combining host_subplot with artist.remove(). This code is an enormous simplification of the app I am porting to Python 3:

```<code>from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.figure import Figure
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA

import numpy as np

import wx

class CanvasFrame(wx.Frame):
    def __init__(self):
        super().__init__(None, -1, 'CanvasFrame', size=(550, 350))

        self.figure = Figure()
        self.axes = host_subplot(111, axes_class=AA.Axes, figure=self.figure)
        t = np.arange(0.0, 3.0, 0.01)
        s = np.sin(2 * np.pi * t)

        self.axes.plot(t, s)
        self.patch = self.axes.fill_between(t, 0, s/2.0, facecolor='r', edgecolor='r',
                                            alpha=0.2, linewidth=1.5, interpolate=True)
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.EXPAND)
        self.SetSizer(self.sizer)
        self.Fit()

        button = wx.Button(self, -1, 'Remove Collection')
        self.sizer.Add(button, 0)
        button.Bind(wx.EVT_BUTTON, self.OnRemoveCollection)

    def OnRemoveCollection(self, event):

        if self.patch is not None:
            self.patch.remove()
            del self.patch
            self.patch = None

            self.canvas.draw()

# Alternatively you could use:
class App(wx.App):
    def OnInit(self):
        """Create the main window and insert the custom frame."""
        frame = CanvasFrame()
        frame.Show(True)

        return True

if __name__ == "__main__":
    app = App()
    app.MainLoop()
</code>```

Shows a very simple plot embedded in wx. There is a button with the label “Remove Collection” at the bottom left of the window. Clicking on it - to try and remove the collection stored in the self.patch attribute from the axes - results in the following:

```<code>Traceback (most recent call last):
  File "C:\Users\J0514162\MyProjects\mpl_remove_collections.py", line 42, in OnRemoveCollection
    self.canvas.draw()
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\backends\backend_wxagg.py", line 29, in draw
    FigureCanvasAgg.draw(self)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\backends\backend_agg.py", line 436, in draw
    self.figure.draw(self.renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\artist.py", line 73, in draw_wrapper
    result = draw(artist, renderer, *args, **kwargs)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\figure.py", line 2810, in draw
    mimage._draw_list_compositing_images(
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\mpl_toolkits\axes_grid1\parasite_axes.py", line 212, in draw
    super().draw(renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\axes\_base.py", line 3082, in draw
    mimage._draw_list_compositing_images(
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\collections.py", line 990, in draw
    self.set_sizes(self._sizes, self.figure.dpi)
AttributeError: 'NoneType' object has no attribute 'dpi'
</code>```

Using a standard add_subplot() rather than host_subplot() works all right, but I really do need host_subplot()...

Could anyone please point to my mistake? This is on Windows 10 64 bit, Python 3.9.10, matplotlib 3.5.1.

Body:
I am facing an annoying issue in combining host_subplot with artist.remove(). This code is an enormous simplification of the app I am porting to Python 3:

from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.figure import Figure
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA

import numpy as np

import wx

class CanvasFrame(wx.Frame):
    def __init__(self):
        super().__init__(None, -1, 'CanvasFrame', size=(550, 350))

        self.figure = Figure()
        self.axes = host_subplot(111, axes_class=AA.Axes, figure=self.figure)
        t = np.arange(0.0, 3.0, 0.01)
        s = np.sin(2 * np.pi * t)

        self.axes.plot(t, s)
        self.patch = self.axes.fill_between(t, 0, s/2.0, facecolor='r', edgecolor='r',
                                            alpha=0.2, linewidth=1.5, interpolate=True)
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.EXPAND)
        self.SetSizer(self.sizer)
        self.Fit()

        button = wx.Button(self, -1, 'Remove Collection')
        self.sizer.Add(button, 0)
        button.Bind(wx.EVT_BUTTON, self.OnRemoveCollection)

    def OnRemoveCollection(self, event):

        if self.patch is not None:
            self.patch.remove()
            del self.patch
            self.patch = None

            self.canvas.draw()

# Alternatively you could use:
class App(wx.App):
    def OnInit(self):
        """Create the main window and insert the custom frame."""
        frame = CanvasFrame()
        frame.Show(True)

        return True

if __name__ == "__main__":
    app = App()
    app.MainLoop()

Shows a very simple plot embedded in wx. There is a button with the label “Remove Collection” at the bottom left of the window. Clicking on it - to try and remove the collection stored in the self.patch attribute from the axes - results in the following:

Traceback (most recent call last):
  File "C:\Users\J0514162\MyProjects\mpl_remove_collections.py", line 42, in OnRemoveCollection
    self.canvas.draw()
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\backends\backend_wxagg.py", line 29, in draw
    FigureCanvasAgg.draw(self)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\backends\backend_agg.py", line 436, in draw
    self.figure.draw(self.renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\artist.py", line 73, in draw_wrapper
    result = draw(artist, renderer, *args, **kwargs)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\figure.py", line 2810, in draw
    mimage._draw_list_compositing_images(
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\mpl_toolkits\axes_grid1\parasite_axes.py", line 212, in draw
    super().draw(renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\axes\_base.py", line 3082, in draw
    mimage._draw_list_compositing_images(
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images
    a.draw(renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "C:\Users\J0514162\WinPython39\WPy64-39100\python-3.9.10.amd64\lib\site-packages\matplotlib\collections.py", line 990, in draw
    self.set_sizes(self._sizes, self.figure.dpi)
AttributeError: 'NoneType' object has no attribute 'dpi'

Using a standard add_subplot() rather than host_subplot() works all right, but I really do need host_subplot()...

Could anyone please point to my mistake? This is on Windows 10 64 bit, Python 3.9.10, matplotlib 3.5.1.


问:
Get users birthday from Facebook Graph API
Let me start by saying I see other answered questions with this a similar title but nothing is working for me.

I'm trying to get the users Birthday from Facebooks API, I'm using expo-auth-session.
I can successfully get the users ID, email and name but nothing else.
Here is my code, what am I missing?

```<code>  const [request, response, promptAsync] = Facebook.useAuthRequest({
    // clientId: '2877415105738397',
    androidClientId: FacebookClientId,
    iosClientId: FacebookClientId,
    expoClientId: FacebookClientId,
    scopes: ['user_birthday '],
    redirectUri: makeRedirectUri({ useProxy: true })
  });
</code>```

Once I have the access_token

```<code>await axios.get(`https://graph.facebook.com/v15.0/me?fields=id,name,email,birthday&access_token=${token}`)
</code>```

But I only get the {"email": "email@gmail.com", "id": "123415656565", "name": "Name"}

I do have app review permissions

UPDATE, FULL COMPONENT BELOW

```<code>import * as React from 'react';
import { View } from 'react-native';
import * as AppAuth from 'expo-auth-session';
import { useAuthRequest } from 'expo-auth-session/build/providers/Facebook';
import { FacebookClientId } from '../config/constant';
import { TouchableOpacity } from 'react-native';
import { FacebookIcon } from '../assets/SvgIcons/FacebookIcon';
import { Styling } from '../assets/style/styling';
import { useEffect, useState } from 'react';
import { onSignupExternal } from '../store/user/user.action';
import { useNavigation } from '@react-navigation/core';
import { useDispatch, useSelector } from 'react-redux';

const useProxy = Platform.select({ web: false, default: true, 'android': true, 'ios': true });
const discovery = {
  authorizationEndpoint: 'https://www.facebook.com/v6.0/dialog/oauth',
  tokenEndpoint: 'https://graph.facebook.com/v6.0/oauth/access_token',
};

export const FaceBook = ({ setLoading }) => {
  const [userData, setUserData] = useState({})
  const navigation = useNavigation()
  const dispatch = useDispatch();
  const { user } = useSelector((storeState) => storeState.userModule);
  const clientId = FacebookClientId;
  const scopes = ['public_profile', 'email', 'user_birthday'];

  const [request, response, promptAsync] = useAuthRequest(
    {
      clientId,
      scopes,
      useProxy,
      redirectUri: AppAuth.makeRedirectUri({
        native: 'com.myapp.app:/',
        useProxy,
      }),
    },
    {useProxy: useProxy},
    discovery
  );

  async function handlePress() {
    try {
      const result = await promptAsync();
      if (result.type === 'success') {
        setLoading(true)
        getUserData(result.params.access_token)
      } else {
        // The user cancelled the login or an error occurred. You can inspect the result object for more details.
        console.log('Login failed :(', result);
      }
    } catch (e) {
      console.error(e);
    }
  }

  async function getUserData(token) {
    let response = await fetch(`https://graph.facebook.com/me?fields=id,name,email,birthday&access_token=${token}`);
    const userInfo = await response.json()
    console.log(userInfo)
    setUserData({
      user_email: userInfo.email,
      user_id: userInfo.id,
      user_full_name: userInfo.name,
      user_ref_id: null,
      auth_system: 'Facebook',
      user_dob: null
    })
  }

  useEffect(() => {
    const getUser = async () => {
      let updateUserData = userData
      // let ref_id = await utilService.convertMailToAsciiCode(userData.user_id)
      // updateUserData.user_ref_id = ref_id
      return Object.keys(userData).length !== 0 && dispatch(onSignupExternal(userData))
    };
    getUser()
  }, [userData])
  useEffect(() => {
    if (user !== null && user?.user_id !== undefined) {
      setLoading(false)
      return navigation.navigate("Dashboard")
    }
  }, [user])

  return (
    <TouchableOpacity style={Styling.facebookLoginBtn}
      onPress={handlePress}>
      <View style={Styling.googleIcon}><FacebookIcon /></View>
    </TouchableOpacity>

  )
}
</code>```

Body:
Let me start by saying I see other answered questions with this a similar title but nothing is working for me.

I'm trying to get the users Birthday from Facebooks API, I'm using expo-auth-session.
I can successfully get the users ID, email and name but nothing else.
Here is my code, what am I missing?

  const [request, response, promptAsync] = Facebook.useAuthRequest({
    // clientId: '2877415105738397',
    androidClientId: FacebookClientId,
    iosClientId: FacebookClientId,
    expoClientId: FacebookClientId,
    scopes: ['user_birthday '],
    redirectUri: makeRedirectUri({ useProxy: true })
  });

Once I have the access_token

await axios.get(`https://graph.facebook.com/v15.0/me?fields=id,name,email,birthday&access_token=${token}`)

But I only get the {"email": "email@gmail.com", "id": "123415656565", "name": "Name"}

I do have app review permissions

UPDATE, FULL COMPONENT BELOW

import * as React from 'react';
import { View } from 'react-native';
import * as AppAuth from 'expo-auth-session';
import { useAuthRequest } from 'expo-auth-session/build/providers/Facebook';
import { FacebookClientId } from '../config/constant';
import { TouchableOpacity } from 'react-native';
import { FacebookIcon } from '../assets/SvgIcons/FacebookIcon';
import { Styling } from '../assets/style/styling';
import { useEffect, useState } from 'react';
import { onSignupExternal } from '../store/user/user.action';
import { useNavigation } from '@react-navigation/core';
import { useDispatch, useSelector } from 'react-redux';

const useProxy = Platform.select({ web: false, default: true, 'android': true, 'ios': true });
const discovery = {
  authorizationEndpoint: 'https://www.facebook.com/v6.0/dialog/oauth',
  tokenEndpoint: 'https://graph.facebook.com/v6.0/oauth/access_token',
};

export const FaceBook = ({ setLoading }) => {
  const [userData, setUserData] = useState({})
  const navigation = useNavigation()
  const dispatch = useDispatch();
  const { user } = useSelector((storeState) => storeState.userModule);
  const clientId = FacebookClientId;
  const scopes = ['public_profile', 'email', 'user_birthday'];

  const [request, response, promptAsync] = useAuthRequest(
    {
      clientId,
      scopes,
      useProxy,
      redirectUri: AppAuth.makeRedirectUri({
        native: 'com.myapp.app:/',
        useProxy,
      }),
    },
    {useProxy: useProxy},
    discovery
  );

  async function handlePress() {
    try {
      const result = await promptAsync();
      if (result.type === 'success') {
        setLoading(true)
        getUserData(result.params.access_token)
      } else {
        // The user cancelled the login or an error occurred. You can inspect the result object for more details.
        console.log('Login failed :(', result);
      }
    } catch (e) {
      console.error(e);
    }
  }

  async function getUserData(token) {
    let response = await fetch(`https://graph.facebook.com/me?fields=id,name,email,birthday&access_token=${token}`);
    const userInfo = await response.json()
    console.log(userInfo)
    setUserData({
      user_email: userInfo.email,
      user_id: userInfo.id,
      user_full_name: userInfo.name,
      user_ref_id: null,
      auth_system: 'Facebook',
      user_dob: null
    })
  }

  useEffect(() => {
    const getUser = async () => {
      let updateUserData = userData
      // let ref_id = await utilService.convertMailToAsciiCode(userData.user_id)
      // updateUserData.user_ref_id = ref_id
      return Object.keys(userData).length !== 0 && dispatch(onSignupExternal(userData))
    };
    getUser()
  }, [userData])
  useEffect(() => {
    if (user !== null && user?.user_id !== undefined) {
      setLoading(false)
      return navigation.navigate("Dashboard")
    }
  }, [user])

  return (
    <TouchableOpacity style={Styling.facebookLoginBtn}
      onPress={handlePress}>
      <View style={Styling.googleIcon}><FacebookIcon /></View>
    </TouchableOpacity>

  )
}


问:
What does the Experimental Clients field count in Google Optimise A/B testing and how it could be replicated in BigQuery?
What does the Experimental Clients field count in Google Optimise A/B testing? and how it could be replicated in BigQuery?

I have an interesting challenge, we have ran an AB test in GA4 using Optimise on conversions, it shows the base is better than the variant,  When I run significance testing in BigQuery I get the opposite result.  This is because I have set BigQuery up to count EXPERIMENT IMPRESSIONS so the conversion rate is events to conversions and not Experimental Clients to conversions.

I am looking to put it into BigQuery so that I can include the results as part of a dashboard on page performance.

Thanks in advance for any help


问:
Multithreading in rust
I'm currently learning rust and want to make a scheduler as part of my learning process. I almost finish it but having problem when I want to run the task that I register in my scheduler as a background process, here's my code:

```<code>// An attribute to hide warnings for unused code.
#![allow(dead_code)]

use std::time::{Duration, SystemTime};
use std::thread;

#[derive(Debug)]
enum Unit {
    Seconds,
    Minutes,
    Hours
}

struct Scheduler {
    logger: String,
    jobs: Vec<Job>
}

struct Job {
    id: i32,
    name: String,
    every: u64,
    unit: Unit,
    task: Box<dyn Fn() -> () + Send + Sync>, // Box is used when we want to use heap reference instead of stack
    registered_at: SystemTime
}

impl Scheduler {
    fn new(logger: String) -> Self {
        Scheduler {
            logger: logger,
            jobs: Vec::<Job>::new(),
        }
    }

    fn add_job(&mut self, job: Job) {
        self.jobs.push(Job {
            id: job.id,
            name: job.name,
            every: job.every,
            unit: job.unit,
            task: Box::new(job.task),
            registered_at: job.registered_at
        });
    }

    fn get_jobs(&self) {
    }

    fn start(&self) {
        loop {
            for job in &self.jobs {
                std::thread::sleep(Duration::from_secs(1));
                Self::should_run(job)
            }
        }
    }

    fn should_run(job: &Job) {
        match job.registered_at.elapsed() {
            Ok(elapsed) => {
                if elapsed.as_secs()%job.every == 0 {
                    let j = job;
                    // Create a new thread and run the background function in it.
                    thread::spawn(move || {
                        // This closure will be run on a separate thread
                        // run the closure here
                        (j.task)()
                    });
                }
            }
            Err(e) => {
                // an error occurred!
                println!("Error: {e:?}");
            }
        };
    }
}

fn main() {
    let mut sch = Scheduler::new(String::from("logger"));

    sch.add_job(Job {
        id: 1,
        name: String::from("downloading report"),
        every: 1,
        unit: Unit::Seconds,
        task: Box::new(|| {
            // This is the first task. It will be executed every 1 seconds.
            println!("downloading...");
        }),
        registered_at: SystemTime::now()
    });

    sch.start();

}

</code>```

I got this error:

```<code>  --> src/main.rs:65:21
   |
59 |       fn should_run(job: &Job) {
   |                     ---  - let's call the lifetime of this reference `'1`
   |                     |
   |                     `job` is a reference that is only valid in the associated function body
...
65 | /                     thread::spawn(move || {
66 | |                         // This closure will be run on a separate thread
67 | |                         // run the closure here
68 | |                         (j.task)()
69 | |                     });
   | |                      ^
   | |                      |
   | |______________________`job` escapes the associated function body here
   |                        argument requires that `'1` must outlive `'static`
</code>```

I'm not sure what I'm missing here since I'm new to rust.

Thank you.

I'm expecting j.task() to be executed asynchronously.

Title: Multithreading in rust

Body:
I'm currently learning rust and want to make a scheduler as part of my learning process. I almost finish it but having problem when I want to run the task that I register in my scheduler as a background process, here's my code:

// An attribute to hide warnings for unused code.
#![allow(dead_code)]

use std::time::{Duration, SystemTime};
use std::thread;

#[derive(Debug)]
enum Unit {
    Seconds,
    Minutes,
    Hours
}

struct Scheduler {
    logger: String,
    jobs: Vec<Job>
}

struct Job {
    id: i32,
    name: String,
    every: u64,
    unit: Unit,
    task: Box<dyn Fn() -> () + Send + Sync>, // Box is used when we want to use heap reference instead of stack
    registered_at: SystemTime
}

impl Scheduler {
    fn new(logger: String) -> Self {
        Scheduler {
            logger: logger,
            jobs: Vec::<Job>::new(),
        }
    }

    fn add_job(&mut self, job: Job) {
        self.jobs.push(Job {
            id: job.id,
            name: job.name,
            every: job.every,
            unit: job.unit,
            task: Box::new(job.task),
            registered_at: job.registered_at
        });
    }

    fn get_jobs(&self) {
    }

    fn start(&self) {
        loop {
            for job in &self.jobs {
                std::thread::sleep(Duration::from_secs(1));
                Self::should_run(job)
            }
        }
    }

    fn should_run(job: &Job) {
        match job.registered_at.elapsed() {
            Ok(elapsed) => {
                if elapsed.as_secs()%job.every == 0 {
                    let j = job;
                    // Create a new thread and run the background function in it.
                    thread::spawn(move || {
                        // This closure will be run on a separate thread
                        // run the closure here
                        (j.task)()
                    });
                }
            }
            Err(e) => {
                // an error occurred!
                println!("Error: {e:?}");
            }
        };
    }
}

fn main() {
    let mut sch = Scheduler::new(String::from("logger"));

    sch.add_job(Job {
        id: 1,
        name: String::from("downloading report"),
        every: 1,
        unit: Unit::Seconds,
        task: Box::new(|| {
            // This is the first task. It will be executed every 1 seconds.
            println!("downloading...");
        }),
        registered_at: SystemTime::now()
    });

    sch.start();

}

I got this error:

  --> src/main.rs:65:21
   |
59 |       fn should_run(job: &Job) {
   |                     ---  - let's call the lifetime of this reference `'1`
   |                     |
   |                     `job` is a reference that is only valid in the associated function body
...
65 | /                     thread::spawn(move || {
66 | |                         // This closure will be run on a separate thread
67 | |                         // run the closure here
68 | |                         (j.task)()
69 | |                     });
   | |                      ^
   | |                      |
   | |______________________`job` escapes the associated function body here
   |                        argument requires that `'1` must outlive `'static`

I'm not sure what I'm missing here since I'm new to rust.

Thank you.

I'm expecting j.task() to be executed asynchronously.


问:
Flutter animated text as counter, double not accepted
Based on this repo: https://gist.github.com/bluemix/4c932e8c4a1cd6f497a4353d9e536f57

Class:

```<code>    class AnimatedCount extends ImplicitlyAnimatedWidget {
  const AnimatedCount({
    Key? key,
    required this.count,
    Duration duration = const Duration(milliseconds: 600),
    Curve curve = Curves.fastOutSlowIn,
  }) : super(duration: duration, curve: curve, key: key);

  final num count;

  @override
  ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState() {
    return _AnimatedCountState();
  }
}

class _AnimatedCountState extends AnimatedWidgetBaseState<AnimatedCount> {
  IntTween _intCount = IntTween(begin: 0, end: 1);
  Tween<double> _doubleCount = Tween<double>();

  @override
  Widget build(BuildContext context) {
    return widget.count is int
        ? Text(_intCount.evaluate(animation).toString())
        : Text(_doubleCount.evaluate(animation).toStringAsFixed(2));
  }

  @override
  void forEachTween(TweenVisitor<dynamic> visitor) {
    if (widget.count is int) {
      _intCount = visitor(
        _intCount,
        widget.count,
        (dynamic value) => IntTween(begin: value),
      ) as IntTween;
    } else {
      _doubleCount = visitor(
        _doubleCount,
        widget.count,
        (dynamic value) => Tween<double>(begin: value),
      ) as Tween<double>;
    }
  }
}
</code>```

I'm trying to pass data:

```<code>AnimatedCount(count: getKcal()), //as Text Widget
</code>```

getKcal function is easy (as for testing purposes):

```<code>  double getKcal() {
    return 10;
  }
</code>```

However I receive an exception here (on the Class AnimatedCount):

```<code>_doubleCount = visitor(
</code>```

Exception has occurred.
_CastError (type 'Null' is not a subtype of type 'double' in type cast)

No problems when I use integers. The Class does not accept doubles and I'm not finding why...

Body:
Based on this repo: https://gist.github.com/bluemix/4c932e8c4a1cd6f497a4353d9e536f57

Class:

    class AnimatedCount extends ImplicitlyAnimatedWidget {
  const AnimatedCount({
    Key? key,
    required this.count,
    Duration duration = const Duration(milliseconds: 600),
    Curve curve = Curves.fastOutSlowIn,
  }) : super(duration: duration, curve: curve, key: key);

  final num count;

  @override
  ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState() {
    return _AnimatedCountState();
  }
}

class _AnimatedCountState extends AnimatedWidgetBaseState<AnimatedCount> {
  IntTween _intCount = IntTween(begin: 0, end: 1);
  Tween<double> _doubleCount = Tween<double>();

  @override
  Widget build(BuildContext context) {
    return widget.count is int
        ? Text(_intCount.evaluate(animation).toString())
        : Text(_doubleCount.evaluate(animation).toStringAsFixed(2));
  }

  @override
  void forEachTween(TweenVisitor<dynamic> visitor) {
    if (widget.count is int) {
      _intCount = visitor(
        _intCount,
        widget.count,
        (dynamic value) => IntTween(begin: value),
      ) as IntTween;
    } else {
      _doubleCount = visitor(
        _doubleCount,
        widget.count,
        (dynamic value) => Tween<double>(begin: value),
      ) as Tween<double>;
    }
  }
}

I'm trying to pass data:

AnimatedCount(count: getKcal()), //as Text Widget

getKcal function is easy (as for testing purposes):

  double getKcal() {
    return 10;
  }

However I receive an exception here (on the Class AnimatedCount):

_doubleCount = visitor(

Exception has occurred.
_CastError (type 'Null' is not a subtype of type 'double' in type cast)

No problems when I use integers. The Class does not accept doubles and I'm not finding why...


问:
Hi, I want to open a Popup model on button click in typescript chrome extension
enter image description hereThis shows error that we can not use import outside module. How can i import a modal on this button click.
Creating chrome extension in react 18 using typescript.
This is my Content script code.</p>
```<code>import Popup from "../src/Modals/Authentication";
function init() {
    const injectElement = document.createElement("button");
    injectElement.className = "rustyZone-element";
    injectElement.innerHTML = "Icon";
    injectElement.onclick = function () {
        // const popup = window.require("../src/Modals/Authentication")
        console.log("here");
        const injectElementPopup = document.createElement("div");
        injectElementPopup.className = "popup-class";
        injectElementPopup.innerHTML = Popup;

    };

    document.querySelector(".theme-icon").appendChild(injectElement);
}
init();

</code>```

Body:
enter image description hereThis shows error that we can not use import outside module. How can i import a modal on this button click.
Creating chrome extension in react 18 using typescript.
This is my Content script code.

import Popup from "../src/Modals/Authentication";
function init() {
    const injectElement = document.createElement("button");
    injectElement.className = "rustyZone-element";
    injectElement.innerHTML = "Icon";
    injectElement.onclick = function () {
        // const popup = window.require("../src/Modals/Authentication")
        console.log("here");
        const injectElementPopup = document.createElement("div");
        injectElementPopup.className = "popup-class";
        injectElementPopup.innerHTML = Popup;

    };

    document.querySelector(".theme-icon").appendChild(injectElement);
}
init();


问:
is there a way to select multiple rows in a table by Control+mouse click in JavaScript playwright
i want to select multiple rows of a table only way i can do is press and hold control key and mouse click

i tried mouse up and down which did not work

```<code>  async multipleStudy(noOfStudy){
        // await this.page.locator('(//p-table[@data-automationid="study_table"]//tr)[2]/td[1]').click();
        await this.page.keyboard.down('Control');

        for (let i = 1; i <= noOfStudy; i++) {
            await this.page.locator('(//p-table[@data-automationid="study_table"]//tr)['+i+']/td[1]').click();
            this.page.waitForTimeout(3000);
        }
        await this.page.keyboard.up('Control');
    }
</code>```

Body:
i want to select multiple rows of a table only way i can do is press and hold control key and mouse click

i tried mouse up and down which did not work

  async multipleStudy(noOfStudy){
        // await this.page.locator('(//p-table[@data-automationid="study_table"]//tr)[2]/td[1]').click();
        await this.page.keyboard.down('Control');

        for (let i = 1; i <= noOfStudy; i++) {
            await this.page.locator('(//p-table[@data-automationid="study_table"]//tr)['+i+']/td[1]').click();
            this.page.waitForTimeout(3000);
        }
        await this.page.keyboard.up('Control');
    }


问:
Error message "Error in rep(keep[, i], tbl) : invalid 'times' argument" using mstate::msprep
The sample data in the package uses the included covariable (reserved by the keep = parameter). My data works fine if I don't include the keep parameter but fails consistently if I use the keep parameter. Since my example works perfectly well without the keep variable, I very much doubt that there is a problem with my main data. It must be some problem with the “keep” data.

```<code>msebmt <- msprep(data = psyneu_run1, trans = tmat,
                 time = c(NA, "FD_time1","de_time1","death_time1"),
                 status = c(NA, "FD_inc", "de_inc","death_inc"),
                 keep=c('sex','age'),
                 id='n_eid' )
</code>```

Error in rep(keep[, i], tbl) : invalid 'times' argument

Thanks in advance for any suggestions.

I don't Konw why. I suspect that it is a bug, but since I can't identify it, I can't be sure. I would be very grateful for anyone that can help me with this issue.

Body:
The sample data in the package uses the included covariable (reserved by the keep = parameter). My data works fine if I don't include the keep parameter but fails consistently if I use the keep parameter. Since my example works perfectly well without the keep variable, I very much doubt that there is a problem with my main data. It must be some problem with the “keep” data.

msebmt <- msprep(data = psyneu_run1, trans = tmat,
                 time = c(NA, "FD_time1","de_time1","death_time1"),
                 status = c(NA, "FD_inc", "de_inc","death_inc"),
                 keep=c('sex','age'),
                 id='n_eid' )

Error in rep(keep[, i], tbl) : invalid 'times' argument

Thanks in advance for any suggestions.

I don't Konw why. I suspect that it is a bug, but since I can't identify it, I can't be sure. I would be very grateful for anyone that can help me with this issue.


问:
How can I add a user that can connect to ActiveMQ Artemis in WildFly via Quarkus JMS?
I have a WildFly application with an embedded ActiveMQ Artemis and I can't seem to figure how to debug it. It seems to connect fine since I'm getting no errors in the log, but I'm unable to read any queues. There is no error but nothing is happening.

I'm running the Quarkus JMS client 1.03 which is using org.apache.activemq » artemis-jms-client 2.19. The server is running WildFly 26.1 with the embedded ActiveMQ Artemis server 2.19.1 so the client and server should be compatible. However, I'm not sure if I've configured it correctly. I'm using the standalone-full.xml.

For testing I've added a user test1:

bash-4.4$ ./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Using realm 'ApplicationRealm' as discovered from the existing property files.
Username : test1
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should be different from the username
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password :
WFLYDM0098: The password should be different from the username
Are you sure you want to use the password entered yes/no? yes
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: guest
About to add user 'test1' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server Jakarta Enterprise Beans calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="dGVzdDE=" />
```
<p>This is the log for creating that user. In my <code>standalone-full.xml</code> I have the role guest for ActiveMQ Artemis and the queue <code>prices</code> set up:</p>
<pre class="lang-xml prettyprint-override"><code><subsystem xmlns="urn:jboss:domain:messaging-activemq:13.1">
    <server name="default">
        ...
        <security-setting name="#">
            <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
        </security-setting>
        ...
        <address-setting name="jms.queue.prices" expiry-address="jms.queue.ExpiryQueue" redelivery-delay="1000" max-delivery-attempts="0"/>
        ...
        <jms-queue name="prices" entries="java:/jms/queue/prices" durable="true"/>
        ...
    </server>
</subsystem>
</code>```

My Quarkus client tries to connect with the following:

```<code>quarkus.artemis.url=tcp://localhost:8080
quarkus.artemis.username=test1
quarkus.artemis.password=test1
</code>```

It has a consumer:

    @Override
    public void run() {
        try (JMSContext context = connectionFactory.createContext(JMSContext.AUTO_ACKNOWLEDGE)) {
            JMSConsumer consumer = context.createConsumer(context.createQueue("prices"));
            while (true) {
                Message message = consumer.receive();
                if (message == null) {
                    // receive returns `null` if the JMSConsumer is closed
                    return;
                }
                lastPrice = message.getBody(String.class);
            }
        } catch (JMSException e) {
            throw new RuntimeException(e);
        }
    }
```
<p>and a producer:</p>
<pre class="lang-java prettyprint-override"><code>    @Override
    public void run() {
        try (JMSContext context = connectionFactory.createContext(JMSContext.AUTO_ACKNOWLEDGE)) {
            context.createProducer().send(context.createQueue("prices"), Integer.toString(random.nextInt(100)));
        }
    }
</code>```

It seem to connect just fine. I can see in the Quarkus log:

```<code>2022-12-08 14:29:59,596 DEBUG [org.apa.act.art.cor.cli.imp.ClientSessionFactoryImpl] (pool-10-thread-1) Trying reconnection attempt 0/1
2022-12-08 14:29:59,596 DEBUG [org.apa.act.art.cor.cli.imp.ClientSessionFactoryImpl] (pool-10-thread-1) Trying to connect with connectorFactory=org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory@6096907d and currentConnectorConfig: TransportConfiguration(name=null, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=8080&host=localhost
2022-12-08 14:29:59,596 DEBUG [org.apa.act.art.cor.rem.imp.net.NettyConnector] (pool-10-thread-1) Connector NettyConnector [host=localhost, port=8080, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] using native epoll
2022-12-08 14:29:59,596 DEBUG [org.apa.act.art.cor.client] (pool-10-thread-1) AMQ211002: Started EPOLL Netty Connector version 4.1.82.Final to localhost:8080
2022-12-08 14:29:59,597 DEBUG [org.apa.act.art.cor.rem.imp.net.NettyConnector] (pool-10-thread-1) Remote destination: localhost/127.0.0.1:8080
2022-12-08 14:29:59,598 DEBUG [org.apa.act.art.cor.rem.imp.net.NettyConnector] (Thread-1 (ActiveMQ-client-netty-threads)) Added ActiveMQClientChannelHandler to Channel with id = 6339db8b
2022-12-08 14:29:59,598 DEBUG [org.apa.act.art.cor.cli.imp.ClientSessionFactoryImpl] (pool-10-thread-1) Connected with the currentConnectorConfig=TransportConfiguration(name=null, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=8080&host=localhost
2022-12-08 14:29:59,599 DEBUG [org.apa.act.art.cor.cli.imp.ClientSessionFactoryImpl] (pool-10-thread-1) Reconnection successful
</code>```

So it seems to be working fine, but I can't seem to send or consume from the queue.

Answers to Justin questions in the comments

Have you tried adding ?httpUpgradeEnabled=true

yes no change

quarkus.artemis.url=tcp://localhost:8080?httpUpgradeEnabled=true

Can you check the consumer-count

Actually there does not even seem to be a session active. I tried to close the connection for my test user but it shown me a dialog "no connection for that user" So maybe it's not even connecting as I thought

Why do you suspect the problem is with the user

I thought it might have something to do with some permission error. I was not sure if I was suppost to add the user to the "guest" group or not

But since I have in my config

        <security-setting name="#">
            <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
        </security-setting>
```

EDIT2. Actually I see now in the log that quarkus seems to be missing permission for creating a consumer. So i guess "guest" role is not the correct one.

I assume that was corrected

Body:
I have a WildFly application with an embedded ActiveMQ Artemis and I can't seem to figure how to debug it. It seems to connect fine since I'm getting no errors in the log, but I'm unable to read any queues. There is no error but nothing is happening.

I'm running the Quarkus JMS client 1.03 which is using org.apache.activemq » artemis-jms-client 2.19. The server is running WildFly 26.1 with the embedded ActiveMQ Artemis server 2.19.1 so the client and server should be compatible. However, I'm not sure if I've configured it correctly. I'm using the standalone-full.xml.

For testing I've added a user test1:

bash-4.4$ ./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Using realm 'ApplicationRealm' as discovered from the existing property files.
Username : test1
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should be different from the username
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password :
WFLYDM0098: The password should be different from the username
Are you sure you want to use the password entered yes/no? yes
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: guest
About to add user 'test1' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server Jakarta Enterprise Beans calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="dGVzdDE=" />

This is the log for creating that user. In my standalone-full.xml I have the role guest for ActiveMQ Artemis and the queue prices set up:

<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.1">
    <server name="default">
        ...
        <security-setting name="#">
            <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
        </security-setting>
        ...
        <address-setting name="jms.queue.prices" expiry-address="jms.queue.ExpiryQueue" redelivery-delay="1000" max-delivery-attempts="0"/>
        ...
        <jms-queue name="prices" entries="java:/jms/queue/prices" durable="true"/>
        ...
    </server>
</subsystem>

My Quarkus client tries to connect with the following:

quarkus.artemis.url=tcp://localhost:8080
quarkus.artemis.username=test1
quarkus.artemis.password=test1

It has a consumer:

    @Override
    public void run() {
        try (JMSContext context = connectionFactory.createContext(JMSContext.AUTO_ACKNOWLEDGE)) {
            JMSConsumer consumer = context.createConsumer(context.createQueue("prices"));
            while (true) {
                Message message = consumer.receive();
                if (message == null) {
                    // receive returns `null` if the JMSConsumer is closed
                    return;
                }
                lastPrice = message.getBody(String.class);
            }
        } catch (JMSException e) {
            throw new RuntimeException(e);
        }
    }

and a producer:

    @Override
    public void run() {
        try (JMSContext context = connectionFactory.createContext(JMSContext.AUTO_ACKNOWLEDGE)) {
            context.createProducer().send(context.createQueue("prices"), Integer.toString(random.nextInt(100)));
        }
    }

It seem to connect just fine. I can see in the Quarkus log:

2022-12-08 14:29:59,596 DEBUG [org.apa.act.art.cor.cli.imp.ClientSessionFactoryImpl] (pool-10-thread-1) Trying reconnection attempt 0/1
2022-12-08 14:29:59,596 DEBUG [org.apa.act.art.cor.cli.imp.ClientSessionFactoryImpl] (pool-10-thread-1) Trying to connect with connectorFactory=org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory@6096907d and currentConnectorConfig: TransportConfiguration(name=null, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=8080&host=localhost
2022-12-08 14:29:59,596 DEBUG [org.apa.act.art.cor.rem.imp.net.NettyConnector] (pool-10-thread-1) Connector NettyConnector [host=localhost, port=8080, httpEnabled=false, httpUpgradeEnabled=false, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true] using native epoll
2022-12-08 14:29:59,596 DEBUG [org.apa.act.art.cor.client] (pool-10-thread-1) AMQ211002: Started EPOLL Netty Connector version 4.1.82.Final to localhost:8080
2022-12-08 14:29:59,597 DEBUG [org.apa.act.art.cor.rem.imp.net.NettyConnector] (pool-10-thread-1) Remote destination: localhost/127.0.0.1:8080
2022-12-08 14:29:59,598 DEBUG [org.apa.act.art.cor.rem.imp.net.NettyConnector] (Thread-1 (ActiveMQ-client-netty-threads)) Added ActiveMQClientChannelHandler to Channel with id = 6339db8b
2022-12-08 14:29:59,598 DEBUG [org.apa.act.art.cor.cli.imp.ClientSessionFactoryImpl] (pool-10-thread-1) Connected with the currentConnectorConfig=TransportConfiguration(name=null, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=8080&host=localhost
2022-12-08 14:29:59,599 DEBUG [org.apa.act.art.cor.cli.imp.ClientSessionFactoryImpl] (pool-10-thread-1) Reconnection successful

So it seems to be working fine, but I can't seem to send or consume from the queue.

Answers to Justin questions in the comments

Have you tried adding ?httpUpgradeEnabled=true

yes no change

quarkus.artemis.url=tcp://localhost:8080?httpUpgradeEnabled=true

Can you check the consumer-count

Actually there does not even seem to be a session active. I tried to close the connection for my test user but it shown me a dialog "no connection for that user" So maybe it's not even connecting as I thought

Why do you suspect the problem is with the user

I thought it might have something to do with some permission error. I was not sure if I was suppost to add the user to the "guest" group or not

But since I have in my config

        <security-setting name="#">
            <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
        </security-setting>

EDIT2. Actually I see now in the log that quarkus seems to be missing permission for creating a consumer. So i guess "guest" role is not the correct one.

I assume that was corrected


问:
NavLink activeClassName not changing background color when clicked
I am trying to make active class in React.js when ever I click on any NavLink I want background color to change

```<code> <NavLink activeClassName="active3"

            exact={true}
            to="/client"
          >
            <div>
              <a href="#" className="nav_logo">
                <img className="slogo" src={forur} />
                <i className="fas fa-angry"></i>{" "}
              </a>
            </div>
          </NavLink>

 <NavLink activeClassName="active3" exact={true} to="/orders">
            <div>
              {" "}
              <a href="#" className="nav_logo">
                <Orders />
                <i className="fas fa-angry"></i>{" "}
              </a>
            </div>
          </NavLink>
</code>```

App.css:

.active3 div{
  background: black;
}
```

Body:
I am trying to make active class in React.js when ever I click on any NavLink I want background color to change

 <NavLink activeClassName="active3"

            exact={true}
            to="/client"
          >

                {" "}

          </NavLink>

 <NavLink activeClassName="active3" exact={true} to="/orders">

              {" "}

                <Orders />
                {" "}

          </NavLink>

App.css:

.active3 div{
  background: black;
}


问:
how to add add leading zeros to string value so that result is fixed length
If I want to add x numbers of zeros to the left of a int I can use this...

```<code>        string fmt = "0000";
        int intValue = 4;
        Console.WriteLine(intValue.ToString(fmt));
        Console.WriteLine();
</code>```

This will give 0004 and is fine, but this does not work if intValue would be a string. Any ideas of how I can accomplish this with a string?

Body:
If I want to add x numbers of zeros to the left of a int I can use this...

        string fmt = "0000";
        int intValue = 4;
        Console.WriteLine(intValue.ToString(fmt));
        Console.WriteLine();

This will give 0004 and is fine, but this does not work if intValue would be a string. Any ideas of how I can accomplish this with a string?


问:
Using the same procedure for Java Environment and Smart Devices Offline Application
For context, I have a Java Web Application running on Tomcat 7 and currently using Genexus 16 U10 in the same knowledge base, I also have an Android offline app.

The application is really extense, so there are a lot of references in almost every procedure. Recently, it has come to the need of using a functionality from Smart Devices which is the ClientStorage external object, and the problem is, it can't be compiled/used in procedures that are going to be used in the Java Environment. Changing every reference (evaluating whether it is a Smart Devices object or a normal object and then creating another procedure just to call for the ClientStorage EO) would take a lot of time.

My question is, Is there any way of using a functionality from Smart Devices in a procedure that's going to be called by the Web Environment? My first thought was to try to find something like the transaction tags (like the image below) but I had no success on it.

Tried to use an External Object available only in Smart Devices application in a procedure that is currently being used by both Smart Devices and Java Web Application. The error in fact is error spc0200: External Object GeneXus\Client\ClientStorage does not implement method 'set(' for Java Web environment.


问:
paths directory abbreviation is ignored in tsconfig
I have a file at location src/lib/db.ts and a script script.ts that imports the db file using import ... from "$lib/db". My tsconfig.json contains

```<code>"paths": {
            "$lib": [
                "src/lib"
            ],
            "$lib/*": [
                "src/lib/*"
            ]
        },
</code>```

It was set-up by SvelteKit. But when I do

```<code>node --experimental-specifier-resolution=node --loader ts-node/esm script.ts --project tsconfig.json
</code>```

I get

```<code>/home/..../node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:757
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base));
        ^
CustomError: Cannot find package '$lib' imported from script.ts.
</code>```

Body:
I have a file at location src/lib/db.ts and a script script.ts that imports the db file using import ... from "$lib/db". My tsconfig.json contains

"paths": {
            "$lib": [
                "src/lib"
            ],
            "$lib/*": [
                "src/lib/*"
            ]
        },

It was set-up by SvelteKit. But when I do

node --experimental-specifier-resolution=node --loader ts-node/esm script.ts --project tsconfig.json

I get

/home/..../node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:757
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base));
        ^
CustomError: Cannot find package '$lib' imported from script.ts.