问:
How to write data to Firebase Realtime DB in Google Cloud Function triggered by google.firebase.database.ref.v1.created event?
I have created a cloud function in python which is being triggered on created data inside some key (e.g. tags)

My function starts like:

```<code>import os
import functions_framework
import numpy
import uuid

@functions_framework.cloud_event
def manage_tags(cloud_event):
   data = cloud_event.data

   [...]

</code>```

I would like to know how can I insert, after all the logic done on that function, some data in a different DB key

Thank you in advance

I am aware of the firebase_admin package for python, but I'm wondering if there is a more direct way (not need to re-init app, setting connection params, etc), since I am using cloud function and I already have the event information

Body:
I have created a cloud function in python which is being triggered on created data inside some key (e.g. tags)

My function starts like:

import os
import functions_framework
import numpy
import uuid

@functions_framework.cloud_event
def manage_tags(cloud_event):
   data = cloud_event.data

   [...]

I would like to know how can I insert, after all the logic done on that function, some data in a different DB key

Thank you in advance

I am aware of the firebase_admin package for python, but I'm wondering if there is a more direct way (not need to re-init app, setting connection params, etc), since I am using cloud function and I already have the event information


来源: stackexchange

问:
scss doesnot work on Live Server but does on local machine
My website is using .scss files for style.

When I am running npm start the site is working fine with all the styles on local machine. But when I open the build on live server. It just shows the contents of the site with no style like just the  html file is opened.

`

```<code>"scripts": {
    "start": "parcel",
    "build": "parcel build"
  },
</code>```

`

I tried learning how things work but wasnt able to succeed.

ContentLicense: CC BY-SA 4.0

Body:
My website is using .scss files for style.

When I am running npm start the site is working fine with all the styles on local machine. But when I open the build on live server. It just shows the contents of the site with no style like just the  html file is opened.

`

"scripts": {
    "start": "parcel",
    "build": "parcel build"
  },

`

I tried learning how things work but wasnt able to succeed.


问:
How to store vars for Apache RewriteRules?
For my rewrite rules I've created an .htaccess file which does some standard replacements first like

```<code>#Redirection to HTTPS
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301]
</code>```

and

```<code>#Prepend www if necessary
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301]
</code>```

At a later step there are several redirections like

```<code>#Redirection of webhooks
RewriteCond %{REQUEST_URI} ^/from/([a-z]+)/?$
RewriteRule ^(.*)$ to.php?value=%1 [NE,L]
</code>```

Now, if a user opens a request without prefixed www, the last RewriteRule does not work correctly. As I learned, this is because the REQUEST_URI holds the original uri and not the modified one.

Is there an option to store the host/uri in a variable, which I can use for the rewrite rules later? Or is there another smart way for the redirection rules, without including the standard replacements multiple times?

Thanks a lot!

Ben

Body:
For my rewrite rules I've created an .htaccess file which does some standard replacements first like

#Redirection to HTTPS
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301]

and

#Prepend www if necessary
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301]

At a later step there are several redirections like

#Redirection of webhooks
RewriteCond %{REQUEST_URI} ^/from/([a-z]+)/?$
RewriteRule ^(.*)$ to.php?value=%1 [NE,L]

Now, if a user opens a request without prefixed www, the last RewriteRule does not work correctly. As I learned, this is because the REQUEST_URI holds the original uri and not the modified one.

Is there an option to store the host/uri in a variable, which I can use for the rewrite rules later? Or is there another smart way for the redirection rules, without including the standard replacements multiple times?

Thanks a lot!

Ben


问:
How to get syncify / asyncify syntactic sugar for python
It seems there is a general need in some use cases that async and non async code according to https://peps.python.org/pep-0492/ in python should be able to work together in a straightforward way.

It should be possible:

To call an async function from a synchronous context

To call a synchronous function from an asynchronous context

without having to bother about the complex infrastructure problems involved and the design decisions that have been made by the inventors of the async/await functionality in python which call for such complexities.

see e.g.

Call async function from sync function, while the synchronous function continues : Python

Why do most asyncio examples use loop.run_until_complete()?

https://www.joeltok.com/posts/2021-02-python-async-sync/

https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-5.html

Hiding the complexity of the answers with some "syntactic sugar" is what i am looking for.

There is e.g.

A) https://github.com/ccorcos/syncify/blob/master/syncify/syncify.py
since 2014 - but that project has no stars as of 2022-12.

B) See also https://gist.github.com/phizaz/20c36c6734878c6ec053245a477572ec for a gist proposing a similar approach.

C) https://www.aeracode.org/2018/02/19/python-async-simplified/ which points to https://github.com/django/asgiref/blob/main/asgiref/sync.py

D) there  is https://asyncer.tiangolo.com/ which has almost a thousand stars.

I tried

A

whith python 3.10 and got the error message:

```<code>  def async(*args):
        ^^^^^
SyntaxError: invalid syntax
CRITICAL: Exiting due to uncaught exception <class 'SyntaxError'>
</code>```

the gist B)

with:

scite_entry=force_sync(doi_obj.asScite)()
```
<p>and got the error message:</p>
```RuntimeError: This event loop is already running
```
<p>which leads to the question:</p>
<ul>
<li>RuntimeError: This event loop is already running in python</li>
</ul>
<p>so it's not useable as a general syntactic sugar hiding the complex details - you have to know in which context you are running your code.</p>
<p><strong>asgiref C)</strong>
and get the error message:</p>
<pre class="lang-py prettyprint-override"><code>RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop - just await the async function directly.
</code>```

so it's again not useable as a general syntactic sugar hiding the complex details - you have to know in which context you are running your code.

the tiangolo library D)

with a single line:

scite_entry=syncify(doi_obj.asScite)()
```
<p>and got the error message:</p>
```RuntimeError: This function can only be run from an AnyIO worker thread
```

so it's not generally useable.

What would be a general approach that hides the involved complex infrastructure problems and might make it into a PEP in the future?

Body:
It seems there is a general need in some use cases that async and non async code according to https://peps.python.org/pep-0492/ in python should be able to work together in a straightforward way.

It should be possible:

To call an async function from a synchronous context

To call a synchronous function from an asynchronous context

without having to bother about the complex infrastructure problems involved and the design decisions that have been made by the inventors of the async/await functionality in python which call for such complexities.

see e.g.

Call async function from sync function, while the synchronous function continues : Python

Why do most asyncio examples use loop.run_until_complete()?

https://www.joeltok.com/posts/2021-02-python-async-sync/

https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-5.html

Hiding the complexity of the answers with some "syntactic sugar" is what i am looking for.

There is e.g.

A) https://github.com/ccorcos/syncify/blob/master/syncify/syncify.py
since 2014 - but that project has no stars as of 2022-12.

B) See also https://gist.github.com/phizaz/20c36c6734878c6ec053245a477572ec for a gist proposing a similar approach.

C) https://www.aeracode.org/2018/02/19/python-async-simplified/ which points to https://github.com/django/asgiref/blob/main/asgiref/sync.py

D) there  is https://asyncer.tiangolo.com/ which has almost a thousand stars.

I tried

A

whith python 3.10 and got the error message:

  def async(*args):
        ^^^^^
SyntaxError: invalid syntax
CRITICAL: Exiting due to uncaught exception <class 'SyntaxError'>

the gist B)

with:

scite_entry=force_sync(doi_obj.asScite)()

and got the error message:

RuntimeError: This event loop is already running

which leads to the question:

RuntimeError: This event loop is already running in python

so it's not useable as a general syntactic sugar hiding the complex details - you have to know in which context you are running your code.

asgiref C)
and get the error message:

RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop - just await the async function directly.

so it's again not useable as a general syntactic sugar hiding the complex details - you have to know in which context you are running your code.

the tiangolo library D)

with a single line:

scite_entry=syncify(doi_obj.asScite)()

and got the error message:

RuntimeError: This function can only be run from an AnyIO worker thread

so it's not generally useable.

What would be a general approach that hides the involved complex infrastructure problems and might make it into a PEP in the future?


问:
DRF Serialize prefetch_related query set
DRF Serialize prefetch_related query set

Help in how to read the data, below is what I am doing.

serializer.py

```<code>class CustomerSerializer(serializers.ModelSerializer):

    user = serializers.PrimaryKeyRelatedField(read_only=True, default=serializers.CurrentUserDefault())
    phonebook = PhonebookSerializer()
    phonenumbers_set = PhonenumbersSerializer(many=True)
    customerdisposition_set = CustomerDispositionSerializer(many=True)

    class Meta:
        model = Customers
        fields = '__all__'
</code>```

queryset

```<code>queryset = Customers.objects.select_related('user', 'phonebook').prefetch_related('phonebook__phonenumbers_set', 'customerdisposition_set').all()
</code>```

queryset.filter(value=value).first()

{'status': u't', 'phonebook_id': 1L, 'modified_dt': datetime.datetime(2022, 2, 24, 5, 57, 38, tzinfo=), 'user_id': 1L, 'followup_dt': None, 'notes': None, '_state': <django.db.models.base.ModelState object at 0x12f6eae08>, 'refid': None, 'source': None, '_user_cache': <User: test>, 'agent_id': None, '_prefetched_objects_cache': {u'customerdisposition_set': []}, '_phonebook_cache': <Phonebook: 6,ree>, 'id': 9L, 'created_dt': datetime.datetime(2022, 3, 4, 6, 28, 58, 125834, tzinfo=)}

Error

AttributeError: Got AttributeError when attempting to get a value for field phonenumbers_set on serializer CustomerSerializer.

Body:
DRF Serialize prefetch_related query set

Help in how to read the data, below is what I am doing.

serializer.py

class CustomerSerializer(serializers.ModelSerializer):

    user = serializers.PrimaryKeyRelatedField(read_only=True, default=serializers.CurrentUserDefault())
    phonebook = PhonebookSerializer()
    phonenumbers_set = PhonenumbersSerializer(many=True)
    customerdisposition_set = CustomerDispositionSerializer(many=True)

    class Meta:
        model = Customers
        fields = '__all__'

queryset

queryset = Customers.objects.select_related('user', 'phonebook').prefetch_related('phonebook__phonenumbers_set', 'customerdisposition_set').all()

queryset.filter(value=value).first()

{'status': u't', 'phonebook_id': 1L, 'modified_dt': datetime.datetime(2022, 2, 24, 5, 57, 38, tzinfo=), 'user_id': 1L, 'followup_dt': None, 'notes': None, '_state': <django.db.models.base.ModelState object at 0x12f6eae08>, 'refid': None, 'source': None, '_user_cache': <User: test>, 'agent_id': None, '_prefetched_objects_cache': {u'customerdisposition_set': []}, '_phonebook_cache': <Phonebook: 6,ree>, 'id': 9L, 'created_dt': datetime.datetime(2022, 3, 4, 6, 28, 58, 125834, tzinfo=)}

Error

AttributeError: Got AttributeError when attempting to get a value for field phonenumbers_set on serializer CustomerSerializer.


问:
thread library is not working on c++ netbeans ide 16
I was using thread on my netbeans ide 16 and it was giving error(main.cpp:14:4: error: 'thread' was not declared in this scope)

i tried adding -pthread and -lpthread in additional options but it didnt work.enter image description here


问:
I want to add multiple paths in one route as both login and signup goes to AuthIndex component In authindex comp not able to togle b/w login nd signup
How to add multiple paths in one route.
I am not able to get the params type.

```<code>import Products from "./Components/Products/Products";
import Header from "./Components/Layout/Header";
import Subheader from "./Components/Layout/Subheader";
import {Routes , Route, Navigate} from "react-router-dom";
import AuthIndex from "./Components/Auth";

const App = () => {
  return (
    <div>
      <Header/>
      <Subheader/>
      <Routes>
        {/* <Route  path = "/login" exact element={<AuthIndex/>}>
        </Route>
        <Route  path = "/signup" exact element={<AuthIndex/>}>
        </Route> */}
        <Route  path = "/:type(login|signup)"
        exact element={<AuthIndex/>}>
        </Route>
        <Route path="/404" element={<h1>Not Found..!!</h1>}>
          </Route>
        <Route path="/:category?" element={<Products/>}>
        </Route>
        </Routes>
    </div>
  );
}

export default App;
//bug
//third route still to be added navigate route instead of redirect route.

</code>```

I want to toggle between login and signup and show buttons accoriding
and if signup then use the REST api call accorging to the params type.
I want if someone signup then it should be store in my firebase
I also want to know how to get params type.

```<code>

import { NavLink, useParams } from "react-router-dom"
import { useState } from "react"
import axios from "axios"

const AuthIndex = () => {
    const [details, setDetails] = useState({
        email : "",
        password: ""
    })
    const params = useParams()

    const handleInput = e => {
        setDetails({
            ...details,
            [e.target.name]: e.target.value
        })
    }

    const handleSubmission = e => {
        e.preventDefault();
        console.log(details)
        if (params.type === "signup") {
            signupWithEmailAndPassword();
        }
    }

    const signupWithEmailAndPassword = async () => {
        try{
            const response = await axios.post(`https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=AIzaSyAJNV9-dm4p8t2gYRohFj6jqzPVBgish_A`, {
            email : details.email,
            password : details.password,
            returnSecureToken : true
        })
        console.log(response)
        }
        catch(error) {
            console.log(error.response)
        }
    }

    // console.log(params)
    return (
        <div className="auth-container">
            <div className="auth-container--box">
                <div className="tab-selector">
                    <NavLink  to={"/login"}><h3>Login</h3></NavLink>
                    <NavLink  to={"/signup"}><h3>Signup</h3></NavLink>
                </div>
                <form  autoComplete={"off"} onSubmit={handleSubmission}>
                    <div className="input-wrap">
                        <label htmlFor="email">Email</label>
                        <input type="text"
                            name="email"
                            placeholder="Enter Email"
                            value={details.email}
                            onChange={handleInput}/>
                    </div>
                    <div className="input-wrap">
                        <label htmlFor="password">Password</label>
                        <input
                            type="password"
                            name="password"
                            placeholder="Enter Password"
                            value={details.password}
                            onChange={handleInput}
                            />
                    </div>
                    <div className="button-wrap">
                        <button className="login-btn">
                            {/* but to solve , showing signup in both cases */}
                            {params.type === "login" ? "Login" : "Signup"}
                            {/* Login */}
                        </button>
                    </div>
                </form>
            </div>
        </div>
    )
}

export default AuthIndex

</code>```

Body:
How to add multiple paths in one route.
I am not able to get the params type.

import Products from "./Components/Products/Products";
import Header from "./Components/Layout/Header";
import Subheader from "./Components/Layout/Subheader";
import {Routes , Route, Navigate} from "react-router-dom";
import AuthIndex from "./Components/Auth";

const App = () => {
  return (

      <Subheader/>
      <Routes>
        {/* <Route  path = "/login" exact element={<AuthIndex/>}>
        </Route>
        <Route  path = "/signup" exact element={<AuthIndex/>}>
        </Route> */}
        <Route  path = "/:type(login|signup)"
        exact element={<AuthIndex/>}>
        </Route>
        <Route path="/404" element={
Not Found..!!
}>
          </Route>
        <Route path="/:category?" element={<Products/>}>
        </Route>
        </Routes>

  );
}

export default App;
//bug
//third route still to be added navigate route instead of redirect route.

I want to toggle between login and signup and show buttons accoriding
and if signup then use the REST api call accorging to the params type.
I want if someone signup then it should be store in my firebase
I also want to know how to get params type.

import { NavLink, useParams } from "react-router-dom"
import { useState } from "react"
import axios from "axios"

const AuthIndex = () => {
    const [details, setDetails] = useState({
        email : "",
        password: ""
    })
    const params = useParams()

    const handleInput = e => {
        setDetails({
            ...details,
            [e.target.name]: e.target.value
        })
    }

    const handleSubmission = e => {
        e.preventDefault();
        console.log(details)
        if (params.type === "signup") {
            signupWithEmailAndPassword();
        }
    }

    const signupWithEmailAndPassword = async () => {
        try{
            const response = await axios.post(`https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=AIzaSyAJNV9-dm4p8t2gYRohFj6jqzPVBgish_A`, {
            email : details.email,
            password : details.password,
            returnSecureToken : true
        })
        console.log(response)
        }
        catch(error) {
            console.log(error.response)
        }
    }

    // console.log(params)
    return (

                    <NavLink  to={"/login"}>
Login
</NavLink>
                    <NavLink  to={"/signup"}>
Signup
</NavLink>

                <form  autoComplete={"off"} onSubmit={handleSubmission}>

                        Email
                        <input type="text"
                            name="email"
                            placeholder="Enter Email"
                            value={details.email}
                            onChange={handleInput}/>

                        Password
                        <input
                            type="password"
                            name="password"
                            placeholder="Enter Password"
                            value={details.password}
                            onChange={handleInput}
                            />

                        <button className="login-btn">
                            {/* but to solve , showing signup in both cases */}
                            {params.type === "login" ? "Login" : "Signup"}
                            {/* Login */}
                        </button>

                </form>

    )
}

export default AuthIndex


问:
Is it possable to stream images to a PDF using tesseract?
I need to stream images from a scanner to a PDF document. Ultimately I want to OCR the images and save the text to the PDF as well, but I'm more concerned with getting the streaming working first. Right now I'm trying the different Python wrappers for tesseract, but I'm open to other languages if the Python wrappers are too limited (Java?).

While this topic may seem to have been addresses ad nauseam most of the discussion centers on passing a list of a directory full of files. The challenge here is that I'm dealing with documents with upwards of 10,000 images so buffering them all entirely in memory first or building the PDF entirely in memory is not possible, and I'm trying to avoid having to write 10,000 images to a tmp directory and then come back and touch them again with a 2nd pass. From a simplified high level the following semantics is what I'm looking for.

```<code># pseudocode
f = pdfOutputStream.open("myPDFFileName", "wb")
for image in scannerImages.next():
    f.appendImageToPDF(image)
f.finalize()
f.close()
</code>```

Is that even possible, and if so, what would my options be?

Body:
I need to stream images from a scanner to a PDF document. Ultimately I want to OCR the images and save the text to the PDF as well, but I'm more concerned with getting the streaming working first. Right now I'm trying the different Python wrappers for tesseract, but I'm open to other languages if the Python wrappers are too limited (Java?).

While this topic may seem to have been addresses ad nauseam most of the discussion centers on passing a list of a directory full of files. The challenge here is that I'm dealing with documents with upwards of 10,000 images so buffering them all entirely in memory first or building the PDF entirely in memory is not possible, and I'm trying to avoid having to write 10,000 images to a tmp directory and then come back and touch them again with a 2nd pass. From a simplified high level the following semantics is what I'm looking for.

# pseudocode
f = pdfOutputStream.open("myPDFFileName", "wb")
for image in scannerImages.next():
    f.appendImageToPDF(image)
f.finalize()
f.close()

Is that even possible, and if so, what would my options be?


问:
Using Java Cipher in non-blocking environment
We have a multi-threaded environment wherein we perform encryption and decryption using javax.crypto.Cipher class.

However, we are facing a Cipher blocking issue.

The thread dumps indicate the following state:

java.lang.Thread.State: BLOCKED (on object monitor)
        at java.security.Provider.getService(Provider.java:680)
        - locked <0x0000000481680800> (a org.bouncycastle.jce.provider.BouncyCastleProvider)
        at javax.crypto.Cipher.getInstance(Cipher.java:629)
        at javax.crypto.Cipher.getInstance(Cipher.java:580)
          .............................................

  java.lang.Thread.State: BLOCKED (on object monitor)
    at javax.crypto.JceSecurityManager.getCryptoPermission(JceSecurityManager.java:120)
    - waiting to lock <0x00000004802e0c10> (a java.lang.Class for javax.crypto.JceSecurityManager)
    at javax.crypto.Cipher.getConfiguredPermission(Cipher.java:2503)
    at javax.crypto.Cipher.initCryptoPermission(Cipher.java:685)
    at javax.crypto.Cipher.getInstance(Cipher.java:658)
    at javax.crypto.Cipher.getInstance(Cipher.java:580)

java.lang.Thread.State: RUNNABLE
    at java.lang.System.identityHashCode(Native Method)
    at java.util.IdentityHashMap.hash(IdentityHashMap.java:301)
    at java.util.IdentityHashMap.get(IdentityHashMap.java:334)
    at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:173)
    - locked <0x00000004802e08b8> (a java.lang.Class for javax.crypto.JceSecurity)
    at javax.crypto.Cipher.getInstance(Cipher.java:638)
```

There are many threads that are blocked at different stages of Cipher.getInstance() method waiting for other threads to perform operations so that they can release the synchronized methods/blocks. We did see that the Cipher.getInstance() method makes use of internal synchronization.

In our code, every thread makes a call to Cipher.getInstance(.....) method with a specified algorithm and provider to get the cipher object and then use it to encrypt/decrypt the data.

How can we resolve the blocking problem.

Would caching of Cipher instance be a solution to the problem. Any suggestions would be really appreciated.

Body:
We have a multi-threaded environment wherein we perform encryption and decryption using javax.crypto.Cipher class.

However, we are facing a Cipher blocking issue.

The thread dumps indicate the following state:

java.lang.Thread.State: BLOCKED (on object monitor)
        at java.security.Provider.getService(Provider.java:680)
        - locked <0x0000000481680800> (a org.bouncycastle.jce.provider.BouncyCastleProvider)
        at javax.crypto.Cipher.getInstance(Cipher.java:629)
        at javax.crypto.Cipher.getInstance(Cipher.java:580)
          .............................................

  java.lang.Thread.State: BLOCKED (on object monitor)
    at javax.crypto.JceSecurityManager.getCryptoPermission(JceSecurityManager.java:120)
    - waiting to lock <0x00000004802e0c10> (a java.lang.Class for javax.crypto.JceSecurityManager)
    at javax.crypto.Cipher.getConfiguredPermission(Cipher.java:2503)
    at javax.crypto.Cipher.initCryptoPermission(Cipher.java:685)
    at javax.crypto.Cipher.getInstance(Cipher.java:658)
    at javax.crypto.Cipher.getInstance(Cipher.java:580)

java.lang.Thread.State: RUNNABLE
    at java.lang.System.identityHashCode(Native Method)
    at java.util.IdentityHashMap.hash(IdentityHashMap.java:301)
    at java.util.IdentityHashMap.get(IdentityHashMap.java:334)
    at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:173)
    - locked <0x00000004802e08b8> (a java.lang.Class for javax.crypto.JceSecurity)
    at javax.crypto.Cipher.getInstance(Cipher.java:638)

There are many threads that are blocked at different stages of Cipher.getInstance() method waiting for other threads to perform operations so that they can release the synchronized methods/blocks. We did see that the Cipher.getInstance() method makes use of internal synchronization.

In our code, every thread makes a call to Cipher.getInstance(.....) method with a specified algorithm and provider to get the cipher object and then use it to encrypt/decrypt the data.

How can we resolve the blocking problem.

Would caching of Cipher instance be a solution to the problem. Any suggestions would be really appreciated.


问:
Make row groups non selectable in DT/datatables
My Shiny app contains a DT table with single selection enabled as well as the rowGroup extension to separate my data into the different categories. When the user clicks on a row of the table, a plot is updated to reflect the row's data. However, it seems like the rowGroup extension create a new row in the table, making it selectable. As there is no data in group rows, the plot throws an error. I also need collapsible rows, and as the user will need to click on the group row to make it collapse, it creates again the issue of selected group rows.

I came across this solution when I looked for ways to make the group rows collapsible. To make them non-selectable as well as collapsible, I tried to add no-select('true') to the group row callback but this did not work.

Is there any way to make group rows non selectable?

Reproductible example:

```<code>library(shiny)
library(DT)
ui <- fluidPage(# Application title
    titlePanel("Collapse/Expand table"),
    mainPanel(DTOutput("my_table")))

callback_js <- JS(
    "
    table.on('click', 'tr.dtrg-group', function () {
        var rowsCollapse = $(this).nextUntil('.dtrg-group');
        $(rowsCollapse).toggleClass('hidden');
        var groupRows = $(this);
        $(groupRows).no-select('true');
    });
    "

)

server <- function(input, output) {
    output$my_table <- DT::renderDT({
        datatable(
            mtcars[1:15, 1:5],
            extensions = 'RowGroup',
            options = list(rowGroup = list(dataSrc = 3), pageLength = 20),
            callback = callback_js,
            selection = 'single'
        )
    })
}

# Run the application
shinyApp(ui = ui, server = server)
</code>```

Body:
My Shiny app contains a DT table with single selection enabled as well as the rowGroup extension to separate my data into the different categories. When the user clicks on a row of the table, a plot is updated to reflect the row's data. However, it seems like the rowGroup extension create a new row in the table, making it selectable. As there is no data in group rows, the plot throws an error. I also need collapsible rows, and as the user will need to click on the group row to make it collapse, it creates again the issue of selected group rows.

I came across this solution when I looked for ways to make the group rows collapsible. To make them non-selectable as well as collapsible, I tried to add no-select('true') to the group row callback but this did not work.

Is there any way to make group rows non selectable?

Reproductible example:

library(shiny)
library(DT)
ui <- fluidPage(# Application title
    titlePanel("Collapse/Expand table"),
    mainPanel(DTOutput("my_table")))

callback_js <- JS(
    "
    table.on('click', 'tr.dtrg-group', function () {
        var rowsCollapse = $(this).nextUntil('.dtrg-group');
        $(rowsCollapse).toggleClass('hidden');
        var groupRows = $(this);
        $(groupRows).no-select('true');
    });
    "

)

server <- function(input, output) {
    output$my_table <- DT::renderDT({
        datatable(
            mtcars[1:15, 1:5],
            extensions = 'RowGroup',
            options = list(rowGroup = list(dataSrc = 3), pageLength = 20),
            callback = callback_js,
            selection = 'single'
        )
    })
}

# Run the application
shinyApp(ui = ui, server = server)


问:
creating a new table whenever a new row is inserted. Then insert that row's id to the new table's id
There is a table called student where data type of id is serial.

id
name
age

1
kim
20

2
sophi
21

Now, I want to create new table(id int,details text) each time I insert a new row. Then, the same id will store in new table's id as well. This will continue to happen whenever I insert any new row.

I have created a trigger function followed by this:

```<code>create or replace trigger problem
after insert on student
for each row execute procedure fun();
</code>```
```<code>create or replace function fun()
returns trigger
as
$$
begin
if new.id>old.id then
create table now(id int, name text);
insert into now(id)
values(new.id)
;
end if;
return new;
end;
$$
language plpgsql;

</code>```

Function creation is done. But the issue is, I can't create many tables with the same name, here which is named as 'now'. What can be done?

I want to create a new table every time I insert a new row and then new row's id must insert to the new table's id.

I'm new to postgreSQL, and stuck with this problem for a while.
All guidance is much appreciated!
Thanks!

Body:
There is a table called student where data type of id is serial.

id
name
age

1
kim
20

2
sophi
21

Now, I want to create new table(id int,details text) each time I insert a new row. Then, the same id will store in new table's id as well. This will continue to happen whenever I insert any new row.

I have created a trigger function followed by this:

create or replace trigger problem
after insert on student
for each row execute procedure fun();

create or replace function fun()
returns trigger
as
$$
begin
if new.id>old.id then
create table now(id int, name text);
insert into now(id)
values(new.id)
;
end if;
return new;
end;
$$
language plpgsql;

Function creation is done. But the issue is, I can't create many tables with the same name, here which is named as 'now'. What can be done?

I want to create a new table every time I insert a new row and then new row's id must insert to the new table's id.

I'm new to postgreSQL, and stuck with this problem for a while.
All guidance is much appreciated!
Thanks!


问:
Visit all edges in a graph with minimum number of paths
I am trying to find an algorithm or a way to find paths in a directed graph to visit all edges exactly once with minimum number of paths possible. Then, print the results found.

For example in this graph, the minimum number of paths to cover all edges exactly once is 2 that are ( 1 → 3 → 4 → 3 → 2 ) and ( 1 → 2 )


问:
Appium: How to disable/uninstall the browser via automation
We have a requirement where we need to disable/uninstall the browser to test the weblinks functionality in the native app. Is there a solution to achieve this in both android and iOS platforms using automation.
Chrome for Android and Safari for iOS.

We are using Appium 1.22.0 with Java as the client library

I can think of one way to go to settings and then click on disable option. But this solution will/may not work against all devices with different operating systems.


问:
When using mapbox-gl js, popups of unclustered points appear on incorrect coordinates on touch screens
```<code>map.on("click", "unclustered-point", (e) => {
      e.originalEvent.stopPropagation();

      const coordinates = e.features[0].geometry.coordinates.slice();
      const title = e.features[0].properties.title;

      const innerHtmlContent = `<div class="w-100">
        <h4 class="h4Class">${title} </h4> </div>`;

      let lang = localStorage.getItem("language");
      let buttonText = "Nasıl gidilir?";

      const divElement = document.createElement("div");
      const assignBtn = document.createElement("div");
      assignBtn.innerHTML = `<button class='btn-primary w-100 d-flex flex-row justify-content-center' >${buttonText}</button>`;
      divElement.innerHTML = innerHtmlContent;
      divElement.appendChild(assignBtn);

      assignBtn.addEventListener("click", () => {
        this.searchStore(title);
        this.openDialog("search");
        this.$store.dispatch("showClusters", false);
      });

      while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
        coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
      }

      new mapboxgl.Popup({ offset: 20 })
        .setLngLat(coordinates)
        .setDOMContent(divElement)
        .addTo(map);
    });
</code>```

I implement cluster and unclusters the same as the documentation of mapbox-gl js but when clicking the uncluster points on the touch screen, it triggers the wrong empty space (right below the marker).

Note : It's working like a charm on desktop view :)

Body:
map.on("click", "unclustered-point", (e) => {
      e.originalEvent.stopPropagation();

      const coordinates = e.features[0].geometry.coordinates.slice();
      const title = e.features[0].properties.title;

      const innerHtmlContent = `

${title}

`;

      let lang = localStorage.getItem("language");
      let buttonText = "Nasıl gidilir?";

      const divElement = document.createElement("div");
      const assignBtn = document.createElement("div");
      assignBtn.innerHTML = `<button class='btn-primary w-100 d-flex flex-row justify-content-center' >${buttonText}</button>`;
      divElement.innerHTML = innerHtmlContent;
      divElement.appendChild(assignBtn);

      assignBtn.addEventListener("click", () => {
        this.searchStore(title);
        this.openDialog("search");
        this.$store.dispatch("showClusters", false);
      });

      while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
        coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
      }

      new mapboxgl.Popup({ offset: 20 })
        .setLngLat(coordinates)
        .setDOMContent(divElement)
        .addTo(map);
    });

I implement cluster and unclusters the same as the documentation of mapbox-gl js but when clicking the uncluster points on the touch screen, it triggers the wrong empty space (right below the marker).

Note : It's working like a charm on desktop view :)


问:
How to create TLB file for C# .NET Standard 2 DLL project
I thought I would try and create a C# DLL using .NET Standard 2.0 instead of .NET Framework 4.6.2. I have the code compiling for the most part and can see the DLL in the bin folder.

But, there is no TLB file which I need for my C++ application to be able to use the library.

Have a missed a step?


问:
django-widget-tweaks: removing "required" for check-box-input
Getting "Please check this box if you want to proceed" error when I want to submit False value for the checkbox.  I am using django-widget-tweaks, forms-Form for form.

Model has is_active = models.BooleanField(default=True, null=True)
Form has is_active=forms.BooleanField(required=False)
Html

```<code><div class="form-check">
            {{ form.is_active.label_tag }}
            {% render_field form.is_active class='form-control form-check-input'  %}
        </div>
</code>```

This is based on Firefox browser.
In forms, added required=False in both forms.CharField(required=False) and forms.BooleanField(required=False).
From the Firefox inspector: CharField, the "required" is not added and can be submitted without adding a text, but for BooleanField, the required is added as required='False'. This still cause an error and not allow to enter without adding a check.
If the required='False' is manually removed via Firefox Inspector, it allows to enter without check.
Why doesn't required='False' not work in Firebox?
Why does adding required='False' for BooleanField (check-box-input) instead of removing "required" like in CharField?
How can we just remove "required" from BooleanField when using check-box-input?

Advanced thanks!

Body:
Getting "Please check this box if you want to proceed" error when I want to submit False value for the checkbox.  I am using django-widget-tweaks, forms-Form for form.

Model has is_active = models.BooleanField(default=True, null=True)
Form has is_active=forms.BooleanField(required=False)
Html

            {{ form.is_active.label_tag }}
            {% render_field form.is_active class='form-control form-check-input'  %}

This is based on Firefox browser.
In forms, added required=False in both forms.CharField(required=False) and forms.BooleanField(required=False).
From the Firefox inspector: CharField, the "required" is not added and can be submitted without adding a text, but for BooleanField, the required is added as required='False'. This still cause an error and not allow to enter without adding a check.
If the required='False' is manually removed via Firefox Inspector, it allows to enter without check.
Why doesn't required='False' not work in Firebox?
Why does adding required='False' for BooleanField (check-box-input) instead of removing "required" like in CharField?
How can we just remove "required" from BooleanField when using check-box-input?

Advanced thanks!


问:
c# web api Facebook log out
I have a web api project in c# in which I do a facebook social login with oauth2 calling the urls of facebok

```<code>public ActionResult FacebookSignIn()
        {
            var loginUrl = "https://www.facebook.com/dialog/oauth?" +
                "client_id=2199053333600218&" +
                "redirect_uri=https://localhost:44391/Home/FacebookCallback&" +
                "response_type = code&" +
                "scope=email&";

            return Redirect(loginUrl);
        }
</code>```

now i get token and user data

```<code>public ActionResult FacebookCallback(string code)
        {

            RestRequest requestCallback = new RestRequest();

            requestCallback.AddQueryParameter("client_id", "2199053333600218");
            requestCallback.AddQueryParameter("client_secret", "3a97c49bc80db712cf61eb8f34593307");
            requestCallback.AddQueryParameter("redirect_uri", "https://localhost:44391/Home/FacebookCallback");
            requestCallback.AddQueryParameter("code", code);

            var restClientCallback = new RestClient(new Uri("https://graph.facebook.com/v15.0/oauth/access_token?"));
            var callbackCredentials = restClientCallback.Get(requestCallback);
            JObject credentials = JObject.Parse(callbackCredentials.Content);
            //https://graph.facebook.com/me?fields=first_name,last_name,id,email + aplication Json + Authorization bearer: accestoken

            RestRequest userRequest = new RestRequest();
            userRequest.AddHeader("Authorization", "Bearer " + credentials["access_token"]);
            Session["AccessToken"] = credentials["access_token"];

            var userParam = new RestClient(new Uri("https://graph.facebook.com/me?fields=first_name,last_name,id,email"));

            var userData = userParam.Get(userRequest);
            JObject paramsUser = JObject.Parse(userData.Content);

    //I save the data now

            return RedirectToAction("Index", "Home");

        }
</code>```

And finally, I close the section on Facebook for a new user to enter, but I can only remove the permissions of my app, so the section does not close.

```<code>public void FacebookLogOut()
        {
            RestRequest request = new RestRequest();
            request.AddQueryParameter("access_token", Session["AccessToken"].ToString());
            var userParam = new RestClient(new Uri("https://graph.facebook.com/me/permissions/email"));
            var resp = userParam.Delete(request);

            Response.Redirect("Index");
        }
</code>```

I can't understand the facebook documentation either. I want to be able to close the facebook section,

Thanks for reading this question and I appreciate your help.

Try using fb.GetLogoutUrl(next=',access_token=').

put the url in a redirectTo(). Is there a facebook url where I can close the section?

Title: c# web api Facebook log out

Body:
I have a web api project in c# in which I do a facebook social login with oauth2 calling the urls of facebok

public ActionResult FacebookSignIn()
        {
            var loginUrl = "https://www.facebook.com/dialog/oauth?" +
                "client_id=2199053333600218&" +
                "redirect_uri=https://localhost:44391/Home/FacebookCallback&" +
                "response_type = code&" +
                "scope=email&";

            return Redirect(loginUrl);
        }

now i get token and user data

public ActionResult FacebookCallback(string code)
        {

            RestRequest requestCallback = new RestRequest();

            requestCallback.AddQueryParameter("client_id", "2199053333600218");
            requestCallback.AddQueryParameter("client_secret", "3a97c49bc80db712cf61eb8f34593307");
            requestCallback.AddQueryParameter("redirect_uri", "https://localhost:44391/Home/FacebookCallback");
            requestCallback.AddQueryParameter("code", code);

            var restClientCallback = new RestClient(new Uri("https://graph.facebook.com/v15.0/oauth/access_token?"));
            var callbackCredentials = restClientCallback.Get(requestCallback);
            JObject credentials = JObject.Parse(callbackCredentials.Content);
            //https://graph.facebook.com/me?fields=first_name,last_name,id,email + aplication Json + Authorization bearer: accestoken

            RestRequest userRequest = new RestRequest();
            userRequest.AddHeader("Authorization", "Bearer " + credentials["access_token"]);
            Session["AccessToken"] = credentials["access_token"];

            var userParam = new RestClient(new Uri("https://graph.facebook.com/me?fields=first_name,last_name,id,email"));

            var userData = userParam.Get(userRequest);
            JObject paramsUser = JObject.Parse(userData.Content);

    //I save the data now

            return RedirectToAction("Index", "Home");

        }

And finally, I close the section on Facebook for a new user to enter, but I can only remove the permissions of my app, so the section does not close.

public void FacebookLogOut()
        {
            RestRequest request = new RestRequest();
            request.AddQueryParameter("access_token", Session["AccessToken"].ToString());
            var userParam = new RestClient(new Uri("https://graph.facebook.com/me/permissions/email"));
            var resp = userParam.Delete(request);

            Response.Redirect("Index");
        }

I can't understand the facebook documentation either. I want to be able to close the facebook section,

Thanks for reading this question and I appreciate your help.

Try using fb.GetLogoutUrl(next=',access_token=').

put the url in a redirectTo(). Is there a facebook url where I can close the section?


问:
Razor pages - Update HTML table after async method has populated a List
Trying to run the @foreach loop once items has been populated, I have tried using StateHasChanged() but can't seem to get it to work

Here is my HTML

```<code><table class="table">
    <thead>
        <tr>
            <th>Field 1</th>
            <th>Field 2</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in items)
        {
            <tr>
                <td>@item.avgHighPrice</td>
                <td>@item.Name</td>
            </tr>
        }
    </tbody>
</table>
</code>```

C# code for populating the items list

```<code>@code {

    private List<Item> items = new List<Item>();

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            items = await LoadDataAsync();
            StateHasChanged();
        }
    }

    private async Task<List<Item>> LoadDataAsync()
    {
        var database = DBConnection.getDatabase();
        IMongoCollection<Item> collection = database.GetCollection<Item>("Prices");
        return await Task.FromResult(items = collection.AsQueryable().ToList());
    }
}
</code>```

Body:
Trying to run the @foreach loop once items has been populated, I have tried using StateHasChanged() but can't seem to get it to work

Here is my HTML

            Field 1
            Field 2

        @foreach (var item in items)
        {

                @item.avgHighPrice
                @item.Name

        }

C# code for populating the items list

@code {

    private List<Item> items = new List<Item>();

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            items = await LoadDataAsync();
            StateHasChanged();
        }
    }

    private async Task<List<Item>> LoadDataAsync()
    {
        var database = DBConnection.getDatabase();
        IMongoCollection<Item> collection = database.GetCollection<Item>("Prices");
        return await Task.FromResult(items = collection.AsQueryable().ToList());
    }
}


问:
Installing VS Code and Node.js
I am new to Node.js and I am using VS Code to write a simple program.  The first problem I ran into was that the program would not block on Readline.question.  My searches found no explanation for why this was happening.  I uninstalled and reinstalled both VS Code and Node.js.  The program I am writing still has the same problem and now, vs code will not run in debug mode.  Can anyone point me to a site or documents that might shed some light on these issues?  I would appreciate any assistance.</p>

Title: Installing VS Code and Node.js


问:
Can't configure spring-boot test with @DataJpaTest
I have below a simple test. I want to run this one with an embedded database H2 but I have an exception. This expeption happens because context checks connection to a production database and I don't want the context to do it because it's unnecessary. The context tries to connect to a database which doesn't even exist. This database in GCP. I have this exception:

com.google.api.gax.rpc.PermissionDeniedException:
io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission denied
on resource projectcom.google.api.gax.rpc.PermissionDeniedException:
io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission denied
on resource project

I've already tried to user @ActiveProfiles and properties in application-test.yml but it didn't work.

So, how can I avoid calling my production database?

```<code>@DataJpaTest
//@ActiveProfiles("test")
class UserRepositoryTest {

    @Autowired
    private UserRepository userRepository;

    @Test
    void getAll() {

    }
}
</code>```
```<code>    <dependencies>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>spring-cloud-gcp-starter-sql-postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>spring-cloud-gcp-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>spring-cloud-gcp-starter-secretmanager</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.20</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
            <version>2.4.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.32.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.firebase</groupId>
            <artifactId>firebase-admin</artifactId>
            <version>7.1.0</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
            <version>2.8.0</version>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
            <version>9.8.1</version>
        </dependency>

        <!--Test-->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2020.0.6</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>spring-cloud-gcp-dependencies</artifactId>
                <version>2.0.11</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</code>```

application-test.yml

```<code>spring:
  profiles:
    active: test
  jpa:
    database: h2
    show-sql: true
    hibernate:
      ddl-auto: create-drop
  datasource:
    url: jdbc:h2:mem:testDb
    driver-class-name: org.h2.Driver
  h2:
    console:
      enabled: true

</code>```

Body:
I have below a simple test. I want to run this one with an embedded database H2 but I have an exception. This expeption happens because context checks connection to a production database and I don't want the context to do it because it's unnecessary. The context tries to connect to a database which doesn't even exist. This database in GCP. I have this exception:

com.google.api.gax.rpc.PermissionDeniedException:
io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission denied
on resource projectcom.google.api.gax.rpc.PermissionDeniedException:
io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission denied
on resource project

I've already tried to user @ActiveProfiles and properties in application-test.yml but it didn't work.

So, how can I avoid calling my production database?

@DataJpaTest
//@ActiveProfiles("test")
class UserRepositoryTest {

    @Autowired
    private UserRepository userRepository;

    @Test
    void getAll() {

    }
}

    <dependencies>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>spring-cloud-gcp-starter-sql-postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>spring-cloud-gcp-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>spring-cloud-gcp-starter-secretmanager</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.20</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
            <version>2.4.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.32.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.firebase</groupId>
            <artifactId>firebase-admin</artifactId>
            <version>7.1.0</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
            <version>2.8.0</version>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
            <version>9.8.1</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2020.0.6</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>spring-cloud-gcp-dependencies</artifactId>
                <version>2.0.11</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

application-test.yml

spring:
  profiles:
    active: test
  jpa:
    database: h2
    show-sql: true
    hibernate:
      ddl-auto: create-drop
  datasource:
    url: jdbc:h2:mem:testDb
    driver-class-name: org.h2.Driver
  h2:
    console:
      enabled: true


问:
how to create an email with that information of an email outlook with python?
good afternoon to all the masters on this topic, the problem is detailed as follows:
1.- I want to extract the information of the last mail that arrives in a specific subfolder
2.- I want to use that information to send in another email without changing the format of the body or the information
3 .- send the new mail</p>
```<code>import win32com.client

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

inbox = outlook.GetDefaultFolder(6).Folders.Item("subfolder")
messages = inbox.Items
message = messages.GetLast()

for message in messages:

  if message.unread == True:    # gets only 'Unread' emails
    subject_content = message.subject
# to store subject lines of mails

    body_content = message.body
# to store Body of mails

    print(subject_content)
    print(body_content)

    message.Unread = True         # mark the mail as 'Read'
    message = messages.GetNext()
    print(message)

    newMsg = message        <================
    newMsg.Body = message.body
    newMsg.Subject = message.Subject
    newMsg.To = "xx@mail.com"
    #newMsg.Send()
</code>```

Body:
good afternoon to all the masters on this topic, the problem is detailed as follows:
1.- I want to extract the information of the last mail that arrives in a specific subfolder
2.- I want to use that information to send in another email without changing the format of the body or the information
3 .- send the new mail

import win32com.client

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

inbox = outlook.GetDefaultFolder(6).Folders.Item("subfolder")
messages = inbox.Items
message = messages.GetLast()

for message in messages:

  if message.unread == True:    # gets only 'Unread' emails
    subject_content = message.subject
# to store subject lines of mails

    body_content = message.body
# to store Body of mails

    print(subject_content)
    print(body_content)

    message.Unread = True         # mark the mail as 'Read'
    message = messages.GetNext()
    print(message)

    newMsg = message        <================
    newMsg.Body = message.body
    newMsg.Subject = message.Subject
    newMsg.To = "xx@mail.com"
    #newMsg.Send()


问:
Python output based question, (elementry lvl),output using user defined function
I am stuck in the logic of the problem and also cannot find the solution for quite long. I am a 12th grader

I am just expecting a detailed solution aur solution at least

```<code>def show(x,y,z):
    print(x+y+z)

def now(x,y,z):
    return x*y*z

a=show(6,16,26)
b=now(2,3,6)
print(a,b)
print(b,a+1)
print(a+b)
</code>```

Body:
I am stuck in the logic of the problem and also cannot find the solution for quite long. I am a 12th grader

I am just expecting a detailed solution aur solution at least

def show(x,y,z):
    print(x+y+z)

def now(x,y,z):
    return x*y*z

a=show(6,16,26)
b=now(2,3,6)
print(a,b)
print(b,a+1)
print(a+b)


问:
Is there a way to import file name as type
I was making an icon component that uses file name as a prop to grab the correct icon from a directory and display it. Here's an example:

```<code><Icon name="close" />
</code>```

It will use close.svg file from icons directory and display it.

What i wanted to do is to make a type that allows name to be only one of the files that are in icons directory. For example, if icons directory looks like this:

Type should be "close" | "collapse" | "delete".

Is it possible to do something like this?

I couldn't figure out a way to import file names from a directory, so I decided to try a different approach:

I'm using vite's import.meta.glob to import all SVG files from a directory, like this:

```<code>import.meta.glob('../assets/icons/*.svg', { eager: true });
</code>```

It returns an object with modules, where each module is a SVG icon as a React component. I wrote a small vite plugin to add an icon name to every SVG module export, so now every module looks like this:

But return type of import.meta.glob is Record<string, unknown>, so I can't use iconName as type since module type is unknown.

So if there's no way to import file names from a directory, maybe there's a way to use module's export as a type? I'm at a complete loss here, so any help would be appreciated.

Body:
I was making an icon component that uses file name as a prop to grab the correct icon from a directory and display it. Here's an example:

<Icon name="close" />

It will use close.svg file from icons directory and display it.

What i wanted to do is to make a type that allows name to be only one of the files that are in icons directory. For example, if icons directory looks like this:

Type should be "close" | "collapse" | "delete".

Is it possible to do something like this?

I couldn't figure out a way to import file names from a directory, so I decided to try a different approach:

I'm using vite's import.meta.glob to import all SVG files from a directory, like this:

import.meta.glob('../assets/icons/*.svg', { eager: true });

It returns an object with modules, where each module is a SVG icon as a React component. I wrote a small vite plugin to add an icon name to every SVG module export, so now every module looks like this:

But return type of import.meta.glob is Record<string, unknown>, so I can't use iconName as type since module type is unknown.

So if there's no way to import file names from a directory, maybe there's a way to use module's export as a type? I'm at a complete loss here, so any help would be appreciated.


问:
Editing a piece of a line in a .txt file with python
I am new at this and beginning to learn Python. I am having some difficulty with writing code to edit only a piece of a specified line in a text file.

The idea is having a text file that stores user task data. Each task with its details is saved in a line of the text file like such:

user, task name, task description, date assigned, due date, task completion status
user, task name, task description, date assigned, due date, task completion status
user, task name, task description, date assigned, due date, task completion status

The task completion status is "No" if not completed and "Yes" if completed.

Firstly, an if function is used to single out which task is assigned to the user logged in to the program on its startup. The program then prompts the user to enter the number of the task they want to mark as completed.
When they entered a number the task completion status of that specific task line needs to change to "Yes" instead of the default "No".

I'm unsure of how to change the value of the task completion status in the text file from "No" to "Yes".

I have managed to get the output in the terminal to print the whole sentence with the "Yes" value, but I am unsure of how to approach the .txt file writing.

Below is the code for showing the logged in user their tasks.

```<code>def view_mine():
    with open ("tasks.txt", "r") as task_file:
        line = task_file.readlines()
        task_list = []
        for index, i in enumerate(line):
            task_list_split = i.split(", ")
            task_list.append(task_list_split)
            if task_list[index][0]== username:
                task_number = (index + 1)
                task_name = task_list[index][1]
                task_assign = task_list[index][0]
                date_assign = task_list[index][3]
                date_due = task_list[index][4]
                complete_task = task_list[index][5]
                task_disc = task_list[index][2]
                if task_assign == username:
                    print(f'''Task number:\t\t\t {task_number}
Task:\t\t\t\t {task_name}
Assigned to:\t\t\t {task_assign}
Date assigned:\t\t\t {date_assign}
Due date:\t\t\t {date_due}
Task complete?\t\t\t {complete_task}
Task description\t\t {task_disc}''')
                    print()
        edit_task = int((input('''Select one of your tasks or enter -1 to return to main menu\n''')))
        line_changing = edit_task - 1
        action = input('''Would you like to mark this task as complete or edit the task?\n''')
        if action == "mark this task as complete":
            replaced_content = ""
            for line in task_file:
                line = line.strip()
                if i == line_changing:
                    new_line = line.replace("No","Yes")
                else:
                    new_line = line
                replaced_content = replaced_content + new_line +"\n"
                i = i+1
            task_file.close()
            with open ("tasks.txt", "w") as write_file:
                write_file.write(replaced_content)
            print("Task marked as complete")
            print()
</code>```

The piece I have under the 'if action == "mark this task as complete":' deletes all the information in the text file but doesn't write anything new in it.

I am a beginner, so I might be missing something obvious but any help would be appreciated.

Body:
I am new at this and beginning to learn Python. I am having some difficulty with writing code to edit only a piece of a specified line in a text file.

The idea is having a text file that stores user task data. Each task with its details is saved in a line of the text file like such:

user, task name, task description, date assigned, due date, task completion status
user, task name, task description, date assigned, due date, task completion status
user, task name, task description, date assigned, due date, task completion status

The task completion status is "No" if not completed and "Yes" if completed.

Firstly, an if function is used to single out which task is assigned to the user logged in to the program on its startup. The program then prompts the user to enter the number of the task they want to mark as completed.
When they entered a number the task completion status of that specific task line needs to change to "Yes" instead of the default "No".

I'm unsure of how to change the value of the task completion status in the text file from "No" to "Yes".

I have managed to get the output in the terminal to print the whole sentence with the "Yes" value, but I am unsure of how to approach the .txt file writing.

Below is the code for showing the logged in user their tasks.

def view_mine():
    with open ("tasks.txt", "r") as task_file:
        line = task_file.readlines()
        task_list = []
        for index, i in enumerate(line):
            task_list_split = i.split(", ")
            task_list.append(task_list_split)
            if task_list[index][0]== username:
                task_number = (index + 1)
                task_name = task_list[index][1]
                task_assign = task_list[index][0]
                date_assign = task_list[index][3]
                date_due = task_list[index][4]
                complete_task = task_list[index][5]
                task_disc = task_list[index][2]
                if task_assign == username:
                    print(f'''Task number:\t\t\t {task_number}
Task:\t\t\t\t {task_name}
Assigned to:\t\t\t {task_assign}
Date assigned:\t\t\t {date_assign}
Due date:\t\t\t {date_due}
Task complete?\t\t\t {complete_task}
Task description\t\t {task_disc}''')
                    print()
        edit_task = int((input('''Select one of your tasks or enter -1 to return to main menu\n''')))
        line_changing = edit_task - 1
        action = input('''Would you like to mark this task as complete or edit the task?\n''')
        if action == "mark this task as complete":
            replaced_content = ""
            for line in task_file:
                line = line.strip()
                if i == line_changing:
                    new_line = line.replace("No","Yes")
                else:
                    new_line = line
                replaced_content = replaced_content + new_line +"\n"
                i = i+1
            task_file.close()
            with open ("tasks.txt", "w") as write_file:
                write_file.write(replaced_content)
            print("Task marked as complete")
            print()

The piece I have under the 'if action == "mark this task as complete":' deletes all the information in the text file but doesn't write anything new in it.

I am a beginner, so I might be missing something obvious but any help would be appreciated.


问:
The split method is not working - want to split the date
I'm trying to split the date on both release_date and first_air_date however the split() method isn't working for me. What am I doing wrong - please explain! I'm a beginner. Many thanks in advance!

Below is my code:

```<code>import { Typography } from "@mui/material";
import { Box } from "@mui/system";
import React from "react";

function Card({ daily }) {
    let text = daily.release_date;
    let airDate = daily.first_air_date;

    const myArray = text.split("-");
    const splitDate = airDate.split("-");
    const word = myArray[0];
    const date = splitDate[0];
    console.log(word);
    console.log(date);

    return (
        <Box
            sx={{
                width: "25%",
                height: "550px",
                backgroundColor: "#144272",
                alignSelf: "flex-start",
                borderRadius: "10px",
            }}
        >
            <Box
                sx={{
                    width: "100%",
                    height: "85%",
                    backgroundColor: "red",
                    borderRadius: "20px",
                }}
            >
                <img
                    className="img-src"
                    src={`https://image.tmdb.org/t/p/w500/${daily.poster_path}`}
                    alt=""
                    style={{
                        width: "100%",
                        height: "100%",
                        objectFit: "cover",
                        borderRadius: "20px",
                    }}
                />
            </Box>
            <Box
                sx={{
                    display: "flex",
                    align: "center",
                    fontFamily: "Open Sans, sans-serif",
                    fontWeight: "normal",
                    fontSize: "20px",
                    color: "#fff",
                    margin: "5px 10px",
                    flexDirection: "column",
                }}
            >
                {daily.original_title ? (
                    <Typography sx={{}}>{daily.original_title}</Typography>
                ) : (
                    <Typography sx={{}}>{daily.name}</Typography>
                )}
                <Typography
                    sx={{
                        fontFamily: "Open Sans, sans-serif",
                        fontWeight: "lighter",
                        fontSize: "15px",
                        color: "#fff",
                        margin: "5px 10px",
                    }}
                >
                    {/*word*/}
                </Typography>

                {daily.release_date ? (
                    <Typography sx={{}}>{text}</Typography>
                ) : (
                    <Typography sx={{}}>{/*airDate*/}</Typography>
                )}
            </Box>
        </Box>
    );
}

export default Card;
</code>```

I used the split() method in another component, here is the code for that one and it worked fine:

```<code>import React from "react";

function Card({ recomendations }) {
    let text = recomendations.release_date;

    const myArray = text.split("-");
    let word = myArray[0];
    console.log(word);
    return (
        <Box
            sx={{
                width: "25%",
                height: "550px",
                backgroundColor: "#144272",
                alignSelf: "flex-start",
                borderRadius: "10px",
            }}
        >
            <Box
                sx={{
                    width: "100%",
                    height: "85%",
                    backgroundColor: "red",
                    borderRadius: "20px",
                }}
            >
                <img
                    className="img-src"
                    src={`https://image.tmdb.org/t/p/w500/${recomendations.poster_path}`}
                    alt=""
                    style={{
                        width: "100%",
                        height: "100%",
                        objectFit: "cover",
                        borderRadius: "20px",
                    }}
                />
            </Box>
            <Box
                sx={{
                    display: "flex",
                    align: "center",
                    fontFamily: "Open Sans, sans-serif",
                    fontWeight: "normal",
                    fontSize: "20px",
                    color: "#fff",
                    margin: "5px 10px",
                    flexDirection: "column",
                }}
            >
                <Typography sx={{}}>{recomendations.original_title}</Typography>
                <Typography
                    sx={{
                        fontFamily: "Open Sans, sans-serif",
                        fontWeight: "lighter",
                        fontSize: "15px",
                        color: "#fff",
                        margin: "5px 10px",
                    }}
                >
                    {word}
                </Typography>
            </Box>
        </Box>
    );
}

export default Card;
</code>```

Body:
I'm trying to split the date on both release_date and first_air_date however the split() method isn't working for me. What am I doing wrong - please explain! I'm a beginner. Many thanks in advance!

Below is my code:

import { Typography } from "@mui/material";
import { Box } from "@mui/system";
import React from "react";

function Card({ daily }) {
    let text = daily.release_date;
    let airDate = daily.first_air_date;

    const myArray = text.split("-");
    const splitDate = airDate.split("-");
    const word = myArray[0];
    const date = splitDate[0];
    console.log(word);
    console.log(date);

    return (
        <Box
            sx={{
                width: "25%",
                height: "550px",
                backgroundColor: "#144272",
                alignSelf: "flex-start",
                borderRadius: "10px",
            }}
        >
            <Box
                sx={{
                    width: "100%",
                    height: "85%",
                    backgroundColor: "red",
                    borderRadius: "20px",
                }}
            >
                <img
                    className="img-src"
                    src={`https://image.tmdb.org/t/p/w500/${daily.poster_path}`}
                    alt=""
                    style={{
                        width: "100%",
                        height: "100%",
                        objectFit: "cover",
                        borderRadius: "20px",
                    }}
                />
            </Box>
            <Box
                sx={{
                    display: "flex",
                    align: "center",
                    fontFamily: "Open Sans, sans-serif",
                    fontWeight: "normal",
                    fontSize: "20px",
                    color: "#fff",
                    margin: "5px 10px",
                    flexDirection: "column",
                }}
            >
                {daily.original_title ? (
                    <Typography sx={{}}>{daily.original_title}</Typography>
                ) : (
                    <Typography sx={{}}>{daily.name}</Typography>
                )}
                <Typography
                    sx={{
                        fontFamily: "Open Sans, sans-serif",
                        fontWeight: "lighter",
                        fontSize: "15px",
                        color: "#fff",
                        margin: "5px 10px",
                    }}
                >
                    {/*word*/}
                </Typography>

                {daily.release_date ? (
                    <Typography sx={{}}>{text}</Typography>
                ) : (
                    <Typography sx={{}}>{/*airDate*/}</Typography>
                )}
            </Box>
        </Box>
    );
}

export default Card;

I used the split() method in another component, here is the code for that one and it worked fine:

import React from "react";

function Card({ recomendations }) {
    let text = recomendations.release_date;

    const myArray = text.split("-");
    let word = myArray[0];
    console.log(word);
    return (
        <Box
            sx={{
                width: "25%",
                height: "550px",
                backgroundColor: "#144272",
                alignSelf: "flex-start",
                borderRadius: "10px",
            }}
        >
            <Box
                sx={{
                    width: "100%",
                    height: "85%",
                    backgroundColor: "red",
                    borderRadius: "20px",
                }}
            >
                <img
                    className="img-src"
                    src={`https://image.tmdb.org/t/p/w500/${recomendations.poster_path}`}
                    alt=""
                    style={{
                        width: "100%",
                        height: "100%",
                        objectFit: "cover",
                        borderRadius: "20px",
                    }}
                />
            </Box>
            <Box
                sx={{
                    display: "flex",
                    align: "center",
                    fontFamily: "Open Sans, sans-serif",
                    fontWeight: "normal",
                    fontSize: "20px",
                    color: "#fff",
                    margin: "5px 10px",
                    flexDirection: "column",
                }}
            >
                <Typography sx={{}}>{recomendations.original_title}</Typography>
                <Typography
                    sx={{
                        fontFamily: "Open Sans, sans-serif",
                        fontWeight: "lighter",
                        fontSize: "15px",
                        color: "#fff",
                        margin: "5px 10px",
                    }}
                >
                    {word}
                </Typography>
            </Box>
        </Box>
    );
}

export default Card;


问:
SOAP request parameter in PHP, need 2 value with the same key in array
the XML structure that method needs two elements with same title. I use array to send parameters but dont know how to send two value with same key in array? if necessery SOAP 1.2 and PHP 5.x </p>

ContentLicense: CC BY-SA 3.0


问:
Flutter Hive hot-restart type-cast error when i try to retrieve data
I store some data in the hive box .. then retrieve it in FavoritesPage it works perfectly
but when I hot-restart the app and go to the FavoritesPage it throws a type-cast error

FavoritesPage :

```<code>class _FavoritesPageState extends State<FavoritesPage> {
  @override
  void initState() {
    super.initState();
    //HandleFavorites.deleteAll();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ValueListenableBuilder<Box<List<FavoritesSongs>>>(
        valueListenable: HandleFavorites.getFavoritesSongs().listenable(),
        builder: (context, fav, _) {
          final favorites = fav.values.toList().cast<List<FavoritesSongs>>();
          return favorites.isEmpty
              ? const Center(child: Text('No Sounds Yet'))
              : Column(
                  children: favorites.map((e) => buildContent(e)).toList());
        },
      ),
    );
  }
}
</code>```

buildContent :

```<code>Widget buildContent(List<FavoritesSongs> favoritesSongs) {
  if (favoritesSongs.isEmpty) {
    return const Center(child: Text('Empty'));
  } else {
    return Column(
      children: [
        ListView.builder(
          scrollDirection: Axis.vertical,
          shrinkWrap: true,
          itemCount: favoritesSongs.length,
          itemBuilder: (BuildContext context, int index) {
            final fav = favoritesSongs[index];
            return Text(fav.id);
          },
        ),
        const Divider(
          height: 20,
          thickness: 2,
          color: Colors.black,
        ),
      ],
    );
  }
}
</code>```

HandleFavorites class :

```<code>class HandleFavorites {
static Box<List<FavoritesSongs>> getFavoritesSongs() =>
      Hive.box<List<FavoritesSongs>>(StaticWords.favorites);
}
</code>```

favorites class

```<code>import 'package:hive/hive.dart';

part 'favorites_songs.g.dart';

@HiveType(typeId: 1, adapterName: "FavoritesSongsAdapter")
class FavoritesSongs {
  FavoritesSongs({required this.id, required this.volume});

  @HiveField(0)
  String id;

  @HiveField(1)
  double volume;
}

@HiveType(typeId: 2, adapterName: "FavoritesListAdapter")
class FavoritesList extends HiveObject {
  FavoritesList({required this.listId, required this.listOfSounds});

  @HiveField(0)
  String listId;

  @HiveField(1)
  List<FavoritesSongs> listOfSounds;
}

</code>```

how i init hive
main.dart file

```<code>Future main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Hive.initFlutter();
  Hive.registerAdapter(FavoritesSongsAdapter());
  Hive.openBox<List<FavoritesSongs>>(StaticWords.favorites);
  runApp(const Equable());
}
</code>```

when i go to the favoritesPage it throw this error

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _CastError was thrown building
ValueListenableBuilder<Box<List>>(dirty, state:
_ValueListenableBuilderState<Box<List>>#b8b8b):
type 'List' is not a subtype of type 'List' in type cast

Body:
I store some data in the hive box .. then retrieve it in FavoritesPage it works perfectly
but when I hot-restart the app and go to the FavoritesPage it throws a type-cast error

FavoritesPage :

class _FavoritesPageState extends State<FavoritesPage> {
  @override
  void initState() {
    super.initState();
    //HandleFavorites.deleteAll();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ValueListenableBuilder<Box<List<FavoritesSongs>>>(
        valueListenable: HandleFavorites.getFavoritesSongs().listenable(),
        builder: (context, fav, _) {
          final favorites = fav.values.toList().cast<List<FavoritesSongs>>();
          return favorites.isEmpty
              ? const Center(child: Text('No Sounds Yet'))
              : Column(
                  children: favorites.map((e) => buildContent(e)).toList());
        },
      ),
    );
  }
}

buildContent :

Widget buildContent(List<FavoritesSongs> favoritesSongs) {
  if (favoritesSongs.isEmpty) {
    return const Center(child: Text('Empty'));
  } else {
    return Column(
      children: [
        ListView.builder(
          scrollDirection: Axis.vertical,
          shrinkWrap: true,
          itemCount: favoritesSongs.length,
          itemBuilder: (BuildContext context, int index) {
            final fav = favoritesSongs[index];
            return Text(fav.id);
          },
        ),
        const Divider(
          height: 20,
          thickness: 2,
          color: Colors.black,
        ),
      ],
    );
  }
}

HandleFavorites class :

class HandleFavorites {
static Box<List<FavoritesSongs>> getFavoritesSongs() =>
      Hive.box<List<FavoritesSongs>>(StaticWords.favorites);
}

favorites class

import 'package:hive/hive.dart';

part 'favorites_songs.g.dart';

@HiveType(typeId: 1, adapterName: "FavoritesSongsAdapter")
class FavoritesSongs {
  FavoritesSongs({required this.id, required this.volume});

  @HiveField(0)
  String id;

  @HiveField(1)
  double volume;
}

@HiveType(typeId: 2, adapterName: "FavoritesListAdapter")
class FavoritesList extends HiveObject {
  FavoritesList({required this.listId, required this.listOfSounds});

  @HiveField(0)
  String listId;

  @HiveField(1)
  List<FavoritesSongs> listOfSounds;
}

how i init hive
main.dart file

Future main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Hive.initFlutter();
  Hive.registerAdapter(FavoritesSongsAdapter());
  Hive.openBox<List<FavoritesSongs>>(StaticWords.favorites);
  runApp(const Equable());
}

when i go to the favoritesPage it throw this error

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _CastError was thrown building
ValueListenableBuilder<Box<List>>(dirty, state:
_ValueListenableBuilderState<Box<List>>#b8b8b):
type 'List' is not a subtype of type 'List' in type cast


问:
Problems for running concurrent futures process pool in JupyterNotebook
I am trying to run some example code, but I got a next result:

A process in the process pool was terminated abruptly while the future
was running or pending.

I tried in Google Colab and everything runs fine, but when I'm in Jupyter, it says that it's not possible. I'm from Ananconda, using the Jupyternotebook in IOS.

For example: this code

```<code>import concurrent.futures
import math

PRIMES = [
    112272535095293,
    112582705942171,
    112272535095293,
    115280095190773,
    115797848077099,
    1099726899285419]

def is_prime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False

    sqrt_n = int(math.floor(math.sqrt(n)))
    for i in range(3, sqrt_n + 1, 2):
        if n % i == 0:
            return False
    return True

def main():
    with concurrent.futures.ProcessPoolExecutor() as executor:
        for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
            print('%d is prime: %s' % (number, prime))

if __name__ == '__main__':
    main()
</code>```

What should I do? What does the error mean?

Body:
I am trying to run some example code, but I got a next result:

A process in the process pool was terminated abruptly while the future
was running or pending.

I tried in Google Colab and everything runs fine, but when I'm in Jupyter, it says that it's not possible. I'm from Ananconda, using the Jupyternotebook in IOS.

For example: this code

import concurrent.futures
import math

PRIMES = [
    112272535095293,
    112582705942171,
    112272535095293,
    115280095190773,
    115797848077099,
    1099726899285419]

def is_prime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False

    sqrt_n = int(math.floor(math.sqrt(n)))
    for i in range(3, sqrt_n + 1, 2):
        if n % i == 0:
            return False
    return True

def main():
    with concurrent.futures.ProcessPoolExecutor() as executor:
        for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
            print('%d is prime: %s' % (number, prime))

if __name__ == '__main__':
    main()

What should I do? What does the error mean?


问:
How to do custom drop-down list in QGIS plugin ( PYQT ) like identify tool
I am currently working on a Qgis Python plugin and now I need to request the user to input an item from a list. But I don't know how to make a custom drop-down list, I researched through the internet but I can't find a solution for this, can you help me to make a custom drop-down list like Build-in Identify tool QGIS (

 )

I try to do by using combobox widget but i need a list to choose item, can you please help me to solve this,
i attaching the photo of example list


问:
seeing multiple log entries for one error
I have a web api controller which is calling a service (using Mediatr) to get back some data, I tried to force an error to get exception logging to work.  But I'm noticing that for 1 error I see 3 entries in the logs, I would assume 1 error = 1 entry, the RequestId is the same for all 3 entries.

In Program.cs after the builder.Build() I have:

```<code>app.UseExceptionHandler("/error");
</code>```

My ErrorsController:

```<code>    [Route("/error")]
    public IActionResult HandleError([FromServices] IHostEnvironment hostEnvironment)
    {
        if (!hostEnvironment.IsDevelopment())
        {
            // if we hit this outside development return 404
            return NotFound();
        }

        var exception = HttpContext.Features.Get<IExceptionHandlerFeature>().Error!;

        return Problem(
         detail: exception.StackTrace,
         title: exception.Message
        );
    }
</code>```

I'm throwing a test error in the service class with:

```<code>throw new Exception("something wrong");
</code>```

Now when I hit that method in the log (db and console) I see 3 entries:

HTTP "GET" "/api/query/staff" responded 500 in 593.6407 ms -> Has StackTrace

An unhandled exception has occurred while executing the request. -> Has same StackTrace as above

HTTP "GET" "/error" responded 500 in 43.4958 ms -> No StackTrace

they all have the same RequestId.

I was trying to log just once, so it's easier to find the exception in the logs, rather than see it 3 times, which i'm assuming is from the service->controller (which called service)->error controller.

Body:
I have a web api controller which is calling a service (using Mediatr) to get back some data, I tried to force an error to get exception logging to work.  But I'm noticing that for 1 error I see 3 entries in the logs, I would assume 1 error = 1 entry, the RequestId is the same for all 3 entries.

In Program.cs after the builder.Build() I have:

app.UseExceptionHandler("/error");

My ErrorsController:

    [Route("/error")]
    public IActionResult HandleError([FromServices] IHostEnvironment hostEnvironment)
    {
        if (!hostEnvironment.IsDevelopment())
        {
            // if we hit this outside development return 404
            return NotFound();
        }

        var exception = HttpContext.Features.Get<IExceptionHandlerFeature>().Error!;

        return Problem(
         detail: exception.StackTrace,
         title: exception.Message
        );
    }

I'm throwing a test error in the service class with:

throw new Exception("something wrong");

Now when I hit that method in the log (db and console) I see 3 entries:

HTTP "GET" "/api/query/staff" responded 500 in 593.6407 ms -> Has StackTrace

An unhandled exception has occurred while executing the request. -> Has same StackTrace as above

HTTP "GET" "/error" responded 500 in 43.4958 ms -> No StackTrace

they all have the same RequestId.

I was trying to log just once, so it's easier to find the exception in the logs, rather than see it 3 times, which i'm assuming is from the service->controller (which called service)->error controller.


问:
How do I change the template of "Sign in with email link" email in Firebase?
Basically, I want to change the template of the "Sign in with email link" email in Firebase, or at least it's language to Portuguese.

I can't find it's template or even someone being direct with the stuff.


问:
FFMpeg shared libraries linking failure
I'm currently trying to link the libav libraries with a project on Windows. The project compiles, but when it actually runs, it immediately exits with an error.

I'm using the libraries found here: https://github.com/BtbN/FFmpeg-Builds/releases/tag/latest. I've tried using both the master builds and the 4.4 builds.

And my CMake config is set up as such,

```<code>    add_executable(CicadaVid FFMPEGTest/CicadaVid.c )
    target_link_libraries(CicadaVid avutil)
</code>```

And just making a call to any function such as,

```<code>    int main() {
        avutil_license();
    }
</code>```

I end up with a return failure immediately. For reference I'm using the win64 builds with a mingW compiler.

Title: FFMpeg shared libraries linking failure

Body:
I'm currently trying to link the libav libraries with a project on Windows. The project compiles, but when it actually runs, it immediately exits with an error.

I'm using the libraries found here: https://github.com/BtbN/FFmpeg-Builds/releases/tag/latest. I've tried using both the master builds and the 4.4 builds.

And my CMake config is set up as such,

    add_executable(CicadaVid FFMPEGTest/CicadaVid.c )
    target_link_libraries(CicadaVid avutil)

And just making a call to any function such as,

    int main() {
        avutil_license();
    }

I end up with a return failure immediately. For reference I'm using the win64 builds with a mingW compiler.