问:
Unable to resolve module "empty-module.js" error
For building an iOS React Native app, I am able to successfully run the following command in a MacOS terminal:

```<code>xcodebuild archive -workspace MyProject.xcworkspace -derivedDataPath build -scheme MyProject -archivePath $PWD/build-artifacts/MyProject.xcarchive -configuration Release CODE_SIGN_STYLE='Automatic' BITCODE_GENERATION_MODE='bitcode'
</code>```

However when invoking the same command via a Jenkins "Execute shell" step, it results in the following error:

```<code>error Unable to resolve module /Users/mike/git/my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js from /Users/mike/git/my-project/_:

None of these files exist:
  * ../my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
  * ../my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js/index(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
    at ModuleResolver.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:136:15)
    at ModuleResolver._getEmptyModule (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:49:26)
    at ModuleResolver._getFileResolvedModule (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:195:21)
    at ModuleResolver.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:132:19)
    at DependencyGraph.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
    at Object.resolve (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/lib/transformHelpers.js:129:24)
    at resolve (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
    at /Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
    at Array.reduce (<anonymous>)
    at resolveDependencies (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)

I have ensured that the PATH is set consistently between the system and Jenkins for build tools like node and npm. I would appreciate any input from anyone who has experienced
</code>```

similar issues.

Body:
For building an iOS React Native app, I am able to successfully run the following command in a MacOS terminal:

xcodebuild archive -workspace MyProject.xcworkspace -derivedDataPath build -scheme MyProject -archivePath $PWD/build-artifacts/MyProject.xcarchive -configuration Release CODE_SIGN_STYLE='Automatic' BITCODE_GENERATION_MODE='bitcode'

However when invoking the same command via a Jenkins "Execute shell" step, it results in the following error:

error Unable to resolve module /Users/mike/git/my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js from /Users/mike/git/my-project/_:

None of these files exist:
  * ../my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
  * ../my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js/index(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
    at ModuleResolver.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:136:15)
    at ModuleResolver._getEmptyModule (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:49:26)
    at ModuleResolver._getFileResolvedModule (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:195:21)
    at ModuleResolver.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:132:19)
    at DependencyGraph.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
    at Object.resolve (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/lib/transformHelpers.js:129:24)
    at resolve (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
    at /Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
    at Array.reduce (<anonymous>)
    at resolveDependencies (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)

I have ensured that the PATH is set consistently between the system and Jenkins for build tools like node and npm. I would appreciate any input from anyone who has experienced

similar issues.


来源: stackexchange

问:
Debugging Java Shaded Dependencies
I'm trying to debug a java-agent jar file in IntelliJ. This jar contains some shaded classes. I'm unable to debug them, since their .java files do not have same package name.

For eg. I have a class com.mypackage.MyClass, which after shading becomes com.shaded.mypackage.MyClass.

So, I opened .class file of these shaded classes in IntelliJ and set break points. But no luck, since code's line number was different in .class file , and IntelliJ sets break points to code at specified line numbers in .java file.

Any idea how to debug the shaded classes? Suggestions for other editors are welcome.

ContentLicense: CC BY-SA 4.0

Title: Debugging Java Shaded Dependencies


问:
The hosts process namespace should not be shared by containers
Im trying to understand what this issue is about, i get a link to docker documentation but it mentions pids(Process ID) and does nothing for me in helping me understand what its about. so what does this pertain to in where i need add this into my compose file and what its meant for/does. The error-> "The hosts process namespace should not be shared by containers" and has a description of "There is no pid declared" and refers to line 39 my_api: and line 5 my_db:

```<code>version: '3.9'

services:

  my_db:
    image: postgres:14-alpine
    container_name: my_db
    environment:
      POSTGRES_USER: "${DB_USERNAME}"
      POSTGRES_PASSWORD: "${DB_PASSWORD}"
      POSTGRES_DB: "${DB_NAME}"
    ports:
      - "127.0.0.1:5432:${DB_PORT}"
    volumes:
      - ./database:/var/lib/postgresql/data

    networks:
      - db

  my_api:
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      posts_db:
        condition: service_healthy
    container_name: my_api
    platform: linux/amd64/v8
    environment:
      CURRENT_ENVIRONMENT: local_docker

      DB_HOST: "${DB_HOST}"
      DB_PORT: "${DB_PORT}"
      DB_NAME: "${DB_NAME}"
      DB_USERNAME: "${DB_USERNAME}"
      DB_PASSWORD: "${DB_PASSWORD}"

    ports:
      - "127.0.0.1:8000:8000"
    volumes:
      - /app/database
      - ./:/app
    networks:
      - api
      - db
    healthcheck:
      test:
        [
          "CMD",
          "wget",
          "-q",
          "http://localhost:8000/api/health_check/cluster",
          "-O",
          "/dev/null"
        ]

networks:
  api:
  db:
</code>```

ive read into documentation about pid and i think its meant to set a namespace for the different containers.

Body:
Im trying to understand what this issue is about, i get a link to docker documentation but it mentions pids(Process ID) and does nothing for me in helping me understand what its about. so what does this pertain to in where i need add this into my compose file and what its meant for/does. The error-> "The hosts process namespace should not be shared by containers" and has a description of "There is no pid declared" and refers to line 39 my_api: and line 5 my_db:

version: '3.9'

services:

  my_db:
    image: postgres:14-alpine
    container_name: my_db
    environment:
      POSTGRES_USER: "${DB_USERNAME}"
      POSTGRES_PASSWORD: "${DB_PASSWORD}"
      POSTGRES_DB: "${DB_NAME}"
    ports:
      - "127.0.0.1:5432:${DB_PORT}"
    volumes:
      - ./database:/var/lib/postgresql/data

    networks:
      - db

  my_api:
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      posts_db:
        condition: service_healthy
    container_name: my_api
    platform: linux/amd64/v8
    environment:
      CURRENT_ENVIRONMENT: local_docker

      DB_HOST: "${DB_HOST}"
      DB_PORT: "${DB_PORT}"
      DB_NAME: "${DB_NAME}"
      DB_USERNAME: "${DB_USERNAME}"
      DB_PASSWORD: "${DB_PASSWORD}"

    ports:
      - "127.0.0.1:8000:8000"
    volumes:
      - /app/database
      - ./:/app
    networks:
      - api
      - db
    healthcheck:
      test:
        [
          "CMD",
          "wget",
          "-q",
          "http://localhost:8000/api/health_check/cluster",
          "-O",
          "/dev/null"
        ]

networks:
  api:
  db:

ive read into documentation about pid and i think its meant to set a namespace for the different containers.


问:
Query with WHERE clause cannot be used with incrementing/timestamp mode
I am using Kafka connect (Confluent 7.2.1) with JDBC (Confluent jdbc 10.5). I'm using the source connector to read data from a view. The view is prepared to return the id (increment) and the last-modified field (timestamp).

My source database is informix. The destination is PostgreSQL although it is beside the point.

The beginning believed that it worked well since the insertions and modifications made them fast, but when the view increased its data (23 million records) the modifications were no longer instantaneous.

Doing tests I noticed that Kafka connect was actually re-reading the entire view and not just the data starting from the last id and last_date.
To test, I limited the view to 100 records and indeed the changes were detected quickly, when I reconfigure it with the 23 million records it takes hours.

Reviewing a little more I see that the current values are shown like this:

```<code>rowtime: 2023/01/04 15:27:16.361 Z, key: ["source_novedades",{"query":"query"}], value: {"timestamp_nanos":0,"incrementing":5001,"timestamp":1672835217000}, partition: 2
</code>```

I don't quite understand what timestamp_nano means but nevertheless I see a single date (timestamp) and it is the last one processed.

On the other hand, the query in the log is shown like this:

```<code>SELECT * FROM my_vw WHERE last_date < ? AND (( last_date = ? AND id > ?) OR last_date > ?) ORDER BY last_date, id ASC
</code>```

Which wouldn't make much sense since I'm asking:

```<code>last_date < ? and also AND (.... OR last_date > ?)
</code>```

So timestamp=1672860963000 is replaced in all date fields (?)? because if so it clearly wouldn't work.

Should I do something so that timestamp_nanos=0 is no longer 0 and takes the last processing date?

This is my source connector:

```<code>    {
        "connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
        "tasks.max": "1",
        "connection.url": "jdbc:informix-sqli://ip:port/testdb:informixserver=mibase",
        "connection.user":"informix",
        "connection.password":"pass",
        "query": "SELECT * FROM my_vw",
        "topic.prefix": "novedades",
        "poll.interval.ms": "10000",
        "mode":"timestamp+incrementing",
        "schema.pattern": "informix",
        "timestamp.column.name": "last_date",
        "incrementing.column.name": "id",
        "validate.non.null": false,

        "numeric.mapping":"best_fit",
        "transforms": "copyFieldToKey,extractKeyFromStruct,removeKeyFromValue",
        "transforms.copyFieldToKey.type": "org.apache.kafka.connect.transforms.ValueToKey",
        "transforms.copyFieldToKey.fields": "id",
        "transforms.extractKeyFromStruct.type": "org.apache.kafka.connect.transforms.ExtractField$Key",
        "transforms.extractKeyFromStruct.field": "id",
        "transforms.removeKeyFromValue.type": "org.apache.kafka.connect.transforms.ReplaceField$Value",
        "transforms.removeKeyFromValue.blacklist": "id",
        "key.converter" : "org.apache.kafka.connect.converters.LongConverter",

        "batch.size": 200000,
        "linger.ms": 60000,
        "compression.type":"lz4",
        "acks": 1,
        "offset.flush.timeout.ms": 300000

}
</code>```

Body:
I am using Kafka connect (Confluent 7.2.1) with JDBC (Confluent jdbc 10.5). I'm using the source connector to read data from a view. The view is prepared to return the id (increment) and the last-modified field (timestamp).

My source database is informix. The destination is PostgreSQL although it is beside the point.

The beginning believed that it worked well since the insertions and modifications made them fast, but when the view increased its data (23 million records) the modifications were no longer instantaneous.

Doing tests I noticed that Kafka connect was actually re-reading the entire view and not just the data starting from the last id and last_date.
To test, I limited the view to 100 records and indeed the changes were detected quickly, when I reconfigure it with the 23 million records it takes hours.

Reviewing a little more I see that the current values are shown like this:

rowtime: 2023/01/04 15:27:16.361 Z, key: ["source_novedades",{"query":"query"}], value: {"timestamp_nanos":0,"incrementing":5001,"timestamp":1672835217000}, partition: 2

I don't quite understand what timestamp_nano means but nevertheless I see a single date (timestamp) and it is the last one processed.

On the other hand, the query in the log is shown like this:

SELECT * FROM my_vw WHERE last_date < ? AND (( last_date = ? AND id > ?) OR last_date > ?) ORDER BY last_date, id ASC

Which wouldn't make much sense since I'm asking:

last_date < ? and also AND (.... OR last_date > ?)

So timestamp=1672860963000 is replaced in all date fields (?)? because if so it clearly wouldn't work.

Should I do something so that timestamp_nanos=0 is no longer 0 and takes the last processing date?

This is my source connector:

    {
        "connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
        "tasks.max": "1",
        "connection.url": "jdbc:informix-sqli://ip:port/testdb:informixserver=mibase",
        "connection.user":"informix",
        "connection.password":"pass",
        "query": "SELECT * FROM my_vw",
        "topic.prefix": "novedades",
        "poll.interval.ms": "10000",
        "mode":"timestamp+incrementing",
        "schema.pattern": "informix",
        "timestamp.column.name": "last_date",
        "incrementing.column.name": "id",
        "validate.non.null": false,

        "numeric.mapping":"best_fit",
        "transforms": "copyFieldToKey,extractKeyFromStruct,removeKeyFromValue",
        "transforms.copyFieldToKey.type": "org.apache.kafka.connect.transforms.ValueToKey",
        "transforms.copyFieldToKey.fields": "id",
        "transforms.extractKeyFromStruct.type": "org.apache.kafka.connect.transforms.ExtractField$Key",
        "transforms.extractKeyFromStruct.field": "id",
        "transforms.removeKeyFromValue.type": "org.apache.kafka.connect.transforms.ReplaceField$Value",
        "transforms.removeKeyFromValue.blacklist": "id",
        "key.converter" : "org.apache.kafka.connect.converters.LongConverter",

        "batch.size": 200000,
        "linger.ms": 60000,
        "compression.type":"lz4",
        "acks": 1,
        "offset.flush.timeout.ms": 300000

}


Title: Convert bounding-box in *json to *txt YOLO in R

Body:
I'd like to convert bounding-box in *json to *txt in R.

My *json file example is:

library(httr)
url <- "https://raw.githubusercontent.com/Leprechault/trash/main/YT_EMBRAPA_002.json"
resp <- GET(url)
resp
Response [https://raw.githubusercontent.com/Leprechault/trash/main/YT_EMBRAPA_002.json]
  Date: 2023-01-04 20:03
  Status: 200
  Content-Type: text/plain; charset=utf-8
  Size: 3.17 MB
{
  "version": "4.6.0",
  "flags": {},
  "shapes": [
    {
      "label": "bsb_rect_001",
      "points": [
        [
          3251.968503937008,
          6167.716535433071
...

I find several options in Python like https://github.com/ultralytics/JSON2YOLO/blob/master/labelbox_json2yolo.py: , but nothing for R. My desirable output format must be:

resp.txt
#1 0.03187574453519598 0.16170617903238507 0.027962295887861657 0.013271229604699675
#1 0.012706582002037762 0.17251532465492553 0.025284385799633536 0.02619433928664258
#1 0.026109900380444223 0.17557775104715606 0.025800148692412303 0.017478468045100976
#1 0.0821176816467061 0.16277558099233308 0.032569459844104406 0.017212954863240232
#1 0.14355303061578945 0.16197837358867168 0.01764685526333884 0.010062047117864015
#1 0.06970802391433885 0.18101680009166335 0.016761029927469716 0.021399067770458635
#1 0.08572352346121012 0.1792776093681684 0.026030117526979826 0.012867954588419023
#1 0.09626168171302374 0.17019105594089837 0.019595732791051243 0.012647323036230063
#1 0.23859686582311218 0.1633650464908571 0.019588233198525706 0.02212791885554269

Please, any help with it?


问:
how to check if one item in a list is also in another list
so basically i'm trying to code uno in python and i'm trying to check weather the card that the player selected to place is actually a card they own, however no matter what i enter the program always thinks that I don't own that card, after some trouble shooting I think I've found that it's because in the list that contains the player's cards, the items themselves also come from a list (basically a list inside a list) and the x in y doesn't read it correctly. Although i think i know the issue, where do i go from here?

Code that gives random card:

```<code>import random as rn, time
def unocards():
    unodeck1 = []
    c = 0
unovalues = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "reverse", "skip", "add 2","1", "2",           "3", "4", "5", "6", "7", "8", "9", "10", "reverse", "skip", "add 2",'+4',"wild card!"]
    unosuits = ["green", "yellow", "red", "blue"]
    for v in unovalues:
        for s in unosuits:
            unodeck1.append([v,s])
def unoplayerscards():
    unoplayerscards1 = rn.choice(unocards())
    return unoplayerscards1

the list that this card goes into:
  unoplayer1 = []
  unoplayer2 = []
  discardpile1 = []
  for i in range(0, 7): unoplayer1.append(unoplayerscards())
  for i in range(0, 7): unoplayer2.append(unoplayerscards())

the code that checks if the user input is in unoplayer1's cards:
 unoinput1.append(input("what card would you like to place?"))
    print(unoinput1)
    if unoinput1 in unoplayer1:
      unoinput1 = 0
      if unoinput1[1] == discardpile1[1] or unoinput1[0] == discardpile1[0]:
        unoplayer1.remove(unoinput1)
        unoinput1 = 0
        stop = 0
      else:
        print("number nor colour match, pick a different card!")
    else:`your text`
      print("you don't have that card, pick a different card!")

</code>```

I tried to see if an item in one list was in another, expected it to say it was, instead it said it wasn't

Body:
so basically i'm trying to code uno in python and i'm trying to check weather the card that the player selected to place is actually a card they own, however no matter what i enter the program always thinks that I don't own that card, after some trouble shooting I think I've found that it's because in the list that contains the player's cards, the items themselves also come from a list (basically a list inside a list) and the x in y doesn't read it correctly. Although i think i know the issue, where do i go from here?

Code that gives random card:

import random as rn, time
def unocards():
    unodeck1 = []
    c = 0
unovalues = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "reverse", "skip", "add 2","1", "2",           "3", "4", "5", "6", "7", "8", "9", "10", "reverse", "skip", "add 2",'+4',"wild card!"]
    unosuits = ["green", "yellow", "red", "blue"]
    for v in unovalues:
        for s in unosuits:
            unodeck1.append([v,s])
def unoplayerscards():
    unoplayerscards1 = rn.choice(unocards())
    return unoplayerscards1

the list that this card goes into:
  unoplayer1 = []
  unoplayer2 = []
  discardpile1 = []
  for i in range(0, 7): unoplayer1.append(unoplayerscards())
  for i in range(0, 7): unoplayer2.append(unoplayerscards())

the code that checks if the user input is in unoplayer1's cards:
 unoinput1.append(input("what card would you like to place?"))
    print(unoinput1)
    if unoinput1 in unoplayer1:
      unoinput1 = 0
      if unoinput1[1] == discardpile1[1] or unoinput1[0] == discardpile1[0]:
        unoplayer1.remove(unoinput1)
        unoinput1 = 0
        stop = 0
      else:
        print("number nor colour match, pick a different card!")
    else:`your text`
      print("you don't have that card, pick a different card!")

I tried to see if an item in one list was in another, expected it to say it was, instead it said it wasn't


问:
label-studio-ml backend requests.exceptions.ConnectionError
I'am trying to get pre annotations from label studio-ml backend. I am running both (label studio and label studio ml on Dockers) The connection to Label-studio-ml has worked but every time when I try to get a pre annotation  I get the following log in my ls-Machine Learning:

```<code>image_url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg
2023-01-04 20:49:16 [2023-01-04 19:49:16,462] [ERROR] [label_studio_ml.exceptions::exception_f::53] Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
2023-01-04 20:49:16     conn = connection.create_connection(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection
2023-01-04 20:49:16     raise err
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
2023-01-04 20:49:16     sock.connect(sa)
2023-01-04 20:49:16 ConnectionRefusedError: [Errno 111] Connection refused
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
2023-01-04 20:49:16     httplib_response = self._make_request(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
2023-01-04 20:49:16     conn.request(method, url, **httplib_request_kw)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
2023-01-04 20:49:16     super(HTTPConnection, self).request(method, url, body=body, headers=headers)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
2023-01-04 20:49:16     self._send_request(method, url, body, headers, encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
2023-01-04 20:49:16     self.endheaders(body, encode_chunked=encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
2023-01-04 20:49:16     self._send_output(message_body, encode_chunked=encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
2023-01-04 20:49:16     self.send(msg)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 980, in send
2023-01-04 20:49:16     self.connect()
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
2023-01-04 20:49:16     conn = self._new_conn()
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
2023-01-04 20:49:16     raise NewConnectionError(
2023-01-04 20:49:16 urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
2023-01-04 20:49:16     resp = conn.urlopen(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
2023-01-04 20:49:16     retries = retries.increment(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
2023-01-04 20:49:16     raise MaxRetryError(_pool, url, error or ResponseError(cause))
2023-01-04 20:49:16 urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused'))
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f
2023-01-04 20:49:16     return f(*args, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/api.py", line 32, in _predict
2023-01-04 20:49:16     predictions, model = _manager.predict(tasks, project, label_config, force_reload, try_fetch, **params)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/model.py", line 582, in predict
2023-01-04 20:49:16     predictions = m.model.predict(tasks, **kwargs)
2023-01-04 20:49:16   File "/app/mobilenet_finetune.py", line 74, in predict
2023-01-04 20:49:16     image_path = self.get_local_path(image_url, project_dir=self.image_dir)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/model.py", line 322, in get_local_path
2023-01-04 20:49:16     return get_local_path(url, project_dir=project_dir, hostname=self.hostname, access_token=self.access_token)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_tools/core/utils/io.py", line 96, in get_local_path
2023-01-04 20:49:16     r = requests.get(url, stream=True, headers=headers)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 75, in get
2023-01-04 20:49:16     return request('get', url, params=params, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
2023-01-04 20:49:16     return session.request(method=method, url=url, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
2023-01-04 20:49:16     resp = self.send(prep, **send_kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
2023-01-04 20:49:16     r = adapter.send(request, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
2023-01-04 20:49:16     raise ConnectionError(e, request=request)
2023-01-04 20:49:16 requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused'))
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
2023-01-04 20:49:16     conn = connection.create_connection(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection
2023-01-04 20:49:16     raise err
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
2023-01-04 20:49:16     sock.connect(sa)
2023-01-04 20:49:16 ConnectionRefusedError: [Errno 111] Connection refused
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
2023-01-04 20:49:16     httplib_response = self._make_request(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
2023-01-04 20:49:16     conn.request(method, url, **httplib_request_kw)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
2023-01-04 20:49:16     super(HTTPConnection, self).request(method, url, body=body, headers=headers)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
2023-01-04 20:49:16     self._send_request(method, url, body, headers, encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
2023-01-04 20:49:16     self.endheaders(body, encode_chunked=encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
2023-01-04 20:49:16     self._send_output(message_body, encode_chunked=encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
2023-01-04 20:49:16     self.send(msg)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 980, in send
2023-01-04 20:49:16     self.connect()
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
2023-01-04 20:49:16     conn = self._new_conn()
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
2023-01-04 20:49:16     raise NewConnectionError(
2023-01-04 20:49:16 urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
2023-01-04 20:49:16     resp = conn.urlopen(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
2023-01-04 20:49:16     retries = retries.increment(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
2023-01-04 20:49:16     raise MaxRetryError(_pool, url, error or ResponseError(cause))
2023-01-04 20:49:16 urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused'))
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f
2023-01-04 20:49:16     return f(*args, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/api.py", line 32, in _predict
2023-01-04 20:49:16     predictions, model = _manager.predict(tasks, project, label_config, force_reload, try_fetch, **params)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/model.py", line 582, in predict
2023-01-04 20:49:16     predictions = m.model.predict(tasks, **kwargs)
2023-01-04 20:49:16   File "/app/mobilenet_finetune.py", line 74, in predict
2023-01-04 20:49:16     image_path = self.get_local_path(image_url, project_dir=self.image_dir)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/model.py", line 322, in get_local_path
2023-01-04 20:49:16     return get_local_path(url, project_dir=project_dir, hostname=self.hostname, access_token=self.access_token)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_tools/core/utils/io.py", line 96, in get_local_path
2023-01-04 20:49:16     r = requests.get(url, stream=True, headers=headers)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 75, in get
2023-01-04 20:49:16     return request('get', url, params=params, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
2023-01-04 20:49:16     return session.request(method=method, url=url, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
2023-01-04 20:49:16     resp = self.send(prep, **send_kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
2023-01-04 20:49:16     r = adapter.send(request, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
2023-01-04 20:49:16     raise ConnectionError(e, request=request)
2023-01-04 20:49:16 requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused'))
</code>```

Can anyone tell me how to let label-studio-ml backend docker to access the image path on the label-studio docker

Body:
I'am trying to get pre annotations from label studio-ml backend. I am running both (label studio and label studio ml on Dockers) The connection to Label-studio-ml has worked but every time when I try to get a pre annotation  I get the following log in my ls-Machine Learning:

image_url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg
2023-01-04 20:49:16 [2023-01-04 19:49:16,462] [ERROR] [label_studio_ml.exceptions::exception_f::53] Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
2023-01-04 20:49:16     conn = connection.create_connection(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection
2023-01-04 20:49:16     raise err
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
2023-01-04 20:49:16     sock.connect(sa)
2023-01-04 20:49:16 ConnectionRefusedError: [Errno 111] Connection refused
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
2023-01-04 20:49:16     httplib_response = self._make_request(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
2023-01-04 20:49:16     conn.request(method, url, **httplib_request_kw)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
2023-01-04 20:49:16     super(HTTPConnection, self).request(method, url, body=body, headers=headers)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
2023-01-04 20:49:16     self._send_request(method, url, body, headers, encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
2023-01-04 20:49:16     self.endheaders(body, encode_chunked=encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
2023-01-04 20:49:16     self._send_output(message_body, encode_chunked=encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
2023-01-04 20:49:16     self.send(msg)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 980, in send
2023-01-04 20:49:16     self.connect()
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
2023-01-04 20:49:16     conn = self._new_conn()
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
2023-01-04 20:49:16     raise NewConnectionError(
2023-01-04 20:49:16 urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
2023-01-04 20:49:16     resp = conn.urlopen(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
2023-01-04 20:49:16     retries = retries.increment(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
2023-01-04 20:49:16     raise MaxRetryError(_pool, url, error or ResponseError(cause))
2023-01-04 20:49:16 urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused'))
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f
2023-01-04 20:49:16     return f(*args, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/api.py", line 32, in _predict
2023-01-04 20:49:16     predictions, model = _manager.predict(tasks, project, label_config, force_reload, try_fetch, **params)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/model.py", line 582, in predict
2023-01-04 20:49:16     predictions = m.model.predict(tasks, **kwargs)
2023-01-04 20:49:16   File "/app/mobilenet_finetune.py", line 74, in predict
2023-01-04 20:49:16     image_path = self.get_local_path(image_url, project_dir=self.image_dir)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/model.py", line 322, in get_local_path
2023-01-04 20:49:16     return get_local_path(url, project_dir=project_dir, hostname=self.hostname, access_token=self.access_token)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_tools/core/utils/io.py", line 96, in get_local_path
2023-01-04 20:49:16     r = requests.get(url, stream=True, headers=headers)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 75, in get
2023-01-04 20:49:16     return request('get', url, params=params, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
2023-01-04 20:49:16     return session.request(method=method, url=url, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
2023-01-04 20:49:16     resp = self.send(prep, **send_kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
2023-01-04 20:49:16     r = adapter.send(request, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
2023-01-04 20:49:16     raise ConnectionError(e, request=request)
2023-01-04 20:49:16 requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused'))
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
2023-01-04 20:49:16     conn = connection.create_connection(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection
2023-01-04 20:49:16     raise err
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
2023-01-04 20:49:16     sock.connect(sa)
2023-01-04 20:49:16 ConnectionRefusedError: [Errno 111] Connection refused
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
2023-01-04 20:49:16     httplib_response = self._make_request(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
2023-01-04 20:49:16     conn.request(method, url, **httplib_request_kw)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
2023-01-04 20:49:16     super(HTTPConnection, self).request(method, url, body=body, headers=headers)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
2023-01-04 20:49:16     self._send_request(method, url, body, headers, encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
2023-01-04 20:49:16     self.endheaders(body, encode_chunked=encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
2023-01-04 20:49:16     self._send_output(message_body, encode_chunked=encode_chunked)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
2023-01-04 20:49:16     self.send(msg)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/http/client.py", line 980, in send
2023-01-04 20:49:16     self.connect()
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
2023-01-04 20:49:16     conn = self._new_conn()
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
2023-01-04 20:49:16     raise NewConnectionError(
2023-01-04 20:49:16 urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
2023-01-04 20:49:16     resp = conn.urlopen(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
2023-01-04 20:49:16     retries = retries.increment(
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
2023-01-04 20:49:16     raise MaxRetryError(_pool, url, error or ResponseError(cause))
2023-01-04 20:49:16 urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused'))
2023-01-04 20:49:16
2023-01-04 20:49:16 During handling of the above exception, another exception occurred:
2023-01-04 20:49:16
2023-01-04 20:49:16 Traceback (most recent call last):
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f
2023-01-04 20:49:16     return f(*args, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/api.py", line 32, in _predict
2023-01-04 20:49:16     predictions, model = _manager.predict(tasks, project, label_config, force_reload, try_fetch, **params)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/model.py", line 582, in predict
2023-01-04 20:49:16     predictions = m.model.predict(tasks, **kwargs)
2023-01-04 20:49:16   File "/app/mobilenet_finetune.py", line 74, in predict
2023-01-04 20:49:16     image_path = self.get_local_path(image_url, project_dir=self.image_dir)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_ml/model.py", line 322, in get_local_path
2023-01-04 20:49:16     return get_local_path(url, project_dir=project_dir, hostname=self.hostname, access_token=self.access_token)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/label_studio_tools/core/utils/io.py", line 96, in get_local_path
2023-01-04 20:49:16     r = requests.get(url, stream=True, headers=headers)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 75, in get
2023-01-04 20:49:16     return request('get', url, params=params, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
2023-01-04 20:49:16     return session.request(method=method, url=url, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
2023-01-04 20:49:16     resp = self.send(prep, **send_kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
2023-01-04 20:49:16     r = adapter.send(request, **kwargs)
2023-01-04 20:49:16   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
2023-01-04 20:49:16     raise ConnectionError(e, request=request)
2023-01-04 20:49:16 requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/1/0c8720ce-0f29e9df11dbc1cce55cb3529517dcd5.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xfffebeb87610>: Failed to establish a new connection: [Errno 111] Connection refused'))

Can anyone tell me how to let label-studio-ml backend docker to access the image path on the label-studio docker


问:
Sometimes i get a ajax error if the file no longer exists and it breaks my when and done function below
I have the following when / done function , if all the "getAjaxFile()" files exist , then it executes as expected , however at times one of the files may be missing and the functions following the initial done do not execute , what is best method to rewrite this or check if one of the getAjaxFile is error and still execute functions after the done ?

```<code>jQuery.when(
    getAjaxFile(1),
    getAjaxFile(2),
    getAjaxFile(3),
    getAjaxFile(4)
).done(function (a1, a2, a3, a4) {
    jQuery.when(
        runFuc1()
    ).done(function (b1) {
        jQuery.when(
            runFuc2()
        ).done(function (c1) {
            runFunctionFinished();
        });
    });
});
</code>```

Referencing the function above , if getAjaxFile(3) fails , i still want to run the other functions inside the initial done function

```<code>jQuery.when(
    runFuc1()
).done(function (b1) {
    jQuery.when(
        runFuc2()
    ).done(function (c1) {
        runFunctionFinished();
    });
});
</code>```

Body:
I have the following when / done function , if all the "getAjaxFile()" files exist , then it executes as expected , however at times one of the files may be missing and the functions following the initial done do not execute , what is best method to rewrite this or check if one of the getAjaxFile is error and still execute functions after the done ?

jQuery.when(
    getAjaxFile(1),
    getAjaxFile(2),
    getAjaxFile(3),
    getAjaxFile(4)
).done(function (a1, a2, a3, a4) {
    jQuery.when(
        runFuc1()
    ).done(function (b1) {
        jQuery.when(
            runFuc2()
        ).done(function (c1) {
            runFunctionFinished();
        });
    });
});

Referencing the function above , if getAjaxFile(3) fails , i still want to run the other functions inside the initial done function

jQuery.when(
    runFuc1()
).done(function (b1) {
    jQuery.when(
        runFuc2()
    ).done(function (c1) {
        runFunctionFinished();
    });
});


问:
Proper way to preconfigure Nexus3 to mirror our internal repository when running in Docker?
We have a set of legacy Gradle projects that I am working on migrating to building in Docker.

Unfortunately they download quite a bit of Maven artifacts from our internal Artifactory server for every build, which is rather slow when working remotely over VPN.  Until we get that fixed properly, I would like to have a local dockerized Nexus3 mirroring Artifactory so I can cache them locally.

I have Nexus3 OSS running in my local Docker Desktop.  I have set up manually two mirror against Artifactory with proper credentials, and one grouping them together, but I have to do this every time the container is recreated.  As of now, this is all that is needed for our usage.

I would like to be able to preconfigure this in the Docker image somehow, instead, so our local configuration comes up and running without manual intervention.  I'm fine with baking in my credentials locally.  The REST API looks promising but will probably require manually running a script after Nexus is ready, which makes it a plan B.

Can this be done in Nexus3 OSS, and if so how?


问:
nodejs middleware typescript generic question

interface CustomRequest<T> extends Request {
  user?: IUser,
  body: T
}

interface CreateBody {
  email:string;
}

interface deleteBody {
  id:string;
}

router.post('/create', authenticate, (req:CustomRequest<CreateBody>, res) => {
  Content.Create({
    email:req.body.email
  })
 }
 router.post('/delete', authenticate, (req:CustomRequest<deleteBody>, res) => {
  Content.Create({
    id:req.body.id
  })
 }

 export const authenticate = async (
   req: CustomRequest<null>
   res: Response,
   next: NextFunction,
 ) => {
   try {
     const user = await User.findToken(req.cookies.auth);
     if (!user) return res.send({ success: false });
     req.user = user;
     next();
   } catch (err) {
     return res.send({ success: false });
   }
 };
```

I want to specify the request type by situation when designating middleware in nodejs.

req:CustomRequest
I've tried generics this way, but it doesn't work.

How can I define the type gracefully?

I would like to specify the type that some api have an e-mail in body and some api have a password in it.

Body:
interface CustomRequest<T> extends Request {
  user?: IUser,
  body: T
}

interface CreateBody {
  email:string;
}

interface deleteBody {
  id:string;
}

router.post('/create', authenticate, (req:CustomRequest<CreateBody>, res) => {
  Content.Create({
    email:req.body.email
  })
 }
 router.post('/delete', authenticate, (req:CustomRequest<deleteBody>, res) => {
  Content.Create({
    id:req.body.id
  })
 }

 export const authenticate = async (
   req: CustomRequest<null>
   res: Response,
   next: NextFunction,
 ) => {
   try {
     const user = await User.findToken(req.cookies.auth);
     if (!user) return res.send({ success: false });
     req.user = user;
     next();
   } catch (err) {
     return res.send({ success: false });
   }
 };

I want to specify the request type by situation when designating middleware in nodejs.

req:CustomRequest
I've tried generics this way, but it doesn't work.

How can I define the type gracefully?

I would like to specify the type that some api have an e-mail in body and some api have a password in it.


问:
Why will variable won't change with Tkinter bind?
I'm trying to make snake in Python with Tkinter. Because I want to minimize the amount of external libraries, I tried to make functions that are activated with tk.bind and change the direction of the snake. First I wanted to see, if that works, so I programmed the functions to print 'up', 'left', ..., and that worked. Than I programmed the functions to change the direction-variable and than print the value in the mainloop. But that didn't work. I don't really know how to fix it, but I assume it has something to do with how things are updated.

The code:

```<code>from tkinter import *
import time
import random

tk = Tk()

tk.title('Snake')
tk.resizable(0, 0)
root = Canvas(tk, bg='black', height=640, width=1024)

dir_snake = 'right'

def chdir_w(event):
  dir_snake = 'up'
  #print('up')
def chdir_a(event):
  dir_snake = 'left'
  #print('left')
def chdir_s(event):
  dir_snake = 'down'
  #print('down')
def chdir_d(event):
  dir_snake = 'right'
  #print('right')
tk.bind('w', chdir_w)
tk.bind('a', chdir_a)
tk.bind('s', chdir_s)
tk.bind('d', chdir_d)

class Snake_Tile:
    def __init__(self, startpos):
        self.body = root.create_rectangle(startpos[0], startpos[1], startpos[0] + 64, //
startpos[1] + 64, outline='green', fill='green')

    def move_to(self, pos):
        root.move(self.body, pos[0], pos[1])

snake_body = [0]
#snake_body[0] = root.create_rectangle(512, 320, 576, 384,  outline='green', fill='green')
snake_body[0] = root.create_rectangle(960, 576, 1024, 640, outline='green', fill='green')

apple_pos = (0, 576)
apple = root.create_rectangle(apple_pos[0], apple_pos[1], apple_pos[0] + 64, //
apple_pos[1] + 64, outline='red', fill='red')
#apple = root.create_rectangle(0, 0, 64, 64,  outline='red', fill='red')

root.pack()
while True:

    tk.update_idletasks()
    tk.update()
    print(dir_snake)
    time.sleep(1/5)

</code>```

I tried to make the program write the direction variable but the variable doesn't change.

Body:
I'm trying to make snake in Python with Tkinter. Because I want to minimize the amount of external libraries, I tried to make functions that are activated with tk.bind and change the direction of the snake. First I wanted to see, if that works, so I programmed the functions to print 'up', 'left', ..., and that worked. Than I programmed the functions to change the direction-variable and than print the value in the mainloop. But that didn't work. I don't really know how to fix it, but I assume it has something to do with how things are updated.

The code:

from tkinter import *
import time
import random

tk = Tk()

tk.title('Snake')
tk.resizable(0, 0)
root = Canvas(tk, bg='black', height=640, width=1024)

dir_snake = 'right'

def chdir_w(event):
  dir_snake = 'up'
  #print('up')
def chdir_a(event):
  dir_snake = 'left'
  #print('left')
def chdir_s(event):
  dir_snake = 'down'
  #print('down')
def chdir_d(event):
  dir_snake = 'right'
  #print('right')
tk.bind('w', chdir_w)
tk.bind('a', chdir_a)
tk.bind('s', chdir_s)
tk.bind('d', chdir_d)

class Snake_Tile:
    def __init__(self, startpos):
        self.body = root.create_rectangle(startpos[0], startpos[1], startpos[0] + 64, //
startpos[1] + 64, outline='green', fill='green')

    def move_to(self, pos):
        root.move(self.body, pos[0], pos[1])

snake_body = [0]
#snake_body[0] = root.create_rectangle(512, 320, 576, 384,  outline='green', fill='green')
snake_body[0] = root.create_rectangle(960, 576, 1024, 640, outline='green', fill='green')

apple_pos = (0, 576)
apple = root.create_rectangle(apple_pos[0], apple_pos[1], apple_pos[0] + 64, //
apple_pos[1] + 64, outline='red', fill='red')
#apple = root.create_rectangle(0, 0, 64, 64,  outline='red', fill='red')

root.pack()
while True:

    tk.update_idletasks()
    tk.update()
    print(dir_snake)
    time.sleep(1/5)

I tried to make the program write the direction variable but the variable doesn't change.


问:
React native slider box, 2 iimages on press not working
Good afternoon everyone, I am facing a problem using react-native-image-slider-box library

I want to show 2 banners at a time, and when I click on one it takes me to a place and when I click on another, it takes me to another place

But when I click on the second image it has the same index as the first so I can't differentiate the click to be able to take it to 2 different places, can someone help me with this problem?

```<code><SliderBox
        firstItem={0}
        initialScrollIndex={0}
        getItemLayout={(i, index) => ({
          length: dimensions.width,
          offset: dimensions.width * index,
          index,
        })}
        itemWidth={dimensions.width}
        sliderWidth={dimensions.width}
        slideStyle={{ width: dimensions.width / 2}}
        contentContainerCustomStyle={{
          width: dimensions.width * banners.length / 2,
        }}
        inactiveSlideOpacity={1}
        inactiveSlideScale={1}
        sliderBoxHeight={100}
        ImageComponentStyle={{ width: '95%', borderRadius: 5, marginTop:8, marginBottom: 8 }}
        resizeMode="stretch"
        images={banners}
        imageLoadingColor="#fff000"
        dotStyle={{
          width: 0,
          height:0,
        }}
        onCurrentImagePressed={onPress}
        lockScrollWhileSnapping
        ImageComponent={FastImage}
        {...settings?.customProps}
      />
</code>```

image showing when i click in a banner image and the index is the same

i tried to change the width properties, but no succes

i want to click on a image

Body:
Good afternoon everyone, I am facing a problem using react-native-image-slider-box library

I want to show 2 banners at a time, and when I click on one it takes me to a place and when I click on another, it takes me to another place

But when I click on the second image it has the same index as the first so I can't differentiate the click to be able to take it to 2 different places, can someone help me with this problem?

<SliderBox
        firstItem={0}
        initialScrollIndex={0}
        getItemLayout={(i, index) => ({
          length: dimensions.width,
          offset: dimensions.width * index,
          index,
        })}
        itemWidth={dimensions.width}
        sliderWidth={dimensions.width}
        slideStyle={{ width: dimensions.width / 2}}
        contentContainerCustomStyle={{
          width: dimensions.width * banners.length / 2,
        }}
        inactiveSlideOpacity={1}
        inactiveSlideScale={1}
        sliderBoxHeight={100}
        ImageComponentStyle={{ width: '95%', borderRadius: 5, marginTop:8, marginBottom: 8 }}
        resizeMode="stretch"
        images={banners}
        imageLoadingColor="#fff000"
        dotStyle={{
          width: 0,
          height:0,
        }}
        onCurrentImagePressed={onPress}
        lockScrollWhileSnapping
        ImageComponent={FastImage}
        {...settings?.customProps}
      />

image showing when i click in a banner image and the index is the same

i tried to change the width properties, but no succes

i want to click on a image


问:
Trigger turbo_stream and html response within show action rails 7
I have a simple messaging app. Users can set up a public profile with their description and people can send them inquiries. Those inquiries are then collected in a table in the user dashboard.

When a user is clicking on a row, a turbo frame opens up and shows the inquiry.

I would like to implement, that the inquiry is automatically set to @inquriy.seen = true  whenever a row is clicked / the inquiry show action is called. Within the table is a blue dot in my ui that indicates, that the message/inquiry is not yet read.

currently i have this code within the show action:

```<code>respond_to do |format|
   if @inquiry.update!(seen: true)
      format.html
      format.turbo_stream { flash.now[:notice] = "Anfrage angesehen." }
   end
end
</code>```

The problem is, that it does not work. The inquiry is successfully updated, but the table does not change. Instead I am getting a Completed 406 Not Acceptable response and an ActionController::UnknownFormat error.

I already tried to accept turbo_streams in the mime_type.rb but there are other features in my app that are using turbo streams that work just fine (btw also in the update action of the inquiries (you can manually set them to read)).

How can I trigger the turbo_stream when clicking calling the show action to update the table in the index action?

Thanks!

Body:
I have a simple messaging app. Users can set up a public profile with their description and people can send them inquiries. Those inquiries are then collected in a table in the user dashboard.

When a user is clicking on a row, a turbo frame opens up and shows the inquiry.

I would like to implement, that the inquiry is automatically set to @inquriy.seen = true  whenever a row is clicked / the inquiry show action is called. Within the table is a blue dot in my ui that indicates, that the message/inquiry is not yet read.

currently i have this code within the show action:

respond_to do |format|
   if @inquiry.update!(seen: true)
      format.html
      format.turbo_stream { flash.now[:notice] = "Anfrage angesehen." }
   end
end

The problem is, that it does not work. The inquiry is successfully updated, but the table does not change. Instead I am getting a Completed 406 Not Acceptable response and an ActionController::UnknownFormat error.

I already tried to accept turbo_streams in the mime_type.rb but there are other features in my app that are using turbo streams that work just fine (btw also in the update action of the inquiries (you can manually set them to read)).

How can I trigger the turbo_stream when clicking calling the show action to update the table in the index action?

Thanks!


问:
Zooming in and out relative to position of the mouse is working, but why does part of the drawn text go out of bounds when zooming in?
Below is a minimal reproducible code example where you can use mouse wheel to zoom in and out relative to the position of the mouse. The JScrollPane also auto-adjusts its size as you zoom in and out.

```<code>package testpane;
import java.awt.event.MouseAdapter;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;

public class TestPane
{
    public static Drawing d;
    public static double zoomFactor = 1;

    public static void main(String[] args)
    {
        JFrame f = new JFrame("Tree Diagram");
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.getContentPane().add(new TestPane().makeDiagram());
        f.setSize(1600, 800);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

    public JComponent makeDiagram()
    {
        d = new Drawing();

        MouseAdapter mouseAdapter = new TestPaneMouseListener();
        d.addMouseListener(mouseAdapter);
        d.addMouseMotionListener(mouseAdapter);
        d.addMouseWheelListener(mouseAdapter);

        return new JScrollPane(d);
    }
}
</code>```
```<code>package testpane;
import java.awt.Component;
import java.awt.Container;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import javax.swing.JComponent;
import javax.swing.JViewport;
import javax.swing.SwingUtilities;
import static testpane.TestPane.d;
import static testpane.TestPane.zoomFactor;

public class TestPaneMouseListener extends MouseAdapter
{
    private final Point origin = new Point();

    @Override
    public void mouseDragged(MouseEvent e)
    {
        Component c = e.getComponent();
        Container p = SwingUtilities.getUnwrappedParent(c);
        if (p instanceof JViewport)
        {
            JViewport viewport = (JViewport) p;
            Point cp = SwingUtilities.convertPoint(c, e.getPoint(), viewport);
            Point vp = viewport.getViewPosition();
            vp.translate(origin.x - cp.x, origin.y - cp.y);
            ((JComponent) c).scrollRectToVisible(new Rectangle(vp, viewport.getSize()));
            origin.setLocation(cp);
        }
    }

   @Override
   public void mousePressed(MouseEvent e)
   {
       Component c = e.getComponent();
       Container p = SwingUtilities.getUnwrappedParent(c);
       if(p instanceof JViewport)
       {
           JViewport viewport = (JViewport) p;
           Point cp = SwingUtilities.convertPoint(c, e.getPoint(), viewport);
           origin.setLocation(cp);
       }
   }

   @Override
    public void mouseWheelMoved(MouseWheelEvent e)
    {
        if(e.getWheelRotation()<0)
        {
            zoomFactor*=1.05;
            d.setZoomFactor(1.05);
        }

        if(e.getWheelRotation()>0)
        {
            zoomFactor/=1.05;
            d.setZoomFactor(1/1.05);
        }
    }
}
</code>```
```<code>package testpane;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.MouseInfo;
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import javax.swing.JPanel;

public class Drawing extends JPanel
{
    private final AffineTransform zoomTransform = new AffineTransform();
    private final Rectangle rect = new Rectangle(1600, 800);
    private double xOffset = 0;
    private double yOffset = 0;
    private double prevZoomFactor = 1;

    public Drawing()
    {
        Font currentFont = getFont();
        Font newFont = currentFont.deriveFont(currentFont.getSize() * 15F);
        setFont(newFont);
        setBackground(Color.WHITE);
    }

    public void setZoomFactor(double zoomFactor)
    {
        zoomTransform.scale(zoomFactor, zoomFactor);
        revalidate();
        repaint();
    }

    @Override
    protected void paintComponent(Graphics g)
    {
        super.paintComponent(g);

        Graphics2D g2d = (Graphics2D) g.create();
        AffineTransform scrollTransform = g2d.getTransform();

        double xRel = MouseInfo.getPointerInfo().getLocation().getX() - getLocationOnScreen().getX();
        double yRel = MouseInfo.getPointerInfo().getLocation().getY() - getLocationOnScreen().getY();

        double zoomDiv = TestPane.zoomFactor / prevZoomFactor;

        xOffset = (zoomDiv) * (xOffset) + (1 - zoomDiv) * xRel;
        yOffset = (zoomDiv) * (yOffset) + (1 - zoomDiv) * yRel;

        prevZoomFactor = TestPane.zoomFactor;

        scrollTransform.translate(xOffset, yOffset);
        scrollTransform.concatenate(zoomTransform);
        g2d.setTransform(scrollTransform);

        g2d.drawString("Example", 400, 400);

        g2d.dispose();
    }

    @Override
    public Dimension getPreferredSize()
    {
        Rectangle r = zoomTransform.createTransformedShape(rect).getBounds();
        return new Dimension(r.width, r.height);
    }
}
</code>```

Here is my problem: the zooming works just fine, but when I zoom too close, part of the "Example" written on the JScrollPane goes out of bounds. I believe that the problem comes from the translation I've made inside of the "Drawing" java class in the "paintComponent" method. While this translation does help me zoom in properly, it also causes my text to go out of bounds if I zoom too close. Is there any way for me to fix this?

Body:
Below is a minimal reproducible code example where you can use mouse wheel to zoom in and out relative to the position of the mouse. The JScrollPane also auto-adjusts its size as you zoom in and out.

package testpane;
import java.awt.event.MouseAdapter;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;

public class TestPane
{
    public static Drawing d;
    public static double zoomFactor = 1;

    public static void main(String[] args)
    {
        JFrame f = new JFrame("Tree Diagram");
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.getContentPane().add(new TestPane().makeDiagram());
        f.setSize(1600, 800);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

    public JComponent makeDiagram()
    {
        d = new Drawing();

        MouseAdapter mouseAdapter = new TestPaneMouseListener();
        d.addMouseListener(mouseAdapter);
        d.addMouseMotionListener(mouseAdapter);
        d.addMouseWheelListener(mouseAdapter);

        return new JScrollPane(d);
    }
}

package testpane;
import java.awt.Component;
import java.awt.Container;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import javax.swing.JComponent;
import javax.swing.JViewport;
import javax.swing.SwingUtilities;
import static testpane.TestPane.d;
import static testpane.TestPane.zoomFactor;

public class TestPaneMouseListener extends MouseAdapter
{
    private final Point origin = new Point();

    @Override
    public void mouseDragged(MouseEvent e)
    {
        Component c = e.getComponent();
        Container p = SwingUtilities.getUnwrappedParent(c);
        if (p instanceof JViewport)
        {
            JViewport viewport = (JViewport) p;
            Point cp = SwingUtilities.convertPoint(c, e.getPoint(), viewport);
            Point vp = viewport.getViewPosition();
            vp.translate(origin.x - cp.x, origin.y - cp.y);
            ((JComponent) c).scrollRectToVisible(new Rectangle(vp, viewport.getSize()));
            origin.setLocation(cp);
        }
    }

   @Override
   public void mousePressed(MouseEvent e)
   {
       Component c = e.getComponent();
       Container p = SwingUtilities.getUnwrappedParent(c);
       if(p instanceof JViewport)
       {
           JViewport viewport = (JViewport) p;
           Point cp = SwingUtilities.convertPoint(c, e.getPoint(), viewport);
           origin.setLocation(cp);
       }
   }

   @Override
    public void mouseWheelMoved(MouseWheelEvent e)
    {
        if(e.getWheelRotation()<0)
        {
            zoomFactor*=1.05;
            d.setZoomFactor(1.05);
        }

        if(e.getWheelRotation()>0)
        {
            zoomFactor/=1.05;
            d.setZoomFactor(1/1.05);
        }
    }
}

package testpane;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.MouseInfo;
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import javax.swing.JPanel;

public class Drawing extends JPanel
{
    private final AffineTransform zoomTransform = new AffineTransform();
    private final Rectangle rect = new Rectangle(1600, 800);
    private double xOffset = 0;
    private double yOffset = 0;
    private double prevZoomFactor = 1;

    public Drawing()
    {
        Font currentFont = getFont();
        Font newFont = currentFont.deriveFont(currentFont.getSize() * 15F);
        setFont(newFont);
        setBackground(Color.WHITE);
    }

    public void setZoomFactor(double zoomFactor)
    {
        zoomTransform.scale(zoomFactor, zoomFactor);
        revalidate();
        repaint();
    }

    @Override
    protected void paintComponent(Graphics g)
    {
        super.paintComponent(g);

        Graphics2D g2d = (Graphics2D) g.create();
        AffineTransform scrollTransform = g2d.getTransform();

        double xRel = MouseInfo.getPointerInfo().getLocation().getX() - getLocationOnScreen().getX();
        double yRel = MouseInfo.getPointerInfo().getLocation().getY() - getLocationOnScreen().getY();

        double zoomDiv = TestPane.zoomFactor / prevZoomFactor;

        xOffset = (zoomDiv) * (xOffset) + (1 - zoomDiv) * xRel;
        yOffset = (zoomDiv) * (yOffset) + (1 - zoomDiv) * yRel;

        prevZoomFactor = TestPane.zoomFactor;

        scrollTransform.translate(xOffset, yOffset);
        scrollTransform.concatenate(zoomTransform);
        g2d.setTransform(scrollTransform);

        g2d.drawString("Example", 400, 400);

        g2d.dispose();
    }

    @Override
    public Dimension getPreferredSize()
    {
        Rectangle r = zoomTransform.createTransformedShape(rect).getBounds();
        return new Dimension(r.width, r.height);
    }
}

Here is my problem: the zooming works just fine, but when I zoom too close, part of the "Example" written on the JScrollPane goes out of bounds. I believe that the problem comes from the translation I've made inside of the "Drawing" java class in the "paintComponent" method. While this translation does help me zoom in properly, it also causes my text to go out of bounds if I zoom too close. Is there any way for me to fix this?


问:
How to flatten a json file which has structs and arrays in the same file with AWS Glue
I used to work with Azure but I'm very very new on AWS. I do have a situation similar with this question . I have lots of json files on S3 bucket and in the files I have structs and arrays. I need to flatten both of them and keep it S3 again.
End of the day I have to load data from S3 to Snowflake.

For now, I have used AWS Glue Crawler and it can recognize my json files' structure. But I couldn't any solution to flatten both structs and arrays at the same time. It has been one year after last comment on the question which I shared, maybe there is a new feature that I can use it and solve my situation easily.
Any help/comment would be amazing.
Thank you.

I have created the structure of json files via AWS Glue Crawler
I tried to flatten via AWS Glue DataBrew but it doesn't work well on big files. It would be great if it works.


问:
ODBC refresh all. Subsequent code to run AFTER refresh is completed
I apologize if this has been asked and answered, but I couldn't quite find the answer and am looking for your expertise.

Windows 10.  Excel 365.

I have an excel spreadsheet with an ODBC connection to a PostgreSQL instance.  The results are output to a tab.  No formatting or modifications are done.  I don't think it matters, but the ODBC connection query is done via a query stored in the the SQL Statement section of the ODBC connection window.

I want to script out a process, using VBA, that does the following:

Refresh the data that would be seen if I clicked on RefreshAll from the Data portion of the ribbon

Pause until the data from the ODBC-sourced data is refreshed and the refreshed data is available in the Excel tab

Upon completion of the refreshed data, navigate to the pivot table that references the ODBC-sourced data and refresh the pivot.

What has me stymied is how to reference in VBA the odbc connection for the refreshall and then wait until it is done before refreshing the pivot table.

Nothing I tried worked (I was going to list what I have tried, but they were complete failures).

Any suggestions are greatly appreciated.

I am new to VBA, so along with solution, if you have any suggestions on resources to learn VBA techniques associated with this kind of challenge, it would be greatly appreciated.

Thanks!


问:
postgres `ts_headline` function is not returning matches it should during full text search
Relevant postgres full-text highlighting docs: https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

Version: I have tried postgres 15 and 12 and experienced this bug (feature?) in both.

In the following 3 full-text search highlighting queries, why do the first one's results not match the second and third's? Im trying to figure out what I can do to get matches on the first query. I first noticed that some of my highlight queries were coming back with no 'hits'. I created the following 3 queries to show the issue I'm having.

According to the docs, when we get back no matches (identified by  tags) it simply returns the first MinWords. That's what is happening in the first query when I think that we should actually get the 2 results back. Like we do in the next two queries.

```<code>db=# SELECT ts_headline('english', 'beginning word word word word CHILD word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word SERVICE ending',
    to_tsquery('english', 'CHILD & SERVICE'),
    'MaxFragments=2,MinWords=5,MaxWords=10');
          ts_headline
-------------------------------
 beginning word word word word
(1 row)
</code>```

Now let's increase MaxWords, now we get 2 matches

```<code>
db=# SELECT ts_headline('english', 'beginning word word word word CHILD word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word SERVICE ending',
    to_tsquery('english', 'CHILD & SERVICE'),
    'MaxFragments=2,MinWords=5,MaxWords=11');
                                                      ts_headline
------------------------------------------------------------------------------------------------------------------------
 beginning word word word word <b>CHILD</b> word word word word word ... word word word word word <b>SERVICE</b> ending
(1 row)
</code>```

Now let's increase MaxFragments, now we get 2 matches

```<code>db=# SELECT ts_headline('english', 'beginning word word word word CHILD word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word SERVICE ending',
    to_tsquery('english', 'CHILD & SERVICE'),
    'MaxFragments=3,MinWords=5,MaxWords=10');
                                               ts_headline
---------------------------------------------------------------------------------------------------------
 word word word word <b>CHILD</b> word word word word word ... word word word word <b>SERVICE</b> ending
(1 row)
</code>```

I feel like something subtle is going on between all the MaxFragments, MinWords, MaxWords settings. Im hoping to find a way to get the first query to match as I do believe it should. Please correct me if I'm wrong.

Body:
Relevant postgres full-text highlighting docs: https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

Version: I have tried postgres 15 and 12 and experienced this bug (feature?) in both.

In the following 3 full-text search highlighting queries, why do the first one's results not match the second and third's? Im trying to figure out what I can do to get matches on the first query. I first noticed that some of my highlight queries were coming back with no 'hits'. I created the following 3 queries to show the issue I'm having.

According to the docs, when we get back no matches (identified by  tags) it simply returns the first MinWords. That's what is happening in the first query when I think that we should actually get the 2 results back. Like we do in the next two queries.

db=# SELECT ts_headline('english', 'beginning word word word word CHILD word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word SERVICE ending',
    to_tsquery('english', 'CHILD & SERVICE'),
    'MaxFragments=2,MinWords=5,MaxWords=10');
          ts_headline
-------------------------------
 beginning word word word word
(1 row)

Now let's increase MaxWords, now we get 2 matches

db=# SELECT ts_headline('english', 'beginning word word word word CHILD word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word SERVICE ending',
    to_tsquery('english', 'CHILD & SERVICE'),
    'MaxFragments=2,MinWords=5,MaxWords=11');
                                                      ts_headline
------------------------------------------------------------------------------------------------------------------------
 beginning word word word word CHILD word word word word word ... word word word word word SERVICE ending
(1 row)

Now let's increase MaxFragments, now we get 2 matches

db=# SELECT ts_headline('english', 'beginning word word word word CHILD word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word SERVICE ending',
    to_tsquery('english', 'CHILD & SERVICE'),
    'MaxFragments=3,MinWords=5,MaxWords=10');
                                               ts_headline
---------------------------------------------------------------------------------------------------------
 word word word word CHILD word word word word word ... word word word word SERVICE ending
(1 row)

I feel like something subtle is going on between all the MaxFragments, MinWords, MaxWords settings. Im hoping to find a way to get the first query to match as I do believe it should. Please correct me if I'm wrong.


问:
FFMpeg geq filter proper documentation
I'm trying to make sense of the geq filter since I couldn't find proper documentation for it.
I've noticed it's very advanced and can do alot of things and may accept different number of parameters in various cases.

For example , I saw an example that created a circular cut of a video using the geq filter that used 3 paramters ("geq=0:128:128").

Anyone knows where can I find proper documentation for this filter?

Title: FFMpeg geq filter proper documentation


问:
Delete multiple rows from Association Table in SQLAlchemy using db.session.execute syntax?
I have an association table that contains relationships between two other SQLAlchemy models that I would like to delete:

```<code>class ItemCategories(db.Model):
    id = Column(Integer, primary_key=True)
    item_id = Column(Integer, ForeignKey("item.id"))
    category_id = Column(Integer, ForeignKey("category.id"))
    # ... other fields
</code>```

The old syntax was to use something like:

```<code>db.session.query(ItemCategories).filter_by(category_id=5).filter(ItemCategories.name="Shelved").delete()
</code>```

But with the newer syntax, I tried:

```<code>db.session.execute(db.select(ItemCategories).filter_by(category_id=5).filter(ItemCategories.name="Shelved").delete())
</code>```

But this errored with:

AttributeError: 'Select' object has no attribute 'delete'

Flask-SQLAlchemy suggests doing:

```<code>db.session.delete(Model Object)
</code>```

But this only deletes a single row, and I would like to delete multiple rows at once. I know I can loop through all the rows and do a session delete one-by-one, but would prefer a bulk delete instead like with the session.query line.

Is there a way to do multiple deletes with db.session.execute()?

Body:
I have an association table that contains relationships between two other SQLAlchemy models that I would like to delete:

class ItemCategories(db.Model):
    id = Column(Integer, primary_key=True)
    item_id = Column(Integer, ForeignKey("item.id"))
    category_id = Column(Integer, ForeignKey("category.id"))
    # ... other fields

The old syntax was to use something like:

db.session.query(ItemCategories).filter_by(category_id=5).filter(ItemCategories.name="Shelved").delete()

But with the newer syntax, I tried:

db.session.execute(db.select(ItemCategories).filter_by(category_id=5).filter(ItemCategories.name="Shelved").delete())

But this errored with:

AttributeError: 'Select' object has no attribute 'delete'

Flask-SQLAlchemy suggests doing:

db.session.delete(Model Object)

But this only deletes a single row, and I would like to delete multiple rows at once. I know I can loop through all the rows and do a session delete one-by-one, but would prefer a bulk delete instead like with the session.query line.

Is there a way to do multiple deletes with db.session.execute()?


问:
Adobe Animate: How to make nested movie clip symbols autoplay and loop
This should be an easy question but through all my searching I cannot find anyone who even so much as mentions this: I want to make a movie clip symbol autoplay. If a symbol is a graphic then it autoplays and loops. Ok, fine. But, once I convert it to a movie clip symbol, it doesn't autoplay and I don't know why. It just stays on the first frame indefinitely.

I've tried this multiple times in different projects. You can see what I mean by creating movie clip symbol, put something in it on its own timeline and drag the symbol on to your main stage timeline. It always stays on the first frame. Can only graphic symbols animate automatically? Do I need some scripting to start it? I can see no properties for autoplaying.


问:
Limit and Offset api call working in network tab but not rendering in browser
I have managed to get the limit and offset working. When I console log offset it adds what it needs and changes the api. In the browser the api is called successfully and I can see the posters in the network request however the items aren't loaded in the browser! Im struggling to see where Im going wrong to get the items to render correctly. Checking the console the posters update in the div too but just dont show inside the browser..

So far I've figured out that it does correctly change the posters when they haven't been swiped away. Once the two posters have been swiped it then doesnt render anymore.. I think its to do with the index being tracked.

```<code>import React, { useEffect, useState } from "react";

import { useSprings } from "react-spring";
import { useGesture } from "react-with-gesture";
import Card from "./Card";
import "../assets/Deck.css";

import Modal from "./modal";

import { Loader } from "./Loader";

import "bootstrap/dist/css/bootstrap.min.css";
import axios from "axios";
import { faCarSide } from "@fortawesome/free-solid-svg-icons";

const to = (i) => ({
  x: 0,
  y: 0,
  delay: 0,
});

const limit = 2

const from = (i) => ({ y: 0 });

const trans = (r, s) => `rotateY(${r / 10}deg) rotateZ(${r}deg)`;

function Deck() {
  const [data, setData] = useState([])
  const [activateModal, setActivateModal] = useState(false);
  const [detail, setShowDetail] = useState(false);
  const [detailRequest, setDetailRequest] = useState(false);
  const [loading, setLoading] = useState(false);
  const [offset, setOffset] = useState(1);
  const [totalItems, setTotalItems] = useState(1)

useEffect(() => {
  const loadDataFromServer = async () => {
      setLoading(true)
      await axios.get(`http://localhost:3001/api/v1/contents?limit=${limit}&offset=${offset}`)
        .then((response) => {
        setData(response.data);
        setTotalItems(response.data.length)
        setLoading(false)
      });
    };
    loadDataFromServer()
  }, [offset]);

  // useEffect(() => {
  //   const getData = () => {
  //     setLoading(true);
  //     fetch(`http://localhost:3001/api/v1/contents?limit=2&offset=${offset}`)
  //       .then(response => response.json())
  //       .then(response => {
  //           setData(response);
  //           setTotalItems(response.length)
  //           setLoading(false);
  //         });
  //       }
  //       getData();
  //   }, [offset]);

  const [nope] = useState(() => new Set());
  const [props, set] = useSprings(data.length, (i) => ({
    ...to(i),
    from: from(i),
  }));

  const bind = useGesture(
    ({
      args: [index],
      down,
      delta: [xDelta],
      distance,
      direction: [xDir],
      velocity,
    }) => {
      const trigger = velocity > 0.1;

      const dir = xDir < 0 ? -1 : 1;

      if (!down && trigger) nope.add(index);

      set((i) => {
        if (index !== i) return;
        const isNope = nope.has(index);

        const x = isNope ? (200 + window.innerWidth) * dir : down ? xDelta : 0;
        return {
          x,
          delay: undefined,
          config: { friction: 50, tension: down ? 800 : isNope ? 200 : 500 },
        };
      });

      if (!down && nope.size === data.length)
        setTimeout(() => nope.clear() || set((i) => to(i)), 600);
    }
  );

  const handleMoreCards = () => {
    setOffset(offset + 2);
  };

  const cards = props.map(({ x, y }, i) => (
    <Card
      i={i}
      x={x}
      y={y}
      trans={trans}
      data={data}
      bind={bind}
      key={i}
      ShowDetail={setShowDetail}
      DetailRequest={setDetailRequest}
      ActivateModal={setActivateModal}
    />
  ));

  console.log(offset)

  return (
    <>
      <>
      {cards}
      {totalItems === 2 && <button className="btn-load-more" onClick={handleMoreCards}>{loading ? 'Loading...' : 'Swipe Some More?'}</button>}
        {activateModal ? (
          detailRequest === false ? (
            <Modal {...detail} closeModal={setActivateModal} />
          ) : (
            <Loader />
          )
        ) : (
          ""
        )}
      </>
    </>
  );
}

export default Deck;
</code>```

Cards Component

```<code>import React from "react";
import { animated, to } from "react-spring";
import axios from "axios";

import '../assets/Card.css'

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBars } from '@fortawesome/free-solid-svg-icons'

const Card = ({ ShowDetail, DetailRequest, ActivateModal, i, x, y, trans, bind, data}) => {
  const { poster_url, id } = data[i];

  const clickHandler = () => {
    ActivateModal(true);
    DetailRequest(true);

    axios.get(`http://localhost:3001/api/v1/contents/${id}`).then((response) => {
      DetailRequest(false);
      ShowDetail(response.data);
    });
  };

  return (
    <animated.div
      key={i}
      {...bind(i)}
      style={{
        transform: to([x, y], (x, y) => `translate3d(${x}px,${y}px,0)`)
      }}
    >
      <div>
        <img className="card" src={poster_url} key={id} alt="poster_picture" />
        <FontAwesomeIcon
        onClick={() => clickHandler()}
        icon={faBars}
        size="3x"
        className='hamburger-icon'
      />
      </div>
      </animated.div>
  );
};

export default Card;
</code>```

Body:
I have managed to get the limit and offset working. When I console log offset it adds what it needs and changes the api. In the browser the api is called successfully and I can see the posters in the network request however the items aren't loaded in the browser! Im struggling to see where Im going wrong to get the items to render correctly. Checking the console the posters update in the div too but just dont show inside the browser..

So far I've figured out that it does correctly change the posters when they haven't been swiped away. Once the two posters have been swiped it then doesnt render anymore.. I think its to do with the index being tracked.

import React, { useEffect, useState } from "react";

import { useSprings } from "react-spring";
import { useGesture } from "react-with-gesture";
import Card from "./Card";
import "../assets/Deck.css";

import Modal from "./modal";

import { Loader } from "./Loader";

import "bootstrap/dist/css/bootstrap.min.css";
import axios from "axios";
import { faCarSide } from "@fortawesome/free-solid-svg-icons";

const to = (i) => ({
  x: 0,
  y: 0,
  delay: 0,
});

const limit = 2

const from = (i) => ({ y: 0 });

const trans = (r, s) => `rotateY(${r / 10}deg) rotateZ(${r}deg)`;

function Deck() {
  const [data, setData] = useState([])
  const [activateModal, setActivateModal] = useState(false);
  const [detail, setShowDetail] = useState(false);
  const [detailRequest, setDetailRequest] = useState(false);
  const [loading, setLoading] = useState(false);
  const [offset, setOffset] = useState(1);
  const [totalItems, setTotalItems] = useState(1)

useEffect(() => {
  const loadDataFromServer = async () => {
      setLoading(true)
      await axios.get(`http://localhost:3001/api/v1/contents?limit=${limit}&offset=${offset}`)
        .then((response) => {
        setData(response.data);
        setTotalItems(response.data.length)
        setLoading(false)
      });
    };
    loadDataFromServer()
  }, [offset]);

  // useEffect(() => {
  //   const getData = () => {
  //     setLoading(true);
  //     fetch(`http://localhost:3001/api/v1/contents?limit=2&offset=${offset}`)
  //       .then(response => response.json())
  //       .then(response => {
  //           setData(response);
  //           setTotalItems(response.length)
  //           setLoading(false);
  //         });
  //       }
  //       getData();
  //   }, [offset]);

  const [nope] = useState(() => new Set());
  const [props, set] = useSprings(data.length, (i) => ({
    ...to(i),
    from: from(i),
  }));

  const bind = useGesture(
    ({
      args: [index],
      down,
      delta: [xDelta],
      distance,
      direction: [xDir],
      velocity,
    }) => {
      const trigger = velocity > 0.1;

      const dir = xDir < 0 ? -1 : 1;

      if (!down && trigger) nope.add(index);

      set((i) => {
        if (index !== i) return;
        const isNope = nope.has(index);

        const x = isNope ? (200 + window.innerWidth) * dir : down ? xDelta : 0;
        return {
          x,
          delay: undefined,
          config: { friction: 50, tension: down ? 800 : isNope ? 200 : 500 },
        };
      });

      if (!down && nope.size === data.length)
        setTimeout(() => nope.clear() || set((i) => to(i)), 600);
    }
  );

  const handleMoreCards = () => {
    setOffset(offset + 2);
  };

  const cards = props.map(({ x, y }, i) => (
    <Card
      i={i}
      x={x}
      y={y}
      trans={trans}
      data={data}
      bind={bind}
      key={i}
      ShowDetail={setShowDetail}
      DetailRequest={setDetailRequest}
      ActivateModal={setActivateModal}
    />
  ));

  console.log(offset)

  return (
    <>
      <>
      {cards}
      {totalItems === 2 && <button className="btn-load-more" onClick={handleMoreCards}>{loading ? 'Loading...' : 'Swipe Some More?'}</button>}
        {activateModal ? (
          detailRequest === false ? (
            <Modal {...detail} closeModal={setActivateModal} />
          ) : (
            <Loader />
          )
        ) : (
          ""
        )}
      </>
    </>
  );
}

export default Deck;

Cards Component

import React from "react";
import { animated, to } from "react-spring";
import axios from "axios";

import '../assets/Card.css'

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBars } from '@fortawesome/free-solid-svg-icons'

const Card = ({ ShowDetail, DetailRequest, ActivateModal, i, x, y, trans, bind, data}) => {
  const { poster_url, id } = data[i];

  const clickHandler = () => {
    ActivateModal(true);
    DetailRequest(true);

    axios.get(`http://localhost:3001/api/v1/contents/${id}`).then((response) => {
      DetailRequest(false);
      ShowDetail(response.data);
    });
  };

  return (
    <animated.div
      key={i}
      {...bind(i)}
      style={{
        transform: to([x, y], (x, y) => `translate3d(${x}px,${y}px,0)`)
      }}
    >

        <FontAwesomeIcon
        onClick={() => clickHandler()}
        icon={faBars}
        size="3x"
        className='hamburger-icon'
      />

      </animated.div>
  );
};

export default Card;