问:
Input and loading from the camera
I have a simple web application where I load products into a database by filling in several Html inputs.

I would probably need to use Javascript to load the EAN into the input field using the camera from the Android phone.

But I don't know where to start. I searched on the internet but couldn't find a solution.
I must have been looking wrong but I really can't find anything.

Title: Input and loading from the camera


来源: stackexchange

问:
How to call html from jQuery?
I'm working on a website with data display, user can edit this data. After a user doing so, I want a modal to confirm the change.

I currently doing it with alert function.
But I read somewhere in this forum that we shoud avoid using alert() outside of debuging.
So I looked for a modal exemple in html on the web.
Now I'm wondering how to call this html from jquery. I tried .html() in vain.
Here is my current code, the alert is still work.

```<code>function updatedata(id, nom, ) {
        $.ajax({
            // Action
            url: 'admin',
            // Method
            type: 'POST',
            data: {
                // Get value
                id: id,
                nom: nom
            },
            success:function(response){
                console.log("success");
                $("div#myModalEdit").html();
                alert(nom + " à été modifier bdd");
            }
        });
    };
</code>```

EDIT: Thank you for your answers, I finally followed the suggestion of using toastr

ContentLicense: CC BY-SA 4.0

Title: How to call html from jQuery?

Body:
I'm working on a website with data display, user can edit this data. After a user doing so, I want a modal to confirm the change.

I currently doing it with alert function.
But I read somewhere in this forum that we shoud avoid using alert() outside of debuging.
So I looked for a modal exemple in html on the web.
Now I'm wondering how to call this html from jquery. I tried .html() in vain.
Here is my current code, the alert is still work.

function updatedata(id, nom, ) {
        $.ajax({
            // Action
            url: 'admin',
            // Method
            type: 'POST',
            data: {
                // Get value
                id: id,
                nom: nom
            },
            success:function(response){
                console.log("success");
                $("div#myModalEdit").html();
                alert(nom + " à été modifier bdd");
            }
        });
    };

EDIT: Thank you for your answers, I finally followed the suggestion of using toastr


问:
Android Studio apk size weird issue
Ok so this is a weird one.

STEP 1: I'm making a new release for my app so I generate a signed apk from the current state of my git repository and it has a size of 29MB.

STEP 2: I checkout my repository at an earlier commit from 1 year ago. I generate another signed apk which results in a apk size of 21MB because the project had much less code back then.

STEP 3: Then I checkout to the current state of my repository as before and make another signed apk. This time the generated apk has a size of 24MB.

Proguard is enabled in all scenarios I mentioned.

So apk C is 5MB smaller than apk A, even though it is supposed to contain the same code.

This has been happening for a long time. I have updated Android Studio since and still happening. I'm practically "forced" to use this trick in order to upload a smaller apk file and it is really annoying to do this every time I make a new release.

Why is this happening and how can I fix this?

Title: Android Studio apk size weird issue


问:
Which way is the best to add background music in my flutter app?
Can someone tell me what would be the best option to have background music in my app? I am talking about something like when I start the app, music should start as well. I do not know how to get this result, I tried with audioplayer package and something else, but I can not make it work. Do you have any other suggestions? Thank you so much.</p>


问:
how to change vs code theme without changing declarations and font colors?
I want to put the theme "Ayu" enter image description here but without changing the colors of the declarations and the fonts, leaving the vs code default enter image description here.

I tried to edit the themes settings.json file


问:
Using -f option with pip install and conda envrironments
Some dependencies in my requirements.txt require a -f option:

pip install torch -f https://data.pyg.org/whl/torch-1.13.0+cu117.html

How would I use this together with pip install -e .?

How would one use this with a conda environment.yml file?

Thanks,
Bogdan


问:
Why does find.exe truncate its result?
I have an ASCII CSV file containing a looooong line (7956 characters). When I use find.exe to extract that line, it only prints the first 4095 bytes. Plus it appends no line feed, so the next hit (or whatever I add) gets glued to (4095 bytes of) the long line in the result.

When using the /N option, the prepended [<line number>] also counts, so the printed line still is 4095 bytes long (more is truncated).

I assume this is a bug...? Is there any workaround?

Title: Why does find.exe truncate its result?


问:
Spring State Machine fails to autowire persistence Repositories after upgrading project to Spring 3.0
When creating sample project to learn Spring state machine I stumbled upon an error:

```<code>Consider defining a bean of type 'org.springframework.statemachine.data.redis.RedisStateMachineRepository' in your configuration.
</code>```

State machine configuration:

```<code>@EnableStateMachineFactory
@Configuration
@RequiredArgsConstructor
public class PaymentStateMachineConfig extends StateMachineConfigurerAdapter<PaymentStatus, PaymentEvent> {

    private final PaymentActions actions;
    private final PaymentStateMachineListener paymentStateMachineListener;
    private final StateMachineRuntimePersister<PaymentStatus, PaymentEvent, String> stateMachineRuntimePersister;

    @Override
    public void configure(StateMachineConfigurationConfigurer<PaymentStatus, PaymentEvent> config) throws Exception {
        config.withConfiguration().listener(paymentStateMachineListener);
        config.withPersistence().runtimePersister(stateMachineRuntimePersister);
    }

    @Override
    public void configure(StateMachineStateConfigurer<PaymentStatus, PaymentEvent> states) throws Exception {
        states.withStates()
                .initial(PaymentStatus.PENDING)
                .end(PaymentStatus.ACCEPTED)
                .end(PaymentStatus.DENIED)
                .states(EnumSet.allOf(PaymentStatus.class));
    }

    @Override
    public void configure(StateMachineTransitionConfigurer<PaymentStatus, PaymentEvent> transitions) throws Exception {
        transitions
                .withExternal()
                .source(PaymentStatus.PENDING)
                .target(PaymentStatus.AUTHORIZED)
                .event(PaymentEvent.AUTHORIZE)
                .name("PAYMENT STATE MACHINE")
                .action(actions.authorizePayment())
                .and()
                .withExternal()
                .source(PaymentStatus.AUTHORIZED)
                .target(PaymentStatus.ACCEPTED)
                .event(PaymentEvent.ACCEPT)
                .action(actions.acceptPayment());
    }

    @Bean
    public StateMachineService<PaymentStatus, PaymentEvent> stateMachineService(
            final StateMachineFactory<PaymentStatus, PaymentEvent> stateMachineFactory,
            final StateMachineRuntimePersister<PaymentStatus, PaymentEvent, String> stateMachinePersist) {
        return new DefaultStateMachineService<>(stateMachineFactory, stateMachinePersist);
    }
}
</code>```

StateMachinePersister Configuration.

```<code>@Configuration
public class MachinePersister {
    @Bean
    public StateMachineRuntimePersister<PaymentStatus, PaymentEvent, String> stateMachineRuntimePersister(
            RedisStateMachineRepository redisStateMachineRepository) {
        return new RedisPersistingStateMachineInterceptor<>(redisStateMachineRepository);
    }
}
</code>```

After downgrading project to JDK8 everything works fine as it is. Any ideas for a workaround with this one?

Body:
When creating sample project to learn Spring state machine I stumbled upon an error:

Consider defining a bean of type 'org.springframework.statemachine.data.redis.RedisStateMachineRepository' in your configuration.

State machine configuration:

@EnableStateMachineFactory
@Configuration
@RequiredArgsConstructor
public class PaymentStateMachineConfig extends StateMachineConfigurerAdapter<PaymentStatus, PaymentEvent> {

    private final PaymentActions actions;
    private final PaymentStateMachineListener paymentStateMachineListener;
    private final StateMachineRuntimePersister<PaymentStatus, PaymentEvent, String> stateMachineRuntimePersister;

    @Override
    public void configure(StateMachineConfigurationConfigurer<PaymentStatus, PaymentEvent> config) throws Exception {
        config.withConfiguration().listener(paymentStateMachineListener);
        config.withPersistence().runtimePersister(stateMachineRuntimePersister);
    }

    @Override
    public void configure(StateMachineStateConfigurer<PaymentStatus, PaymentEvent> states) throws Exception {
        states.withStates()
                .initial(PaymentStatus.PENDING)
                .end(PaymentStatus.ACCEPTED)
                .end(PaymentStatus.DENIED)
                .states(EnumSet.allOf(PaymentStatus.class));
    }

    @Override
    public void configure(StateMachineTransitionConfigurer<PaymentStatus, PaymentEvent> transitions) throws Exception {
        transitions
                .withExternal()
                .source(PaymentStatus.PENDING)
                .target(PaymentStatus.AUTHORIZED)
                .event(PaymentEvent.AUTHORIZE)
                .name("PAYMENT STATE MACHINE")
                .action(actions.authorizePayment())
                .and()
                .withExternal()
                .source(PaymentStatus.AUTHORIZED)
                .target(PaymentStatus.ACCEPTED)
                .event(PaymentEvent.ACCEPT)
                .action(actions.acceptPayment());
    }

    @Bean
    public StateMachineService<PaymentStatus, PaymentEvent> stateMachineService(
            final StateMachineFactory<PaymentStatus, PaymentEvent> stateMachineFactory,
            final StateMachineRuntimePersister<PaymentStatus, PaymentEvent, String> stateMachinePersist) {
        return new DefaultStateMachineService<>(stateMachineFactory, stateMachinePersist);
    }
}

StateMachinePersister Configuration.

@Configuration
public class MachinePersister {
    @Bean
    public StateMachineRuntimePersister<PaymentStatus, PaymentEvent, String> stateMachineRuntimePersister(
            RedisStateMachineRepository redisStateMachineRepository) {
        return new RedisPersistingStateMachineInterceptor<>(redisStateMachineRepository);
    }
}

After downgrading project to JDK8 everything works fine as it is. Any ideas for a workaround with this one?


问:
Powershell stops working with C# class when it contains a method signature with DateTime dt = default
We have a Powershell API which exposes a C# class to the powershell user. The user can then call methods on the class. Someone has changed the signature of one of the methods in the class to contain 'DateTime dt = default'. Now if you try and call any methods on the class such as $session.GetVersion() you get the following exception:

```<code>The following exception occurred while retrieving member "GetVersion": "Encountered an invalid type for a default value."
At F:\Projects\powershell scripts\parameters.ps1:13 char:1
+ $session.GetVersion()
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
    + FullyQualifiedErrorId : CatchFromBaseGetMember

</code>```

We have unfortunately released the code like this. I am wondering if there is any workaround we could get users to do with the powershell to get this to wok. Is there any way to get powershell to ignore the method with the signature it does not like, or to get powershell not to have a problem with the use of default ?

I am trying to find a workaround to the problem.

Body:
We have a Powershell API which exposes a C# class to the powershell user. The user can then call methods on the class. Someone has changed the signature of one of the methods in the class to contain 'DateTime dt = default'. Now if you try and call any methods on the class such as $session.GetVersion() you get the following exception:

The following exception occurred while retrieving member "GetVersion": "Encountered an invalid type for a default value."
At F:\Projects\powershell scripts\parameters.ps1:13 char:1
+ $session.GetVersion()
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
    + FullyQualifiedErrorId : CatchFromBaseGetMember

We have unfortunately released the code like this. I am wondering if there is any workaround we could get users to do with the powershell to get this to wok. Is there any way to get powershell to ignore the method with the signature it does not like, or to get powershell not to have a problem with the use of default ?

I am trying to find a workaround to the problem.


问:
How to pass the body of a request as a stream to a websocket without corrupting data?
I want to get the request body as a stream and while it's uploading, pass it to a web socket. This is my current implementation:

```<code>        InputStream is = request.getInputStream();
        int total = 0;
        int bytes;
        byte[] buff = new byte[8192];
        while ((bytes = is.read(buff)) != -1) {
            total = total + bytes;
            this.simpMessagingTemplate.convertAndSend("test", Arrays.toString(buff));
        }
        this.simpMessagingTemplate.convertAndSend("test", "END");
</code>```

When sending it now, I'm not sure if the data gets corrupted or duplciated but I can't parse the request. Once the data is sent over, I send END so I know that I can parse the data on the frontend.

Body:
I want to get the request body as a stream and while it's uploading, pass it to a web socket. This is my current implementation:

        InputStream is = request.getInputStream();
        int total = 0;
        int bytes;
        byte[] buff = new byte[8192];
        while ((bytes = is.read(buff)) != -1) {
            total = total + bytes;
            this.simpMessagingTemplate.convertAndSend("test", Arrays.toString(buff));
        }
        this.simpMessagingTemplate.convertAndSend("test", "END");

When sending it now, I'm not sure if the data gets corrupted or duplciated but I can't parse the request. Once the data is sent over, I send END so I know that I can parse the data on the frontend.


问:
Python bamboolib has no attribute plugins
I'm trying to install bamboolib on a virtual env (py 3.6.8) but when I try to import the library on Jupyter lab I get the following error: module 'bamboolib' has no attribute 'plugins'.

```<code>Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\__init__.py", line 85, in <module>
    from bamboolib.wrangler import show
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\wrangler.py", line 81, in <module>
    from bamboolib.views.suggest_string_manipulation import SuggestStringManipulation
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\views\suggest_string_manipulation.py", line 13, in <module>
    from bamboolib.transformation_plugins.string_transformations import (
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\transformation_plugins\__init__.py", line 5, in <module>
    from bamboolib.transformation_plugins.bulk_change_datatype import BulkChangeDatatype
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\transformation_plugins\bulk_change_datatype.py", line 9, in <module>
    from bamboolib.plugins import TransformationPlugin, DF_OLD, DF_NEW, Singleselect, Text
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\plugins\__init__.py", line 6, in <module>
    from bamboolib.plugins._utils import create_plugin_base_class
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\plugins\_utils.py", line 5, in <module>
    import bamboolib.plugins._registry as PluginRegistry
AttributeError: module 'bamboolib' has no attribute 'plugins'
</code>```

Body:
I'm trying to install bamboolib on a virtual env (py 3.6.8) but when I try to import the library on Jupyter lab I get the following error: module 'bamboolib' has no attribute 'plugins'.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\__init__.py", line 85, in <module>
    from bamboolib.wrangler import show
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\wrangler.py", line 81, in <module>
    from bamboolib.views.suggest_string_manipulation import SuggestStringManipulation
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\views\suggest_string_manipulation.py", line 13, in <module>
    from bamboolib.transformation_plugins.string_transformations import (
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\transformation_plugins\__init__.py", line 5, in <module>
    from bamboolib.transformation_plugins.bulk_change_datatype import BulkChangeDatatype
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\transformation_plugins\bulk_change_datatype.py", line 9, in <module>
    from bamboolib.plugins import TransformationPlugin, DF_OLD, DF_NEW, Singleselect, Text
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\plugins\__init__.py", line 6, in <module>
    from bamboolib.plugins._utils import create_plugin_base_class
  File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\plugins\_utils.py", line 5, in <module>
    import bamboolib.plugins._registry as PluginRegistry
AttributeError: module 'bamboolib' has no attribute 'plugins'


问:
Conditional jump or move depends on unitialised value(s) when using strcat
I need to write a program that scans a text file with numbers and strings. I use strtok to separate numbers from strings and than I add the text from file word by word to my string in a structure.

The code works but when i run the program through valgrind it says
==18761== Conditional jump or move depends on uninitialised value(s)
==18761==    at 0x483F4B9: strcat (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==18761==    by 0x109C31: main (lab.c:225)

So here is the code:

```<code>while(fscanf(fi, "%[^\n]\n", str) != EOF)
{
    word = strtok(str, " \n");

    while(word != NULL)
    {
        if((number > 1) && correct)
        {
            len_text += strlen(word);
            text = realloc(text, (len_text +1) * sizeof(char));
            strcat(text, word);

            if(len_text)
            {
                len_text++;
                text = realloc(text, (len_text +1) *sizeof(char));
                strcat(text, " ");
            }
        }

        word = strtok(NULL, " \n");
        number++;
    }

    if(len_text)
    {
        len_text--;
        text = realloc(text, (len_text + 1) * sizeof(char));
        text[len_text] = '\0';
    }
    else
    {
        correct = 0;
    }

    if (correct)
    {
        list = realloc(list, (len_list+1) * sizeof(Note));
        (list[len_list]).id = id;
        (list[len_list]).level = level;
        (list[len_list]).text = text;
        len_list++;
    }
    text = NULL;
    len_text = 0;
    correct = 1;
    number = 0;
}
</code>```

Body:
I need to write a program that scans a text file with numbers and strings. I use strtok to separate numbers from strings and than I add the text from file word by word to my string in a structure.

The code works but when i run the program through valgrind it says
==18761== Conditional jump or move depends on uninitialised value(s)
==18761==    at 0x483F4B9: strcat (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==18761==    by 0x109C31: main (lab.c:225)

So here is the code:

while(fscanf(fi, "%[^\n]\n", str) != EOF)
{
    word = strtok(str, " \n");

    while(word != NULL)
    {
        if((number > 1) && correct)
        {
            len_text += strlen(word);
            text = realloc(text, (len_text +1) * sizeof(char));
            strcat(text, word);

            if(len_text)
            {
                len_text++;
                text = realloc(text, (len_text +1) *sizeof(char));
                strcat(text, " ");
            }
        }

        word = strtok(NULL, " \n");
        number++;
    }

    if(len_text)
    {
        len_text--;
        text = realloc(text, (len_text + 1) * sizeof(char));
        text[len_text] = '\0';
    }
    else
    {
        correct = 0;
    }

    if (correct)
    {
        list = realloc(list, (len_list+1) * sizeof(Note));
        (list[len_list]).id = id;
        (list[len_list]).level = level;
        (list[len_list]).text = text;
        len_list++;
    }
    text = NULL;
    len_text = 0;
    correct = 1;
    number = 0;
}


问:
akka http dockerized curl connection reset by peer
I have a problem with connecting by curl to simple akka http server living in docker container.

Here is source code:

```<code>sbt new akka/akka-http-quickstart-scala.g8
</code>```

added sbt native packager plugin to plugins.sbt

```<code>addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")
</code>```

and small change in build.sbt at the end:

```<code>  libraryDependencies ++= Seq(
      ...
    ),
    dockerExposedPorts := Seq(8080)
  )
  .enablePlugins(JavaAppPackaging, DockerPlugin)
</code>```

so docker exposed ports and enable plugins.
If I will run it with network host like:

docker run --network host image-name:0.1
it work fine, but without network host or -p 8080:8080 or without does not work,
every time I get

curl: (56) Recv failure: Connection reset by peer

can it be smth connected with interface param ?

```<code>Http().newServerAt("localhost", 8080).bind(routes)
</code>```

Body:
I have a problem with connecting by curl to simple akka http server living in docker container.

Here is source code:

sbt new akka/akka-http-quickstart-scala.g8

added sbt native packager plugin to plugins.sbt

addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")

and small change in build.sbt at the end:

  libraryDependencies ++= Seq(
      ...
    ),
    dockerExposedPorts := Seq(8080)
  )
  .enablePlugins(JavaAppPackaging, DockerPlugin)

so docker exposed ports and enable plugins.
If I will run it with network host like:

docker run --network host image-name:0.1
it work fine, but without network host or -p 8080:8080 or without does not work,
every time I get

curl: (56) Recv failure: Connection reset by peer

can it be smth connected with interface param ?

Http().newServerAt("localhost", 8080).bind(routes)


问:
Type assignation problem in TypeScript (Argument type is not assignable to parameter of type)
I've found an interesting Angular 5 project on Github and I'd like to make it work in Angular 14 (I'm using Angular since 1 month, I'm currently learning). Now, since doing it via npm seems a little bit tricky (and I don't even know if it is possible to achieve a good result with it), I was trying to create a new Angular 14 project with all the components and scripts from the code of the repository, and then updating the syntax from 5 to 14.

I "think" that I'm doing it correctly, but I've got an error that I don't really understand. It says:

```<code>Argument of type 'WorkflowNode | WorkflowConnection' is not assignable to parameter of type 'WorkflowNode & WorkflowConnection'.
Type 'WorkflowNode' is not assignable to type 'WorkflowNode & WorkflowConnection'.
    Type 'WorkflowNode' is missing the following properties from type 'WorkflowConnection': from, to
</code>```

Here's the code where I have the problem

```<code>getClickEvent(e: WorkflowConnection | WorkflowNode) {
        if (e.click) {
            return e.click(e); // parameter 'e' is the error
        }
        return () => {};
    }
</code>```

Here's WorkflowNode:

```<code>export class WorkflowNode {
    id?: number | string;
    title: string;
    x?: number;
    y?: number;
    click?: (WorkflowNode: WorkflowNode) => void;

    constructor(title: string, id: number | string = '', x? : number, y?: number) {
        this.title = title;
        this.id = id
        this.x = x;
        this.y = y;
    }

}
</code>```

And here's the WorkflowConnection:

```<code>export class WorkflowConnection {
    from!: WorkflowNode;
    to!: WorkflowNode;
    title?: string;
    fromSide?: 'top' | 'left' | 'bottom' | 'right' = 'right';
    toSide?: 'top' | 'left' | 'bottom' | 'right' = 'left';
    color?: string;
    click?: (Connection: WorkflowConnection) => void;
}
</code>```

Can someone help me understand this message? As I told at the beginning, I found it on Github, I'm not the creator of the repository. I'm just trying to understand if there's a way to make it work with Angular 14. Thanks!

Body:
I've found an interesting Angular 5 project on Github and I'd like to make it work in Angular 14 (I'm using Angular since 1 month, I'm currently learning). Now, since doing it via npm seems a little bit tricky (and I don't even know if it is possible to achieve a good result with it), I was trying to create a new Angular 14 project with all the components and scripts from the code of the repository, and then updating the syntax from 5 to 14.

I "think" that I'm doing it correctly, but I've got an error that I don't really understand. It says:

Argument of type 'WorkflowNode | WorkflowConnection' is not assignable to parameter of type 'WorkflowNode & WorkflowConnection'.
Type 'WorkflowNode' is not assignable to type 'WorkflowNode & WorkflowConnection'.
    Type 'WorkflowNode' is missing the following properties from type 'WorkflowConnection': from, to

Here's the code where I have the problem

getClickEvent(e: WorkflowConnection | WorkflowNode) {
        if (e.click) {
            return e.click(e); // parameter 'e' is the error
        }
        return () => {};
    }

Here's WorkflowNode:

export class WorkflowNode {
    id?: number | string;
    title: string;
    x?: number;
    y?: number;
    click?: (WorkflowNode: WorkflowNode) => void;

    constructor(title: string, id: number | string = '', x? : number, y?: number) {
        this.title = title;
        this.id = id
        this.x = x;
        this.y = y;
    }

}

And here's the WorkflowConnection:

export class WorkflowConnection {
    from!: WorkflowNode;
    to!: WorkflowNode;
    title?: string;
    fromSide?: 'top' | 'left' | 'bottom' | 'right' = 'right';
    toSide?: 'top' | 'left' | 'bottom' | 'right' = 'left';
    color?: string;
    click?: (Connection: WorkflowConnection) => void;
}

Can someone help me understand this message? As I told at the beginning, I found it on Github, I'm not the creator of the repository. I'm just trying to understand if there's a way to make it work with Angular 14. Thanks!


问:
How to export and import dotnet dev-certs correctly?
I tried to create, export and then import .NET 7 developer certificates but it seems this does not work in a straightforward way. So, it occurred to me to turn to a collective brain.

Here is what I did

dotnet dev-certs https --trust --check

[No valid cerficicate found.]

dotnet dev-certs https --trust

Successfully created and trusted a new HTTPS certificate.

At this point I can check with certmgr.msc that there's a certificate in "My"/CurrentUser (pfx) and the same one in "Root"/LocalMachine (cer).

Then if I

dotnet dev-certs --clean

HTTPS development certificates successfully removed from the machine.

dotnet dev-certs https --trust --check

No valid cerficicate found.]

Now, if I use certmgr.msc to import the certificates again and then

dotnet dev-certs https --trust --check

No valid cerficicate found.

This feels very unexpected, I would assume there is a trusted certificate in place.

It's the same situation even if I do dotnet dev-certs https --export-path "dev-cert.pfx --password "somepassword" and then try to import this certificate.

What I actually tried to do initially was to set a developer certificate in Azure DevOps. But it so happens dotnet dev-certs --trust requires an interactive prompt by the Windows Server OS and so won't work. Hence trying to just import a certificate created elsewhere.

I also tried to consume the pfx certificate via appsettings.json:Kestrel:HttpsInlineCertFile does not seem to work. So it looks like there's something either with export or re-import of a certificate created with dotnet dev-certs https --trust, but can't put a finger into it.


问:
Wordpress - Double authors names but no duplicate accounts
Hi I recently imported blog posts in my existing Wordpress installation.
Once the blogs where imported, I noticed the authors started appearing twice : https://roulezelectrique.com/blogue.

It is not the plugin that I'm using that is acting up.

I then checked out if I can attribute these newly imported blogs to the original author's name directly in Wordpress admin area and found that all the names are appearing twice in that selector as well. I then checked to see if the accounts appeared twice but, only one account per author.

Screenshot of list of duplicate authors

How is this so? And how can I fix it. I have access to the database but just can't find the relation of where this is stored. I also check the database's posts in wp_posts and the post_author ID seems to be attributed to the correct authors. in my case 11, 38, etc.. So no wrong ID's there too.


问:
GitLabCI deploy to one of x environments
We have a pretty big CI Pipeline including E2E Tests. We currently cannot use the GitLab feature of deploying to dynamic environments, because there is currently still manual work necessary for creating an environment. Therefore all e2e tests run against a single "E2E stage". I would like to add more E2E stages manually.
But here is the problem:
How can I deploy to one (currently unused) E2E stage, run the tests (in a different GitLabCI job) and lock the stage for other tests during that time?

I tried using three special runners with different tags ( ["e2e", "e2e-1"], ["e2e", "e2e-2"], ["e2e", "e2e-3"] ), but I could not tell GitLab to run all jobs of a pipeline on one of these runners (chosen randomly or even better which one is currently free) only. If I start the deployment on "e2e-3" and after that "e2e-1" is free for testing, it might choose that one, which then will not have the correct artifact deployed.


问:
Localizing Identity Server Razor pages and messages
I am developing a Blazor hosted WASM app with individual accounts, that by default uses Duende Identity Server. It works, but all the account management pages and messages are in English when I need them to be in French (I don't need a multilanguage version).

I found that to translate them, I can add the scaffolded Razor pages to the server project.
Now, I can translate the texts in the generated pages, but that brings a few questions:

Has anyone (Microsoft?) already done that quite standard localization work? Would it be available to use?

Texts to be translated are located in different locations: inline in the HTML, in data annotations... it's not easy to not forget any of them.

Some messages (i.e. "You are logged out") seem to be buried into the DLLs, so I didn't find how to translate them.

I couldn't find many resources on the subject on the Internet, so any hints would be much appreciated.


问:
Spring component returning list from previous run
I have a spring component which looks like this. It has other beans auto-wired to it. And these components are returned as a list by the method getConfigurators(String Id)

```<code>@Component
public class Configuration{

    @Autowired
    private  Config Config1;
    @Autowired
    private  Config Config2;

    @Override
    public List<Config> getConfigurators(String Id) {
        return List.of(
                Config1,
                Config2);
       }
     }
</code>```

When I run the application the first time, I get everything correct for getConfigurators(String Id). The subsequent runs, I get the values populated by the first run. I want that every time I run the application, the list is not pre populated with the config values from before.

The Config class looks like this

```<code>@Component
public class Config1 implements Config {
 final List errors = new ArrayList<>();
   @Override
    public List<> validate() {
        boolean isValid // some logic
        if (!isValid) {
            errors.add("Some error");
        }
        return errors;
    }
}
</code>```

Body:
I have a spring component which looks like this. It has other beans auto-wired to it. And these components are returned as a list by the method getConfigurators(String Id)

@Component
public class Configuration{

    @Autowired
    private  Config Config1;
    @Autowired
    private  Config Config2;

    @Override
    public List<Config> getConfigurators(String Id) {
        return List.of(
                Config1,
                Config2);
       }
     }

When I run the application the first time, I get everything correct for getConfigurators(String Id). The subsequent runs, I get the values populated by the first run. I want that every time I run the application, the list is not pre populated with the config values from before.

The Config class looks like this

@Component
public class Config1 implements Config {
 final List errors = new ArrayList<>();
   @Override
    public List<> validate() {
        boolean isValid // some logic
        if (!isValid) {
            errors.add("Some error");
        }
        return errors;
    }
}


问:
Upload image to server using expo-file-system
In a react native app, I am following the documentation of expo-file-system to upload an image from the gallery of my phone and send it to a node.js server that uses multer to process the file. Unfortunately, I am having the following error when I send the http request:

```<code>Possible Unhandled Promise Rejection (id: 1):
Error: Failed to connect to localhost/127.0.0.1:3000
</code>```

I know that the server is working because I have tested it with the same client but using axios and fetch to send the request and it reached the server.

This is the code that I am using in the client side:

```<code>//.env
URL =  'http://localhost:3000/api/upload'
</code>```
```<code>//uploadImage.js
import React, { useState } from "react";
import { View, Button, Image, StyleSheet } from "react-native";
import * as ImagePicker from 'expo-image-picker'
import * as FileSystem from 'expo-file-system';
import {URL} from "@env"

const ImageUpload = ()=>{

   const [image, setImage] = useState('')
   const [name, setName] = useState('')
   const [type,  setType] = useState('')

    const openImageLibrary = async()=>{
    let result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.Images,
        allowsEditing: true,
        aspect: [4, 3],
        quality: 1,
      });

      console.log('this is the result',result);

      if (!result.canceled) {
        const uri = result.assets[0].uri
        const filename = uri.split('/').pop();
        const match = /\.(\w+)$/.exec(filename);
        const imageType = match ? `image/${match[1]}` : `image`;
        setImage(uri);
        setName(filename)
        setType(imageType)

      }
   }
   const sendPictureToServer = async()=>{

    const response = await FileSystem.uploadAsync(URL ,image,{
        fieldName: 'photo',
        httpMethod: 'POST',
        uploadType: FileSystem.FileSystemUploadType.BINARY_CONTENT,

    })

   }
    return(
        <View>

                <Button title = 'select' onPress={openImageLibrary}/>
                <Button title='send' onPress={sendPictureToServer}/>

        </View>
    )
}

</code>```

This is the node.js server

```<code>//index.js
const Express = require('express')
const multer = require('multer')
const bodyParser = require('body-parser')

const app = Express()
app.use(bodyParser.json())

const upload = multer({  dest: 'uploads/' } )

app.get('/', (req, res) => {
  res.status(200).send('You can post to /api/upload.')
})

app.post('/api/upload', upload.single('photo'), (req, res) => {
  console.log('file', req.file)
  console.log('body', req.body)
  res.status(200).json({
    message: 'success!',
  })
})

app.listen(3000, () => {
  console.log('App running on http://localhost:3000')
})
</code>```

Body:
In a react native app, I am following the documentation of expo-file-system to upload an image from the gallery of my phone and send it to a node.js server that uses multer to process the file. Unfortunately, I am having the following error when I send the http request:

Possible Unhandled Promise Rejection (id: 1):
Error: Failed to connect to localhost/127.0.0.1:3000

I know that the server is working because I have tested it with the same client but using axios and fetch to send the request and it reached the server.

This is the code that I am using in the client side:

//.env
URL =  'http://localhost:3000/api/upload'

//uploadImage.js
import React, { useState } from "react";
import { View, Button, Image, StyleSheet } from "react-native";
import * as ImagePicker from 'expo-image-picker'
import * as FileSystem from 'expo-file-system';
import {URL} from "@env"

const ImageUpload = ()=>{

   const [image, setImage] = useState('')
   const [name, setName] = useState('')
   const [type,  setType] = useState('')

    const openImageLibrary = async()=>{
    let result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.Images,
        allowsEditing: true,
        aspect: [4, 3],
        quality: 1,
      });

      console.log('this is the result',result);

      if (!result.canceled) {
        const uri = result.assets[0].uri
        const filename = uri.split('/').pop();
        const match = /\.(\w+)$/.exec(filename);
        const imageType = match ? `image/${match[1]}` : `image`;
        setImage(uri);
        setName(filename)
        setType(imageType)

      }
   }
   const sendPictureToServer = async()=>{

    const response = await FileSystem.uploadAsync(URL ,image,{
        fieldName: 'photo',
        httpMethod: 'POST',
        uploadType: FileSystem.FileSystemUploadType.BINARY_CONTENT,

    })

   }
    return(
        <View>

                <Button title = 'select' onPress={openImageLibrary}/>
                <Button title='send' onPress={sendPictureToServer}/>

        </View>
    )
}

This is the node.js server

//index.js
const Express = require('express')
const multer = require('multer')
const bodyParser = require('body-parser')

const app = Express()
app.use(bodyParser.json())

const upload = multer({  dest: 'uploads/' } )

app.get('/', (req, res) => {
  res.status(200).send('You can post to /api/upload.')
})

app.post('/api/upload', upload.single('photo'), (req, res) => {
  console.log('file', req.file)
  console.log('body', req.body)
  res.status(200).json({
    message: 'success!',
  })
})

app.listen(3000, () => {
  console.log('App running on http://localhost:3000')
})


问:
UnsatisfiableError with anaconda for hicexplorer
I am getting this error when I try to install hicexplorer and I am not sure whats going wrong here. This is my first time getting this error.


问:
Waveshare LCD1602 display scrolling text on Raspberry Pi
I'm trying to scroll text on the Waveshare LCD1602 display (16x2).
I've uploaded the LCD1602 library here for reference

I notice that it has command addresses for the following

#flags for display entry mode
LCD_ENTRYRIGHT = 0x00
LCD_ENTRYLEFT = 0x02
LCD_ENTRYSHIFTINCREMENT = 0x01
LCD_ENTRYSHIFTDECREMENT = 0x00

#flags for display/cursor shift
LCD_DISPLAYMOVE = 0x08
LCD_CURSORMOVE = 0x00
LCD_MOVERIGHT = 0x04
LCD_MOVELEFT = 0x00
```
<p>What I'm struggling with is if I have characters at positions <code>0,15</code> and <code>1,15</code>, how do I scroll this to the left?</p>
<p>What I'm aiming for is the characters to scroll to the left, in the hope of simply outputting a large piece of text per line and scrolling it.</p>
<p>What I've written</p>
<pre class="lang-py prettyprint-override"><code>import RGB1602
import Rpi.GPIO as GPIO
import time

lcd = RGB1602.RGB1602(16,2)

# SET COLOURS...

lcd.clear()
lcd.setCursor(0,0)
lcd.printout("      abc")
time.sleep(1)
lcd.command(0x04) # also tried 0x00
</code>```

The "abc" does not move to the left, and finding documentation for this has only come up with the Ardiuino examples, not the Pi or Pico examples

Body:
I'm trying to scroll text on the Waveshare LCD1602 display (16x2).
I've uploaded the LCD1602 library here for reference

I notice that it has command addresses for the following

#flags for display entry mode
LCD_ENTRYRIGHT = 0x00
LCD_ENTRYLEFT = 0x02
LCD_ENTRYSHIFTINCREMENT = 0x01
LCD_ENTRYSHIFTDECREMENT = 0x00

#flags for display/cursor shift
LCD_DISPLAYMOVE = 0x08
LCD_CURSORMOVE = 0x00
LCD_MOVERIGHT = 0x04
LCD_MOVELEFT = 0x00

What I'm struggling with is if I have characters at positions 0,15 and 1,15, how do I scroll this to the left?

What I'm aiming for is the characters to scroll to the left, in the hope of simply outputting a large piece of text per line and scrolling it.

What I've written

import RGB1602
import Rpi.GPIO as GPIO
import time

lcd = RGB1602.RGB1602(16,2)

# SET COLOURS...

lcd.clear()
lcd.setCursor(0,0)
lcd.printout("      abc")
time.sleep(1)
lcd.command(0x04) # also tried 0x00

The "abc" does not move to the left, and finding documentation for this has only come up with the Ardiuino examples, not the Pi or Pico examples


问:
Big text are being cut at bottom portion of tabbed activity in android
I am using android tabbed activity but, last few lines of big text are being cut at bottom portion of tabbed activity in android.

This is the "activity_main.xml" file:-

```<code><?xml version="1.0" encoding="utf-8"?>

<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/Theme.BhagavadGitaUI.AppBarOverlay">

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:minHeight="?actionBarSize"
            android:padding="@dimen/appbar_padding"
            android:text="@string/app_name"
            android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" />

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:tabMode="scrollable" />

    </com.google.android.material.appbar.AppBarLayout>

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <!--<com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/fab_margin"
        android:layout_marginBottom="16dp"
        app:srcCompat="@android:drawable/ic_dialog_email" />-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</code>```

This is the "fragment_main.xml" file:-

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/constraintLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.main.PlaceholderFragment">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <LinearLayout
            android:layout_height="fill_parent"
            android:layout_width="fill_parent"
            android:orientation="vertical">

        <TextView
        android:id="@+id/section_label"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginStart="0dp"
        android:layout_marginTop="0dp"
        android:layout_marginEnd="0dp"
        android:layout_marginBottom="0dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="@+id/constraintLayout"
        tools:layout_constraintLeft_creator="0"
        tools:layout_constraintTop_creator="0" />

        </LinearLayout>

    </ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

I am putting text/string directly in the java file and last 1 line is not visible.

Please let me know where the issue is and oblige me thereby.

Thanks.

Body:
I am using android tabbed activity but, last few lines of big text are being cut at bottom portion of tabbed activity in android.

This is the "activity_main.xml" file:-

<?xml version="1.0" encoding="utf-8"?>

<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/Theme.BhagavadGitaUI.AppBarOverlay">

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:minHeight="?actionBarSize"
            android:padding="@dimen/appbar_padding"
            android:text="@string/app_name"
            android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" />

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:tabMode="scrollable" />

    </com.google.android.material.appbar.AppBarLayout>

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

This is the "fragment_main.xml" file:-

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/constraintLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.main.PlaceholderFragment">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <LinearLayout
            android:layout_height="fill_parent"
            android:layout_width="fill_parent"
            android:orientation="vertical">

        <TextView
        android:id="@+id/section_label"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginStart="0dp"
        android:layout_marginTop="0dp"
        android:layout_marginEnd="0dp"
        android:layout_marginBottom="0dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="@+id/constraintLayout"
        tools:layout_constraintLeft_creator="0"
        tools:layout_constraintTop_creator="0" />

        </LinearLayout>

    </ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>

I am putting text/string directly in the java file and last 1 line is not visible.

Please let me know where the issue is and oblige me thereby.

Thanks.


问:
How to create a test that detect if the page was refreshed?
I want to create a test in ruby that refresh the page and also check if it was refreshed.

it 'Refreshing the page' do
  visit current_path
end
```

how to make the assertion of this?

Body:
I want to create a test in ruby that refresh the page and also check if it was refreshed.

it 'Refreshing the page' do
  visit current_path
end

how to make the assertion of this?


问:
For loop to overwrite a value inside a column - R
I'm currently working on my uni project and I'm trying to prepare my data.
I added a new column to store the name of the group where sorted elements belong.
I have given it a default value of NA, now I am trying to overwrite it using a for loop so that it displays a proper name of each element's group.
I've been trying to change my loops multiple times and see what could work, but nothing seems to - the output I get doesn't change and the value of the group remains NA.
Here's my code:

```<code>dane2<-dane[,-c(3,4,6,7,8,9,10,11,12,13,14)]
Grupa<-NA
dane2<-cbind(dane2, Grupa)

</code>```
```<code>k1<-kob1chol[sample(nrow(kob1chol), 15),]
  for (i in k1){
    Grupa[dane2$Grupa] <- "K1"
  }
k2<-kob2chol[sample(nrow(kob2chol), 15),]
  for (i in k2){
    Grupa[dane2$Grupa] <- "K2"
  }
m1<-mez1chol[sample(nrow(mez1chol), 15),]
  for (i in m1){
    dane2$Grupa[dane2$Grupa] <- "M1"
  }
m2<-mez2chol[sample(nrow(mez2chol), 15),]
  for (i in m2){
    dane2$Grupa[dane2$Grupa] <- "M2"
  }

</code>```

And here's a sample of my output:
(https://i.stack.imgur.com/VrR0O.png)

I'd be grateful for all advice, thank you in advance!

Change the NA value to the name of the group (K1, K2, M1, M2)

Body:
I'm currently working on my uni project and I'm trying to prepare my data.
I added a new column to store the name of the group where sorted elements belong.
I have given it a default value of NA, now I am trying to overwrite it using a for loop so that it displays a proper name of each element's group.
I've been trying to change my loops multiple times and see what could work, but nothing seems to - the output I get doesn't change and the value of the group remains NA.
Here's my code:

dane2<-dane[,-c(3,4,6,7,8,9,10,11,12,13,14)]
Grupa<-NA
dane2<-cbind(dane2, Grupa)

k1<-kob1chol[sample(nrow(kob1chol), 15),]
  for (i in k1){
    Grupa[dane2$Grupa] <- "K1"
  }
k2<-kob2chol[sample(nrow(kob2chol), 15),]
  for (i in k2){
    Grupa[dane2$Grupa] <- "K2"
  }
m1<-mez1chol[sample(nrow(mez1chol), 15),]
  for (i in m1){
    dane2$Grupa[dane2$Grupa] <- "M1"
  }
m2<-mez2chol[sample(nrow(mez2chol), 15),]
  for (i in m2){
    dane2$Grupa[dane2$Grupa] <- "M2"
  }

And here's a sample of my output:
(https://i.stack.imgur.com/VrR0O.png)

I'd be grateful for all advice, thank you in advance!

Change the NA value to the name of the group (K1, K2, M1, M2)


问:
Is it possible to find previous machine type used by a GCP VM instance after changing to a different machine type?
In GCP Compute Engine, after changing a VM's machine type from for example, from e2-medium-2 to e2-standard-4, is there a way to list exactly when the machine type was changed from which type to which type.

Maybe if there is some kind of way to list the change events that would be helpful for audit purposes.

Thank you

I tried to check in the gcloud command interface and cloud logging but unable find machine type update events.


问:
Tree to Array in Javascript - 2x difference in performance between spread (...) and generator based syntax
What causes the difference in performance between these two implementations of pre-order traversal?

So I wanted to practice some functional programming in JavaScript and to create some functions that can operate on trees. I checked a bunch of articles abut it, and it seems that functional programming is not the way to go in JavaScript and that for loops and other imperative functionalities are quite common. I wanted to test which way of traversing a tree would be faster - the functional one based on spread syntax or the one based on yield. It seems that the spread syntax based is much faster - it's roughly twice as fast as the one based on yield! Also, it has quite a lot of variance, while the

I got this code from being as slow as 700op/s and as fast as 1500 op/s while the yield based implementation is stable around 400 op/s.

Here is the code:

class BinaryTreeNode {
  constructor(key, value = key, parent = null) {
    this.key = key;
    this.value = value;
    this.parent = parent;
    this.left = null;
    this.right = null;
  }

  get isLeaf() {
    return this.left === null && this.right === null;
  }

  get hasChildren() {
    return !this.isLeaf;
  }
}

class BinaryTree {
  constructor(key, value = key) {
    this.root = new BinaryTreeNode(key, value);
  }

  seql(node = this.root) {
    return [
      node,
      ...(node.left ? this.seql(node.left) : []),
      ...(node.right ? this.seql(node.right) : []),
    ];
  }

  *preOrderTraversal(node = this.root) {
    yield node;
    if (node.left) yield* this.preOrderTraversal(node.left);
    if (node.right) yield* this.preOrderTraversal(node.right);
  }

  fill() {
    for (let node of this.seql()) {
      if (node.left === null) {
        node.left = new BinaryTreeNode(Math.random(), Math.random(), node);
      }
      if (node.right === null) {
        node.right = new BinaryTreeNode(Math.random(), Math.random(), node);
      }
    }
  }
}

let i = 1;
const tree = new BinaryTree(Math.random, Math.random());
while (i < 13) {
  tree.fill();
  i++;
}

const test = () => {
  [...tree.preOrderTraversal()];
  //[...tree.seql()];
};

const iterationsC = 50;
const main = async () => {
  const runBaseline = (iterations = iterationsC) => {
    let startTime = new Date().getTime();
    for (let i = 0; i < iterations; i++) {
      // no operation
    }
    let endTime = new Date().getTime();
    return endTime - startTime;
  };

  const runTest = (iterations = iterationsC) => {
    let startTime = new Date().getTime();

    for (let i = 0; i < iterations; i++) test();

    let endTime = new Date().getTime();
    let baselineTime = runBaseline(iterations);
    let totalTime = endTime - startTime - baselineTime;
    let fnTime = (totalTime / iterations).toFixed(10);
    let operations = Math.floor((1000 / totalTime) * iterations);

    console.log(`total: ${totalTime}, time: ${fnTime}, op/sec: ${operations}`);
  };

  while (true) {
    runTest();
    await sleep(50);
  }

  function sleep(ms) {
    return new Promise((resolve) => setTimeout(resolve, ms));
  }
};

main();
```

The code for the binary tree comes from 30 seconds blog and is licensed under CC 4.0 and the code from benchmarking comes from this blogpost.

This is a massive difference. What can be the cause of that?

Body:
What causes the difference in performance between these two implementations of pre-order traversal?

So I wanted to practice some functional programming in JavaScript and to create some functions that can operate on trees. I checked a bunch of articles abut it, and it seems that functional programming is not the way to go in JavaScript and that for loops and other imperative functionalities are quite common. I wanted to test which way of traversing a tree would be faster - the functional one based on spread syntax or the one based on yield. It seems that the spread syntax based is much faster - it's roughly twice as fast as the one based on yield! Also, it has quite a lot of variance, while the

I got this code from being as slow as 700op/s and as fast as 1500 op/s while the yield based implementation is stable around 400 op/s.

Here is the code:

class BinaryTreeNode {
  constructor(key, value = key, parent = null) {
    this.key = key;
    this.value = value;
    this.parent = parent;
    this.left = null;
    this.right = null;
  }

  get isLeaf() {
    return this.left === null && this.right === null;
  }

  get hasChildren() {
    return !this.isLeaf;
  }
}

class BinaryTree {
  constructor(key, value = key) {
    this.root = new BinaryTreeNode(key, value);
  }

  seql(node = this.root) {
    return [
      node,
      ...(node.left ? this.seql(node.left) : []),
      ...(node.right ? this.seql(node.right) : []),
    ];
  }

  *preOrderTraversal(node = this.root) {
    yield node;
    if (node.left) yield* this.preOrderTraversal(node.left);
    if (node.right) yield* this.preOrderTraversal(node.right);
  }

  fill() {
    for (let node of this.seql()) {
      if (node.left === null) {
        node.left = new BinaryTreeNode(Math.random(), Math.random(), node);
      }
      if (node.right === null) {
        node.right = new BinaryTreeNode(Math.random(), Math.random(), node);
      }
    }
  }
}

let i = 1;
const tree = new BinaryTree(Math.random, Math.random());
while (i < 13) {
  tree.fill();
  i++;
}

const test = () => {
  [...tree.preOrderTraversal()];
  //[...tree.seql()];
};

const iterationsC = 50;
const main = async () => {
  const runBaseline = (iterations = iterationsC) => {
    let startTime = new Date().getTime();
    for (let i = 0; i < iterations; i++) {
      // no operation
    }
    let endTime = new Date().getTime();
    return endTime - startTime;
  };

  const runTest = (iterations = iterationsC) => {
    let startTime = new Date().getTime();

    for (let i = 0; i < iterations; i++) test();

    let endTime = new Date().getTime();
    let baselineTime = runBaseline(iterations);
    let totalTime = endTime - startTime - baselineTime;
    let fnTime = (totalTime / iterations).toFixed(10);
    let operations = Math.floor((1000 / totalTime) * iterations);

    console.log(`total: ${totalTime}, time: ${fnTime}, op/sec: ${operations}`);
  };

  while (true) {
    runTest();
    await sleep(50);
  }

  function sleep(ms) {
    return new Promise((resolve) => setTimeout(resolve, ms));
  }
};

main();

The code for the binary tree comes from 30 seconds blog and is licensed under CC 4.0 and the code from benchmarking comes from this blogpost.

This is a massive difference. What can be the cause of that?


问:
how to split a word after special character
How do I make it so that the string stays constrained to the width of 150, and wraps to a new line on the hyphen?

div {
  width: 150px;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div>
  12333-2333-233-23339392-332332323
</div></code>```

Body:
How do I make it so that the string stays constrained to the width of 150, and wraps to a new line on the hyphen?

div {
  width: 150px;
}

  12333-2333-233-23339392-332332323


问:
Python How to convert pdf to jpg(pdf2jpg) without '[WinError 2] The system cannot find the file specified'?
I am trying to convert pdf file to jpg, but the error happens. I can open that pdf file using 'os' module, but '[WinError 2] The system cannot find the file specified' happend if i using pdf2jpg module.</p>
```<code>Here is the code.

import win32com.client as win32
import os
import fnmatch
import pandas as pd
from pdf2jpg import pdf2jpg

def pdfToJpg():

    pdf2jpg.convert_pdf2jpg(r"C:\Users\user\Desktop\pythonProject\pot.pdf", r"C:\Users\user\Desktop\pythonProject\pott.jpg", dpi = 300, pages ='1')

pdfToJpg()

Here is the Output.

[WinError 2] The system cannot find the file specified
</code>```

Body:
I am trying to convert pdf file to jpg, but the error happens. I can open that pdf file using 'os' module, but '[WinError 2] The system cannot find the file specified' happend if i using pdf2jpg module.

Here is the code.

import win32com.client as win32
import os
import fnmatch
import pandas as pd
from pdf2jpg import pdf2jpg

def pdfToJpg():

    pdf2jpg.convert_pdf2jpg(r"C:\Users\user\Desktop\pythonProject\pot.pdf", r"C:\Users\user\Desktop\pythonProject\pott.jpg", dpi = 300, pages ='1')

pdfToJpg()

Here is the Output.

[WinError 2] The system cannot find the file specified


问:
Is setting the DataSource property of two combo boxes in one line known to cause issues?
The following line of code seems to be causing a bug

comboBoxLunch1.DataSource = comboBoxLunch2.DataSource = GrabLunchFromSQL();
```
<p>replacing it with the following removes the bug</p>
<pre class="lang-cs prettyprint-override"><code>comboBoxLunch1.DataSource = GrabLunchFromSQL();
comboBoxLunch2.DataSource = GrabLunchFromSQL();
</code>```

Said bug is that changing the selected item in one combo box will change it in another. Is this a known issue with a known explanation? Nothing in the documentation for DataSource suggests such an issue to me and I don't see why the choice of data source would relate to how the entries are stored in memory.

Body:
The following line of code seems to be causing a bug

comboBoxLunch1.DataSource = comboBoxLunch2.DataSource = GrabLunchFromSQL();

replacing it with the following removes the bug

comboBoxLunch1.DataSource = GrabLunchFromSQL();
comboBoxLunch2.DataSource = GrabLunchFromSQL();

Said bug is that changing the selected item in one combo box will change it in another. Is this a known issue with a known explanation? Nothing in the documentation for DataSource suggests such an issue to me and I don't see why the choice of data source would relate to how the entries are stored in memory.


问:
Successful Export (SQL Server Import and Export Wizard) but No Data on Database
I am looking for help with exporting data to the SQL server database.

I export CSV to the SQL server DB and despite the transfer is successful no data appears on the server Database. I am unable to find the cause of the issue.

I am using Export and Import Wizzard via SSIS in Visual Studio. I do not want to create a new table but import data from CSV to the existing table.

The table had the data previously but I cleared it with DELETE command epic00

The CSV file is on the local machine (C drive)

Data type: single-byte signed integer pic1

Checked Enable Identity insert pic2

Rows and columns seem to be OK pic3

SECESFULL pic4

BUT NO DATA IN THE TABLE pic5

I can't use this wizard in Microsoft SQL Server Management Studio due to the differences between 64-bit PC and 32-bit program

I can't use the SQL server developer because of the errors during the installation and I can't resolve it now

I tried to use the bulk insert task in Visual Studio but I got errors

What I want? Export the data from csv file to existing table on SQL server database.
Do you have an idea what I should check?

I had some errors when I tried to export CSV to SQL server database before:

```<code>- Validating (Error)
    Messages
    * Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "ParameterSet".
     (SQL Server Import and Export Wizard)

    * Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
     (SQL Server Import and Export Wizard)

    * Error 0xc004706b: Data Flow Task 1: "Destination - inputParameters" failed validation and returned validation status "VS_ISBROKEN".
     (SQL Server Import and Export Wizard)

    * Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
     (SQL Server Import and Export Wizard)

    * Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
     (SQL Server Import and Export Wizard)

    Error: 0xC002F304 at Bulk Insert Task, Bulk Insert Task: An error occurred with the following error message: "Cannot bulk load because the file " could not be opened. Operating system error code (null).".

</code>```

But once I changed the type of the data (DataType) to single-byte signed integer and made sure that is ticked Enable Identity insert the errors did not appear again.

Body:
I am looking for help with exporting data to the SQL server database.

I export CSV to the SQL server DB and despite the transfer is successful no data appears on the server Database. I am unable to find the cause of the issue.

I am using Export and Import Wizzard via SSIS in Visual Studio. I do not want to create a new table but import data from CSV to the existing table.

The table had the data previously but I cleared it with DELETE command epic00

The CSV file is on the local machine (C drive)

Data type: single-byte signed integer pic1

Checked Enable Identity insert pic2

Rows and columns seem to be OK pic3

SECESFULL pic4

BUT NO DATA IN THE TABLE pic5

I can't use this wizard in Microsoft SQL Server Management Studio due to the differences between 64-bit PC and 32-bit program

I can't use the SQL server developer because of the errors during the installation and I can't resolve it now

I tried to use the bulk insert task in Visual Studio but I got errors

What I want? Export the data from csv file to existing table on SQL server database.
Do you have an idea what I should check?

I had some errors when I tried to export CSV to SQL server database before:

- Validating (Error)
    Messages
    * Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "ParameterSet".
     (SQL Server Import and Export Wizard)

    * Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
     (SQL Server Import and Export Wizard)

    * Error 0xc004706b: Data Flow Task 1: "Destination - inputParameters" failed validation and returned validation status "VS_ISBROKEN".
     (SQL Server Import and Export Wizard)

    * Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
     (SQL Server Import and Export Wizard)

    * Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
     (SQL Server Import and Export Wizard)

    Error: 0xC002F304 at Bulk Insert Task, Bulk Insert Task: An error occurred with the following error message: "Cannot bulk load because the file " could not be opened. Operating system error code (null).".

But once I changed the type of the data (DataType) to single-byte signed integer and made sure that is ticked Enable Identity insert the errors did not appear again.


问:
SimpleDateFormatter "ddMMyyyy" incorrectly parse month and year
I'm parsing user date of birth string. And faced a very strange parsing scenario.

My code is the following:

```<code>SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy")
try {
  Date date = formatter.parse(input); // input - is a user entered string
} catch (ParseException e) {
}
</code>```

If input is "22221985", I have a date 22, October, 1986. But I expect some sort of ParseException for this and similar scenario, when month is higher, then 12.

Body:
I'm parsing user date of birth string. And faced a very strange parsing scenario.

My code is the following:

SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy")
try {
  Date date = formatter.parse(input); // input - is a user entered string
} catch (ParseException e) {
}

If input is "22221985", I have a date 22, October, 1986. But I expect some sort of ParseException for this and similar scenario, when month is higher, then 12.


问:
How to convert scattered data into griddata for linear interpolator in Python?
Basically, I have a dataset that gives me scattered N-dimensional data with one-dimensional output (eg. f(x1,..,xN) -> y).

N can range from 3 to 15, so using the Scipy's LinearNDInterpolator is not fesable, because it is O(N^2) and it basically gets stuck with higher dimensions because it has to inverting a huge matrix.

This is how I came across the interpn function, the only problem is that I haven't understood how to convert my data.

I've tried the following:

```<code>arr = [np.arange(0,1.01,0.01) for i in range(len(self.X[0]))] # X[0]'s length can be 3 to 15

gridded_data_points = np.meshgrid(*arr)

grid_z1 = spi.griddata(X_train_with_corners, Y_train_with_corners, gridded_data_points, method='linear')

Y_pred = spi.interpn(gridded_data_points, grid_z1, self.X_test, method="linear")
</code>```

But this doesn't work and I get a ValueError: broadcast dimensions too large. error.

I also don't know if I'm converting the data using the right approach: to my eyes having the griddata interpolator and then interpn looks redundant, but as far as I've understood the interpn wants to have the data in a grid format and the only way is to interpolate my scattered data using griddata and then feed this data to the interpn, but I might be wrong in this.

Do you know how to linear interpolate high dimension scattered data?

Body:
Basically, I have a dataset that gives me scattered N-dimensional data with one-dimensional output (eg. f(x1,..,xN) -> y).

N can range from 3 to 15, so using the Scipy's LinearNDInterpolator is not fesable, because it is O(N^2) and it basically gets stuck with higher dimensions because it has to inverting a huge matrix.

This is how I came across the interpn function, the only problem is that I haven't understood how to convert my data.

I've tried the following:

arr = [np.arange(0,1.01,0.01) for i in range(len(self.X[0]))] # X[0]'s length can be 3 to 15

gridded_data_points = np.meshgrid(*arr)

grid_z1 = spi.griddata(X_train_with_corners, Y_train_with_corners, gridded_data_points, method='linear')

Y_pred = spi.interpn(gridded_data_points, grid_z1, self.X_test, method="linear")

But this doesn't work and I get a ValueError: broadcast dimensions too large. error.

I also don't know if I'm converting the data using the right approach: to my eyes having the griddata interpolator and then interpn looks redundant, but as far as I've understood the interpn wants to have the data in a grid format and the only way is to interpolate my scattered data using griddata and then feed this data to the interpn, but I might be wrong in this.

Do you know how to linear interpolate high dimension scattered data?


问:
Pass data into Sliding up panel flutter
Hi Sorry i'm new to flutter, I have a Googlemap with markers that are loaded from my json uri and i've a sliding up Panel from the The sliding_up_panel package.

When i click on the marker i've a windowInfo with details from the marker and Button. When i press the button the sliding up panel opens.
marker with infoWindow
my sliding up panel
I need to pass data (IdPompe) from my marker to my sliding up panel then on the pressed button send this data and data from the field to my database.
But when i try to do it and print my data it has the same value for all the markers

I tried to create variable to store my data "IdPompe" and then giving it new value in my loop

`

```<code>final Map<String, Marker> _markers = {};
String Idpompe ="";

Future<void> _onMapCreated(GoogleMapController controller) async {
  _customInfoWindowController.googleMapController= controller;
  late String Etatpompe;
  final Pompes = await fetchPumps();
  setState(()  {
    _markers.clear();
    print(Pompes.length);
    BitmapDescriptor icon = BitmapDescriptor.defaultMarkerWithHue(0.0);

   for (final pompes in Pompes) {

     Idpompe =  pompes.NewID;

      final marker = Marker(
        icon: icon ,
        markerId: MarkerId(pompes.NewID),
        position: LatLng(pompes.CoordonneesY, pompes.CoordonneesX),
        onTap: (){
          if (pompes.EtatPompe == 1){
            Etatpompe = "ABANDONNEE";

          } else if (pompes.EtatPompe == 2){
            Etatpompe = "EN PANNE";

          }
          else if (pompes.EtatPompe == 3){
            Etatpompe = "MAUVAIS ETAT";

          } else if (pompes.EtatPompe == 4){
            Etatpompe = "BON ETAT";

          }
          _customInfoWindowController.addInfoWindow!(

            Container(
              height: 300,
              width: 200,
              decoration: BoxDecoration(
                color: Colors.white,
                border: Border.all(color: Colors.grey),
                borderRadius: BorderRadius.circular(10.0)
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,

                children: [
                  SizedBox(height: 4,),
                  Center(child: Text(Etatpompe),
                  SizedBox(height: 5,),
                  Row(
                    children: [

                      Text("Type pompes: ")
                      Text(pompes.TypePompe)
                    ],
                  ),
                  SizedBox(height: 5,),
                  Row(
                    children: [
                      SizedBox(width: 8,),
                      Text("Village: ",textAlign: TextAlign.start,style: TextStyle(color: Color(0xff5F6368), fontWeight: FontWeight.w600
                      )),
                      SizedBox(width: 3,),
                      Text(pompes.NomVillage)
                    ],
                  ),

                  Center(
                    child: ElevatedButton(onPressed: () {

                      panelController.open();
                      _customInfoWindowController.hideInfoWindow!();

                    }, child: const Text("Demander un dévis",textAlign: TextAlign.center, style: TextStyle(
                      backgroundColor: Colors.blue
                    ),)),
                  )
                ],
              ),
            ),
            LatLng(pompes.CoordonneesY, pompes.CoordonneesX)
          );

        }
      );

      _markers[pompes.NewID] = marker;
       print(Idpompe);
    }
  });
}
</code>```

`
Then use it in my sliding up panel

```<code>@override
Widget build(BuildContext context) {
  final panelHeightOpened = MediaQuery.of(context).size.height * 0.75;
  final panelHeightClosed = MediaQuery.of(context).size.height * 0 ;
  return SafeArea(
  child: Scaffold(

  body: SlidingUpPanel(
    color: Colors.white,
    controller: panelController,
    maxHeight: panelHeightOpened,
    minHeight: panelHeightClosed,
    body: _initialPosition == null ? Center(child:Text('loading map..', style: TextStyle(fontFamily: 'Avenir-Medium', color: Colors.grey[400]),),) :
    Stack(
      children: [ GoogleMap(onMapCreated: _onMapCreated, initialCameraPosition: CameraPosition(target: _initialPosition,
      zoom:4,),myLocationButtonEnabled: true,myLocationEnabled: true, markers: _markers.values.toSet() ,onTap: (position){_customInfoWindowController.hideInfoWindow!();
        },
      onCameraMove: (position){
        _customInfoWindowController.onCameraMove!();
      },
      ),
      CustomInfoWindow(controller: _customInfoWindowController,
        height: 122,
        width: 223,
        offset: 35,
      ),
      ]
    ),
    panelBuilder: (controller) => PanelWidget(
      controller:controller,
      panelController: panelController,
      idPompe: Idpompe,
    ),
    borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),

    parallaxOffset: .5,
  ),
  )
  );
  }
</code>```

this is my panelWidget class

```<code>import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';

class PanelWidget extends StatefulWidget {
  final ScrollController controller;
  final PanelController panelController;
  final String idPompe;

  const PanelWidget({Key? key, required this.controller,required this.panelController,required this.idPompe}) : super(key: key);

  @override
  State<PanelWidget> createState() => _PanelWidgetState();
}

class _PanelWidgetState extends State<PanelWidget> {
  final GlobalKey<FormState> _formKey = GlobalKey();

  String firstName = "";
  String lastName = "";

  @override
  Widget build(BuildContext context) {
    return ListView(
      padding: EdgeInsets.zero,
      children: [
        const SizedBox(height: 12,),
        buildDragHandle(),
        const SizedBox(height: 10,),
        buildAboutText(context,widget.idPompe),

      ],
    );
  }

</code>```

Widget buildAboutText(context,String Id) =>

```<code>Container(

  padding: const EdgeInsets.symmetric(horizontal: 24),
  child: Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      Center(
        child: Text(
            'Ma Demande'),
      ),
        /.../

      ElevatedButton(
        style: ElevatedButton.styleFrom(
            minimumSize: const Size.fromHeight(50)),
        onPressed: () {
          print(Id);
        },
        child: const Text("Envoyer"),
      ),

    ],
  ),

);
</code>```
```<code>

</code>```

Title: Pass data into Sliding up panel flutter

Body:
Hi Sorry i'm new to flutter, I have a Googlemap with markers that are loaded from my json uri and i've a sliding up Panel from the The sliding_up_panel package.

When i click on the marker i've a windowInfo with details from the marker and Button. When i press the button the sliding up panel opens.
marker with infoWindow
my sliding up panel
I need to pass data (IdPompe) from my marker to my sliding up panel then on the pressed button send this data and data from the field to my database.
But when i try to do it and print my data it has the same value for all the markers

I tried to create variable to store my data "IdPompe" and then giving it new value in my loop

`

final Map<String, Marker> _markers = {};
String Idpompe ="";

Future<void> _onMapCreated(GoogleMapController controller) async {
  _customInfoWindowController.googleMapController= controller;
  late String Etatpompe;
  final Pompes = await fetchPumps();
  setState(()  {
    _markers.clear();
    print(Pompes.length);
    BitmapDescriptor icon = BitmapDescriptor.defaultMarkerWithHue(0.0);

   for (final pompes in Pompes) {

     Idpompe =  pompes.NewID;

      final marker = Marker(
        icon: icon ,
        markerId: MarkerId(pompes.NewID),
        position: LatLng(pompes.CoordonneesY, pompes.CoordonneesX),
        onTap: (){
          if (pompes.EtatPompe == 1){
            Etatpompe = "ABANDONNEE";

          } else if (pompes.EtatPompe == 2){
            Etatpompe = "EN PANNE";

          }
          else if (pompes.EtatPompe == 3){
            Etatpompe = "MAUVAIS ETAT";

          } else if (pompes.EtatPompe == 4){
            Etatpompe = "BON ETAT";

          }
          _customInfoWindowController.addInfoWindow!(

            Container(
              height: 300,
              width: 200,
              decoration: BoxDecoration(
                color: Colors.white,
                border: Border.all(color: Colors.grey),
                borderRadius: BorderRadius.circular(10.0)
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,

                children: [
                  SizedBox(height: 4,),
                  Center(child: Text(Etatpompe),
                  SizedBox(height: 5,),
                  Row(
                    children: [

                      Text("Type pompes: ")
                      Text(pompes.TypePompe)
                    ],
                  ),
                  SizedBox(height: 5,),
                  Row(
                    children: [
                      SizedBox(width: 8,),
                      Text("Village: ",textAlign: TextAlign.start,style: TextStyle(color: Color(0xff5F6368), fontWeight: FontWeight.w600
                      )),
                      SizedBox(width: 3,),
                      Text(pompes.NomVillage)
                    ],
                  ),

                  Center(
                    child: ElevatedButton(onPressed: () {

                      panelController.open();
                      _customInfoWindowController.hideInfoWindow!();

                    }, child: const Text("Demander un dévis",textAlign: TextAlign.center, style: TextStyle(
                      backgroundColor: Colors.blue
                    ),)),
                  )
                ],
              ),
            ),
            LatLng(pompes.CoordonneesY, pompes.CoordonneesX)
          );

        }
      );

      _markers[pompes.NewID] = marker;
       print(Idpompe);
    }
  });
}

`
Then use it in my sliding up panel

@override
Widget build(BuildContext context) {
  final panelHeightOpened = MediaQuery.of(context).size.height * 0.75;
  final panelHeightClosed = MediaQuery.of(context).size.height * 0 ;
  return SafeArea(
  child: Scaffold(

  body: SlidingUpPanel(
    color: Colors.white,
    controller: panelController,
    maxHeight: panelHeightOpened,
    minHeight: panelHeightClosed,
    body: _initialPosition == null ? Center(child:Text('loading map..', style: TextStyle(fontFamily: 'Avenir-Medium', color: Colors.grey[400]),),) :
    Stack(
      children: [ GoogleMap(onMapCreated: _onMapCreated, initialCameraPosition: CameraPosition(target: _initialPosition,
      zoom:4,),myLocationButtonEnabled: true,myLocationEnabled: true, markers: _markers.values.toSet() ,onTap: (position){_customInfoWindowController.hideInfoWindow!();
        },
      onCameraMove: (position){
        _customInfoWindowController.onCameraMove!();
      },
      ),
      CustomInfoWindow(controller: _customInfoWindowController,
        height: 122,
        width: 223,
        offset: 35,
      ),
      ]
    ),
    panelBuilder: (controller) => PanelWidget(
      controller:controller,
      panelController: panelController,
      idPompe: Idpompe,
    ),
    borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),

    parallaxOffset: .5,
  ),
  )
  );
  }

this is my panelWidget class

import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';

class PanelWidget extends StatefulWidget {
  final ScrollController controller;
  final PanelController panelController;
  final String idPompe;

  const PanelWidget({Key? key, required this.controller,required this.panelController,required this.idPompe}) : super(key: key);

  @override
  State<PanelWidget> createState() => _PanelWidgetState();
}

class _PanelWidgetState extends State<PanelWidget> {
  final GlobalKey<FormState> _formKey = GlobalKey();

  String firstName = "";
  String lastName = "";

  @override
  Widget build(BuildContext context) {
    return ListView(
      padding: EdgeInsets.zero,
      children: [
        const SizedBox(height: 12,),
        buildDragHandle(),
        const SizedBox(height: 10,),
        buildAboutText(context,widget.idPompe),

      ],
    );
  }

Widget buildAboutText(context,String Id) =>

Container(

  padding: const EdgeInsets.symmetric(horizontal: 24),
  child: Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      Center(
        child: Text(
            'Ma Demande'),
      ),
        /.../

      ElevatedButton(
        style: ElevatedButton.styleFrom(
            minimumSize: const Size.fromHeight(50)),
        onPressed: () {
          print(Id);
        },
        child: const Text("Envoyer"),
      ),

    ],
  ),

);


问:
How to hide/show part of the text by button tap
I have long text in UILabel and button, which could hide/show this text.
But I don't understand how to realize this.

My text is located in a cell. Button in next cell.

At the first time I need to show only three lines of text.


问:
How to make a effect of zooming in to stars or marbles in Processing. Like a HyperJump effect in Starwars
So i have an assignment to do this project.

star wars like effect

And my problem with that is no matter where the marble might randomly generate, it must have the same speed as any other.

I got to the point where depending on the placement of  the marble, the direction of movement will change accordingly, but i cannot wrap my head around what to do next. Because i don't know how to make a constant speed but different directions because it depends on speedX/speedY .

I think the issue must lie around there.

I am new to the processing and programming overall, so if you can please help.

```<code>  speedX[i] = x[i] / 100f;
  speedY[i] = y[i] / 100f;
</code>```
```<code>import processing.core.*;

public class Main extends PApplet {
    int NUMBER_OF_STARS = 100;
    float[] x = new float[NUMBER_OF_STARS];
    float[] y = new float[NUMBER_OF_STARS];
    float[] dX = new float[NUMBER_OF_STARS];
    float[] dY = new float[NUMBER_OF_STARS];

    float[] speedX = new float[NUMBER_OF_STARS];
    float[] speedY = new float[NUMBER_OF_STARS];

    float minR, maxR;

    public void settings() {
        fullScreen();
    }

    public void setup() {
        minR = 10;
        maxR = 40;
        for (int i = 0; i < NUMBER_OF_STARS; i++) {
            x[i] = random(-width / 2f + maxR, width / 2f - maxR);
            y[i] = random(-height / 2f + maxR, height / 2f - maxR);
            speedX[i] = x[i] / 100f;
            speedY[i] = y[i] / 100f;
        }
    }

    public void draw() {
        fill(0, 0, 0, 20);
        rect(0, 0, width, height);
        translate(width / 2f, height / 2f);
        for (int i = 0; i < NUMBER_OF_STARS; i++) {
            fill(255, 255, 255);
            circle(x[i] + dX[i], y[i] + dY[i], 30);
            dX[i] += speedX[i];
            dY[i] += speedY[i];
        }

    }

    public static void main(String[] args) {
        PApplet.main("Main");
    }

}
</code>```

I tried just making the speed the 1/100 of coordinates of the marble. It created the effect, but the marbles, because of this, moving at different speed. Especially those marbles that are near center don't move at all.
They need to have effect like they all are moving towards you, like in Star wars movies, or in like in these example  (https://i.stack.imgur.com/SsVL9.png)

P.S please judge my code and share any advices that will make my code more readable

Body:
So i have an assignment to do this project.

star wars like effect

And my problem with that is no matter where the marble might randomly generate, it must have the same speed as any other.

I got to the point where depending on the placement of  the marble, the direction of movement will change accordingly, but i cannot wrap my head around what to do next. Because i don't know how to make a constant speed but different directions because it depends on speedX/speedY .

I think the issue must lie around there.

I am new to the processing and programming overall, so if you can please help.

  speedX[i] = x[i] / 100f;
  speedY[i] = y[i] / 100f;

import processing.core.*;

public class Main extends PApplet {
    int NUMBER_OF_STARS = 100;
    float[] x = new float[NUMBER_OF_STARS];
    float[] y = new float[NUMBER_OF_STARS];
    float[] dX = new float[NUMBER_OF_STARS];
    float[] dY = new float[NUMBER_OF_STARS];

    float[] speedX = new float[NUMBER_OF_STARS];
    float[] speedY = new float[NUMBER_OF_STARS];

    float minR, maxR;

    public void settings() {
        fullScreen();
    }

    public void setup() {
        minR = 10;
        maxR = 40;
        for (int i = 0; i < NUMBER_OF_STARS; i++) {
            x[i] = random(-width / 2f + maxR, width / 2f - maxR);
            y[i] = random(-height / 2f + maxR, height / 2f - maxR);
            speedX[i] = x[i] / 100f;
            speedY[i] = y[i] / 100f;
        }
    }

    public void draw() {
        fill(0, 0, 0, 20);
        rect(0, 0, width, height);
        translate(width / 2f, height / 2f);
        for (int i = 0; i < NUMBER_OF_STARS; i++) {
            fill(255, 255, 255);
            circle(x[i] + dX[i], y[i] + dY[i], 30);
            dX[i] += speedX[i];
            dY[i] += speedY[i];
        }

    }

    public static void main(String[] args) {
        PApplet.main("Main");
    }

}

I tried just making the speed the 1/100 of coordinates of the marble. It created the effect, but the marbles, because of this, moving at different speed. Especially those marbles that are near center don't move at all.
They need to have effect like they all are moving towards you, like in Star wars movies, or in like in these example  (https://i.stack.imgur.com/SsVL9.png)

P.S please judge my code and share any advices that will make my code more readable


问:
.Net Framework Window Service Unable to access DB Store Procedure
.Net Framework Window Service works fine when I run it manually but when I create exe and run the following commands:

```<code>>cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
>installutil.exe -i C:\WS\ReportWindowsService.exe
</code>```

It log following error:

```<code>The EXECUTE permission was denied on the object 'usp_postScheduled', database 'randomDB_mi', schema 'dbo'.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
</code>```

Body:
.Net Framework Window Service works fine when I run it manually but when I create exe and run the following commands:

>cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
>installutil.exe -i C:\WS\ReportWindowsService.exe

It log following error:

The EXECUTE permission was denied on the object 'usp_postScheduled', database 'randomDB_mi', schema 'dbo'.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)


问:
Emitting an event inside an event
So I am trying to emit an event to my parent component from the child component.

I emit it when the valueChanges event triggers. This works only once and then not anymore.

Is this possible to do in Angular?

Emitting an event on new event trigger?

Might be connected to Why can't I emit event inside subscribe().

```<code>@Output('formChanged') formEmitter = new EventEmitter();
ngOnInit() {
    this.currencyConversionForm.valueChanges.subscribe((selectedValue: any) => {
      console.log('form value changed');
      console.log(selectedValue);
      this.formEmitter.emit(selectedValue);
    })
}

handleFormChanged(value: any) {
   console.log(value);
   his.amount = value.amount;
   this.baseCurrency = value.baseCurrencyForm;
   this.counterCurrency = value.counterCurrencyForm;
}
</code>```

This works the first time when I call it, but not the second time.

Title: Emitting an event inside an event

Body:
So I am trying to emit an event to my parent component from the child component.

I emit it when the valueChanges event triggers. This works only once and then not anymore.

Is this possible to do in Angular?

Emitting an event on new event trigger?

Might be connected to Why can't I emit event inside subscribe().

@Output('formChanged') formEmitter = new EventEmitter();
ngOnInit() {
    this.currencyConversionForm.valueChanges.subscribe((selectedValue: any) => {
      console.log('form value changed');
      console.log(selectedValue);
      this.formEmitter.emit(selectedValue);
    })
}

handleFormChanged(value: any) {
   console.log(value);
   his.amount = value.amount;
   this.baseCurrency = value.baseCurrencyForm;
   this.counterCurrency = value.counterCurrencyForm;
}

This works the first time when I call it, but not the second time.


问:
Options for .Net Maui Authentication
Currently I have an application that is running asp.net MVC 5 utilizing Owin.IAppBuilder for authentication. This was the standard authentication method when building mvc applications. My current auth method connects to a SQL database and uses the standard aspNetUsers table method.

I am looking to start building a .net Maui mobile app. I would like to allow existing and future users of my MVC 5 application to authenticate with the .net Maui mobile app.

I researched many options but unsure the correct methods to start implementing. Does anyone have suggestions on what Path I should take?

Title: Options for .Net Maui Authentication