问:
In a tripartite network in networkX in Python, is there a way to find most connected node in each layer?
I have a network which is stored as a networkX graph G. It is undirected so has three layers and there are connections between nodes each layer. Is there a way to find most connected node in each layer e.g. for each node to find how many connections are coming to it/going out from it (I imagine these are the same for undirected graphs?) and therefore rank them somehow. For the middles layer, what's needed is to know how often a node is connected to any of the nodes in the left layer and right layer separately. An image of the network is below. Can I assign that as the node size as well?. Similarly for the line width of the graph to be controlled by how often a connection is made in the data. Thanks.

Edited:
I've found the information from the data which forms this network. Now with this information, how can I assign the edge weight in the bokeh plot. I'm creating edges from the edge tuple column. Similarly, I have a node list with their node weight/size depending on frequency as well.

```<code>df.head()
Index Edge-tuple    Edge-weight
0   (dFac-1637903094, vcFac-1679993405) 9
1   (dFac--1093622611, vcFac--641939347)    8
2   (dFac-2117005857, vcFac-1094947741) 7
3   (dFac-1922215824, vcFac--802250542) 7
4   (dFac--1444346401, vcFac--1590094556)   6
</code>```

Body:
I have a network which is stored as a networkX graph G. It is undirected so has three layers and there are connections between nodes each layer. Is there a way to find most connected node in each layer e.g. for each node to find how many connections are coming to it/going out from it (I imagine these are the same for undirected graphs?) and therefore rank them somehow. For the middles layer, what's needed is to know how often a node is connected to any of the nodes in the left layer and right layer separately. An image of the network is below. Can I assign that as the node size as well?. Similarly for the line width of the graph to be controlled by how often a connection is made in the data. Thanks.

Edited:
I've found the information from the data which forms this network. Now with this information, how can I assign the edge weight in the bokeh plot. I'm creating edges from the edge tuple column. Similarly, I have a node list with their node weight/size depending on frequency as well.

df.head()
Index Edge-tuple    Edge-weight
0   (dFac-1637903094, vcFac-1679993405) 9
1   (dFac--1093622611, vcFac--641939347)    8
2   (dFac-2117005857, vcFac-1094947741) 7
3   (dFac-1922215824, vcFac--802250542) 7
4   (dFac--1444346401, vcFac--1590094556)   6


来源: stackexchange

问:
Picture next to text in html and css 2023
I'm a newbie at html and css, please could someone help me out.I'm trying to get the 'Full Stack Development' and icon further away from the picture. Also, stretch 'Full Stack Development' text out a bit. Please explain it in a simple way I could understand.

how I want it to look like
Vs this is how its turn out to be

HTML CODE:

```<code><body>
 <nav class="header">
        <a href='' ><img src='' height="50px"  alt='logo'/></a>

 <ul class="menu">
            <li><a href=""> Home</a></li>
            <li><a href=""> Education</a></li>
            <li><a href=""> Experience</a></li>
            <li><a href=""> Projects</a></li>
            <li><a href=""> Contact Me</a></li>
         </ul>
    </nav>

<div id="container">
 <img src="" alt="">
<div class="text">
        <h1 class="greeting-text" style="color: rgb(0, 28, 85);"></h1>

        <h2 class="greeting-nickname" style="color: rgb(0, 28, 85);">( You can call me)</h2>
<h3>
        <p class="greeting-text-p subTitle" style="color: rgb(122, 122, 145);">
        </p>
</h3>
        <p>
        <a class="rounded-button" href="">
            <ion-icon name="logo-instagram" size="large"></ion-icon>
         </a>

         <a class="rounded-button" href="">
            <ion-icon name="logo-linkedin" size="large"></ion-icon>

            <a class="rounded-button" href="">
                <ion-icon name="logo-github" size="large"></ion-icon>
            </a>

            <a class="rounded-button" href="">
            <ion-icon name="mail-outline" size="large"></ion-icon>
            </a>

    <div id="Contact">
        <a href=""> See My Resume</a>
        </div>
    </P>

        <div class="container">
            <h2 class="heading"> What I Do?</h2>

            <img src="fSD1.png" alt="what I Do">

            <h1 class="name" style="color: rgb(3, 2, 8);"> Full Stack Development</h1>

    <p class="icon">
    <ion-icon name="logo-html5"></ion-icon>
    <ion-icon name="logo-css3"></ion-icon>
    <ion-icon name="logo-nodejs"></ion-icon>
    <ion-icon name="logo-python"></ion-icon>
    <ion-icon name="logo-javascript"></ion-icon>
    <ion-icon name="logo-react"></ion-icon>
    </p>

</div>

</div>

</div>

 <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
 <script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>

</body>
</html>

CSS CODE:

body
{
    margin:0%;
    font-family: Hoefler Text, Helvetica, sans-serif;
background-color: rgb(233, 245, 248);
        color: black;
}

header{
   margin: 3% 10% 3% 10%;
    padding: 37px 161px;
     align-items: center;
}

.menu{
    list-style-type: none;
    margin: 0;
    padding: 0;
    float: right;

}
.menu li{
    display: inline-block;
    padding: 20px 40px;
    font-size: 20px;
}
.menu li a:hover{
    color: rgb(0, 216, 247);
    border-bottom: 5px solid #03090a;

}

#container{
    margin: 0 20px 15px 20px;
    text-align: right;
    float: right;
}
img{
max-width: 400px;
padding: 10px 10px 10px 10px;

}
.heading{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    column-gap: 1.6rem;
    margin-top: 400px;
    padding: 0px 0px 0px 200px;
}

.heading::before, .heading::after{
content: "";
height: 2px;
background-color: #03090a;
display: flex;
}
.text{
    text-align: justify;
    font-family: Hoefler Text;
    font-size: 20px;
    padding: 10px 600px 30px 20px;
    float: left;
    position: relative;
    bottom: 600px;
}
#Contact{
    background-color: rgb(37, 198, 235);
    color: rgba (0,0,0,.8);
    display: inline-block;
    padding: 2% 4%;
    font-size: 16px;
    font-weight: 501;
    float: left;

}
a:link, a:visited, a:hover, a:active {
    text-decoration: none;
    color: rgb(1, 0, 0);

}

#containerone{
    margin: 0 20px 15px 20px;
    text-align: left;
    float: left;
}
    .title{
        text-align: justify;
        font-family: Hoefler Text;
        font-size: 20px;
        padding: 10px 20px 20px 700px;
        align-items: right;
        position: relative;
        bottom: 500px;
    }
    .studies{
        font-size: 50px;
        position: none;
        bottom: 300px;
        text-align: center;

    }
    img{
        max-width: 500px;
        padding: 10px 10px 10px 10px

    }
/* This is where I need help in */

    .name{
        text-align: right;
        font-family: Hoefler Text;
        font-size: 35px;
        padding: 10px 10px 10px 400px;
        align-items: right;
        position: relative;
        bottom: 400px;
    }

.icon{
    text-align: right;
    font-size: 37px;
    padding: 10px 10px 200px 550px;
    align-items: right;
    position: relative;
    bottom: 400px;
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'm a newbie at html and css, please could someone help me out.I'm trying to get the 'Full Stack Development' and icon further away from the picture. Also, stretch 'Full Stack Development' text out a bit. Please explain it in a simple way I could understand.

how I want it to look like
Vs this is how its turn out to be

HTML CODE:

 Home

 Education

 Experience

 Projects

 Contact Me

( You can call me)

            <ion-icon name="logo-instagram" size="large"></ion-icon>

            <ion-icon name="logo-linkedin" size="large"></ion-icon>

                <ion-icon name="logo-github" size="large"></ion-icon>

            <ion-icon name="mail-outline" size="large"></ion-icon>

         See My Resume

 What I Do?

 Full Stack Development

    <ion-icon name="logo-html5"></ion-icon>
    <ion-icon name="logo-css3"></ion-icon>
    <ion-icon name="logo-nodejs"></ion-icon>
    <ion-icon name="logo-python"></ion-icon>
    <ion-icon name="logo-javascript"></ion-icon>
    <ion-icon name="logo-react"></ion-icon>

CSS CODE:

body
{
    margin:0%;
    font-family: Hoefler Text, Helvetica, sans-serif;
background-color: rgb(233, 245, 248);
        color: black;
}

header{
   margin: 3% 10% 3% 10%;
    padding: 37px 161px;
     align-items: center;
}

.menu{
    list-style-type: none;
    margin: 0;
    padding: 0;
    float: right;

}
.menu li{
    display: inline-block;
    padding: 20px 40px;
    font-size: 20px;
}
.menu li a:hover{
    color: rgb(0, 216, 247);
    border-bottom: 5px solid #03090a;

}

#container{
    margin: 0 20px 15px 20px;
    text-align: right;
    float: right;
}
img{
max-width: 400px;
padding: 10px 10px 10px 10px;

}
.heading{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    column-gap: 1.6rem;
    margin-top: 400px;
    padding: 0px 0px 0px 200px;
}

.heading::before, .heading::after{
content: "";
height: 2px;
background-color: #03090a;
display: flex;
}
.text{
    text-align: justify;
    font-family: Hoefler Text;
    font-size: 20px;
    padding: 10px 600px 30px 20px;
    float: left;
    position: relative;
    bottom: 600px;
}
#Contact{
    background-color: rgb(37, 198, 235);
    color: rgba (0,0,0,.8);
    display: inline-block;
    padding: 2% 4%;
    font-size: 16px;
    font-weight: 501;
    float: left;

}
a:link, a:visited, a:hover, a:active {
    text-decoration: none;
    color: rgb(1, 0, 0);

}

#containerone{
    margin: 0 20px 15px 20px;
    text-align: left;
    float: left;
}
    .title{
        text-align: justify;
        font-family: Hoefler Text;
        font-size: 20px;
        padding: 10px 20px 20px 700px;
        align-items: right;
        position: relative;
        bottom: 500px;
    }
    .studies{
        font-size: 50px;
        position: none;
        bottom: 300px;
        text-align: center;

    }
    img{
        max-width: 500px;
        padding: 10px 10px 10px 10px

    }
/* This is where I need help in */

    .name{
        text-align: right;
        font-family: Hoefler Text;
        font-size: 35px;
        padding: 10px 10px 10px 400px;
        align-items: right;
        position: relative;
        bottom: 400px;
    }

.icon{
    text-align: right;
    font-size: 37px;
    padding: 10px 10px 200px 550px;
    align-items: right;
    position: relative;
    bottom: 400px;
}


问:
moviepy problem with ImageMagick: delegate library support not built-in
I'm using Ubuntu 22.04.1 LTS and when I try to run a Python code that uses the moviepy library, it returns an error related to ImageMagick:

My simple code:

```<code>from moviepy.editor import *

text = TextClip("test", fontsize=24, color='white')

text = text.set_duration(10)

background = ColorClip((1920, 1080), color=(0, 0, 0))

background = background.set_duration(10)

test_video = CompositeVideoClip([background, text.set_pos(('right', 'bottom'))])
</code>```

The error when I run python3 code.py (I'm using virtual env called ttenv):

```<code>Traceback (most recent call last):
  File "/home/myuser/project/ttenv/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 1137, in __init__
    subprocess_call(cmd, logger=None)
  File "/home/myuser/project/ttenv/lib/python3.10/site-packages/moviepy/tools.py", line 54, in subprocess_call
    raise IOError(err.decode('utf8'))
OSError: convert: delegate library support not built-in '/usr/share/fonts/type1/gsfonts/n022003l.pfb' (Freetype) @ warning/annotate.c/RenderFreetype/2067.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
convert: no images defined `PNG32:/tmp/tmpg4dfl7dq.png' @ error/convert.c/ConvertImageCommand/3342.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myuser/project/make-video.py", line 4, in <module>
    text = TextClip("test", fontsize=24, color='white')
  File "/home/pedro/tt-project/ttenv/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 1146, in __init__
    raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:

convert: delegate library support not built-in '/usr/share/fonts/type1/gsfonts/n022003l.pfb' (Freetype) @ warning/annotate.c/RenderFreetype/2067.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
convert: no images defined `PNG32:/tmp/tmpg4dfl7dq.png' @ error/convert.c/ConvertImageCommand/3342.
.

.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect
</code>```

My /etc/ImageMagick-6/policy.xml file:

```<code><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
  <!ELEMENT policymap (policy)*>
  <!ATTLIST policymap xmlns CDATA #FIXED ''>
  <!ELEMENT policy EMPTY>
  <!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
    name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
    stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
]>
<!--
  Configure ImageMagick policies.

  Domains include system, delegate, coder, filter, path, or resource.

  Rights include none, read, write, execute and all.  Use | to combine them,
  for example: "read | write" to permit read from, or write to, a path.

  Use a glob expression as a pattern.

  Suppose we do not want users to process MPEG video images:

    <policy domain="delegate" rights="none" pattern="mpeg:decode" />

  Here we do not want users reading images from HTTP:

    <policy domain="coder" rights="none" pattern="HTTP" />

  The /repository file system is restricted to read only.  We use a glob
  expression to match all paths that start with /repository:

    <policy domain="path" rights="read" pattern="/repository/*" />

  Lets prevent users from executing any image filters:

    <policy domain="filter" rights="none" pattern="*" />

  Any large image is cached to disk rather than memory:

    <policy domain="resource" name="area" value="1GP"/>

  Use the default system font unless overwridden by the application:

    <policy domain="system" name="font" value="/usr/share/fonts/favorite.ttf"/>

  Define arguments for the memory, map, area, width, height and disk resources
  with SI prefixes (.e.g 100MB).  In addition, resource policies are maximums
  for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
  exceeds policy maximum so memory limit is 1GB).

  Rules are processed in order.  Here we want to restrict ImageMagick to only
  read or write a small subset of proven web-safe image types:

    <policy domain="delegate" rights="none" pattern="*" />
    <policy domain="filter" rights="none" pattern="*" />
    <policy domain="coder" rights="none" pattern="*" />
-->
    <policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />

<policymap>
  <policy domain="resource" name="temporary-path" value="/tmp"/>
  <policy domain="resource" name="memory" value="256MiB"/>
  <policy domain="resource" name="map" value="512MiB"/>
  <policy domain="resource" name="width" value="16KP"/>
  <policy domain="resource" name="height" value="16KP"/>
  <!-- <policy domain="resource" name="list-length" value="128"/> -->
  <policy domain="resource" name="area" value="128MP"/>
  <policy domain="resource" name="disk" value="1GiB"/>
  <!-- <policy domain="resource" name="file" value="768"/> -->
  <!-- <policy domain="resource" name="thread" value="4"/> -->
  <!-- <policy domain="resource" name="throttle" value="0"/> -->
  <!-- <policy domain="resource" name="time" value="3600"/> -->
  <!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
  <!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
  <!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
  <!-- <policy domain="cache" name="synchronize" value="True"/> -->
  <!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
  <!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
  <!-- <policy domain="system" name="shred" value="2"/> -->
  <!-- <policy domain="system" name="precision" value="6"/> -->
  <!-- <policy domain="system" name="font" value="/path/to/font.ttf"/> -->
  <!-- <policy domain="system" name="pixel-cache-memory" value="anonymous"/> -->
  <!-- <policy domain="system" name="shred" value="2"/> -->
  <!-- <policy domain="system" name="precision" value="6"/> -->
  <!-- not needed due to the need to use explicitly by mvg: -->
  <!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
  <!-- use curl -->
  <policy domain="delegate" rights="none" pattern="URL" />
  <policy domain="delegate" rights="none" pattern="HTTPS" />
  <policy domain="delegate" rights="none" pattern="HTTP" />
  <!-- in order to avoid to get image with password text -->
  <policy domain="path" rights="none" pattern="@*"/>
  <!-- disable ghostscript format types -->
  <policy domain="coder" rights="none" pattern="PS" />
  <policy domain="coder" rights="none" pattern="PS2" />
  <policy domain="coder" rights="none" pattern="PS3" />
  <policy domain="coder" rights="none" pattern="EPS" />
  <policy domain="coder" rights="none" pattern="PDF" />
  <policy domain="coder" rights="none" pattern="XPS" />
  <policy domain="coder" rights="none" pattern="TEXT" />
</policymap>
</code>```

My /usr/share/fonts/type1/gsfonts permissions:
-rwxrwxrwx 1 root  root for all files

I've already tried this solutions:

Updating it to the latest version running sudo apt-get update && sudo apt-get upgrade

Giving permissions on /tmp and on font's file to my user

Changing some configurations on policy.xml

Edit:

The file /usr/share/fonts/type1/gsfonts/n022003l.pfb output:

```<code>/usr/share/fonts/type1/gsfonts/n022003l.pfb: PostScript Type 1 font program data (NimbusMonL-Regu 1.06)
</code>```

The ls -l /user/share/fonts/type1/gsfonts/n022003l.pfb output:

```<code>-rwxrwxrwx 1 root root 94786 jan  3 15:54 /usr/share/fonts/type1/gsfonts/n022003l.pfb
</code>```

The convert -debug all -font /usr/share/fonts/type1/gsfonts/n022003l.pfb -pointsize 48 label:"Hello World" hello.png output:

```<code>2023-01-05T04:13:50+00:00 0:00.000 0.000u 7.1.0 Configure convert[4089]: utility.c/ExpandFilenames/973/Configure
Command line: convert {-debug} {all} {-font} {/usr/share/fonts/type1/gsfonts/n022003l.pfb} {-pointsize} {48} {label:Hello World} {hello.png}
2023-01-05T04:13:50+00:00 0:00.000 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Module; rights=Unrecognized; pattern="LABEL" ...
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Coder; rights=Read; pattern="LABEL" ...
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/SetPixelChannelMask/6307/Pixel
Hello World[07ffffff]
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/LogPixelChannels/6191/Pixel
Hello World[07ffffff]
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/LogPixelChannels/6288/Pixel
  0: red (update)
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/LogPixelChannels/6288/Pixel
  1: green (update)
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/LogPixelChannels/6288/Pixel
  2: blue (update)
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireMagickResource/390/Resource
Area: 1B/0B/15.4046GiB
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireMagickResource/390/Resource
Memory: 12B/12B/7.70229GiB
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Cache convert[4089]: cache.c/OpenPixelCache/3798/Cache
open Hello World[0] (Heap Memory, 1x1x3 12B)
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy Hello World[0]
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishMagickResource/1074/Resource
Memory: 12B/0B/7.70229GiB
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireMagickResource/390/Resource
Width: 264B/0B/409.6PiB
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/share/ImageMagick-7/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/lib/ImageMagick-7.1.0//config-Q16HDRI/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/etc/ImageMagick-7/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/share/doc/ImageMagick-7/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/home/pedro/.config/ImageMagick/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Configure convert[4089]: locale.c/LoadLocaleCache/1177/Configure
Loading locale configure file "/usr/local/share/ImageMagick-7/locale.xml" ...
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/share/ImageMagick-7/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/lib/ImageMagick-7.1.0//config-Q16HDRI/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/etc/ImageMagick-7/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/share/doc/ImageMagick-7/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/home/pedro/.config/ImageMagick/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Configure convert[4089]: locale.c/LoadLocaleCache/1177/Configure
Loading locale configure file "/usr/local/share/ImageMagick-7/english.xml" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Exception convert[4089]: annotate.c/RenderFreetype/2067/Exception
delegate library support not built-in '/usr/share/fonts/type1/gsfonts/n022003l.pfb' (Freetype)
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Annotate convert[4089]: annotate.c/RenderPostscript/2193/Annotate
Font /usr/share/fonts/type1/gsfonts/n022003l.pfb; pointsize 48
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/584/Resource
...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/641/Resource
/tmp/magick-jFaf2l7OrlfUHLbBH6k8gV6rt2rScPzL
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Module; rights=Unrecognized; pattern="PS" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Path; rights=Read; pattern="/tmp/magick-jFaf2l7OrlfUHLbBH6k8gV6rt2rScPzL" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Blob convert[4089]: blob.c/OpenBlob/3453/Blob
  read 3 magic header bytes
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Coder; rights=Read; pattern="PS" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Path; rights=Read; pattern="/tmp/magick-jFaf2l7OrlfUHLbBH6k8gV6rt2rScPzL" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Blob convert[4089]: blob.c/OpenBlob/3453/Blob
  read 3 magic header bytes
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/584/Resource
...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/641/Resource
/tmp/magick-faN1FzvtOzDGwqP1YcnLHRxwC4IEtWRQ
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-faN1FzvtOzDGwqP1YcnLHRxwC4IEtWRQ
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/584/Resource
...
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/641/Resource
/tmp/magick-YZX9RZBSyTVr3ShLu0CNAr_BqGDvAgCI
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/usr/local/share/ImageMagick-7/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/usr/local/lib/ImageMagick-7.1.0//config-Q16HDRI/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/usr/local/etc/ImageMagick-7/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/usr/local/share/doc/ImageMagick-7/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/home/pedro/.config/ImageMagick/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: delegate.c/LoadDelegateCache/2094/Configure
Loading delegate configuration file "/usr/local/etc/ImageMagick-7/delegates.xml" ...
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/584/Resource
...
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/641/Resource
/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Delegate; rights=Execute; pattern="gs" ...
2023-01-05T04:13:50+00:00 0:00.063 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-YZX9RZBSyTVr3ShLu0CNAr_BqGDvAgCI
2023-01-05T04:13:50+00:00 0:00.063 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-faN1FzvtOzDGwqP1YcnLHRxwC4IEtWRQ
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Path; rights=Read; pattern="/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb1" ...
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Blob convert[4089]: blob.c/OpenBlob/3453/Blob
  read 3 magic header bytes
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Path; rights=Read; pattern="/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb1" ...
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Blob convert[4089]: blob.c/OpenBlob/3453/Blob
  read 3 magic header bytes
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Exception convert[4089]: constitute.c/ReadImage/741/Exception
no decode delegate for this image format `'
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb1
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb1
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy convert: delegate library support not built-in '/usr/share/fonts/type1/gsfonts/n022003l.pfb' (Freetype) @ warning/annotate.c/RenderFreetype/2067. convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-jFaf2l7OrlfUHLbBH6k8gV6rt2rScPzL
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Annotate convert[4089]: annotate.c/GetTypeMetrics/933/Annotate
Metrics: text: Hello World; width: 0; height: 0; ascent: 0; descent: 0; max advance: 0; bounds: 0,0  0,0; origin: 0,0; pixels per em: 0,0; underline position: 0; underline thickness: 0
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireMagickResource/390/Resource
Height: 0B/0B/409.6PiB
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Exception convert[4089]: convert.c/ConvertImageCommand/3342/Exception
no images defined `hello.png' convert: no images defined `hello.png' @ error/convert.c/ConvertImageCommand/3342.
</code>```

Trying to use a .ttf font with convert -font /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf -pointsize 48 label:"Hello World" hello.png returns an error too:

```<code>convert: delegate library support not built-in '/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf' (Freetype) @ warning/annotate.c/RenderFreetype/2067.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
convert: no images defined `hello.png' @ error/convert.c/ConvertImageCommand/3342.
</code>```

Body:
I'm using Ubuntu 22.04.1 LTS and when I try to run a Python code that uses the moviepy library, it returns an error related to ImageMagick:

My simple code:

from moviepy.editor import *

text = TextClip("test", fontsize=24, color='white')

text = text.set_duration(10)

background = ColorClip((1920, 1080), color=(0, 0, 0))

background = background.set_duration(10)

test_video = CompositeVideoClip([background, text.set_pos(('right', 'bottom'))])

The error when I run python3 code.py (I'm using virtual env called ttenv):

Traceback (most recent call last):
  File "/home/myuser/project/ttenv/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 1137, in __init__
    subprocess_call(cmd, logger=None)
  File "/home/myuser/project/ttenv/lib/python3.10/site-packages/moviepy/tools.py", line 54, in subprocess_call
    raise IOError(err.decode('utf8'))
OSError: convert: delegate library support not built-in '/usr/share/fonts/type1/gsfonts/n022003l.pfb' (Freetype) @ warning/annotate.c/RenderFreetype/2067.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
convert: no images defined `PNG32:/tmp/tmpg4dfl7dq.png' @ error/convert.c/ConvertImageCommand/3342.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myuser/project/make-video.py", line 4, in <module>
    text = TextClip("test", fontsize=24, color='white')
  File "/home/pedro/tt-project/ttenv/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 1146, in __init__
    raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:

convert: delegate library support not built-in '/usr/share/fonts/type1/gsfonts/n022003l.pfb' (Freetype) @ warning/annotate.c/RenderFreetype/2067.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
convert: no images defined `PNG32:/tmp/tmpg4dfl7dq.png' @ error/convert.c/ConvertImageCommand/3342.
.

.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect

My /etc/ImageMagick-6/policy.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
  <!ELEMENT policymap (policy)*>
  <!ATTLIST policymap xmlns CDATA #FIXED ''>
  <!ELEMENT policy EMPTY>
  <!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
    name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
    stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
]>

    <policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />

<policymap>
  <policy domain="resource" name="temporary-path" value="/tmp"/>
  <policy domain="resource" name="memory" value="256MiB"/>
  <policy domain="resource" name="map" value="512MiB"/>
  <policy domain="resource" name="width" value="16KP"/>
  <policy domain="resource" name="height" value="16KP"/>

  <policy domain="resource" name="area" value="128MP"/>
  <policy domain="resource" name="disk" value="1GiB"/>

  <policy domain="delegate" rights="none" pattern="URL" />
  <policy domain="delegate" rights="none" pattern="HTTPS" />
  <policy domain="delegate" rights="none" pattern="HTTP" />

  <policy domain="path" rights="none" pattern="@*"/>

  <policy domain="coder" rights="none" pattern="PS" />
  <policy domain="coder" rights="none" pattern="PS2" />
  <policy domain="coder" rights="none" pattern="PS3" />
  <policy domain="coder" rights="none" pattern="EPS" />
  <policy domain="coder" rights="none" pattern="PDF" />
  <policy domain="coder" rights="none" pattern="XPS" />
  <policy domain="coder" rights="none" pattern="TEXT" />
</policymap>

My /usr/share/fonts/type1/gsfonts permissions:
-rwxrwxrwx 1 root  root for all files

I've already tried this solutions:

Updating it to the latest version running sudo apt-get update && sudo apt-get upgrade

Giving permissions on /tmp and on font's file to my user

Changing some configurations on policy.xml

Edit:

The file /usr/share/fonts/type1/gsfonts/n022003l.pfb output:

/usr/share/fonts/type1/gsfonts/n022003l.pfb: PostScript Type 1 font program data (NimbusMonL-Regu 1.06)

The ls -l /user/share/fonts/type1/gsfonts/n022003l.pfb output:

-rwxrwxrwx 1 root root 94786 jan  3 15:54 /usr/share/fonts/type1/gsfonts/n022003l.pfb

The convert -debug all -font /usr/share/fonts/type1/gsfonts/n022003l.pfb -pointsize 48 label:"Hello World" hello.png output:

2023-01-05T04:13:50+00:00 0:00.000 0.000u 7.1.0 Configure convert[4089]: utility.c/ExpandFilenames/973/Configure
Command line: convert {-debug} {all} {-font} {/usr/share/fonts/type1/gsfonts/n022003l.pfb} {-pointsize} {48} {label:Hello World} {hello.png}
2023-01-05T04:13:50+00:00 0:00.000 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Module; rights=Unrecognized; pattern="LABEL" ...
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Coder; rights=Read; pattern="LABEL" ...
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/SetPixelChannelMask/6307/Pixel
Hello World[07ffffff]
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/LogPixelChannels/6191/Pixel
Hello World[07ffffff]
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/LogPixelChannels/6288/Pixel
  0: red (update)
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/LogPixelChannels/6288/Pixel
  1: green (update)
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Pixel convert[4089]: pixel.c/LogPixelChannels/6288/Pixel
  2: blue (update)
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireMagickResource/390/Resource
Area: 1B/0B/15.4046GiB
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireMagickResource/390/Resource
Memory: 12B/12B/7.70229GiB
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Cache convert[4089]: cache.c/OpenPixelCache/3798/Cache
open Hello World[0] (Heap Memory, 1x1x3 12B)
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy Hello World[0]
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishMagickResource/1074/Resource
Memory: 12B/0B/7.70229GiB
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireMagickResource/390/Resource
Width: 264B/0B/409.6PiB
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/share/ImageMagick-7/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/lib/ImageMagick-7.1.0//config-Q16HDRI/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/etc/ImageMagick-7/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/share/doc/ImageMagick-7/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/home/pedro/.config/ImageMagick/locale.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Configure convert[4089]: locale.c/LoadLocaleCache/1177/Configure
Loading locale configure file "/usr/local/share/ImageMagick-7/locale.xml" ...
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/share/ImageMagick-7/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/lib/ImageMagick-7.1.0//config-Q16HDRI/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/etc/ImageMagick-7/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/usr/local/share/doc/ImageMagick-7/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Locale convert[4089]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/home/pedro/.config/ImageMagick/english.xml"
2023-01-05T04:13:50+00:00 0:00.001 0.000u 7.1.0 Configure convert[4089]: locale.c/LoadLocaleCache/1177/Configure
Loading locale configure file "/usr/local/share/ImageMagick-7/english.xml" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Exception convert[4089]: annotate.c/RenderFreetype/2067/Exception
delegate library support not built-in '/usr/share/fonts/type1/gsfonts/n022003l.pfb' (Freetype)
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Annotate convert[4089]: annotate.c/RenderPostscript/2193/Annotate
Font /usr/share/fonts/type1/gsfonts/n022003l.pfb; pointsize 48
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/584/Resource
...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/641/Resource
/tmp/magick-jFaf2l7OrlfUHLbBH6k8gV6rt2rScPzL
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Module; rights=Unrecognized; pattern="PS" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Path; rights=Read; pattern="/tmp/magick-jFaf2l7OrlfUHLbBH6k8gV6rt2rScPzL" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Blob convert[4089]: blob.c/OpenBlob/3453/Blob
  read 3 magic header bytes
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Coder; rights=Read; pattern="PS" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Path; rights=Read; pattern="/tmp/magick-jFaf2l7OrlfUHLbBH6k8gV6rt2rScPzL" ...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Blob convert[4089]: blob.c/OpenBlob/3453/Blob
  read 3 magic header bytes
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/584/Resource
...
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/641/Resource
/tmp/magick-faN1FzvtOzDGwqP1YcnLHRxwC4IEtWRQ
2023-01-05T04:13:50+00:00 0:00.002 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-faN1FzvtOzDGwqP1YcnLHRxwC4IEtWRQ
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/584/Resource
...
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/641/Resource
/tmp/magick-YZX9RZBSyTVr3ShLu0CNAr_BqGDvAgCI
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/usr/local/share/ImageMagick-7/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/usr/local/lib/ImageMagick-7.1.0//config-Q16HDRI/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/usr/local/etc/ImageMagick-7/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/usr/local/share/doc/ImageMagick-7/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: configure.c/GetConfigureOptions/695/Configure
Searching for configure file: "/home/pedro/.config/ImageMagick/delegates.xml"
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Configure convert[4089]: delegate.c/LoadDelegateCache/2094/Configure
Loading delegate configuration file "/usr/local/etc/ImageMagick-7/delegates.xml" ...
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/584/Resource
...
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireUniqueFileResource/641/Resource
/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb
2023-01-05T04:13:50+00:00 0:00.003 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Delegate; rights=Execute; pattern="gs" ...
2023-01-05T04:13:50+00:00 0:00.063 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-YZX9RZBSyTVr3ShLu0CNAr_BqGDvAgCI
2023-01-05T04:13:50+00:00 0:00.063 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-faN1FzvtOzDGwqP1YcnLHRxwC4IEtWRQ
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Path; rights=Read; pattern="/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb1" ...
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Blob convert[4089]: blob.c/OpenBlob/3453/Blob
  read 3 magic header bytes
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Policy convert[4089]: policy.c/IsRightsAuthorized/647/Policy
Domain: Path; rights=Read; pattern="/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb1" ...
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Blob convert[4089]: blob.c/OpenBlob/3453/Blob
  read 3 magic header bytes
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Exception convert[4089]: constitute.c/ReadImage/741/Exception
no decode delegate for this image format `'
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb1
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-IjaxzuCSMrQfTLIUilHJYLnuZLFP8Sjb1
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy convert: delegate library support not built-in '/usr/share/fonts/type1/gsfonts/n022003l.pfb' (Freetype) @ warning/annotate.c/RenderFreetype/2067. convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Resource convert[4089]: resource.c/RelinquishUniqueFileResource/1113/Resource
/tmp/magick-jFaf2l7OrlfUHLbBH6k8gV6rt2rScPzL
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Annotate convert[4089]: annotate.c/GetTypeMetrics/933/Annotate
Metrics: text: Hello World; width: 0; height: 0; ascent: 0; descent: 0; max advance: 0; bounds: 0,0  0,0; origin: 0,0; pixels per em: 0,0; underline position: 0; underline thickness: 0
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Resource convert[4089]: resource.c/AcquireMagickResource/390/Resource
Height: 0B/0B/409.6PiB
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Cache convert[4089]: cache.c/DestroyPixelCache/1064/Cache
destroy
2023-01-05T04:13:50+00:00 0:00.064 0.000u 7.1.0 Exception convert[4089]: convert.c/ConvertImageCommand/3342/Exception
no images defined `hello.png' convert: no images defined `hello.png' @ error/convert.c/ConvertImageCommand/3342.

Trying to use a .ttf font with convert -font /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf -pointsize 48 label:"Hello World" hello.png returns an error too:

convert: delegate library support not built-in '/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf' (Freetype) @ warning/annotate.c/RenderFreetype/2067.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/741.
convert: no images defined `hello.png' @ error/convert.c/ConvertImageCommand/3342.


问:
Custom parameters in Duende Identity Server
I have an angular application using the authorization code grant, with the oidc library I added a custom parameter. I am able to get it value with IIdentityServerInteractionService in the controller (customerId = 123).

I am trying to add some claims based in the customerId in the Profile service, but I am not able to get that custom parameter in the ProfileDataRequest,
Does anyone know if I am missing something or has any direction.


问:
VBA code to save selected worksheet as pdf
I'm having trouble using the following code to save selected worksheet as pdf

```<code>Sub PrintIndiv()
Dim TotalPages As Integer
Dim myPDF As PdfDistiller
Dim PSFileName As String
Dim PDFFileName As String

Set myPDF = New PdfDistiller

TotEE = Worksheets("Input").Cells(19, 3)

For EE = 1 To TotEE
 Worksheets("Results").Cells(1, 2) = EE

 PSFileName = Sheets("Input").Range("C14") & EE & ".ps"
 PDFFileName = Sheets("Input").Range("C14") & EE & ".pdf"

 Calculate
 TotalPages = Worksheets("Results").Cells(7, 1 + EE)

 ActiveWorkbook.Unprotect ("12345")

 If TotalPages < 5 Then
    Worksheets("IInf-Cover Page").Visible = True
    Worksheets("IInf-Page 1").Visible = True
    Worksheets("IInf-Page 2").Visible = True
    Worksheets("IInf-Page 3").Visible = True
    Worksheets("IInf-Page 4").Visible = True
    Sheets(Array("IInf-Cover Page", "IInf-Page 1", "IInf-Page 2", "IInf-Page 3", "IInf-Page 4")).Select
    ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prtofilename:=PSFileName
    Worksheets("IInf-Cover Page").Visible = False
    Worksheets("IInf-Page 1").Visible = False
    Worksheets("IInf-Page 2").Visible = False
    Worksheets("IInf-Page 3").Visible = False
    Worksheets("IInf-Page 4").Visible = False
 End If

 If TotalPages >= 5 Then
    Worksheets("IInf-Cover Page").Visible = True
    Worksheets("IInf-Page 1").Visible = True
    Worksheets("IInf-Page 2").Visible = True
    Worksheets("IInf-Page 3").Visible = True
    Worksheets("IInf-Page 4").Visible = True
    Worksheets("IInf-Page 5").Visible = True
    Sheets(Array("IInf-Cover Page", "IInf-Page 1", "IInf-Page 2", "IInf-Page 3", "IInf-Page 4", "IInf-Page 5")).Select
    ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prtofilename:=PSFileName
    Worksheets("IInf-Cover Page").Visible = False
    Worksheets("IInf-Page 1").Visible = False
    Worksheets("IInf-Page 2").Visible = False
    Worksheets("IInf-Page 3").Visible = False
    Worksheets("IInf-Page 4").Visible = False
    Worksheets("IInf-Page 5").Visible = False
 End If

 myPDF.FileToPDF PSFileName, PDFFileName, ""
 Kill (PSFileName)

Next EE

ActiveWorkbook.Protect ("12345")

End Sub

</code>```

Once I executed the code, it gives me the "Microsoft Excel is waiting for another application to complete an ole action." error after it was able to only save one iteration as pdf and not even in the location that I specified in cell C14 of input page. I tried to debug and "myPDF.FileToPDF PSFileName, PDFFileName, "" " was highlighted. Anyone has any idea how to fix it? Thanks,

Body:
I'm having trouble using the following code to save selected worksheet as pdf

Sub PrintIndiv()
Dim TotalPages As Integer
Dim myPDF As PdfDistiller
Dim PSFileName As String
Dim PDFFileName As String

Set myPDF = New PdfDistiller

TotEE = Worksheets("Input").Cells(19, 3)

For EE = 1 To TotEE
 Worksheets("Results").Cells(1, 2) = EE

 PSFileName = Sheets("Input").Range("C14") & EE & ".ps"
 PDFFileName = Sheets("Input").Range("C14") & EE & ".pdf"

 Calculate
 TotalPages = Worksheets("Results").Cells(7, 1 + EE)

 ActiveWorkbook.Unprotect ("12345")

 If TotalPages < 5 Then
    Worksheets("IInf-Cover Page").Visible = True
    Worksheets("IInf-Page 1").Visible = True
    Worksheets("IInf-Page 2").Visible = True
    Worksheets("IInf-Page 3").Visible = True
    Worksheets("IInf-Page 4").Visible = True
    Sheets(Array("IInf-Cover Page", "IInf-Page 1", "IInf-Page 2", "IInf-Page 3", "IInf-Page 4")).Select
    ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prtofilename:=PSFileName
    Worksheets("IInf-Cover Page").Visible = False
    Worksheets("IInf-Page 1").Visible = False
    Worksheets("IInf-Page 2").Visible = False
    Worksheets("IInf-Page 3").Visible = False
    Worksheets("IInf-Page 4").Visible = False
 End If

 If TotalPages >= 5 Then
    Worksheets("IInf-Cover Page").Visible = True
    Worksheets("IInf-Page 1").Visible = True
    Worksheets("IInf-Page 2").Visible = True
    Worksheets("IInf-Page 3").Visible = True
    Worksheets("IInf-Page 4").Visible = True
    Worksheets("IInf-Page 5").Visible = True
    Sheets(Array("IInf-Cover Page", "IInf-Page 1", "IInf-Page 2", "IInf-Page 3", "IInf-Page 4", "IInf-Page 5")).Select
    ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prtofilename:=PSFileName
    Worksheets("IInf-Cover Page").Visible = False
    Worksheets("IInf-Page 1").Visible = False
    Worksheets("IInf-Page 2").Visible = False
    Worksheets("IInf-Page 3").Visible = False
    Worksheets("IInf-Page 4").Visible = False
    Worksheets("IInf-Page 5").Visible = False
 End If

 myPDF.FileToPDF PSFileName, PDFFileName, ""
 Kill (PSFileName)

Next EE

ActiveWorkbook.Protect ("12345")

End Sub

Once I executed the code, it gives me the "Microsoft Excel is waiting for another application to complete an ole action." error after it was able to only save one iteration as pdf and not even in the location that I specified in cell C14 of input page. I tried to debug and "myPDF.FileToPDF PSFileName, PDFFileName, "" " was highlighted. Anyone has any idea how to fix it? Thanks,


问:
How to implement singleton @ObservedObject in SwiftUI
I'm curious, is there a way to implement a singleton @ObservedObject? I'm trying to find an alternative to the environmentObject pattern in SwiftUI, and for some situations (eg for an AppState object where there should only be a single instance), I'm experimenting with the idea of using a single shared instance that can be picked up directly in subviews, without any setup from the parents.

This would have the delightful side benefit of easier previews (since the need for .environmentObject(...) would go away).

Here's some sample code I've been playing with:

```<code>// An object to hold App State. There should only ever be one instance.
class AppState : ObservableObject {
    @Published var showLabels = false

    static var shared: AppState { AppState() }
}

// A subview that could pick up the AppState through static member on the class
struct IdentityPanel: View {
    @ObservedObject var appState = AppState.shared
    @State private var name = ""

    var body: some View {
        Section("Identity") {
            if appState.showLabels {
                Text("Enter your Name here:")
            }
            TextField("Name", text: $name)
        }
    }
}

// The parent view, it also accesses the AppState directly, but doesn't
// do any setup for the child.
struct SingletonAppState: View {
    @ObservedObject var appState = AppState.shared

    var body: some View {
        Form {
            Toggle("Show Labels", isOn: $appState.showLabels)

            IdentityPanel()
        }
    }
}

// Look, Ma, no .environmentObject!
struct SingletonAppState_Previews: PreviewProvider {
    static var previews: some View {
        SingletonAppState()
    }
}
</code>```

Now this compiles and everything, but value changes aren't being picked up correctly. Changing the showLabels value in the parent doesn't cause the child to refresh, as I had hoped.

My first thought was that maybe the AppState object needs to be instantiated in a view with a @StateObject decorator, to have all the required scaffolding set up. So I tried this newer definition for the class:

```<code>class AppState : ObservableObject {
    @Published var showLabels = false

    private struct StateHolder : View {
        @StateObject var state = AppState()
        var body: some View {
            Text("_")
        }
    }
    static private var _stateHolder: StateHolder { StateHolder() }
    static var shared: AppState { _stateHolder.state }
}
</code>```

But that didn't work either. So then I thought that maybe the owner of the State needs to be in the view hierarchy directly, so I changed the decorator in SingletonAppState from @ObservedObject to @StateObject. But that didn't improve things either.

I don't understand what's going on at a lower level to make any more progress. Can someone have any insight in this, please? Hopefully, I've just missed something simple.

Body:
I'm curious, is there a way to implement a singleton @ObservedObject? I'm trying to find an alternative to the environmentObject pattern in SwiftUI, and for some situations (eg for an AppState object where there should only be a single instance), I'm experimenting with the idea of using a single shared instance that can be picked up directly in subviews, without any setup from the parents.

This would have the delightful side benefit of easier previews (since the need for .environmentObject(...) would go away).

Here's some sample code I've been playing with:

// An object to hold App State. There should only ever be one instance.
class AppState : ObservableObject {
    @Published var showLabels = false

    static var shared: AppState { AppState() }
}

// A subview that could pick up the AppState through static member on the class
struct IdentityPanel: View {
    @ObservedObject var appState = AppState.shared
    @State private var name = ""

    var body: some View {
        Section("Identity") {
            if appState.showLabels {
                Text("Enter your Name here:")
            }
            TextField("Name", text: $name)
        }
    }
}

// The parent view, it also accesses the AppState directly, but doesn't
// do any setup for the child.
struct SingletonAppState: View {
    @ObservedObject var appState = AppState.shared

    var body: some View {
        Form {
            Toggle("Show Labels", isOn: $appState.showLabels)

            IdentityPanel()
        }
    }
}

// Look, Ma, no .environmentObject!
struct SingletonAppState_Previews: PreviewProvider {
    static var previews: some View {
        SingletonAppState()
    }
}

Now this compiles and everything, but value changes aren't being picked up correctly. Changing the showLabels value in the parent doesn't cause the child to refresh, as I had hoped.

My first thought was that maybe the AppState object needs to be instantiated in a view with a @StateObject decorator, to have all the required scaffolding set up. So I tried this newer definition for the class:

class AppState : ObservableObject {
    @Published var showLabels = false

    private struct StateHolder : View {
        @StateObject var state = AppState()
        var body: some View {
            Text("_")
        }
    }
    static private var _stateHolder: StateHolder { StateHolder() }
    static var shared: AppState { _stateHolder.state }
}

But that didn't work either. So then I thought that maybe the owner of the State needs to be in the view hierarchy directly, so I changed the decorator in SingletonAppState from @ObservedObject to @StateObject. But that didn't improve things either.

I don't understand what's going on at a lower level to make any more progress. Can someone have any insight in this, please? Hopefully, I've just missed something simple.


问:
How to automate Jenkins ssh credentials creation in python?
I am trying to create Jenkins user & ssh_key credentials in python with below script but it's not working anyhow! It gives some server exception with some html data.
I am not sure what things are going wrong here.

```<code>from api4jenkins import Jenkins

jenkins_client = Jenkins('http://xx.xx.xx.xx:8080', auth=('admin', 'xxxxxxx'))

with open("/home/oem/.ssh/id_rsa","r") as file:
    ssh_key = file.read()

sshPayload = f'''<com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey plugin="ssh-credentials@1.16">
  <scope>GLOBAL</scope>
  <id>Kubernetes_Master</id>
  <description>SSH Credential for K8S Master</description>
  <username>ubuntu</username>
  <privateKeySource class="com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey\$DirectEntryPrivateKeySource">
    <privateKey>{ssh_key}</privateKey>
  </privateKeySource>
</com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey>'''

jenkins_client.credentials.create(sshPayload)
</code>```

I tried to give the key as it is in the  section but no luck.Even mentioning the key file located at Jenkins server doesn't work either. Any help on this will be appreciated.
I followed the below mentioned in below question for simple user and password way but for ssh key there are no more discussions.
Question Link

Body:
I am trying to create Jenkins user & ssh_key credentials in python with below script but it's not working anyhow! It gives some server exception with some html data.
I am not sure what things are going wrong here.

from api4jenkins import Jenkins

jenkins_client = Jenkins('http://xx.xx.xx.xx:8080', auth=('admin', 'xxxxxxx'))

with open("/home/oem/.ssh/id_rsa","r") as file:
    ssh_key = file.read()

sshPayload = f'''<com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey plugin="ssh-credentials@1.16">
  <scope>GLOBAL</scope>
  <id>Kubernetes_Master</id>
  <description>SSH Credential for K8S Master</description>
  <username>ubuntu</username>
  <privateKeySource class="com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey\$DirectEntryPrivateKeySource">
    <privateKey>{ssh_key}</privateKey>
  </privateKeySource>
</com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey>'''

jenkins_client.credentials.create(sshPayload)

I tried to give the key as it is in the  section but no luck.Even mentioning the key file located at Jenkins server doesn't work either. Any help on this will be appreciated.
I followed the below mentioned in below question for simple user and password way but for ssh key there are no more discussions.
Question Link


问:
Pass data from one class function to another class function in flask restfull api
Below is the code of a restful api made using flask_restful module. I want to pass value from class A post to class B post.

```<code>from flask import Flask, request
from flask_restful import Api, Resource
from flask_cors import CORS

app = Flask(__name__)
app.config['SECRET_KEY'] = 'kF$EbR@Hv'
CORS(app)
api = Api(app)

class A(Resource):

    def post(self):
        B().post()
        # do some other stuff....

class B(Resource):

    def post(self):
        x = request.get_json()
        # do some operation with x

api.add_resource(A, '/a')
api.add_resource(B, '/b')

if __name__ == '__main__':
    app.run()

</code>```

I tried B().post({'fdsf':'dsfs'}) but it didn't work. I was expecting to get this {'fdsf':'dsfs'} in x.

Body:
Below is the code of a restful api made using flask_restful module. I want to pass value from class A post to class B post.

from flask import Flask, request
from flask_restful import Api, Resource
from flask_cors import CORS

app = Flask(__name__)
app.config['SECRET_KEY'] = 'kF$EbR@Hv'
CORS(app)
api = Api(app)

class A(Resource):

    def post(self):
        B().post()
        # do some other stuff....

class B(Resource):

    def post(self):
        x = request.get_json()
        # do some operation with x

api.add_resource(A, '/a')
api.add_resource(B, '/b')

if __name__ == '__main__':
    app.run()

I tried B().post({'fdsf':'dsfs'}) but it didn't work. I was expecting to get this {'fdsf':'dsfs'} in x.


问:
Supabase check whether a user is currently in/listening to a realtime channel from postgres function
How can one, from a postgres function, check whether a user is currently in/listening to a realtime channel?

I want to create notification entries in the database only if the user is not currently online.


问:
sonatype nexus auto create repository when publish maven artifact
Can I set up Nexus Repository OSS to automatically create a repository if it doesn't exist when publishing artifacts ?</p>


问:
NGINX reverse proxy use port when requesting resource
If I have an NGINX with reverse proxy setting such as:

```<code>upstream {{ server_name }} {
    server 127.0.0.1:1111;
}

server {
    listen 443 ssl default deferred;
    server_name {{ domain_name }};

    ssl_certificate         /etc/letsencrypt/live/{{ domain_name }}/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/{{ domain_name }}/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/{{ domain_name }}/fullchain.pem;

    ssl_session_cache shared:SSL:50m;
    ssl_session_timeout 5m;
    ssl_stapling on;
    ssl_stapling_verify on;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "....";

    ssl_dhparam /etc/nginx/dhparams.pem;
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/reverse-access.log;
    error_log /var/log/nginx/reverse-error.log;

    root /var/www/html/;

    location / {
        proxy_pass http://{{ server_name }};
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
    }
}
</code>```

How can I make that port number appear in the browser when requesting that resource as well? Currently it only appear the domain name which I normally prefer, but now I need to have the possibility to have the port in the URL. Any idea how to achieve this?

Body:
If I have an NGINX with reverse proxy setting such as:

upstream {{ server_name }} {
    server 127.0.0.1:1111;
}

server {
    listen 443 ssl default deferred;
    server_name {{ domain_name }};

    ssl_certificate         /etc/letsencrypt/live/{{ domain_name }}/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/{{ domain_name }}/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/{{ domain_name }}/fullchain.pem;

    ssl_session_cache shared:SSL:50m;
    ssl_session_timeout 5m;
    ssl_stapling on;
    ssl_stapling_verify on;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "....";

    ssl_dhparam /etc/nginx/dhparams.pem;
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/reverse-access.log;
    error_log /var/log/nginx/reverse-error.log;

    root /var/www/html/;

    location / {
        proxy_pass http://{{ server_name }};
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
    }
}

How can I make that port number appear in the browser when requesting that resource as well? Currently it only appear the domain name which I normally prefer, but now I need to have the possibility to have the port in the URL. Any idea how to achieve this?


问:
Complex lambda with sqlalchemy filter query
Consider an ORM class describing a "Store":

class Store(Base, AbstractSchema):
    __tablename__ = 'store'
    id = Column(Integer, primary_key=True)
    ...
    s2_cell_id       = Column(BigInteger,  unique=False, nullable=True)
```
<p><code>s2_cell_id</code> describes the location of a store as an id of S2 cell  <em>i.e Google S2</em> I am using <code>s2sphere</code> library in python for that.</p>
<p>Goal is to write a query that searches for stores in a certain range. I tried to use <code>@hybrid_method</code> as follows:</p>
<pre class="lang-py prettyprint-override"><code>    @hybrid_method
    def lies_inside(self, cells : list[Cell]):
        for c in cells:
            is_inside = c.contains(Cell(CellId(self.s2_cell_id)))
            if is_inside : return True
        return False

    @lies_inside.expression
    def lies_inside(cls, cells: list[Cell]):
        for c in cells:
            is_inside = c.contains(Cell(CellId(cls.s2_cell_id)))
            if is_inside : return True
        return False
</code>```

Usage is like this:

# Compute the set of cell that intersect the search area
candidates = router.location_manager.get_covering_cells(lat, lng, r, 13)

# Query the database for stores whose cell IDs are in the set of intersecting cells
query = db.query(Store).filter(Store.lies_inside(candidates)).all()
```
<p>I get the following error unfortunately:</p>
<pre class="lang-py prettyprint-override"><code>Traceback (most recent call last):
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 419, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\routing.py", line 235, in app
    raw_response = await run_endpoint_function(
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\FARO-User\Desktop\personal\dev\repos\woher-backend\.\src\routers\search.py", line 33, in get_nearby_stores
    query = db.query(Store).filter(Store.lies_inside(candidates)).all()
  File "c:\users\faro-user\desktop\personal\dev\repos\woher-backend\src\sql\models\store.py", line 55, in lies_inside
    is_inside = c.contains(Cell(CellId(cls.s2_cell_id)))
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\s2sphere\sphere.py", line 2354, in __init__
    face, i, j, orientation = cell_id.to_face_ij_orientation()
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\s2sphere\sphere.py", line 1298, in to_face_ij_orientation
    face = self.face()
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\s2sphere\sphere.py", line 1057, in face
    return self.id() >> self.__class__.POS_BITS
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\operators.py", line 458, in __rshift__
    return self.operate(rshift, other)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\elements.py", line 868, in operate
    return op(self.comparator, *other, **kwargs)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\operators.py", line 458, in __rshift__
    return self.operate(rshift, other)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\type_api.py", line 77, in operate
    return o[0](self.expr, op, *(other + o[1:]), **kwargs)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\default_comparator.py", line 181, in _unsupported_impl
    raise NotImplementedError(
NotImplementedError: Operator 'rshift' is not supported on this expression
</code>```

Any idea how to design such query appropriately?

Some Analysis:

The issue occurs because internally in s2sphere, this line is computed somewhere which appears in the traceback as well: return self.id() >> self.__class__.POS_BITS which clashes with sqlalchemy

Body:
Consider an ORM class describing a "Store":

class Store(Base, AbstractSchema):
    __tablename__ = 'store'
    id = Column(Integer, primary_key=True)
    ...
    s2_cell_id       = Column(BigInteger,  unique=False, nullable=True)

s2_cell_id describes the location of a store as an id of S2 cell  i.e Google S2 I am using s2sphere library in python for that.

Goal is to write a query that searches for stores in a certain range. I tried to use @hybrid_method as follows:

    @hybrid_method
    def lies_inside(self, cells : list[Cell]):
        for c in cells:
            is_inside = c.contains(Cell(CellId(self.s2_cell_id)))
            if is_inside : return True
        return False

    @lies_inside.expression
    def lies_inside(cls, cells: list[Cell]):
        for c in cells:
            is_inside = c.contains(Cell(CellId(cls.s2_cell_id)))
            if is_inside : return True
        return False

Usage is like this:

# Compute the set of cell that intersect the search area
candidates = router.location_manager.get_covering_cells(lat, lng, r, 13)

# Query the database for stores whose cell IDs are in the set of intersecting cells
query = db.query(Store).filter(Store.lies_inside(candidates)).all()

I get the following error unfortunately:

Traceback (most recent call last):
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 419, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\routing.py", line 235, in app
    raw_response = await run_endpoint_function(
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\FARO-User\Desktop\personal\dev\repos\woher-backend\.\src\routers\search.py", line 33, in get_nearby_stores
    query = db.query(Store).filter(Store.lies_inside(candidates)).all()
  File "c:\users\faro-user\desktop\personal\dev\repos\woher-backend\src\sql\models\store.py", line 55, in lies_inside
    is_inside = c.contains(Cell(CellId(cls.s2_cell_id)))
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\s2sphere\sphere.py", line 2354, in __init__
    face, i, j, orientation = cell_id.to_face_ij_orientation()
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\s2sphere\sphere.py", line 1298, in to_face_ij_orientation
    face = self.face()
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\s2sphere\sphere.py", line 1057, in face
    return self.id() >> self.__class__.POS_BITS
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\operators.py", line 458, in __rshift__
    return self.operate(rshift, other)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\elements.py", line 868, in operate
    return op(self.comparator, *other, **kwargs)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\operators.py", line 458, in __rshift__
    return self.operate(rshift, other)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\type_api.py", line 77, in operate
    return o[0](self.expr, op, *(other + o[1:]), **kwargs)
  File "C:\Users\FARO-User\Anaconda3\envs\woher-backend\lib\site-packages\sqlalchemy\sql\default_comparator.py", line 181, in _unsupported_impl
    raise NotImplementedError(
NotImplementedError: Operator 'rshift' is not supported on this expression

Any idea how to design such query appropriately?

Some Analysis:

The issue occurs because internally in s2sphere, this line is computed somewhere which appears in the traceback as well: return self.id() >> self.__class__.POS_BITS which clashes with sqlalchemy


问:
Issue: nesting flexboxes next and on top of each other
I currently have a problem with nesting a flex box layout. I have a parent flex container and four separate containers within it, so far the other 3 column containers work correctly. However when I try to place another container underneath the main one it simply moves to the right side.

.container-wrap {
  display: flex;
  justify-content: center;
}

.container-leftbar {
  display: flex;
  height: 100%;
  gap: 10px;
  padding: 10px;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  max-width: fit-content;
}

.container-main {
  display: flex;
  height: 100%;
  gap: 10px;
  padding: 10px;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  max-width: fit-content;
}

.container-main2 {
  display: flex;
  height: 100%;
  gap: 10px;
  padding: 10px;
  justify-content: center;
  flex-direction: row;
  flex-wrap: wrap;
}

.container-rightbar {
  display: flex;
  height: 100%;
  gap: 10px;
  padding: 10px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  max-width: fit-content;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!--flex wrap-->
<div class="container-wrap">
  <!--left column-->
  <div class="container-leftbar">
    <div class="1a">123</div>
    <div class="1b">123</div>
    <div class="1c">123</div>
  </div>
  <!--1 middle body-->
  <div class="container-main">
    <div class="2a">123</div>
    <div class="2b">123</div>
  </div>
  <!--2 middle body-->
  <div class="container-main2">
    <div class="3a">123</div>
    <div class="3b">123</div>
  </div>
  <!--right column-->
  <div class="container-rightbar">
    <div class="3a">123</div>
    <div class="3b">123</div>
    <div class="3c">123</div>
  </div>
</div></code>```

I tried to manually place the the top and left margin of the main box however I only really was able to achieve the top margin placing. I'm still somewhat new to using flex so any sort of help is appreciated.

Body:
I currently have a problem with nesting a flex box layout. I have a parent flex container and four separate containers within it, so far the other 3 column containers work correctly. However when I try to place another container underneath the main one it simply moves to the right side.

.container-wrap {
  display: flex;
  justify-content: center;
}

.container-leftbar {
  display: flex;
  height: 100%;
  gap: 10px;
  padding: 10px;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  max-width: fit-content;
}

.container-main {
  display: flex;
  height: 100%;
  gap: 10px;
  padding: 10px;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  max-width: fit-content;
}

.container-main2 {
  display: flex;
  height: 100%;
  gap: 10px;
  padding: 10px;
  justify-content: center;
  flex-direction: row;
  flex-wrap: wrap;
}

.container-rightbar {
  display: flex;
  height: 100%;
  gap: 10px;
  padding: 10px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  max-width: fit-content;
}

123

123

123

123

123

123

123

123

123

123

I tried to manually place the the top and left margin of the main box however I only really was able to achieve the top margin placing. I'm still somewhat new to using flex so any sort of help is appreciated.


问:
bind takes a long time
I am using over 20 raspberry pis to control heating and other functions in my house. For instance each room has a pi (client) with a temperature sensor, which sends a message to another pi (server) at one of three manifolds to open or close a valve on the heating system.
My problem is the amount of time the server takes to execute the bind instruction. A newly set up pi will typically take a few millisecond to execute the line, but soon the time becomes variable, sometimes milliseconds, usually seconds, but frequently tens of seconds or even hundreds of seconds.

typical code,

```<code>elapselp = default_timer()  # timing start
port = 12571                # port number, many different ones used
while bound == 0:
     try:
          s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          s1.bind(('', port))
          bound = 1
          elapselp1 = default_timer() - elapselp
          print ('bind time = ', elapselp1)
</code>```

As stated above elapselp1 can be at the low millisecond level, or 200 seconds which causes significant problems.

I usually find I can get back to short times by changing the port number used, which means changing on all the clients, but after some time running happily the times will increase again. Rebooting or powering down does not help. I am using Raspberry 4s and Zero Ws, no difference.
I suspect that some register is not clearing, but outside that am clueless. Can somebody advise please.
I am running Rasparian 3.6 and Python3

Thank you for all your replies, here is the remainder of this section of the code.

As I’m not sure how to input his I’m breaking it down over a number of comments.

```<code>elapselp = default_timer()
port =12571
while bound == 0:
    try:
        s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s1.bind(('', port))
        bound = 1
        elapselp1 = default_timer()- elapselp
        print (‘bind time = ‘, elapselp2)
    except:
        dummy = 1

    s1.listen(5)
    print ('waiting for input ', end='')
    while True:
        conn, addr = s1.accept()
        print ('connected by ', addr)
        conn.send('thank you'.encode())
        data = conn.recv(1024).decode()
        print ('data = ', data)
        time.sleep(5)
        conn.close()
        s1.close()

        if data == '10':
            startdaw = default_timer()
            GPIO.output(22, GPIO.LOW)
            print ('switch dining area heating off')
            h1 = 0
            dawl = edaw
            startdawr = default_timer()
        elif data == '11':
            GPIO.output(22, GPIO.HIGH)

    ## A lot of other actions depending on data received here

        else:
            print ('another code ', data)
        if not data:
            break
            print ('yet another')
</code>```

I have a number of Raspberry pi Zeros running the code for test along with 7 doing so as part of my control system. The performance is very erratic.
One unit running through the code every 30 seconds in response to a client has been running over 5 days, majority of the bind times have been under 1 millsec, I see some between 1 and 10, but it has recorded one time of 130 seconds.
Another unit which failed to bind for over two hours has now completed over 33,000 binds (this one just closes after the bind, no if statements), and the longest time for a bind is 710 msec.

If I take out the try/except I get no error message, it just drops through and loops back.

I hope there is some useful information in there.

Title: bind takes a long time

Body:
I am using over 20 raspberry pis to control heating and other functions in my house. For instance each room has a pi (client) with a temperature sensor, which sends a message to another pi (server) at one of three manifolds to open or close a valve on the heating system.
My problem is the amount of time the server takes to execute the bind instruction. A newly set up pi will typically take a few millisecond to execute the line, but soon the time becomes variable, sometimes milliseconds, usually seconds, but frequently tens of seconds or even hundreds of seconds.

typical code,

elapselp = default_timer()  # timing start
port = 12571                # port number, many different ones used
while bound == 0:
     try:
          s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          s1.bind(('', port))
          bound = 1
          elapselp1 = default_timer() - elapselp
          print ('bind time = ', elapselp1)

As stated above elapselp1 can be at the low millisecond level, or 200 seconds which causes significant problems.

I usually find I can get back to short times by changing the port number used, which means changing on all the clients, but after some time running happily the times will increase again. Rebooting or powering down does not help. I am using Raspberry 4s and Zero Ws, no difference.
I suspect that some register is not clearing, but outside that am clueless. Can somebody advise please.
I am running Rasparian 3.6 and Python3

Thank you for all your replies, here is the remainder of this section of the code.

As I’m not sure how to input his I’m breaking it down over a number of comments.

elapselp = default_timer()
port =12571
while bound == 0:
    try:
        s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s1.bind(('', port))
        bound = 1
        elapselp1 = default_timer()- elapselp
        print (‘bind time = ‘, elapselp2)
    except:
        dummy = 1

    s1.listen(5)
    print ('waiting for input ', end='')
    while True:
        conn, addr = s1.accept()
        print ('connected by ', addr)
        conn.send('thank you'.encode())
        data = conn.recv(1024).decode()
        print ('data = ', data)
        time.sleep(5)
        conn.close()
        s1.close()

        if data == '10':
            startdaw = default_timer()
            GPIO.output(22, GPIO.LOW)
            print ('switch dining area heating off')
            h1 = 0
            dawl = edaw
            startdawr = default_timer()
        elif data == '11':
            GPIO.output(22, GPIO.HIGH)

    ## A lot of other actions depending on data received here

        else:
            print ('another code ', data)
        if not data:
            break
            print ('yet another')

I have a number of Raspberry pi Zeros running the code for test along with 7 doing so as part of my control system. The performance is very erratic.
One unit running through the code every 30 seconds in response to a client has been running over 5 days, majority of the bind times have been under 1 millsec, I see some between 1 and 10, but it has recorded one time of 130 seconds.
Another unit which failed to bind for over two hours has now completed over 33,000 binds (this one just closes after the bind, no if statements), and the longest time for a bind is 710 msec.

If I take out the try/except I get no error message, it just drops through and loops back.

I hope there is some useful information in there.


问:
Firebase with google auth automatically select user (React Expo project)
Firebase with google auth automatically select user. So i have no access to the "choose account" page.

I can't use :

```<code>  GoogleSignin.revokeAccess()
</code>```

because GoogleSignin is now deprecated

And :

```<code>  export const provider = new GoogleAuthProvider();
      provider.setCustomParameters({
      prompt: "select_account",
  });
</code>```

only works on browers.

the SignIn and SignOut method works as they should, here is the code if needed:

```<code>  const GoogleLogin = () => {
    const [request, response, promptAsync] = useIdTokenAuthRequest({
      clientId: process.env.REACT_APP_CLIENT_ID_WEB,
    });

    useEffect(() => {
      if (response?.type === "success") {
        const { id_token } = response.params;
        const auth = getAuth();
        const credential = GoogleAuthProvider.credential(id_token);
        signInWithCredential(auth, credential);
      }
    }, [response]);
    return (
      <TouchableOpacity
        onPress={() => {
          promptAsync();
        }}
        style={styles.button3}
        disabled={!request}
      >
        <Text style={styles.buttonText}>Login with Google</Text>
      </TouchableOpacity>
    );
  };
</code>```

Is there a way so i can ket the user  choose an account they prefer to use?

Thanks for the helps.

Body:
Firebase with google auth automatically select user. So i have no access to the "choose account" page.

I can't use :

  GoogleSignin.revokeAccess()

because GoogleSignin is now deprecated

And :

  export const provider = new GoogleAuthProvider();
      provider.setCustomParameters({
      prompt: "select_account",
  });

only works on browers.

the SignIn and SignOut method works as they should, here is the code if needed:

  const GoogleLogin = () => {
    const [request, response, promptAsync] = useIdTokenAuthRequest({
      clientId: process.env.REACT_APP_CLIENT_ID_WEB,
    });

    useEffect(() => {
      if (response?.type === "success") {
        const { id_token } = response.params;
        const auth = getAuth();
        const credential = GoogleAuthProvider.credential(id_token);
        signInWithCredential(auth, credential);
      }
    }, [response]);
    return (
      <TouchableOpacity
        onPress={() => {
          promptAsync();
        }}
        style={styles.button3}
        disabled={!request}
      >
        <Text style={styles.buttonText}>Login with Google</Text>
      </TouchableOpacity>
    );
  };

Is there a way so i can ket the user  choose an account they prefer to use?

Thanks for the helps.


问:
how can I populate state/province according to a selected specific country
how can I populate searchable state/provincedropdown according to a selected specific country. Is there any easy way without using any third party library? also state/province will be disable unless I select a country.

I tried but all I could do is a simple dropdown with country names


问:
Issues running multiple bat files that set up environment from windows service where final bat file executes python script
I have a python script (app) that runs great when executed from a bat file. i.e. the bat file calls python and executes the py file. Before this executing it first prepares the paths and environments from some third party apps (like calling Anaconda activate and others). When I trigger this bat file from the command prompt or double clicking on it, all is well, each internal bat file is executed in sequence finally calling the python file.

However I have now set this up as a windows service. Using C# to call the bat file:
how to create an installer for a .net windows service

I see that the bat file is being executed (as I print out to file to show it was triggered), the windows service starts and runs and even polls every 5 minutes and prints to windows event viewer.

All the bat files are executed (I have added prints to file in all of them) to ensure they are called and the py file is executed but fails.

What I have diagnosed is that as the call was done from windows service the individual bat files are almost executed in their own memory, similar to multi-processing in Python (I suspect). This means that as each bat file is executed it "doesn't see" the execution of the previous bat file so all environment variable and other settings are lost.

So when the py file is executed the settings that are required to preload are not loaded and it fails.

I have gone so far as to copy all the steps in each bat file and concatenate into one long bat file. But as there are some calls to 3rd party software like exe files for example it doesn't help, the work of the exe for example (I suspect) are loaded in own memory (my interpretation) and therefore same issue occurs, the required preload is not seen by the py.

As a simple example, there is a bat file call that calls Anaconda activate myEnvironment before other bat files are called. I see from the printout in the file that this was executed successfully but when the next bat file is called it doesn't see the execution of the previous (so doesn't continue to next step which uses the activated environment).

Again, when I load the bat file manually or through double click, all is well.

Has anyone had any experience in this?


问:
Spring Gateway 'Access-Control-Allow-Origin' header contains multiple values 'DOMAIN, *', but only one is allowed
While trying to connect a React frontend to the backend through the Spring Cloud Gateway version(2021.0.5), CORS throws an error due to Multiples Values. CORS is configured only in the Gateway; backend services do not have CORS configured. We tried several things, such as configuring CORS via Bean, as well YML file, but it did not solve the issue. Any help would be appreciated.

YML configuration

```<code>spring:
application:
    name: ecs_api_gateway
cloud:
    gateway:
        default-filters:
          - DedupeResponseHeader=Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_UNIQUE
        globalcors:
          cors-configurations:
            '[/**]':
                allowed-origins: "http://ayc.org"
                allowed-methods: "*"
                allowed-headers: "*"
                allow-credentials: true
</code>```

Body:
While trying to connect a React frontend to the backend through the Spring Cloud Gateway version(2021.0.5), CORS throws an error due to Multiples Values. CORS is configured only in the Gateway; backend services do not have CORS configured. We tried several things, such as configuring CORS via Bean, as well YML file, but it did not solve the issue. Any help would be appreciated.

YML configuration

spring:
application:
    name: ecs_api_gateway
cloud:
    gateway:
        default-filters:
          - DedupeResponseHeader=Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_UNIQUE
        globalcors:
          cors-configurations:
            '[/**]':
                allowed-origins: "http://ayc.org"
                allowed-methods: "*"
                allowed-headers: "*"
                allow-credentials: true