问:
Foreign key constraint is incorrectly formed
I'm developing a DB with MySQL.
I'm trying to add some tables.

```<code>CREATE TABLE Services (
srv_id int NOT NULL PRIMARY KEY,
srv_description char(100) NOT NULL
);

CREATE TABLE Categories(
ctg_id INT NOT NULL PRIMARY KEY,
ctg_description char(25) NOT NULL
);

CREATE TABLE Bathhouses(
bth_id int NOT NULL PRIMARY KEY,
bth_name char(25) NOT NULL UNIQUE,
bth_start_date date NOT NULL CHECK (MONTH(bth_start_date) > 3),
bth_end_date date NOT NULL CHECK (MONTH(bth_end_date) < 11),
bth_address char(25) NOT NULL,
ctg_id INT NOT NULL,
FOREIGN KEY (ctg_id) REFERENCES Categories(ctg_id)
);

CREATE TABLE Customers(
cus_id int NOT NULL PRIMARY KEY,
cus_name char(25) NOT NULL,
cus_surname char(25) NOT NULL,
cus_birthdate date NOT NULL,
cus_sexgender ENUM('male ', 'female', 'other')
);

CREATE TABLE CustomersServicesUses (
cussruvuses_id int NOT NULL PRIMARY KEY,
cus_id int NOT NULL,
srv_id int NOT NULL,
cussruvuses_isSubscriber tinyint(1) NOT NULL,
FOREIGN KEY (cus_id) REFERENCES Customers(cus_id),
FOREIGN KEY (srv_id) REFERENCES Services(srv_id)
);
</code>```

What is the cause of this error?

Unable to create table `bathhouses`.`customersservicesuses` (errno: 150 "Foreign key constraint is incorrectly formed") (Details…)

Many questions here on Stack Overflow found that the target table had two primary keys but in my case I have only one PK. Other solutions suggest that the two fields (PK and the FK of the other table) could be different, but in my case they have the same name and the same data type.

Details:

```<code>===================================== 2022-12-16 21:19:22 0x5dbc INNODB MONITOR OUTPUT
===================================== Per second averages calculated from the last 10 seconds
----------------- BACKGROUND THREAD
----------------- srv_master_thread loops: 47 srv_active, 0 srv_shutdown, 10442 srv_idle srv_master_thread log flush and writes: 10489
---------- SEMAPHORES
---------- OS WAIT ARRAY INFO: reservation count 265 OS WAIT ARRAY INFO: signal count 212 RW-shared spins 292, rounds 6753, OS waits 173 RW-excl spins 70, rounds 1524, OS waits 27 RW-sx spins 0, rounds 0, OS waits 0 Spin rounds per wait: 23.13 RW-shared, 21.77 RW-excl, 0.00 RW-sx
------------------------ LATEST FOREIGN KEY ERROR
------------------------ 2022-12-16 21:02:05 0x5158 Error in foreign key constraint of table `bathhouses`.`customersservicesuses`: Create  table `bathhouses`.`customersservicesuses` with foreign key constraint failed. Referenced table `bathhouses`.`services` not found in the data dictionary near 'FOREIGN KEY (srv_ID) REFERENCES Services(srv_ID) )'.
------------ TRANSACTIONS
------------ Trx id counter 5994 Purge done for trx's n:o < 5994 undo n:o < 0 state: running but idle History list length 12 LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 284098011705752, not started 0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 284098011701544, not started 0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 284098011697336, not started 0 lock struct(s), heap size 1128, 0 row lock(s)
-------- FILE I/O
-------- I/O thread 0 state: native aio handle (insert buffer thread) I/O thread 1 state: native aio handle (log thread) I/O thread 2 state: native aio handle (read thread) I/O thread 3 state: native aio handle (read thread) I/O thread 4 state: native aio handle (read thread) I/O thread 5 state: native aio handle (read thread) I/O thread 6 state: native aio handle (write thread) I/O thread 7 state: native aio handle (write thread) I/O thread 8 state: native aio handle (write thread) I/O thread 9 state: native aio handle (write thread) Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,  ibuf aio reads:, log i/o's:, sync i/o's: Pending flushes (fsync) log: 0; buffer pool: 0 718 OS file reads, 1276 OS file writes, 559 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX
------------------------------------- Ibuf: size 1, free list len 0, seg size 2, 0 merges merged operations:  insert 0, delete mark 0, delete 0 discarded operations:  insert 0, delete mark 0, delete 0 Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 1 buffer(s)
0.00 hash searches/s, 0.30 non-hash searches/s
--- LOG
--- Log sequence number 2228333 Log flushed up to   2228333 Pages flushed up to 2228333 Last checkpoint at  2228324 0 pending log flushes, 0 pending chkp writes 307 log i/o's done, 0.00 log i/o's/second
---------------------- BUFFER POOL AND MEMORY
---------------------- Total large memory allocated 33554432 Dictionary memory allocated 87080 Buffer pool size   1003 Free buffers 746 Database pages     256 Old database pages 0 Modified db pages  0 Percent of dirty pages(LRU & free pages): 0.000 Max dirty pages percent: 75.000 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s Pages read 681, created 267, written 893
0.00 reads/s, 0.00 creates/s, 0.00 writes/s Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000 Pages read ahead
0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s LRU len: 256, unzip_LRU len: 0 I/O sum[2]:cur[0], unzip sum[0]:cur[0]
-------------- ROW OPERATIONS
-------------- 0 queries inside InnoDB, 0 queries in queue 0 read views open inside InnoDB Process ID=13700, Main thread ID=11024, state: sleeping Number of rows inserted 0, updated 15, deleted 0, read 574
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.30 reads/s Number of system rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
---------------------------- END OF INNODB MONITOR OUTPUT
============================
</code>```

Body:
I'm developing a DB with MySQL.
I'm trying to add some tables.

CREATE TABLE Services (
srv_id int NOT NULL PRIMARY KEY,
srv_description char(100) NOT NULL
);

CREATE TABLE Categories(
ctg_id INT NOT NULL PRIMARY KEY,
ctg_description char(25) NOT NULL
);

CREATE TABLE Bathhouses(
bth_id int NOT NULL PRIMARY KEY,
bth_name char(25) NOT NULL UNIQUE,
bth_start_date date NOT NULL CHECK (MONTH(bth_start_date) > 3),
bth_end_date date NOT NULL CHECK (MONTH(bth_end_date) < 11),
bth_address char(25) NOT NULL,
ctg_id INT NOT NULL,
FOREIGN KEY (ctg_id) REFERENCES Categories(ctg_id)
);

CREATE TABLE Customers(
cus_id int NOT NULL PRIMARY KEY,
cus_name char(25) NOT NULL,
cus_surname char(25) NOT NULL,
cus_birthdate date NOT NULL,
cus_sexgender ENUM('male ', 'female', 'other')
);

CREATE TABLE CustomersServicesUses (
cussruvuses_id int NOT NULL PRIMARY KEY,
cus_id int NOT NULL,
srv_id int NOT NULL,
cussruvuses_isSubscriber tinyint(1) NOT NULL,
FOREIGN KEY (cus_id) REFERENCES Customers(cus_id),
FOREIGN KEY (srv_id) REFERENCES Services(srv_id)
);

What is the cause of this error?

Unable to create table `bathhouses`.`customersservicesuses` (errno: 150 "Foreign key constraint is incorrectly formed") (Details…)

Many questions here on Stack Overflow found that the target table had two primary keys but in my case I have only one PK. Other solutions suggest that the two fields (PK and the FK of the other table) could be different, but in my case they have the same name and the same data type.

Details:

===================================== 2022-12-16 21:19:22 0x5dbc INNODB MONITOR OUTPUT
===================================== Per second averages calculated from the last 10 seconds
----------------- BACKGROUND THREAD
----------------- srv_master_thread loops: 47 srv_active, 0 srv_shutdown, 10442 srv_idle srv_master_thread log flush and writes: 10489
---------- SEMAPHORES
---------- OS WAIT ARRAY INFO: reservation count 265 OS WAIT ARRAY INFO: signal count 212 RW-shared spins 292, rounds 6753, OS waits 173 RW-excl spins 70, rounds 1524, OS waits 27 RW-sx spins 0, rounds 0, OS waits 0 Spin rounds per wait: 23.13 RW-shared, 21.77 RW-excl, 0.00 RW-sx
------------------------ LATEST FOREIGN KEY ERROR
------------------------ 2022-12-16 21:02:05 0x5158 Error in foreign key constraint of table `bathhouses`.`customersservicesuses`: Create  table `bathhouses`.`customersservicesuses` with foreign key constraint failed. Referenced table `bathhouses`.`services` not found in the data dictionary near 'FOREIGN KEY (srv_ID) REFERENCES Services(srv_ID) )'.
------------ TRANSACTIONS
------------ Trx id counter 5994 Purge done for trx's n:o < 5994 undo n:o < 0 state: running but idle History list length 12 LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 284098011705752, not started 0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 284098011701544, not started 0 lock struct(s), heap size 1128, 0 row lock(s)
---TRANSACTION 284098011697336, not started 0 lock struct(s), heap size 1128, 0 row lock(s)
-------- FILE I/O
-------- I/O thread 0 state: native aio handle (insert buffer thread) I/O thread 1 state: native aio handle (log thread) I/O thread 2 state: native aio handle (read thread) I/O thread 3 state: native aio handle (read thread) I/O thread 4 state: native aio handle (read thread) I/O thread 5 state: native aio handle (read thread) I/O thread 6 state: native aio handle (write thread) I/O thread 7 state: native aio handle (write thread) I/O thread 8 state: native aio handle (write thread) I/O thread 9 state: native aio handle (write thread) Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,  ibuf aio reads:, log i/o's:, sync i/o's: Pending flushes (fsync) log: 0; buffer pool: 0 718 OS file reads, 1276 OS file writes, 559 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX
------------------------------------- Ibuf: size 1, free list len 0, seg size 2, 0 merges merged operations:  insert 0, delete mark 0, delete 0 discarded operations:  insert 0, delete mark 0, delete 0 Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 0 buffer(s) Hash table size 4441, node heap has 1 buffer(s)
0.00 hash searches/s, 0.30 non-hash searches/s
--- LOG
--- Log sequence number 2228333 Log flushed up to   2228333 Pages flushed up to 2228333 Last checkpoint at  2228324 0 pending log flushes, 0 pending chkp writes 307 log i/o's done, 0.00 log i/o's/second
---------------------- BUFFER POOL AND MEMORY
---------------------- Total large memory allocated 33554432 Dictionary memory allocated 87080 Buffer pool size   1003 Free buffers 746 Database pages     256 Old database pages 0 Modified db pages  0 Percent of dirty pages(LRU & free pages): 0.000 Max dirty pages percent: 75.000 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s Pages read 681, created 267, written 893
0.00 reads/s, 0.00 creates/s, 0.00 writes/s Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000 Pages read ahead
0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s LRU len: 256, unzip_LRU len: 0 I/O sum[2]:cur[0], unzip sum[0]:cur[0]
-------------- ROW OPERATIONS
-------------- 0 queries inside InnoDB, 0 queries in queue 0 read views open inside InnoDB Process ID=13700, Main thread ID=11024, state: sleeping Number of rows inserted 0, updated 15, deleted 0, read 574
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.30 reads/s Number of system rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
---------------------------- END OF INNODB MONITOR OUTPUT
============================


来源: stackexchange

问:
twitter[tweepy] api not returning user information
Project is returning blank lists: [ ] [ ] [ ]

[Done] exited with code=0 in 5.102 seconds

I'll give some context of what i'm trying to achieve and hopefully I can get some help.

I am looking to have a bot that searches twitter for new/existing accounts created under 1 month, with less than ~5000 followers and report their usernames back to me.

I have it searching through a yaml file with 'users' and 'words' to see if it can find a match in twitter BIOs, etc.

```<code># define authentication handler
auth_handler = tweepy.OAuth1UserHandler(consumer_key,consumer_secret)

# Set access tokens
auth_handler.set_access_token(access_token,access_token_secret)

# Creating the API
api = tweepy.API(auth_handler,wait_on_rate_limit=True)

# Creating client token
client = tweepy.Client(bearer_token=Bearer_token)

# Searching tweets
search_term='NFTshill NFTs NFTdrop -filter:retweets'
tweet_amount=1000
# Create a cursor object
tweets=tweepy.Cursor(api.search_tweets,q=search_term,lang='en',tweet_mode='extended').items(tweet_amount)

usernames = []
final_users = []
u_followers = []
u_description = []
u_top = []

with open("config.yaml","r") as file:
    top_accounts = yaml.safe_load(file)

users = client.get_users(usernames=top_accounts['accounts'])

top_user_id = [user.id for user in users.data]

words = "|".join(top_accounts['words'])

for tweet in tweets:
    screen_names = tweet.user.screen_name
    followers = tweet.user.followers_count
    description = tweet.user.description
    created = tweet.user.created_at.date()

    try:
        if followers < 5000 and re.findall(pattern = words,string = description) and created.year == 2022 and created.month >= 10:
            follower_ids = api.get_follower_ids(screen_name=screen_names)
            top_user = set(top_user_id) & set(follower_ids)
            u_top.append(top_user)
            final_users.append(screen_names)

            second = []
            for user in top_user_id:
                if user in follower_ids:
                    second.append(user)
            print(second)

    except tweepy.RateLimitError:
        print("Rate limit reached. Sleeping for:", api.rate_limit_status()['resources']['followers']['/followers/ids']['reset'])
        time.sleep(api.rate_limit_status()['resources']['followers']['/followers/ids']['reset'])
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Project is returning blank lists: [ ] [ ] [ ]

[Done] exited with code=0 in 5.102 seconds

I'll give some context of what i'm trying to achieve and hopefully I can get some help.

I am looking to have a bot that searches twitter for new/existing accounts created under 1 month, with less than ~5000 followers and report their usernames back to me.

I have it searching through a yaml file with 'users' and 'words' to see if it can find a match in twitter BIOs, etc.

# define authentication handler
auth_handler = tweepy.OAuth1UserHandler(consumer_key,consumer_secret)

# Set access tokens
auth_handler.set_access_token(access_token,access_token_secret)

# Creating the API
api = tweepy.API(auth_handler,wait_on_rate_limit=True)

# Creating client token
client = tweepy.Client(bearer_token=Bearer_token)

# Searching tweets
search_term='NFTshill NFTs NFTdrop -filter:retweets'
tweet_amount=1000
# Create a cursor object
tweets=tweepy.Cursor(api.search_tweets,q=search_term,lang='en',tweet_mode='extended').items(tweet_amount)

usernames = []
final_users = []
u_followers = []
u_description = []
u_top = []

with open("config.yaml","r") as file:
    top_accounts = yaml.safe_load(file)

users = client.get_users(usernames=top_accounts['accounts'])

top_user_id = [user.id for user in users.data]

words = "|".join(top_accounts['words'])

for tweet in tweets:
    screen_names = tweet.user.screen_name
    followers = tweet.user.followers_count
    description = tweet.user.description
    created = tweet.user.created_at.date()

    try:
        if followers < 5000 and re.findall(pattern = words,string = description) and created.year == 2022 and created.month >= 10:
            follower_ids = api.get_follower_ids(screen_name=screen_names)
            top_user = set(top_user_id) & set(follower_ids)
            u_top.append(top_user)
            final_users.append(screen_names)

            second = []
            for user in top_user_id:
                if user in follower_ids:
                    second.append(user)
            print(second)

    except tweepy.RateLimitError:
        print("Rate limit reached. Sleeping for:", api.rate_limit_status()['resources']['followers']['/followers/ids']['reset'])
        time.sleep(api.rate_limit_status()['resources']['followers']['/followers/ids']['reset'])


问:
Apache: FallbackResource gets called even for found pages
I'm using FallbackResource directive for an Apache web server to serve the root index page when the requested page is not found, but it seems to be called for found pages too.

Here's a brief summary of the files below. When going to index.php, the user will be redirected to login.php. There, a string is printed to a file. When going to login.php directly, the print happens twice. When the FallbackResource line is removed from the apache config, this problem doesn't happen.

Apache site config file

```<code><VirtualHost *:80>
  ServerName localhost
  DocumentRoot /var/www/html

  <Directory /var/www/html>
    # Also tried /index.php
    FallbackResource /
  </Directory>
</VirtualHost>
</code>```

index.php

```<code><?php include 'includes/session.php'; ?>
</code>```

login.php

```<code><?php file_put_contents('log-file', "TEST\n", FILE_APPEND); ?>
</code>```

includes/session.php

```<code><?php
session_start();
if (($_SESSION['loginStatus'] ?? "0") != "1") {
  header('location:/login.php');
}
?>
</code>```

Does anyone know what's wrong and how to fix or work around this?

Body:
I'm using FallbackResource directive for an Apache web server to serve the root index page when the requested page is not found, but it seems to be called for found pages too.

Here's a brief summary of the files below. When going to index.php, the user will be redirected to login.php. There, a string is printed to a file. When going to login.php directly, the print happens twice. When the FallbackResource line is removed from the apache config, this problem doesn't happen.

Apache site config file

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot /var/www/html

  <Directory /var/www/html>
    # Also tried /index.php
    FallbackResource /
  </Directory>
</VirtualHost>

index.php

<?php include 'includes/session.php'; ?>

login.php

<?php file_put_contents('log-file', "TEST\n", FILE_APPEND); ?>

includes/session.php

<?php
session_start();
if (($_SESSION['loginStatus'] ?? "0") != "1") {
  header('location:/login.php');
}
?>

Does anyone know what's wrong and how to fix or work around this?


问:
Importing an excel file into JavaScript with each row as an array or object
everyone. I am working on a script in JavaScript for use in Adobe Illustrator, and I would like to import an excel file which lists customers and their contact info into the javaScript. In this way someone can keep the excel file updated, and the javaScript would update the customers information.
When the javaScript is run, a window opens in Illustrator where information can be input to be entered in an Illustrator document.

The excel file would contain our frequent customers and their contact info, put into a drop-down menu to save on typing.

I am pretty close, and have successfully imported a .csv file and changed it over to useable data in javaScript. The problem I am having is that I don't know how to dynamically change the number of items in the customer menu as the .csv file changes.

Also, my code seems to be very cumbersome, and I think that there are more efficient ways of doing it.

I was wondering what are some different ways of doing this.


问:
sed - how to consider nested structure?
I have wrote a sed to replace a code from terraform but it's failing when has nested structure inside:

```<code>sed -r -i '' -e '/resource "love"( )?{/,/}/d'
</code>```

This works smooth when file is something like:

file.tf

```<code>resource "love" {
  name = "johnny"
}

resource "b" {
  age = 35
}
</code>```

But it's failing when it has something like:

file2.tf

```<code>resource "love" {
  name = "johnny"
  address = {
    ...
  }
}

resource "b" {
  age = 35
}
</code>```

In both cases, the expected result should be:

```<code>resource "b" {
  age = 35
}
</code>```

It should remove all element love you. Is there any way to cover it on sed? I want to drop all

Title: sed - how to consider nested structure?

Body:
I have wrote a sed to replace a code from terraform but it's failing when has nested structure inside:

sed -r -i '' -e '/resource "love"( )?{/,/}/d'

This works smooth when file is something like:

file.tf

resource "love" {
  name = "johnny"
}

resource "b" {
  age = 35
}

But it's failing when it has something like:

file2.tf

resource "love" {
  name = "johnny"
  address = {
    ...
  }
}

resource "b" {
  age = 35
}

In both cases, the expected result should be:

resource "b" {
  age = 35
}

It should remove all element love you. Is there any way to cover it on sed? I want to drop all


问:
Use multiple workspaces containing django without PYTHONPATH
Sometimes I need to run our project with django backand in multiple workspaces on different git versions. While doing it I discovered that django is heavely relying on PYTHONPATH and probably because of that mixing up the workspaces.
When I call python manger.py runserver for example, I can see sources being pulled from the other workspace.
On contrary, if I remove both workspaces from PYTHONPATH (which was the only thing in there) the above command fails with the quite infamous error:

```<code>File "/opt/homebrew/Cellar/python@3.11/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: XYZ
</code>```

For me it looks like, he can not find the modules outside django, which has been otherwise obtained from the PYTHONPATH path. Since all our modules including the one that is reported to be missing are on the same level as django I tried to extend the sys.path in manage.py like this:

```<code>import pathlib

def main():
    current_dir = pathlib.Path().resolve()
    [sys.path.append(str(x)) for x in current_dir.parent.iterdir() if
     x.is_dir() and not x.name.startswith(".")]
</code>```

Although I can see the path being extended the above exception still occurs.

Any help on how to use multiple workspaces containing django without PYTHONPATH are highly appreciated, thanks in advance.

Body:
Sometimes I need to run our project with django backand in multiple workspaces on different git versions. While doing it I discovered that django is heavely relying on PYTHONPATH and probably because of that mixing up the workspaces.
When I call python manger.py runserver for example, I can see sources being pulled from the other workspace.
On contrary, if I remove both workspaces from PYTHONPATH (which was the only thing in there) the above command fails with the quite infamous error:

File "/opt/homebrew/Cellar/python@3.11/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: XYZ

For me it looks like, he can not find the modules outside django, which has been otherwise obtained from the PYTHONPATH path. Since all our modules including the one that is reported to be missing are on the same level as django I tried to extend the sys.path in manage.py like this:

import pathlib

def main():
    current_dir = pathlib.Path().resolve()
    [sys.path.append(str(x)) for x in current_dir.parent.iterdir() if
     x.is_dir() and not x.name.startswith(".")]

Although I can see the path being extended the above exception still occurs.

Any help on how to use multiple workspaces containing django without PYTHONPATH are highly appreciated, thanks in advance.


问:
Difference between passport.js and services like msal-angular/msal-react/angularx-social-login?
just wondering what’s the difference between using passport.js to authenticate and using frontend authentication libraries such as msal-angular, msal-react, angularx-social-login, etc? And is there a “better” approach between these options?</p>


问:
found pages without a React Component as default export in pages/helpers/helpers
I am trying to upload my website to netlify and i keep getting this error.

 Compiled successfully
8:10:58 PM: info  - Collecting page data...
8:11:03 PM: > Build optimization failed: found pages without a React Component as default export in
8:11:03 PM: pages/config/firebase-config
8:11:03 PM: pages/helpers/helpers
8:11:03 PM: See https://nextjs.org/docs/messages/page-without-valid-component for more info.
8:11:03 PM:
8:11:03 PM: ────────────────────────────────────────────────────────────────
8:11:03 PM:   "build.command" failed
8:11:03 PM: ────────────────────────────────────────────────────────────────
8:11:03 PM:
8:11:03 PM:   Error message
8:11:03 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
8:11:03 PM:
8:11:03 PM:   Error location
8:11:03 PM:   In Build command from Netlify app:
8:11:03 PM:   npm run build
8:11:03 PM:

import { createContext } from "react";

    export const AppContext = createContext(null);

    //This is my helpers file, it is inside a component folder not the pages folder.```

I found this Can't build React/Next project - found page without a React Component as default export (context api file) as the general explanation, but when i try it, it's not working for me, What's the solution please??

Body:
I am trying to upload my website to netlify and i keep getting this error.

 Compiled successfully
8:10:58 PM: info  - Collecting page data...
8:11:03 PM: > Build optimization failed: found pages without a React Component as default export in
8:11:03 PM: pages/config/firebase-config
8:11:03 PM: pages/helpers/helpers
8:11:03 PM: See https://nextjs.org/docs/messages/page-without-valid-component for more info.
8:11:03 PM:
8:11:03 PM: ────────────────────────────────────────────────────────────────
8:11:03 PM:   "build.command" failed
8:11:03 PM: ────────────────────────────────────────────────────────────────
8:11:03 PM:
8:11:03 PM:   Error message
8:11:03 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
8:11:03 PM:
8:11:03 PM:   Error location
8:11:03 PM:   In Build command from Netlify app:
8:11:03 PM:   npm run build
8:11:03 PM:

import { createContext } from "react";

    export const AppContext = createContext(null);

    //This is my helpers file, it is inside a component folder not the pages folder.

I found this Can't build React/Next project - found page without a React Component as default export (context api file) as the general explanation, but when i try it, it's not working for me, What's the solution please??


问:
During container build service can't be found via dns name resolution
So, I have 3 services: DB, backend, and frontend.

I made a docker-compose file to execute everything:

```<code>version: '3.9'
services:
  postgres:
    container_name: postgres
    image: postgres:14.6-alpine
    restart: always
    env_file:
      - .env.db
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgres/data/pgdata
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql
    networks:
      - website

  backend:
    container_name: backend
    build: ./backend
    restart: unless-stopped
    env_file: .env.backend
    ports:
      - "1337:1337"
    volumes:
      - ./backend/config:/opt/app/config
      - ./backend/src:/opt/app/src
      - ./backend/package.json:/opt/package.json
      - ./backend/yarn.lock:/opt/yarn.lock
      - ./backend/public/uploads:/opt/app/public/uploads
    networks:
      - website
    depends_on:
      - postgres

  frontend:
    build: ./frontend
    container_name: frontend
    ports:
      - "3000:3000"
    networks:
      - website
    depends_on:
      - backend

volumes:
  postgres-data:
    external: true

networks:
  website:
    driver: bridge
</code>```

Here is my frontend/Dockerfile:

```<code># Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY yarn.lock* package*.json ./
RUN \
  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  elif [ -f package-lock.json ]; then npm ci; \
  else echo "Lockfile not found." && exit 1; \
  fi

# Rebuild the source code only when needed
FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_PUBLIC_API_URL http://backend:1337/graphql

RUN yarn build

FROM node:16-alpine AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]
</code>```

Also I developed a custom shell script to make sure that backend is up and running before building the frontend.
General idea there is:

```<code>docker compose up -d postgres backend
**wait logic**
docker compose up -d frontend
</code>```

So, my question is why I'm getting error below during the build step ?
Services supposed to be in the same network and their name resolution should work as expected...

Error: request to http://backend:1337/graphql failed, reason: getaddrinfo ENOTFOUND backend

I tried to login into a dummy alpine image and ping backend from it, worked as expected.

Any ideas?

Body:
So, I have 3 services: DB, backend, and frontend.

I made a docker-compose file to execute everything:

version: '3.9'
services:
  postgres:
    container_name: postgres
    image: postgres:14.6-alpine
    restart: always
    env_file:
      - .env.db
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgres/data/pgdata
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql
    networks:
      - website

  backend:
    container_name: backend
    build: ./backend
    restart: unless-stopped
    env_file: .env.backend
    ports:
      - "1337:1337"
    volumes:
      - ./backend/config:/opt/app/config
      - ./backend/src:/opt/app/src
      - ./backend/package.json:/opt/package.json
      - ./backend/yarn.lock:/opt/yarn.lock
      - ./backend/public/uploads:/opt/app/public/uploads
    networks:
      - website
    depends_on:
      - postgres

  frontend:
    build: ./frontend
    container_name: frontend
    ports:
      - "3000:3000"
    networks:
      - website
    depends_on:
      - backend

volumes:
  postgres-data:
    external: true

networks:
  website:
    driver: bridge

Here is my frontend/Dockerfile:

# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY yarn.lock* package*.json ./
RUN \
  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  elif [ -f package-lock.json ]; then npm ci; \
  else echo "Lockfile not found." && exit 1; \
  fi

# Rebuild the source code only when needed
FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_PUBLIC_API_URL http://backend:1337/graphql

RUN yarn build

FROM node:16-alpine AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]

Also I developed a custom shell script to make sure that backend is up and running before building the frontend.
General idea there is:

docker compose up -d postgres backend
**wait logic**
docker compose up -d frontend

So, my question is why I'm getting error below during the build step ?
Services supposed to be in the same network and their name resolution should work as expected...

Error: request to http://backend:1337/graphql failed, reason: getaddrinfo ENOTFOUND backend

I tried to login into a dummy alpine image and ping backend from it, worked as expected.

Any ideas?


问:
Would ternany computers be impervious to binary-coded worms/viruses?
I'm a computer noob pro writer brewing up a post digital-Dark Age story, and I wondered if ternary computation could be a workaround to some 'binary STUXnet-like super-bug bricking everything' scenario. I know the real costs of such a changeover would be huge, but that only helps me. What I want to understand are the precise hardware vs. software differences of binary vs. ternary systems, and whether their characteristics are 'apples and oranges' enough to support a selective technological reset after a big binary setback.

Imagine I was writing this for you, so it has to be believable enough that you would not hurl it across the room.

thanks,
KDA

I'm aware that there are already compilers that can run certain ternary parts of algos, but is the reverse the case? or could it be? What I'm looking for is some unique ternary characteristic that would immunize it against any bad binary bug.


问:
Stanze ca spacy, or how to Asse Euro Signs to spacy
Currently I try to measure specificity and text. Among other things I want to include Euro Sign as Money Value, but unfortunately spacy does only recognize a dollar sign.

I tried all the english packages of spacy:

https://spacy.io/models/en

But none of them includes Euro signs.

Would Stanza be better? I heard it takes more CPU Power and I have a lot of texts.

What I want to build in the end is a specificity measure for each of around 1k text files.

I.e.

Txt1 = Words xxx Specificity 0.0XX

Txt2 = ...

What would be the easiest way to achieve this? I dont need any Special names or organisations, the simple standard model with money values, Dates etc would suffice

Best regards


问:
INVALID SYNTAX while trying to run program on Google Colab
I have been trying to Load data from csv file to my python 3 code However it is showing invalid syntax error for line 8</p>
```<code>   ## Import the relevant libraries
   import pandas as pd
   import matplotlib.pyplot as plt
   import seaborn as sns
   sns.set()
   from sklearn.cluster import KMeans

   ## Load the data
   Load data from the csv file: <i> 'Countries_exercise.csv'</i>.

   # Load the data
   raw_data = pd.read_csv('Countries_exercise.csv')
   # Check the data
   raw_data
   Remove the duplicate index column from the dataset.
   data = raw_data.copy()
</code>```

Body:
I have been trying to Load data from csv file to my python 3 code However it is showing invalid syntax error for line 8

   ## Import the relevant libraries
   import pandas as pd
   import matplotlib.pyplot as plt
   import seaborn as sns
   sns.set()
   from sklearn.cluster import KMeans

   ## Load the data
   Load data from the csv file:  'Countries_exercise.csv'.

   # Load the data
   raw_data = pd.read_csv('Countries_exercise.csv')
   # Check the data
   raw_data
   Remove the duplicate index column from the dataset.
   data = raw_data.copy()


问:
Handling web-socket connections with Ejabberd
My usecase is to handle multiple websocket connections without any authorization and connect it to some pub-sub service for the communication. I have read in the ejabberd docs that it supports the websocket but I am not sure about how to implement it for my usecase or is that even possible?

I was able to create a websocket connection with ejabberd using postman but I had to add the credentials(which I don't want) and if I try to send any text message its throwing "parse error"


问:
Covariance and CS0266
We know that co-variance allows us to do things like this:

IEnumerable<object> objects;
IEnumerable<string> strings = new[] { "hello", "world" };
objects = strings;
```
<p>This code compiles, and works, due to co-variance.</p>
<p>However, if I use a bound generic, I get an error, as in the example:</p>
```void Test<T>(T blah) where T : ISerializable
{
    IEnumerable<T> x = new[] { blah };
    IEnumerable<ISerializable> y;
    y = x;
}
```
<p>Gives the following error</p>
```[CS0266] Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<T>' to 'System.Collections.Generic.IEnumerable<System.Runtime.Serialization.ISerializable>'.
An explicit conversion exists (are you missing a cast?)
```
<p>In my head, this should work. I suspected that this could be related to some incompatibility with value types, and this was true. If I change the signature to</p>
<pre class="lang-cs prettyprint-override"><code>void Test<T>(T blah) where T : class, ISerializable
</code>```

the code compiles with no errors.

But why? And how is this related to the error message?

Title: Covariance and CS0266

Body:
We know that co-variance allows us to do things like this:

IEnumerable<object> objects;
IEnumerable<string> strings = new[] { "hello", "world" };
objects = strings;

This code compiles, and works, due to co-variance.

However, if I use a bound generic, I get an error, as in the example:

void Test<T>(T blah) where T : ISerializable
{
    IEnumerable<T> x = new[] { blah };
    IEnumerable<ISerializable> y;
    y = x;
}

Gives the following error

[CS0266] Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<T>' to 'System.Collections.Generic.IEnumerable<System.Runtime.Serialization.ISerializable>'.
An explicit conversion exists (are you missing a cast?)

In my head, this should work. I suspected that this could be related to some incompatibility with value types, and this was true. If I change the signature to

void Test<T>(T blah) where T : class, ISerializable

the code compiles with no errors.

But why? And how is this related to the error message?


问:
Are these pip commands equivalent when installing packages from a local directory?
I have a situation where I need to download some Python packages on an internet-connected asset, then install them on a disconnected asset. Let's say I go through the following steps:

Create a requirements file, requirements.txt

Download packages to a local folder: py -m pip download -r "requirements.txt" -d "pkg_dir"

Move requirements.txt and pkg_dir to the disconnected asset

Install the packages from pkg_dir: here is my question

Is this command: py -m pip install -r "requirements.txt" --no-index --find-links "pkg_dir"

equivalent to this command: py -m pip install -r "requirements.txt" --index-url "pkg_dir"

The pip documentation states that the --index-url is the

Base URL of the Python Package Index (default https://pypi.org/simple). This should point to a repository compliant with PEP 503 (the simple repository API) or a local directory laid out in the same format.

(emphasis mine)

I'm just curious if these commands behave the same way when the "index URL" is a local folder. I know that the typical --no-index --find-links variant works as expected; this is just something I was wondering about.


问:
How can I use Vite to create a simple (one file) Typescript NPM package?
I would like to create a small open-source library and register it with NPM so that I can use it in my other projects. What is the best way to do this with Vite?
The library is pretty simple, it is a one file of Typescript. Ideally I just need to be able to:

Compile with typescript

Run tests (any testing framework as long as it is simple)

Package and deploy NPM package

Is there perhaps a simple (as in as few files as possible) template or some other way (maybe a blog post) that you would recommend?

Note: I've tried doing this with npm create vite@latest --> Vanilla --> Typescript. However this creates index.html and bunch of other files which I really do not need.  I would really like to keep it as simple as possible, I'm not interested in minification, tree-shaking ... kitchen sink etc. My library is pretty simple and only needs basic Javascript functionality, it does not use any browser (DOM) or node.js functionality.

Thanks in advance for any helpful reply.


问:
VBA to Archive Emails in Outlook
I'm using Microsoft Outlook for Office 365 (desktop app, not the web version).  My emails periodically archive to the Online Archive folder, which I like because I sometimes need to access archived stuff in the last few years from webmail.  But beyond a few years back, I manually move emails from the Online Archive folders into folders in .pst data files that are stored on my hard drive.

Unfortunately, the process of moving the files from the Online Archive to the .pst files is really slow/delicate.  If I select more than a couple weeks of emails to move at one time, that move process can take a really long time (hours).  And, maybe more of a problem, if I try to move more than a couple weeks of messages, Outlook will often crash (and I'm never confident that some emails weren't lost in the move).  So what I end up doing is manually moving just a few days of emails at a time, which eats up a lot of time and requires my attention.

I'd like to write a VBA subroutine where I could specify the source folder (inbox or sent folder from my Online Archive), target folder (folder in an open .pst file), and a year, and then the VBA would move all of the messages from the specified year from the source to target, but moving only a day of messages at a time (or maybe a few days at a time).

I know VBA for Access and Excel, but no idea really where to start with Outlook.  Much web searching has not really surfaced any useful info.

Title: VBA to Archive Emails in Outlook


问:
Angular 14 Cache reuse route custom element not working
I was working on Angular 14 application. As part of the development, I'm using custom elements to render when routing takes place. It's working as expected when I'm performing routing, but when I'm trying to use cache reuse route strategy the normal components are working fine but the component which has custom element it's not rendering.

I'm also using module federation, as part of it I'm creating bundle js file using gulp by creating MFE as a custom element.

It's working as expected when I perform normal routing, but when I would like to cache it, the MFE is not rendering.

Could someone provide a solution for this?

For example:

app.module.ts

```<code>{
 path: 'app-mfe',
 component: 'LoadMFEComponent'
}
</code>```

load-mfe.component.html

```<code><custom-mfe></custom-mfe>
</code>```

load-mfe.component.ts

```<code>export class LoadMFEComponent {
 constructor() {
  const _ele = document.createElement('script');
  _ele.type = 'text/javascript';
  _ele.async = true;
  _ele.src = './assets/js/compMfe.js';
  document.body.appendChild(_ele);
 }
}
</code>```

created this compMfe.js using gulp and placed under assets/js folder.

When I'm routing to this component it's working as expected but when I'm using CacheReuseRouteStrategy it's not working but for the other components it's working fine.

Body:
I was working on Angular 14 application. As part of the development, I'm using custom elements to render when routing takes place. It's working as expected when I'm performing routing, but when I'm trying to use cache reuse route strategy the normal components are working fine but the component which has custom element it's not rendering.

I'm also using module federation, as part of it I'm creating bundle js file using gulp by creating MFE as a custom element.

It's working as expected when I perform normal routing, but when I would like to cache it, the MFE is not rendering.

Could someone provide a solution for this?

For example:

app.module.ts

{
 path: 'app-mfe',
 component: 'LoadMFEComponent'
}

load-mfe.component.html

<custom-mfe></custom-mfe>

load-mfe.component.ts

export class LoadMFEComponent {
 constructor() {
  const _ele = document.createElement('script');
  _ele.type = 'text/javascript';
  _ele.async = true;
  _ele.src = './assets/js/compMfe.js';
  document.body.appendChild(_ele);
 }
}

created this compMfe.js using gulp and placed under assets/js folder.

When I'm routing to this component it's working as expected but when I'm using CacheReuseRouteStrategy it's not working but for the other components it's working fine.


问:
How to use Hyperlink in React Router dom Link
```<code>        <li>
          <Link2
            to="https://drive.google.com/file/d/12tcVPBcikN-s_HaD-GdjZrkbygLFv7td/view?usp=sharing">
            Resume
          </Link2>
        </li>
</code>```

I am trying to link My resume drive link but when I click the link it is showing a 404 error.
How do I use hyperlinks in the Link tags?

import { Link as Link1 } from 'react-scroll'; import { Link as Link2 } from 'react-router-dom';

I imported the Link as Link2.

```<code>          <Link2
            to={`https://drive.google.com/file/d/12tcVPBcikN-s_HaD-GdjZrkbygLFv7td/view?usp=sharing`}>
            Resume
          </Link2>
        </li>
</code>```

I tried this way. I also tried to use the Anchor tag inside Link but it only works when I manually right-click and open the link in a new tab.

Body:
          <Link2
            to="https://drive.google.com/file/d/12tcVPBcikN-s_HaD-GdjZrkbygLFv7td/view?usp=sharing">
            Resume
          </Link2>

I am trying to link My resume drive link but when I click the link it is showing a 404 error.
How do I use hyperlinks in the Link tags?

import { Link as Link1 } from 'react-scroll'; import { Link as Link2 } from 'react-router-dom';

I imported the Link as Link2.

          <Link2
            to={`https://drive.google.com/file/d/12tcVPBcikN-s_HaD-GdjZrkbygLFv7td/view?usp=sharing`}>
            Resume
          </Link2>

I tried this way. I also tried to use the Anchor tag inside Link but it only works when I manually right-click and open the link in a new tab.


问:
why the return statement inside main function is terminating unexpectedly?
I have a requirement wherein I have to perform multiple pyspark transformations and write it to a parquet file. But below are the conditions:

there are in total 2 files, but at a time either one of them or both could be supplied by the user.

when x_path file is given then if i == x_path and x_path != "null" block should be executed and written to a destination for x_path only.

when its l_path, then elif i == l_path and l_path != "null" block should be executed and written to a destination for l_path only.

when both the files are passed then if x_path != "null" and l_path != "null" block should be executed and written to a destination for both files combined.

Since I am using pytest for integration testing, writing in the destination shouldn't happen. But the final DF (append_l_x_df) should be returned.

Below is the code snippet. I have tried to make it as close to my actual requirement as possible.

```<code>def main(x_path, l_path, y_path, test=False):
    for i in [x_path, l_path]:
      if i == x_path and x_path != "null":
        if not test:
          p_df = func.read_parquet_file(x_path)
        elif test:
            p_df = func.create_spark_dataframe_with_schema(test_p.test_data, test_p.x_schema)
        rename_cols_df = p_df.withColumnRenamed(existingName, newNam)
        return rename_prem_cols_df

        if x_path != "null" and  l_path == "null":
          if not test:
            c_time = func.get_current_timestamp_for_curate_container()
            c_path = <destination_path>
            func.write_df_as_parquet_file(rename_cols_df, c_path, logger)

      elif i == l_path and l_path != "null":
        if not test:
          l_df = func.read_parquet_file(l_path)
        elif test:
          l_df = func.create_spark_dataframe_with_schema(test_p.l_test_data, test_p.l_schema)
        split_yr_mnth_qtr_df = func.split_yr_mnth_qtr(rename_ldr_cols_df, "Date", "Year", "Month", "Quarter"
        return split_yr_mnth_qtr_df

        if x_path == "null" and  l_path != "null":
          if not test:
            c_time = func.get_current_timestamp_for_curate_container()
            c_path = <destination_path>
            func.write_df_as_parquet_file(split_yr_mnth_qtr_df, c_path, logger)

    if test:
      if x_path != "null" and l_path != "null":
          append_l_x_df = func.union_df([rename_cols_df, split_yr_mnth_qtr_df])
          return append_l_x_df

      elif not test:
        if x_path != "null" and l_path != "null":
          append_l_x_df = func.union_df([rename_cols_df, split_yr_mnth_qtr_df])
          c_time = func.get_current_timestamp_for_curate_container()
          c_path = <destination_path>

          # Write final data to Curate zone
          func.write_df_as_parquet_file(append_l_x_df, c_path, logger)

if __name__ == '__main__':
  main(x_path, l_path, y_path, test=False)
</code>```

My problem is when I am executing my test file through pytest, the main python file with above code snippet is executed, but getting terminated at the very first return statement return rename_prem_cols_df. Hence my test case(s) are failing. Below are the reason.

For my test scenario, I have created set of expected schema, which has 26 columns. Those 26 columns are present in the final combined DF, which is append_l_x_df.

Since the program is getting terminated at return rename_prem_cols_df, so my test is failing, because this DF has different sets of column count.

Note:

At the time of testing, I am passing 2 files. so, ideally the program should come till the end where we have append_l_x_df DF.

I think that I have not used the return statement at the right places. But not sure if that could be the issue.

the sample pyspark transformation which I have mentioned in the code snippet is supposed to execute whether or not test=True, ie, the transformation should execute even if test mode is False. This part is taken care already as seen in the above snippet.

Body:
I have a requirement wherein I have to perform multiple pyspark transformations and write it to a parquet file. But below are the conditions:

there are in total 2 files, but at a time either one of them or both could be supplied by the user.

when x_path file is given then if i == x_path and x_path != "null" block should be executed and written to a destination for x_path only.

when its l_path, then elif i == l_path and l_path != "null" block should be executed and written to a destination for l_path only.

when both the files are passed then if x_path != "null" and l_path != "null" block should be executed and written to a destination for both files combined.

Since I am using pytest for integration testing, writing in the destination shouldn't happen. But the final DF (append_l_x_df) should be returned.

Below is the code snippet. I have tried to make it as close to my actual requirement as possible.

def main(x_path, l_path, y_path, test=False):
    for i in [x_path, l_path]:
      if i == x_path and x_path != "null":
        if not test:
          p_df = func.read_parquet_file(x_path)
        elif test:
            p_df = func.create_spark_dataframe_with_schema(test_p.test_data, test_p.x_schema)
        rename_cols_df = p_df.withColumnRenamed(existingName, newNam)
        return rename_prem_cols_df

        if x_path != "null" and  l_path == "null":
          if not test:
            c_time = func.get_current_timestamp_for_curate_container()
            c_path = <destination_path>
            func.write_df_as_parquet_file(rename_cols_df, c_path, logger)

      elif i == l_path and l_path != "null":
        if not test:
          l_df = func.read_parquet_file(l_path)
        elif test:
          l_df = func.create_spark_dataframe_with_schema(test_p.l_test_data, test_p.l_schema)
        split_yr_mnth_qtr_df = func.split_yr_mnth_qtr(rename_ldr_cols_df, "Date", "Year", "Month", "Quarter"
        return split_yr_mnth_qtr_df

        if x_path == "null" and  l_path != "null":
          if not test:
            c_time = func.get_current_timestamp_for_curate_container()
            c_path = <destination_path>
            func.write_df_as_parquet_file(split_yr_mnth_qtr_df, c_path, logger)

    if test:
      if x_path != "null" and l_path != "null":
          append_l_x_df = func.union_df([rename_cols_df, split_yr_mnth_qtr_df])
          return append_l_x_df

      elif not test:
        if x_path != "null" and l_path != "null":
          append_l_x_df = func.union_df([rename_cols_df, split_yr_mnth_qtr_df])
          c_time = func.get_current_timestamp_for_curate_container()
          c_path = <destination_path>

          # Write final data to Curate zone
          func.write_df_as_parquet_file(append_l_x_df, c_path, logger)

if __name__ == '__main__':
  main(x_path, l_path, y_path, test=False)

My problem is when I am executing my test file through pytest, the main python file with above code snippet is executed, but getting terminated at the very first return statement return rename_prem_cols_df. Hence my test case(s) are failing. Below are the reason.

For my test scenario, I have created set of expected schema, which has 26 columns. Those 26 columns are present in the final combined DF, which is append_l_x_df.

Since the program is getting terminated at return rename_prem_cols_df, so my test is failing, because this DF has different sets of column count.

Note:

At the time of testing, I am passing 2 files. so, ideally the program should come till the end where we have append_l_x_df DF.

I think that I have not used the return statement at the right places. But not sure if that could be the issue.

the sample pyspark transformation which I have mentioned in the code snippet is supposed to execute whether or not test=True, ie, the transformation should execute even if test mode is False. This part is taken care already as seen in the above snippet.


问:
how to auto increment cell id's when cloning table row using JavaScript?
I'm trying to create a function in java script to add a row to a table by incrementing the id, I have two selects,
1- first select we select course or training
2- title depending on first select for example when I choose course in title I will have all the courses
my problem is that when i click on add new row it adds the row but it does not change title

function addNewRow(tabl) {
    this.event.preventDefault();
    let tab = document.getElementById(tabl);
    let rowCount = tab.rows.length;
    let cellCount = tab.rows[0].cells.length;
    let row = tab.insertRow(rowCount);
    for (let i = 0; i < cellCount; i++) {
        let cell = row.insertCell(i);
        if (i < cellCount - 1) {
            //cell.innerHTML='';
            cell.innerHTML = tab.rows[1].cells[i].innerHTML;
        } else {
            cell.innerHTML = '';
        }
    }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="table-responsive">
                        <label for="objetinscription"><h4>Vos Objet D'inscription</h4></label>
                        <table class="table table-hover" id="objetinscription">
                            <caption>
                                <button class="parene-btn bg-bleu" onclick="addNewRow('objetinscription')">Ajouter</button>
                            </caption>
                            <thead>
                            <tr>
                                <th>Cours</th>
                                <th>Intitulé</th>
                                <th></th>
                            </tr>
                            </thead>
                            <tr>
                                <td><select class="form-select" id="typecours" onchange="onchange_inscription()" name="cours[]">
                                        <option selected value="">-- Faites votre choix --</option>
                                        <option value="Cours">Cours</option>
                                        <option value="Formation">Formation</option>
                                    </select>

                                </td>
                                <td>
                                    <select id="intitule" name="intitule[]" class="form-select">

                                    </select>
                                </td>

                                <td>
                                    <input class="blue" type="button" class="btn" value="Supprimer" onclick="deleteRow('objetinscription',this)"/>
                                </td>
                            </tr>

                        </table>
                    </div></code>```

Body:
I'm trying to create a function in java script to add a row to a table by incrementing the id, I have two selects,
1- first select we select course or training
2- title depending on first select for example when I choose course in title I will have all the courses
my problem is that when i click on add new row it adds the row but it does not change title

function addNewRow(tabl) {
    this.event.preventDefault();
    let tab = document.getElementById(tabl);
    let rowCount = tab.rows.length;
    let cellCount = tab.rows[0].cells.length;
    let row = tab.insertRow(rowCount);
    for (let i = 0; i < cellCount; i++) {
        let cell = row.insertCell(i);
        if (i < cellCount - 1) {
            //cell.innerHTML='';
            cell.innerHTML = tab.rows[1].cells[i].innerHTML;
        } else {
            cell.innerHTML = '';
        }
    }
}

Vos Objet D'inscription

                                <button class="parene-btn bg-bleu" onclick="addNewRow('objetinscription')">Ajouter</button>

                                Cours
                                Intitulé

                                <select class="form-select" id="typecours" onchange="onchange_inscription()" name="cours[]">
                                        <option selected value="">-- Faites votre choix --</option>
                                        <option value="Cours">Cours</option>
                                        <option value="Formation">Formation</option>
                                    </select>

                                    <select id="intitule" name="intitule[]" class="form-select">

                                    </select>

                                    <input class="blue" type="button" class="btn" value="Supprimer" onclick="deleteRow('objetinscription',this)"/>


问:
What is Microsoft.Common.CurrentVersion.targets and what is it used for?
I was in hot pursuit of a big mystery in a Visual Studio 2022 C# testing project that I didn't originally create.  I couldn't figure out how a certain EXE in a folder was making its way into the bin folder when I did a build.  This EXE was not being produced by the build, but was part of an external tool that happened to be in a Lib folder within the solution folder.  I had removed a reference to this EXE from the csproj file and thought everything was good to go to prevent it from being copied to bin.  However, every time I would do a build, that same exe file would still get copied to my bin folder.  I could not figure out for the life of me how this EXE file was getting copied into the bin folder.  There was a DLL that I was using that the EXE also uses, but I didn't think including that DLL in my project would cause the EXE to get copied with it.

Finally I decided to create a dummy file in the bin folder with the same EXE name and make it read-only.  I did the build and suddenly a file-write error occurred in C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets file.

So, I had found the culprit, but then it raised a question..., What exactly is C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets doing?  Is it somehow automatically copying files into the bin folder?  Seems like there is some black magic going on behind the scenes at it is confusing the heck out of me!


问:
Spring Session JDBC not respecting Expired Attribute
Trying to integrate Spring Session into a grails app.  Successfully have gotten the sessions to persist on the back end and now I am looking at trying to manually expire sessions.

The problem is when I expire a session manually as shown below.  I am not logged out of the application.  Further more, when I interrogate the session object, it thinks that it is not expired.

Am I doing something wrong?

```<code>// Gets my user
def user = ctx.springSecurityService.getPrincipal()

// Gets my current session
SpringSessionBackedSessionInformation session = ctx.sessionRegistry.getAllSessions(user, false)[0]

// Expires my session (Can see change in database)
session.expireNow()

// returns false.  When I look at the code for the method it is only checking if the session has
// expired due to a timeout
session.session.isExpired()
</code>```

I tried looking through the docs on Spring Session for Expiry and didn't see anything for JDBC specifically.  Thought I'd post it to see if anyone out there is well versed in Spring Session.

Body:
Trying to integrate Spring Session into a grails app.  Successfully have gotten the sessions to persist on the back end and now I am looking at trying to manually expire sessions.

The problem is when I expire a session manually as shown below.  I am not logged out of the application.  Further more, when I interrogate the session object, it thinks that it is not expired.

Am I doing something wrong?

// Gets my user
def user = ctx.springSecurityService.getPrincipal()

// Gets my current session
SpringSessionBackedSessionInformation session = ctx.sessionRegistry.getAllSessions(user, false)[0]

// Expires my session (Can see change in database)
session.expireNow()

// returns false.  When I look at the code for the method it is only checking if the session has
// expired due to a timeout
session.session.isExpired()

I tried looking through the docs on Spring Session for Expiry and didn't see anything for JDBC specifically.  Thought I'd post it to see if anyone out there is well versed in Spring Session.


问:
Maintaining date information when placing boxplots along the x-axis using plotly in r
When placing boxplots along the x-axis using plotly in r, I would like to preserve the date information as the distance between boxes, rather than treating dates as factors and squeezing them uniformly.

I can produce the desired layout if I use the date to specify the color, but I feel there is likely a more 'correct' way to do this.

Thanks all!

```<code>library(tidyverse)
library(plotly)

randomdates <- sample(seq(as.Date('1999/01/01'), as.Date('2000/01/01'), by="day"), 12)
df          <- data.frame( dates = rep(randomdates, 100), value = sample(1:10, 1200, replace = T)) %>% arrange(dates)

plot_ly(df, y = ~value, color = ~as.factor(dates), type = 'box') # produces the layout that I want
plot_ly(df, y = ~value, x = ~as.factor(dates), type = 'box') # puts even spaces between plots
</code>```

Body:
When placing boxplots along the x-axis using plotly in r, I would like to preserve the date information as the distance between boxes, rather than treating dates as factors and squeezing them uniformly.

I can produce the desired layout if I use the date to specify the color, but I feel there is likely a more 'correct' way to do this.

Thanks all!

library(tidyverse)
library(plotly)

randomdates <- sample(seq(as.Date('1999/01/01'), as.Date('2000/01/01'), by="day"), 12)
df          <- data.frame( dates = rep(randomdates, 100), value = sample(1:10, 1200, replace = T)) %>% arrange(dates)

plot_ly(df, y = ~value, color = ~as.factor(dates), type = 'box') # produces the layout that I want
plot_ly(df, y = ~value, x = ~as.factor(dates), type = 'box') # puts even spaces between plots


问:
How to run elevated as different user in AutohotKey?
I try to run osk as a different user in AutohotKey.

```<code>RunAs, MyUser, MyPassword
Run osk
</code>```

=> The requested operation requires elevation, so changed to

```<code>RunAs, MyUser, MyPassword
Run *runas osk
</code>```

=> System verbs unsupported with RunAs

I have checked on this and the forum says I need to install AutohotKey with UAC on, which I did. But still no luck.

Any ideas?

Private remark, related to my post on SU

Body:
I try to run osk as a different user in AutohotKey.

RunAs, MyUser, MyPassword
Run osk

=> The requested operation requires elevation, so changed to

RunAs, MyUser, MyPassword
Run *runas osk

=> System verbs unsupported with RunAs

I have checked on this and the forum says I need to install AutohotKey with UAC on, which I did. But still no luck.

Any ideas?

Private remark, related to my post on SU


问:
i want to click to spesific location on minimized window
I have an clicker script and it's working well for working with cursor

but I want this :

1-my cursor WON'T move

2-the script will click on my coordinates

```<code>import time
import win32gui
import win32api
import win32con

wdname = 'myexe'

hwnd = win32gui.FindWindow(None, wdname) # parent handle
print(hwnd)

def control_click(x, y, handle, button):

    l_param = win32api.MAKELONG(x, y)

    if button == 'left':
        win32gui.PostMessage(handle, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, l_param)
        win32gui.PostMessage(handle, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, l_param)

    elif button == 'right':
         win32gui.PostMessage(handle, win32con.WM_RBUTTONDOWN, 0, l_param)
         win32gui.PostMessage(handle, win32con.WM_RBUTTONUP, 0, l_param)

control_click(x, y, 1769574, button ='left')
</code>```

that is my code hope u will help :)

Body:
I have an clicker script and it's working well for working with cursor

but I want this :

1-my cursor WON'T move

2-the script will click on my coordinates

import time
import win32gui
import win32api
import win32con

wdname = 'myexe'

hwnd = win32gui.FindWindow(None, wdname) # parent handle
print(hwnd)

def control_click(x, y, handle, button):

    l_param = win32api.MAKELONG(x, y)

    if button == 'left':
        win32gui.PostMessage(handle, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, l_param)
        win32gui.PostMessage(handle, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, l_param)

    elif button == 'right':
         win32gui.PostMessage(handle, win32con.WM_RBUTTONDOWN, 0, l_param)
         win32gui.PostMessage(handle, win32con.WM_RBUTTONUP, 0, l_param)

control_click(x, y, 1769574, button ='left')

that is my code hope u will help :)


问:
How Can I Check For A Value Not Being In A Set?
I'm trying to use TLA+ to model a system.  This is a simplified version of the model I'm trying to build; I'm posting the simplified version because I think it's adequate to demonstrate my question:

```<code>---- MODULE demonstrate_question ----

VARIABLE msg_queue

vars == <<msg_queue>>

request == {"request"}
response == {"response"}

InsertToQueue(message, queue) ==
    queue \union message

RemoveFromQueue(message, queue) ==
    queue \ message

IsMessageInQueue(message, queue) ==
    message \in queue

MessageNotInQueue(message, queue) ==
(* Also tried ~(IsMessageInQueue(message, queue)); also failed *)
    message \notin queue

NewMessage(message, queue) ==
(* Also tried /\ message \notin queue; failed *)
    MessageNotInQueue(message,msg_queue)

Init ==
    /\ msg_queue = {}

RequestReceived(message) ==
    /\ NewMessage(message, msg_queue)
    /\ msg_queue' = InsertToQueue(message, msg_queue)

Next ==
    \/ RequestReceived(request)

Spec == Init \/ [][Next]_vars
====
</code>```

When I attempt to check the model I get this error:

```<code>The exception was a java.lang.RuntimeException
: Attempted to compare the set {"request"} with the value:
"request"
</code>```

And the stack trace points to the NewMessage call inside RequestReceived. In fact I can comment out the NewMessage call and there's no error. I want the NewMessage call to insure it's not a message I've already got in the queue.

Any suggestions of what I might do to check to see if a particular value is not in a set?  I'm testing this with VSCode and I have the feeling that either VSCode or the TLC model checker is caching some things but I'm not sure that factors in here.

Body:
I'm trying to use TLA+ to model a system.  This is a simplified version of the model I'm trying to build; I'm posting the simplified version because I think it's adequate to demonstrate my question:

---- MODULE demonstrate_question ----

VARIABLE msg_queue

vars == <<msg_queue>>

request == {"request"}
response == {"response"}

InsertToQueue(message, queue) ==
    queue \union message

RemoveFromQueue(message, queue) ==
    queue \ message

IsMessageInQueue(message, queue) ==
    message \in queue

MessageNotInQueue(message, queue) ==
(* Also tried ~(IsMessageInQueue(message, queue)); also failed *)
    message \notin queue

NewMessage(message, queue) ==
(* Also tried /\ message \notin queue; failed *)
    MessageNotInQueue(message,msg_queue)

Init ==
    /\ msg_queue = {}

RequestReceived(message) ==
    /\ NewMessage(message, msg_queue)
    /\ msg_queue' = InsertToQueue(message, msg_queue)

Next ==
    \/ RequestReceived(request)

Spec == Init \/ [][Next]_vars
====

When I attempt to check the model I get this error:

The exception was a java.lang.RuntimeException
: Attempted to compare the set {"request"} with the value:
"request"

And the stack trace points to the NewMessage call inside RequestReceived. In fact I can comment out the NewMessage call and there's no error. I want the NewMessage call to insure it's not a message I've already got in the queue.

Any suggestions of what I might do to check to see if a particular value is not in a set?  I'm testing this with VSCode and I have the feeling that either VSCode or the TLC model checker is caching some things but I'm not sure that factors in here.


问:
Performance varies depending on how PostgreSQL function is called
I'm calling a function that "RETURNS INTEGER".

I've noticed that it executes faster if I call it like this:

SELECT * FROM MyFunction;

The other ways to call it which are slower are like this:
2. SELECT MyFunction;
3. SELECT FROM MyFunction;

Does anybody know if there is a reason for this behavior?
I'm thinking there must be something else happening that's unrelated to how the function is called.

I executed this function many many times and used every combination regarding the order -- meaning 1 2 3, 1 3 2, 2 1 3, 2 3 1, 3 1 2, 3 2 1.  It's consistently showing superior performance when executed using method #1.


问:
Some troubles with imported fonts in webpack5
Need help. I have some alerts in F12-mode in Chrome. Something wrong with generated font urls. I see, that "/" is missing, but I cant understand where exactly in the config it needs to be taken into

GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-regular.3c59762f44fc47f9.woff2 net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-700.197d5bcc87b1c4d1.woff2 net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-700.482417918467e4ff.woff net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-regular.a7d1d96be5a03ab0.woff net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-700.c79fd14cdad0cc10.ttf net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-regular.e612876c4c643542.ttf net::ERR_ABORTED 404 (Not Found)

I think something wrong with my webpack.config.js.

```<code>const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const FileManagerPlugin = require('filemanager-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');

module.exports = {
    entry: path.join(__dirname, 'src', 'index.js'),
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'index.[contenthash:16].js',
        assetModuleFilename: path.join('images', '[name].[contenthash:16][ext]'),
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: 'babel-loader',
                exclude: /node_modules/,
            },
            {
                test: /\.pug$/,
                loader: 'pug-loader',
            },
            {
                test: /\.(scss|css)$/,
                use: [
                    MiniCssExtractPlugin.loader,
                    'css-loader',
                    'postcss-loader',
                    'sass-loader',
                ],
            },
            {
                test: /\.(png|jpg|jpeg|gif)$/i,
                type: 'asset/resource',
            },
            {
                test: /\.svg$/,
                type: 'asset/resource',
                generator: {
                    filename: path.join('icons', '[name].[contenthash:16][ext]'),
                },
            },
            {
                test: /\.(woff2?|eot|ttf|otf)$/i,
                type: 'asset/resource',
                generator: {
                    filename: path.join('fonts', '[name].[contenthash:16][ext]'),
                }
            },
        ],
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: path.join(__dirname, 'src', 'template.pug'),
            filename: 'index.html',
        }),
        new FileManagerPlugin({
            events: {
                onStart: {
                    delete: ['dist'],
                },
                onEnd: {
                    copy: [
                        {
                            source: path.join('src', 'static'),
                            destination: 'dist',
                        },
                    ],
                },
            },
        }),
        new MiniCssExtractPlugin({
            filename: '[name].[contenthash:16].css',
        }),
    ],
    devServer: {
        watchFiles: path.join(__dirname, 'src'),
        port: 9000,
    },
    optimization: {
        minimizer: [
            new ImageMinimizerPlugin({
                minimizer: {
                    implementation: ImageMinimizerPlugin.imageminMinify,
                    options: {
                        plugins: [
                            ['gifsicle', { interlaced: true }],
                            ['jpegtran', { progressive: true }],
                            ['optipng', { optimizationLevel: 5 }],
                            ['svgo', { name: 'preset-default' }],
                        ],
                    },
                },
            }),
        ],
    },
};
</code>```

And, for example, generated fonts.scss file

```<code>/* https://gwfh.mranftl.com/
open-sans-regular - latin_cyrillic */

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: url('./open-sans-v34-latin_cyrillic-regular.eot'); /* IE9 Compat Modes */
  src: local(''),
  url('./open-sans-v34-latin_cyrillic-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('./open-sans-v34-latin_cyrillic-regular.woff2') format('woff2'), /* Super Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-regular.woff') format('woff'), /* Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-regular.ttf') format('truetype'), /* Safari, Android, iOS */
  url('./open-sans-v34-latin_cyrillic-regular.svg#OpenSans') format('svg'); /* Legacy iOS */
}
/* open-sans-700 - latin_cyrillic */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 700;
  src: url('./open-sans-v34-latin_cyrillic-700.eot'); /* IE9 Compat Modes */
  src: local(''),
  url('./open-sans-v34-latin_cyrillic-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('./open-sans-v34-latin_cyrillic-700.woff2') format('woff2'), /* Super Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-700.woff') format('woff'), /* Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-700.ttf') format('truetype'), /* Safari, Android, iOS */
  url('./open-sans-v34-latin_cyrillic-700.svg#OpenSans') format('svg'); /* Legacy iOS */
}
/* open-sans-italic - latin_cyrillic */
@font-face {
  font-family: 'Open Sans';
  font-style: italic;
  font-weight: 400;
  src: url('./open-sans-v34-latin_cyrillic-italic.eot'); /* IE9 Compat Modes */
  src: local(''),
  url('./open-sans-v34-latin_cyrillic-italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('./open-sans-v34-latin_cyrillic-italic.woff2') format('woff2'), /* Super Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-italic.woff') format('woff'), /* Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-italic.ttf') format('truetype'), /* Safari, Android, iOS */
  url('./open-sans-v34-latin_cyrillic-italic.svg#OpenSans') format('svg'); /* Legacy iOS */
}
/* open-sans-700italic - latin_cyrillic */
@font-face {
  font-family: 'Open Sans';
  font-style: italic;
  font-weight: 700;
  src: url('./open-sans-v34-latin_cyrillic-700italic.eot'); /* IE9 Compat Modes */
  src: local(''),
  url('./open-sans-v34-latin_cyrillic-700italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('./open-sans-v34-latin_cyrillic-700italic.woff2') format('woff2'), /* Super Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-700italic.woff') format('woff'), /* Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-700italic.ttf') format('truetype'), /* Safari, Android, iOS */
  url('./open-sans-v34-latin_cyrillic-700italic.svg#OpenSans') format('svg'); /* Legacy iOS */
}
</code>```

The only thing that came to mind was to write the path to the folder with fonts in 'dist' after build, but this didnt help

```<code>generator: {
                    filename: path.join('fonts', '[name].[contenthash:16][ext]'),
                }
</code>```

Body:
Need help. I have some alerts in F12-mode in Chrome. Something wrong with generated font urls. I see, that "/" is missing, but I cant understand where exactly in the config it needs to be taken into

GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-regular.3c59762f44fc47f9.woff2 net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-700.197d5bcc87b1c4d1.woff2 net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-700.482417918467e4ff.woff net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-regular.a7d1d96be5a03ab0.woff net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-700.c79fd14cdad0cc10.ttf net::ERR_ABORTED 404 (Not Found) main.3c39802aaceabaab.css:1          GET http://localhost:9000/fontsopen-sans-v34-latin_cyrillic-regular.e612876c4c643542.ttf net::ERR_ABORTED 404 (Not Found)

I think something wrong with my webpack.config.js.

const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const FileManagerPlugin = require('filemanager-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');

module.exports = {
    entry: path.join(__dirname, 'src', 'index.js'),
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'index.[contenthash:16].js',
        assetModuleFilename: path.join('images', '[name].[contenthash:16][ext]'),
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: 'babel-loader',
                exclude: /node_modules/,
            },
            {
                test: /\.pug$/,
                loader: 'pug-loader',
            },
            {
                test: /\.(scss|css)$/,
                use: [
                    MiniCssExtractPlugin.loader,
                    'css-loader',
                    'postcss-loader',
                    'sass-loader',
                ],
            },
            {
                test: /\.(png|jpg|jpeg|gif)$/i,
                type: 'asset/resource',
            },
            {
                test: /\.svg$/,
                type: 'asset/resource',
                generator: {
                    filename: path.join('icons', '[name].[contenthash:16][ext]'),
                },
            },
            {
                test: /\.(woff2?|eot|ttf|otf)$/i,
                type: 'asset/resource',
                generator: {
                    filename: path.join('fonts', '[name].[contenthash:16][ext]'),
                }
            },
        ],
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: path.join(__dirname, 'src', 'template.pug'),
            filename: 'index.html',
        }),
        new FileManagerPlugin({
            events: {
                onStart: {
                    delete: ['dist'],
                },
                onEnd: {
                    copy: [
                        {
                            source: path.join('src', 'static'),
                            destination: 'dist',
                        },
                    ],
                },
            },
        }),
        new MiniCssExtractPlugin({
            filename: '[name].[contenthash:16].css',
        }),
    ],
    devServer: {
        watchFiles: path.join(__dirname, 'src'),
        port: 9000,
    },
    optimization: {
        minimizer: [
            new ImageMinimizerPlugin({
                minimizer: {
                    implementation: ImageMinimizerPlugin.imageminMinify,
                    options: {
                        plugins: [
                            ['gifsicle', { interlaced: true }],
                            ['jpegtran', { progressive: true }],
                            ['optipng', { optimizationLevel: 5 }],
                            ['svgo', { name: 'preset-default' }],
                        ],
                    },
                },
            }),
        ],
    },
};

And, for example, generated fonts.scss file

/* https://gwfh.mranftl.com/
open-sans-regular - latin_cyrillic */

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: url('./open-sans-v34-latin_cyrillic-regular.eot'); /* IE9 Compat Modes */
  src: local(''),
  url('./open-sans-v34-latin_cyrillic-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('./open-sans-v34-latin_cyrillic-regular.woff2') format('woff2'), /* Super Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-regular.woff') format('woff'), /* Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-regular.ttf') format('truetype'), /* Safari, Android, iOS */
  url('./open-sans-v34-latin_cyrillic-regular.svg#OpenSans') format('svg'); /* Legacy iOS */
}
/* open-sans-700 - latin_cyrillic */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 700;
  src: url('./open-sans-v34-latin_cyrillic-700.eot'); /* IE9 Compat Modes */
  src: local(''),
  url('./open-sans-v34-latin_cyrillic-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('./open-sans-v34-latin_cyrillic-700.woff2') format('woff2'), /* Super Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-700.woff') format('woff'), /* Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-700.ttf') format('truetype'), /* Safari, Android, iOS */
  url('./open-sans-v34-latin_cyrillic-700.svg#OpenSans') format('svg'); /* Legacy iOS */
}
/* open-sans-italic - latin_cyrillic */
@font-face {
  font-family: 'Open Sans';
  font-style: italic;
  font-weight: 400;
  src: url('./open-sans-v34-latin_cyrillic-italic.eot'); /* IE9 Compat Modes */
  src: local(''),
  url('./open-sans-v34-latin_cyrillic-italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('./open-sans-v34-latin_cyrillic-italic.woff2') format('woff2'), /* Super Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-italic.woff') format('woff'), /* Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-italic.ttf') format('truetype'), /* Safari, Android, iOS */
  url('./open-sans-v34-latin_cyrillic-italic.svg#OpenSans') format('svg'); /* Legacy iOS */
}
/* open-sans-700italic - latin_cyrillic */
@font-face {
  font-family: 'Open Sans';
  font-style: italic;
  font-weight: 700;
  src: url('./open-sans-v34-latin_cyrillic-700italic.eot'); /* IE9 Compat Modes */
  src: local(''),
  url('./open-sans-v34-latin_cyrillic-700italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('./open-sans-v34-latin_cyrillic-700italic.woff2') format('woff2'), /* Super Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-700italic.woff') format('woff'), /* Modern Browsers */
  url('./open-sans-v34-latin_cyrillic-700italic.ttf') format('truetype'), /* Safari, Android, iOS */
  url('./open-sans-v34-latin_cyrillic-700italic.svg#OpenSans') format('svg'); /* Legacy iOS */
}

The only thing that came to mind was to write the path to the folder with fonts in 'dist' after build, but this didnt help

generator: {
                    filename: path.join('fonts', '[name].[contenthash:16][ext]'),
                }


问:
Excel Date on Axis
I'm creating a graph with 5 sorts of data that should have in horizontal axis only 2 values, "10/22" and "11/22" (two dates).

The problem I'm facing is than the Excel creates a strange axis, as you can see:

How can I, for example, show only horizontal for 09/22-10/22-11/22-12/22?

This is the Axis configuration:

Thanks

Title: Excel Date on Axis


问:
Excel "spill range is unknown" with limited possible range
I'm having some trouble figuring out why I'm frequently getting spill errors.  Here's the deal:  I have column C with exactly 200 elements that take the form "x -- y" where x and y are positive integers each generated by the RANDBETWEEN function.  Then in cell D2 I use the UNIQUE function create a spilled array out of the column C contents.  But about 60% of the time I get a SPILL error, "Spill range is unknown".  I get that there is some variability in the length of the array, but it can't ever be over 200.  It doesn't make sense to me that this error would occur when there is a strict upper limit.  FWIW, the UNIQUE formula is:

=UNIQUE(C2:C200)

I could see that there might be a problem with C:C instead of C2:200, but not with the way this is set up.  Any suggestions?  Thank you.


问:
Python how to determine if a subprocess is already running?
I'm able to create a subprocess.

```<code>process = subprocess.Popen(
    [
        r"C:\Program Files\BlueStacks_nxt\HD-Player.exe",
        "--instance",
        "Nougat32",
        "--cmd",
        "launchApp",
        "--package",
        "com.supercell.clashofclans",
    ],
    stderr=subprocess.PIPE,
)
</code>```

However, I only want to create one if there isn't one that already exists. If there is one that exists, I want to focus on the window and not create a new process. Is there a way I can achieve this?

Body:
I'm able to create a subprocess.

process = subprocess.Popen(
    [
        r"C:\Program Files\BlueStacks_nxt\HD-Player.exe",
        "--instance",
        "Nougat32",
        "--cmd",
        "launchApp",
        "--package",
        "com.supercell.clashofclans",
    ],
    stderr=subprocess.PIPE,
)

However, I only want to create one if there isn't one that already exists. If there is one that exists, I want to focus on the window and not create a new process. Is there a way I can achieve this?


问:
Machine to Machine Dynamic Application Registration with Auth0

I first asked this question over at https://community.auth0.com/, but
re-iterating here to reach a wider audience,

https://community.auth0.com/t/machine-to-machine-dynamic-application-registration/96639

I'm wondering, how can I specify a dynamically created client as type Machine-to-Machine (for use with an API) at creation time? My high-level goal is to allow developers the ability to create their own applications, then use the client credentials flow to access information via a resource server, as per OIDC spec.

Seems like every approach requires me to manually update a "Generic" dynamic application. For instance, I can do something like

```<code>curl --request POST \
  --url 'https://<tenant>.us.auth0.com/oidc/register' \
  --header 'content-type: application/json' \
  --data '{"client_name":"My Dynamic Application","redirect_uris": ["https://application.example.com/callback", "https://application.example.com/callback2"] }'
</code>```

But then it defaults My Dynamic Application to type "Generic". Ideally, i'd like to specify something like { "app_type": "m2m" }, and be able to "extend" the functionality of the oidc/register endpoint.

Body:
I first asked this question over at https://community.auth0.com/, but
re-iterating here to reach a wider audience,

https://community.auth0.com/t/machine-to-machine-dynamic-application-registration/96639

I'm wondering, how can I specify a dynamically created client as type Machine-to-Machine (for use with an API) at creation time? My high-level goal is to allow developers the ability to create their own applications, then use the client credentials flow to access information via a resource server, as per OIDC spec.

Seems like every approach requires me to manually update a "Generic" dynamic application. For instance, I can do something like

curl --request POST \
  --url 'https://<tenant>.us.auth0.com/oidc/register' \
  --header 'content-type: application/json' \
  --data '{"client_name":"My Dynamic Application","redirect_uris": ["https://application.example.com/callback", "https://application.example.com/callback2"] }'

But then it defaults My Dynamic Application to type "Generic". Ideally, i'd like to specify something like { "app_type": "m2m" }, and be able to "extend" the functionality of the oidc/register endpoint.