问:
JSP form returing to 404 instead of mapping to a controller's method
I want to map the form action with the controller method as below, but i get the 404 page not found error.

my JSP page:

```<code>    <h1>Welcome to SportyShoes</h1>

    <form action="loginaction" method="post">
    <input type="text" name="adminname">
    <input type="password" name="password">
    <button>Submit</button>
    </form>
</code>```

my controller page:

```<code>@Controller
public class AdminController {

    @Autowired
    private AdminService adminService;

    @RequestMapping(value = "/loginaction", method = RequestMethod.POST)
    public String loginAction(ModelMap map, @RequestParam(value="adminname") String adminName, @RequestParam(value="password") String password) {

        Admin admin = adminService.authenticate(adminName, password);
        if(admin == null) {
            map.addAttribute("error", "admin name or password is wrong");
            return null;
        }
        return "entry";

    }
}
</code>```

but i get the error:

There was an unexpected error (type=Not Found, status=404).
JSP file [/WEB-INF/views/loginaction.jsp] not found

my POM:

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.sportyshoes</groupId>
    <artifactId>sportyshoes</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>sportyshoes</name>
    <description>An e-commerce for sporty shoes</description>
    <properties>
        <java.version>11</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <!--embeded tomcat is to suppor the jsp-->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

     <!--   <dependency>
            <groupId>javax.servlet.jsp.jstl</groupId>
            <artifactId>javax.servlet.jsp.jstl-api</artifactId>
            <version>1.2.1</version>
        </dependency> -->

        <!-- https://mvnrepository.com/artifact/jakarta.servlet.jsp.jstl/jakarta.servlet.jsp.jstl-api -->
    <dependency>
        <groupId>jakarta.servlet.jsp.jstl</groupId>
        <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
        </dependency>

        <!--<dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>javax.servlet.jsp.jstl</artifactId>
            <version>1.2.1</version>
        </dependency>-->
        <!-- https://mvnrepository.com/artifact/org.glassfish.web/jakarta.servlet.jsp.jstl -->
    <dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>jakarta.servlet.jsp.jstl</artifactId>
    </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/jstl/jstl -->
<!--    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency> -->

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
</code>```

What did I do wrong? Please find my POM which I have included. It was working fine before and I did a few changes and redid the entire files now it is showing this 404 error.

Body:
I want to map the form action with the controller method as below, but i get the 404 page not found error.

my JSP page:

Welcome to SportyShoes

    <form action="loginaction" method="post">
    <input type="text" name="adminname">
    <input type="password" name="password">
    <button>Submit</button>
    </form>

my controller page:

@Controller
public class AdminController {

    @Autowired
    private AdminService adminService;

    @RequestMapping(value = "/loginaction", method = RequestMethod.POST)
    public String loginAction(ModelMap map, @RequestParam(value="adminname") String adminName, @RequestParam(value="password") String password) {

        Admin admin = adminService.authenticate(adminName, password);
        if(admin == null) {
            map.addAttribute("error", "admin name or password is wrong");
            return null;
        }
        return "entry";

    }
}

but i get the error:

There was an unexpected error (type=Not Found, status=404).
JSP file [/WEB-INF/views/loginaction.jsp] not found

my POM:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.0</version>
        <relativePath/>
    </parent>
    <groupId>com.sportyshoes</groupId>
    <artifactId>sportyshoes</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>sportyshoes</name>
    <description>An e-commerce for sporty shoes</description>
    <properties>
        <java.version>11</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

    <dependency>
        <groupId>jakarta.servlet.jsp.jstl</groupId>
        <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
        </dependency>

    <dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>jakarta.servlet.jsp.jstl</artifactId>
    </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

What did I do wrong? Please find my POM which I have included. It was working fine before and I did a few changes and redid the entire files now it is showing this 404 error.


来源: stackexchange

问:
The application's Info.plist does not contain a valid CFBundleVersion

The application's Info.plist does not contain a valid CFBundleVersion.
Ensure your bundle contains a valid CFBundleVersion.

I'm getting this error while implementing react native stripe

when Im remove
npm install @stripe/stripe-react-native
then working good

ContentLicense: CC BY-SA 4.0


问:
Range slider with Bars on each index
Please guide me on this design implementation,
Design

Main problem is how we can place the blue bars on exact number in the range slider?

```<code><input type="range" min="1.0" max="5.0" step="0.01">
</code>```

Title: Range slider with Bars on each index

Body:
Please guide me on this design implementation,
Design

Main problem is how we can place the blue bars on exact number in the range slider?

<input type="range" min="1.0" max="5.0" step="0.01">


问:
MongoDB remove all elements from the array inside one document
I want to delete all elements from an array in my document..

I have an array of object id's

My model looks like this:

```<code>const TypeSchema = new mongoose.Schema({
  ISOklasifikacija: { type: String, requred: false },
  profilUIC: { type: String, requred: false },
  certificateId: [
    {
      type: Schema.Types.ObjectId,
      ref: "Certificates",
      required: false,
    },
  ],
});
</code>```

My query for clearing the array is:

```<code> let type = await Type.findOneAndUpdate(
      {
        _id: req.params.typeId,
      },
      {
        $set: { certificateId: [] },
      },
      { multi: true }
    );

    console.log(type);
</code>```

It nevers clear the array. In console I get: null and this id exists which I am passing in

Thanks for help

Body:
I want to delete all elements from an array in my document..

I have an array of object id's

My model looks like this:

const TypeSchema = new mongoose.Schema({
  ISOklasifikacija: { type: String, requred: false },
  profilUIC: { type: String, requred: false },
  certificateId: [
    {
      type: Schema.Types.ObjectId,
      ref: "Certificates",
      required: false,
    },
  ],
});

My query for clearing the array is:

 let type = await Type.findOneAndUpdate(
      {
        _id: req.params.typeId,
      },
      {
        $set: { certificateId: [] },
      },
      { multi: true }
    );

    console.log(type);

It nevers clear the array. In console I get: null and this id exists which I am passing in

Thanks for help


问:
Iterate over list of CompletableFutures in loop without recursion
So I have this piece of Java code written with recursion.

```<code>package test;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {

        List<AllocationCandidateSet> candidates = new ArrayList<>();
        IntStream.range(0, 5000).forEach(__ -> candidates.add(new AllocationCandidateSet()));
        AllocationContext ctx = new AllocationContext();
        ctx.currentPlacementZoneAllocationCandidatesProvider = candidates.iterator();

        Main main = new Main();
        main.attemptAllocation(ctx).join();

        System.out.println(ctx.firstSuccessfulCandidateSet);
        System.out.println(ctx.iteration);
}

private CompletableFuture<AllocationContext> attemptAllocation(AllocationContext context) {
    return CompletableFuture.completedFuture(context)
            .thenCompose(this::getNextCandidateSet)
            .thenCompose(this::runAffinityFilters)
            .thenCompose(ctx -> {
                if (ctx.firstSuccessfulCandidateSet == null
                        && context.currentPlacementZoneAllocationCandidatesProvider.hasNext()) {
                    return attemptAllocation(ctx);
                } else {
                    return CompletableFuture.completedFuture(ctx);
                }
            });
}

private CompletableFuture<AllocationContext> getNextCandidateSet(AllocationContext ctx) {
    // For the sake of simplicity, I omitted most of the logic inside this method.
    ctx.currentCandidateSet = ctx.currentPlacementZoneAllocationCandidatesProvider.next();
    ctx.iteration++;
    return CompletableFuture.completedFuture(ctx);
}

private CompletableFuture<AllocationContext> runAffinityFilters(AllocationContext ctx) {
    // This is a long running async operation doing DB calls
    return CompletableFuture.completedFuture(ctx)
            .thenCompose(context -> {
                // Do some DB calls and run business logic and evaluate if the current AllocationCandidateSet is successful
                boolean success = context.iteration == 1876;
                return CompletableFuture.completedFuture(success);
            })
            .thenAccept(success -> {
                if (success) {
                    ctx.firstSuccessfulCandidateSet = ctx.currentCandidateSet;
                }
            })
            .thenApply(__ -> ctx);
}

public static class AllocationContext {
    Iterator<AllocationCandidateSet> currentPlacementZoneAllocationCandidatesProvider;
    AllocationCandidateSet currentCandidateSet;

    AllocationCandidateSet firstSuccessfulCandidateSet;

    int iteration = 0;
}

public static class AllocationCandidateSet {

}
</code>```

}

Results are accumulated inside the AllocationContext which is a thread-safe object holder that contains Iterator - context.currentPlacementZoneAllocationCandidatesProvider.
The iterator is a normal one - having next() and hasNext() methods.

The getNextCandidateSet() method advances the iterator forward. This method is actually sync as opposed to async so theoretically .thenCompose(this::getNextCandidateSet) can be replaced with .thenApply(this::getNextCandidateSet) with little refactoring.

The problem I'm having is with the runAffinityFilters() method... This method is doing async calls to the Database with must be non-blocking. Its signature returns CompletableFuture<AllocationContext> and it's not feasible to change it.

Therefore, calls to runAffinityFilters() are chained in this CompletableFuture chain with recursion - after each runAffinityFilters() call, a check for successful result is made - if running the affinity filters yielded no success ( (ctx.firstSuccessfulCandidateSet == null ) and the iterator can be advanced ( context.currentPlacementZoneAllocationCandidatesProvider.hasNext() )
... then allocateAttempt(ctx) is invoked again.

Is there a way to replace the recursion with regular iteration? With the recursive solution I'm hitting StackOverflowError near the 1000th loop...
It would be ideal to continue running runAffinityFilters() as async call, waiting for it to complete, checking the condition if (ctx.firstSuccessfulCandidateSet == null && context.currentPlacementZoneAllocationCandidatesProvider.hasNext())  and then continuing with next iteration.

Body:
So I have this piece of Java code written with recursion.

package test;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {

        List<AllocationCandidateSet> candidates = new ArrayList<>();
        IntStream.range(0, 5000).forEach(__ -> candidates.add(new AllocationCandidateSet()));
        AllocationContext ctx = new AllocationContext();
        ctx.currentPlacementZoneAllocationCandidatesProvider = candidates.iterator();

        Main main = new Main();
        main.attemptAllocation(ctx).join();

        System.out.println(ctx.firstSuccessfulCandidateSet);
        System.out.println(ctx.iteration);
}

private CompletableFuture<AllocationContext> attemptAllocation(AllocationContext context) {
    return CompletableFuture.completedFuture(context)
            .thenCompose(this::getNextCandidateSet)
            .thenCompose(this::runAffinityFilters)
            .thenCompose(ctx -> {
                if (ctx.firstSuccessfulCandidateSet == null
                        && context.currentPlacementZoneAllocationCandidatesProvider.hasNext()) {
                    return attemptAllocation(ctx);
                } else {
                    return CompletableFuture.completedFuture(ctx);
                }
            });
}

private CompletableFuture<AllocationContext> getNextCandidateSet(AllocationContext ctx) {
    // For the sake of simplicity, I omitted most of the logic inside this method.
    ctx.currentCandidateSet = ctx.currentPlacementZoneAllocationCandidatesProvider.next();
    ctx.iteration++;
    return CompletableFuture.completedFuture(ctx);
}

private CompletableFuture<AllocationContext> runAffinityFilters(AllocationContext ctx) {
    // This is a long running async operation doing DB calls
    return CompletableFuture.completedFuture(ctx)
            .thenCompose(context -> {
                // Do some DB calls and run business logic and evaluate if the current AllocationCandidateSet is successful
                boolean success = context.iteration == 1876;
                return CompletableFuture.completedFuture(success);
            })
            .thenAccept(success -> {
                if (success) {
                    ctx.firstSuccessfulCandidateSet = ctx.currentCandidateSet;
                }
            })
            .thenApply(__ -> ctx);
}

public static class AllocationContext {
    Iterator<AllocationCandidateSet> currentPlacementZoneAllocationCandidatesProvider;
    AllocationCandidateSet currentCandidateSet;

    AllocationCandidateSet firstSuccessfulCandidateSet;

    int iteration = 0;
}

public static class AllocationCandidateSet {

}

}

Results are accumulated inside the AllocationContext which is a thread-safe object holder that contains Iterator - context.currentPlacementZoneAllocationCandidatesProvider.
The iterator is a normal one - having next() and hasNext() methods.

The getNextCandidateSet() method advances the iterator forward. This method is actually sync as opposed to async so theoretically .thenCompose(this::getNextCandidateSet) can be replaced with .thenApply(this::getNextCandidateSet) with little refactoring.

The problem I'm having is with the runAffinityFilters() method... This method is doing async calls to the Database with must be non-blocking. Its signature returns CompletableFuture<AllocationContext> and it's not feasible to change it.

Therefore, calls to runAffinityFilters() are chained in this CompletableFuture chain with recursion - after each runAffinityFilters() call, a check for successful result is made - if running the affinity filters yielded no success ( (ctx.firstSuccessfulCandidateSet == null ) and the iterator can be advanced ( context.currentPlacementZoneAllocationCandidatesProvider.hasNext() )
... then allocateAttempt(ctx) is invoked again.

Is there a way to replace the recursion with regular iteration? With the recursive solution I'm hitting StackOverflowError near the 1000th loop...
It would be ideal to continue running runAffinityFilters() as async call, waiting for it to complete, checking the condition if (ctx.firstSuccessfulCandidateSet == null && context.currentPlacementZoneAllocationCandidatesProvider.hasNext())  and then continuing with next iteration.


问:
SSRS - Referring to a table Expression within a Text Box Expression
Good morning,
I have the below expression in a table column within SSRS (Essentially outputs a Yes/No based on whether another column has a value.

I want to refer to this expression within a header row that counts the number of Yes answers. However I do not know how to refer to the table expression within that header expression.
I have tried !Fields (this won't work as it is a lookup based on multiple datasets) and !ReportItems but it cannot use this as the original expression is an aggregate.

Thank you for any help you can provide.

The table expression:

```<code>=IIF(NOT ISNothing(Lookup(Fields!UserID.Value, Fields!USER_ID.Value, Fields!Logins.value,"CE_LoginsList")), "Y", "N")
</code>```

What I would expect the headers expression to resemble:

```<code>=Count(IIF(ReportItems!HasLicense.Value, "Y", Nothing))
</code>```

Body:
Good morning,
I have the below expression in a table column within SSRS (Essentially outputs a Yes/No based on whether another column has a value.

I want to refer to this expression within a header row that counts the number of Yes answers. However I do not know how to refer to the table expression within that header expression.
I have tried !Fields (this won't work as it is a lookup based on multiple datasets) and !ReportItems but it cannot use this as the original expression is an aggregate.

Thank you for any help you can provide.

The table expression:

=IIF(NOT ISNothing(Lookup(Fields!UserID.Value, Fields!USER_ID.Value, Fields!Logins.value,"CE_LoginsList")), "Y", "N")

What I would expect the headers expression to resemble:

=Count(IIF(ReportItems!HasLicense.Value, "Y", Nothing))


问:
Best practice to secure an Electron application from Linux traget
I have an Electron application packaged into an asar file. However, it's mentioned almost everywhere that there's no security at all for that format. Everyone can unpack it with

```<code>npx asar extract app.asar destfolder
</code>```

and access the source code + resource files (certificates, images, audio, everything).

Which means technically a person can tamper with the code and resources files as much as they want and create fake builds with unwanted code.

I want to protect my electron app from tampering by Linux users. Is there any way to do so?

Body:
I have an Electron application packaged into an asar file. However, it's mentioned almost everywhere that there's no security at all for that format. Everyone can unpack it with

npx asar extract app.asar destfolder

and access the source code + resource files (certificates, images, audio, everything).

Which means technically a person can tamper with the code and resources files as much as they want and create fake builds with unwanted code.

I want to protect my electron app from tampering by Linux users. Is there any way to do so?


问:
Laravel NPM fixing cross-env problem leading to problem 'enoent spawn bash ENOENT'
I've been struggling to fix the common 'cross-env' is not recognized as an internal or external command, problem with NPM in a Laravel 9.x project on a Windows 10 machine. I've gone over most of the other similar topics but I can't find a solution that works and I'm not familiar with yarn which is what a lot of the answers involve.

npm install -g cross-env was used but trying to run NPM then gave a path error:

```<code>> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-mde_modules/laravel-mix/setup/webpack.config.js

The system cannot find the path specified.
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules\webpack\bin\webpack.js ENOENT
    at notFoundError (C:\Users\Tobias\AppData\Roaming\npm\node_modules\cross-env\node_molib\enoent.js:6:26)
    at verifyENOENT (C:\Users\Tobias\AppData\Roaming\npm\node_modules\cross-env\node_modib\enoent.js:40:16)
    at cp.emit (C:\Users\Tobias\AppData\Roaming\npm\node_modules\cross-env\node_modules\oent.js:27:25)
Emitted 'error' event on ChildProcess instance at:
    at cp.emit (C:\Users\Tobias\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  path: 'node_modules\\webpack\\bin\\webpack.js',
  spawnargs: [
    '--progress',
    '--hide-modules',
    '--config=node_modules/laravel-mix/setup/webpack.config.js'
  ]
}
Node.js v18.12.1`
</code>```

To solve this I used the command npm config set script-shell bash as suggested here

But this then gives a 'NOENT' problem that I can't find a good solution for to fix (or revert back)

```<code>
> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-m

npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\xampp\htdocs\antheap
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tobias\AppData\Local\npm-cache\_logs\2022-12-22T09_34_44_288Z-debug-0.log
</code>```

here is the logfile

```<code>0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\Tobias\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using npm@8.11.0
2 info using node@v18.12.1
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Users\Tobias\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\xampp\htdocs\antheap\.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\Tobias\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\Tobias\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 12ms
19 timing npm:load:configload Completed in 12ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm run development
23 verbose argv "run" "development"
24 timing npm:load:setTitle Completed in 1ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 3ms
27 verbose logfile logs-max:10 dir:C:\Users\Tobias\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\Tobias\AppData\Local\npm-cache\_logs\2022-12-22T09_34_44_288Z-debug-0.log
29 timing npm:load:logFile Completed in 15ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 34ms
33 silly logfile start cleaning logs, removing 2 files
34 timing command:run Completed in 8ms
35
35 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:283:19)
35 verbose stack     at onErrorNT (node:internal/child_process:476:16)
35 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
36 verbose cwd C:\xampp\htdocs\antheap
37 verbose Windows_NT 10.0.19044
38 verbose node v18.12.1
39 verbose npm  v8.11.0
40 error code ENOENT
41 error syscall spawn bash
42 error path C:\xampp\htdocs\antheap
43 error errno -4058
44 error enoent spawn bash ENOENT
45 error enoent This is related to npm not being able to find a file.
45 error enoent
46 verbose exit -4058
47 timing npm Completed in 54ms
48 verbose code -4058
49 error A complete log of this run can be found in:
49 error     C:\Users\Tobias\AppData\Local\npm-cache\_logs\2022-12-22T09_34_44_288Z-debug-0.log

</code>```

I saw a suggesting to use npm ci but this didn't work. I've also reinstalled Node.js, and ran npm install, both to no effect.

Deleting and reinstalling NPM within the app doesn't help either. I also show a host of other possible issues (like the old lock file which it however never seems to update properly),

```<code>
PS C:\xampp\htdocs\antheap> npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated chokidar@2.1.6: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated flatten@1.0.2: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated source-map-resolve@0.5.2: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated acorn-dynamic-import@2.0.2: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated axios@0.18.1: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated popper.js@1.15.0: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated buffer@4.9.1: This version of 'buffer' is out-of-date. You must update to v4.9.2 or newer
npm WARN deprecated svgo@0.7.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated core-js@2.6.9: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\xampp\htdocs\antheap\node_modules\node-sass
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tobias\AppData\Local\npm-cache\_logs\2022-12-22T09_52_52_967Z-debug-0.log

</code>```

Body:
I've been struggling to fix the common 'cross-env' is not recognized as an internal or external command, problem with NPM in a Laravel 9.x project on a Windows 10 machine. I've gone over most of the other similar topics but I can't find a solution that works and I'm not familiar with yarn which is what a lot of the answers involve.

npm install -g cross-env was used but trying to run NPM then gave a path error:

> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-mde_modules/laravel-mix/setup/webpack.config.js

The system cannot find the path specified.
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules\webpack\bin\webpack.js ENOENT
    at notFoundError (C:\Users\Tobias\AppData\Roaming\npm\node_modules\cross-env\node_molib\enoent.js:6:26)
    at verifyENOENT (C:\Users\Tobias\AppData\Roaming\npm\node_modules\cross-env\node_modib\enoent.js:40:16)
    at cp.emit (C:\Users\Tobias\AppData\Roaming\npm\node_modules\cross-env\node_modules\oent.js:27:25)
Emitted 'error' event on ChildProcess instance at:
    at cp.emit (C:\Users\Tobias\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  path: 'node_modules\\webpack\\bin\\webpack.js',
  spawnargs: [
    '--progress',
    '--hide-modules',
    '--config=node_modules/laravel-mix/setup/webpack.config.js'
  ]
}
Node.js v18.12.1`

To solve this I used the command npm config set script-shell bash as suggested here

But this then gives a 'NOENT' problem that I can't find a good solution for to fix (or revert back)

> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-m

npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\xampp\htdocs\antheap
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tobias\AppData\Local\npm-cache\_logs\2022-12-22T09_34_44_288Z-debug-0.log

here is the logfile

0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\Tobias\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using npm@8.11.0
2 info using node@v18.12.1
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Users\Tobias\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\xampp\htdocs\antheap\.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\Tobias\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\Tobias\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 12ms
19 timing npm:load:configload Completed in 12ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm run development
23 verbose argv "run" "development"
24 timing npm:load:setTitle Completed in 1ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 3ms
27 verbose logfile logs-max:10 dir:C:\Users\Tobias\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\Tobias\AppData\Local\npm-cache\_logs\2022-12-22T09_34_44_288Z-debug-0.log
29 timing npm:load:logFile Completed in 15ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 34ms
33 silly logfile start cleaning logs, removing 2 files
34 timing command:run Completed in 8ms
35
35 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:283:19)
35 verbose stack     at onErrorNT (node:internal/child_process:476:16)
35 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
36 verbose cwd C:\xampp\htdocs\antheap
37 verbose Windows_NT 10.0.19044
38 verbose node v18.12.1
39 verbose npm  v8.11.0
40 error code ENOENT
41 error syscall spawn bash
42 error path C:\xampp\htdocs\antheap
43 error errno -4058
44 error enoent spawn bash ENOENT
45 error enoent This is related to npm not being able to find a file.
45 error enoent
46 verbose exit -4058
47 timing npm Completed in 54ms
48 verbose code -4058
49 error A complete log of this run can be found in:
49 error     C:\Users\Tobias\AppData\Local\npm-cache\_logs\2022-12-22T09_34_44_288Z-debug-0.log

I saw a suggesting to use npm ci but this didn't work. I've also reinstalled Node.js, and ran npm install, both to no effect.

Deleting and reinstalling NPM within the app doesn't help either. I also show a host of other possible issues (like the old lock file which it however never seems to update properly),

PS C:\xampp\htdocs\antheap> npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated chokidar@2.1.6: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated flatten@1.0.2: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated source-map-resolve@0.5.2: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated acorn-dynamic-import@2.0.2: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated axios@0.18.1: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated popper.js@1.15.0: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated buffer@4.9.1: This version of 'buffer' is out-of-date. You must update to v4.9.2 or newer
npm WARN deprecated svgo@0.7.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated core-js@2.6.9: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\xampp\htdocs\antheap\node_modules\node-sass
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tobias\AppData\Local\npm-cache\_logs\2022-12-22T09_52_52_967Z-debug-0.log


问:
how I apply scroll animation with "scrolltopositionwithoffset" method?
I am trying to set animation with "scrolltopositionwithoffset" but when get offsset its call it is does't smooth scroll it is just rich the offset.i needed to set use "scrolltopositionwithoffset" method because i get offset. i can't use "smoothScrollToPosition".

How can I apply smooth Scroll animation with "smoothScrollToPosition" this method?

Can Anyone have answer?

I want to apply smooth Scroll animation with "smoothScrollToPosition" this method.


问:
Unable to generate an X.509 certificate with a custom crypto.Signer implementation
I am trying to generate an X.509 certificate based on an RSA key pair stored in an HSM. I use this PKCS #11 implementation to communicate with my HSM.

Since my cryptographic objects are stored in the latter, if the operations I want to perform need the private key (a signature for example), I have to implement the crypto.Signer interface to be able to "access the private key". Here is this implementation.

type RSASigner struct {
    PrivateKey p11.PrivateKey
    PublicKey  *rsa.PublicKey
}

func (s RSASigner) Public() crypto.PublicKey {
    return s.PublicKey
}

func (s RSASigner) Sign(_ io.Reader, digest []byte, _ crypto.SignerOpts) ([]byte, error) {
    return s.PrivateKey.Sign(pkcs11.Mechanism{Mechanism: pkcs11.CKM_SHA512_RSA_PKCS}, digest)
}

func NewRSASigner(privateKey p11.PrivateKey) (*RSASigner, error) {
    var (
        modulus, publicExponent []byte
        err                     error
    )

    // Retrieve modulus n from the private key
    // Reminder: n = p * q
    modulus, err = p11.Object(privateKey).Attribute(pkcs11.CKA_MODULUS)
    if err != nil {
        return nil, err
    }

    // Retrieve public exponent (e: "always" 65537) from the private key
    // Reminder: φ(n) = (p - 1) * (q - 1), e such that 1 < e < φ(n) and e and φ(n) are co prime
    publicExponent, err = p11.Object(privateKey).Attribute(pkcs11.CKA_PUBLIC_EXPONENT)
    if err != nil {
        return nil, err
    }

    // Public key is (e, n)
    publicKey := &rsa.PublicKey{
        N: new(big.Int).SetBytes(modulus),
        E: int(big.NewInt(0).SetBytes(publicExponent).Uint64()),
    }

    return &RSASigner{PrivateKey: privateKey, PublicKey: publicKey}, nil
}
```
<p>This implementation works. For example, to create a CSR, the CreateCertificateRequest function requires the private key to sign the CSR (<code>priv any</code> parameter), which is where I provide an instance of <code>RSASigner</code>.</p>
<p>The CreateCertificate function is somewhat similar, the parameter <code>pub</code> is the public key of the certificate to be generated and <code>priv</code> is the private key of the signer.</p>
<p>In the code below, I am trying to generate a self-signed X.509 certificate, so according to the API, the <code>template</code> and <code>parent</code> parameters are the same.</p>
<pre class="lang-golang prettyprint-override"><code>func (t *Token) X509(id, objectType, output string) ([]time.Duration, error) {
    startFunction := time.Now()

    var (
        keyType            int
        privateKeyTemplate []*pkcs11.Attribute
        privateKeyObject   p11.Object
        err                error
        timings            []time.Duration
        signer             *RSASigner
        cert               []byte
        file               *os.File
        writtenBytes       int
    )

    objectType = strings.ToLower(objectType)

    if objectType != "rsa" && objectType != "ec" {
        logger.Fatalf("%s: unrecognized type, it can only be equal to rsa or ec", objectType)
    }

    switch objectType {
    case "rsa":
        keyType = pkcs11.CKK_RSA
    case "ec":
        keyType = pkcs11.CKK_EC
    }

    // Creation of the template to find the private key based on the given id (PKCS #11 attribute CKA_ID)
    privateKeyTemplate = []*pkcs11.Attribute{
        pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, keyType),
        pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),
        pkcs11.NewAttribute(pkcs11.CKA_ID, id),
    }

    startFindObject := time.Now()
    privateKeyObject, err = t.session.FindObject(privateKeyTemplate)
    timings = append(timings, time.Since(startFindObject))
    if err != nil {
        return nil, err
    }

    // Creation of the X.509 certificate template
    certTemplate := &x509.Certificate{
        SerialNumber: big.NewInt(2023),
        Subject: pkix.Name{
            CommonName: "test",
        },
        SignatureAlgorithm: x509.SHA512WithRSA,
        NotBefore:          time.Now(),
        NotAfter:           time.Now().AddDate(1, 0, 0),
    }

    // Instantiate the RSASigner with the found private key object
    signer, err = NewRSASigner(p11.PrivateKey(privateKeyObject))
    if err != nil {
        return nil, err
    }

    startCreateCert := time.Now()
    cert, err = x509.CreateCertificate(rand.Reader, certTemplate, certTemplate, signer.PublicKey, signer)
    timings = append(timings, time.Since(startCreateCert))
    if err != nil {
        return nil, err
    }

    file, err = os.Create(output)
    if err != nil {
        return nil, err
    }

    writtenBytes, err = file.Write(cert)
    if err != nil {
        return nil, err
    }

    logger.Printf("Wrote %d bytes in %s", writtenBytes, output)

    return append(timings, time.Since(startFunction)), nil
}
</code>```

This function returns the following error regardless of the key type (RSA or EC).

```<code>FATA[2022-12-22 10:48:50] x509: signature over certificate returned by signer is invalid: crypto/rsa: verification error
</code>```

This error is returned if the crypto.Signer implementation was not done correctly.

I implemented crypto.Signer to try to do the same thing with a key pair on elliptic curve but the error is the same.

I also tried different hash algorithms in the Sign function but it doesn't change anything.

The error seems to come from the implementation of crypto.Signer although it works for generating a CSR.

Body:
I am trying to generate an X.509 certificate based on an RSA key pair stored in an HSM. I use this PKCS #11 implementation to communicate with my HSM.

Since my cryptographic objects are stored in the latter, if the operations I want to perform need the private key (a signature for example), I have to implement the crypto.Signer interface to be able to "access the private key". Here is this implementation.

type RSASigner struct {
    PrivateKey p11.PrivateKey
    PublicKey  *rsa.PublicKey
}

func (s RSASigner) Public() crypto.PublicKey {
    return s.PublicKey
}

func (s RSASigner) Sign(_ io.Reader, digest []byte, _ crypto.SignerOpts) ([]byte, error) {
    return s.PrivateKey.Sign(pkcs11.Mechanism{Mechanism: pkcs11.CKM_SHA512_RSA_PKCS}, digest)
}

func NewRSASigner(privateKey p11.PrivateKey) (*RSASigner, error) {
    var (
        modulus, publicExponent []byte
        err                     error
    )

    // Retrieve modulus n from the private key
    // Reminder: n = p * q
    modulus, err = p11.Object(privateKey).Attribute(pkcs11.CKA_MODULUS)
    if err != nil {
        return nil, err
    }

    // Retrieve public exponent (e: "always" 65537) from the private key
    // Reminder: φ(n) = (p - 1) * (q - 1), e such that 1 < e < φ(n) and e and φ(n) are co prime
    publicExponent, err = p11.Object(privateKey).Attribute(pkcs11.CKA_PUBLIC_EXPONENT)
    if err != nil {
        return nil, err
    }

    // Public key is (e, n)
    publicKey := &rsa.PublicKey{
        N: new(big.Int).SetBytes(modulus),
        E: int(big.NewInt(0).SetBytes(publicExponent).Uint64()),
    }

    return &RSASigner{PrivateKey: privateKey, PublicKey: publicKey}, nil
}

This implementation works. For example, to create a CSR, the CreateCertificateRequest function requires the private key to sign the CSR (priv any parameter), which is where I provide an instance of RSASigner.

The CreateCertificate function is somewhat similar, the parameter pub is the public key of the certificate to be generated and priv is the private key of the signer.

In the code below, I am trying to generate a self-signed X.509 certificate, so according to the API, the template and parent parameters are the same.

func (t *Token) X509(id, objectType, output string) ([]time.Duration, error) {
    startFunction := time.Now()

    var (
        keyType            int
        privateKeyTemplate []*pkcs11.Attribute
        privateKeyObject   p11.Object
        err                error
        timings            []time.Duration
        signer             *RSASigner
        cert               []byte
        file               *os.File
        writtenBytes       int
    )

    objectType = strings.ToLower(objectType)

    if objectType != "rsa" && objectType != "ec" {
        logger.Fatalf("%s: unrecognized type, it can only be equal to rsa or ec", objectType)
    }

    switch objectType {
    case "rsa":
        keyType = pkcs11.CKK_RSA
    case "ec":
        keyType = pkcs11.CKK_EC
    }

    // Creation of the template to find the private key based on the given id (PKCS #11 attribute CKA_ID)
    privateKeyTemplate = []*pkcs11.Attribute{
        pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, keyType),
        pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),
        pkcs11.NewAttribute(pkcs11.CKA_ID, id),
    }

    startFindObject := time.Now()
    privateKeyObject, err = t.session.FindObject(privateKeyTemplate)
    timings = append(timings, time.Since(startFindObject))
    if err != nil {
        return nil, err
    }

    // Creation of the X.509 certificate template
    certTemplate := &x509.Certificate{
        SerialNumber: big.NewInt(2023),
        Subject: pkix.Name{
            CommonName: "test",
        },
        SignatureAlgorithm: x509.SHA512WithRSA,
        NotBefore:          time.Now(),
        NotAfter:           time.Now().AddDate(1, 0, 0),
    }

    // Instantiate the RSASigner with the found private key object
    signer, err = NewRSASigner(p11.PrivateKey(privateKeyObject))
    if err != nil {
        return nil, err
    }

    startCreateCert := time.Now()
    cert, err = x509.CreateCertificate(rand.Reader, certTemplate, certTemplate, signer.PublicKey, signer)
    timings = append(timings, time.Since(startCreateCert))
    if err != nil {
        return nil, err
    }

    file, err = os.Create(output)
    if err != nil {
        return nil, err
    }

    writtenBytes, err = file.Write(cert)
    if err != nil {
        return nil, err
    }

    logger.Printf("Wrote %d bytes in %s", writtenBytes, output)

    return append(timings, time.Since(startFunction)), nil
}

This function returns the following error regardless of the key type (RSA or EC).

FATA[2022-12-22 10:48:50] x509: signature over certificate returned by signer is invalid: crypto/rsa: verification error

This error is returned if the crypto.Signer implementation was not done correctly.

I implemented crypto.Signer to try to do the same thing with a key pair on elliptic curve but the error is the same.

I also tried different hash algorithms in the Sign function but it doesn't change anything.

The error seems to come from the implementation of crypto.Signer although it works for generating a CSR.


问:
Azure Remote Tables And Entity Framework: Join two tables
I read through some answeres here, but they dont seem to apply my usecase.

I have a a few tables running on Azure Mobile Apps Backend, I can query them just fine with entity framework.
I know that I could do two queries and just join my results on client side, but Im sure there is a better way.

My issue is however, that I have a table inside my middleware, and then a dataservice with a remote model class that I use to query data from my service. This is how I would query a User by Email:

```<code>public async Task<IEnumerable<UserItem>?> GetItemByEmail(string email)
{
    await InitializeAsync();
    try
    {
        return await _table.GetAsyncItems().Where(x => x.Email == email).ToListAsync();
    }
    catch (Exception e)
    {
        return null;
    }
}
</code>```

The issue however is, that this only works on the one table (UserItemTable) which is referencend in _table.

Now there is no reference to a second table with which I wanna join.
Maybe this isnt the right place to do this inside the RemoteTable Controllers?

Any help would be appreciated.

Body:
I read through some answeres here, but they dont seem to apply my usecase.

I have a a few tables running on Azure Mobile Apps Backend, I can query them just fine with entity framework.
I know that I could do two queries and just join my results on client side, but Im sure there is a better way.

My issue is however, that I have a table inside my middleware, and then a dataservice with a remote model class that I use to query data from my service. This is how I would query a User by Email:

public async Task<IEnumerable<UserItem>?> GetItemByEmail(string email)
{
    await InitializeAsync();
    try
    {
        return await _table.GetAsyncItems().Where(x => x.Email == email).ToListAsync();
    }
    catch (Exception e)
    {
        return null;
    }
}

The issue however is, that this only works on the one table (UserItemTable) which is referencend in _table.

Now there is no reference to a second table with which I wanna join.
Maybe this isnt the right place to do this inside the RemoteTable Controllers?

Any help would be appreciated.


问:
Unable to open messaging channel in Substrate Tutorial

Replace chain-spec.rs
In Open Message Passing Channels guide, use the parachain-template.js parachain_id of 1000, 1001 respectively.

Add sudo pallet to runtime/lib.js.

```<code>impl pallet_sudo::Config for Runtime {
    type RuntimeEvent = RuntimeEvent;
    type RuntimeCall = RuntimeCall;
}

construct_time!(

    // Sudo: pallet_sudo, // or next line does not success open channel
    Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
)
</code>```

Use cargo build -release for node/src/chain-spec.rs with parachian_id = 1000 and 1001 respectively.

Start a test network with zombienet, where config.toml is configured according to the Simulate Parachains documentation.

```<code>[relaychain]
default_command = "polkadot-v0.9.32"
default_args = [ "-lparachain=debug" ]

chain = "rococo-local"

  [[relaychain.nodes]]
  name = "alice"
  validator = true
  ws_port = 9900

  [[relaychain.nodes]]
  name = "bob"
  validator = true
  ws_port = 9901

  [[relaychain.nodes]]
  name = "charlie"
  validator = true
  ws_port = 9902

  [[relaychain.nodes]]
  name = "dave"
  validator = true
  ws_port = 9903

[[parachains]]
id = 1000
cumulus_based = true

  [parachains.collator]
  name = "parachain-A-1000-collator01"
  command = "parachain-A-template-node-v0.9.32"
  ws_port = 9910

[[parachains]]
id = 1001
cumulus_based = true

  [parachains.collator]
  name = "parachain-B-1001-collator01"
  command = "parachain-B-template-node-v0.9.32"
  ws_port = 9920

[[hrmpChannels]]
sender = 1000
recipient = 1001
maxCapacity = 8
maxMessageSize = 8000

[[hrmpChannels]]
sender = 1001
recipient = 1000
maxCapacity = 8
maxMessageSize = 8000
</code>```

The question arises.
When I follow the documentation step by step, there is no hrmp.OpenChannelRequested event in the recent time of the relay chain when the transaction is submitted, and ump.ExecutedUpward shows incomplete.

Parachain 1000 XCM Parameter 1:

Parachain 1000 XCM Parameter 2:

Relaychain Error:

Parachain Event:

I followed the steps above and am not sure what step was missed that caused the error in step 5 to occur.

Body:
Replace chain-spec.rs
In Open Message Passing Channels guide, use the parachain-template.js parachain_id of 1000, 1001 respectively.

Add sudo pallet to runtime/lib.js.

impl pallet_sudo::Config for Runtime {
    type RuntimeEvent = RuntimeEvent;
    type RuntimeCall = RuntimeCall;
}

construct_time!(

    // Sudo: pallet_sudo, // or next line does not success open channel
    Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
)

Use cargo build -release for node/src/chain-spec.rs with parachian_id = 1000 and 1001 respectively.

Start a test network with zombienet, where config.toml is configured according to the Simulate Parachains documentation.

[relaychain]
default_command = "polkadot-v0.9.32"
default_args = [ "-lparachain=debug" ]

chain = "rococo-local"

  [[relaychain.nodes]]
  name = "alice"
  validator = true
  ws_port = 9900

  [[relaychain.nodes]]
  name = "bob"
  validator = true
  ws_port = 9901

  [[relaychain.nodes]]
  name = "charlie"
  validator = true
  ws_port = 9902

  [[relaychain.nodes]]
  name = "dave"
  validator = true
  ws_port = 9903

[[parachains]]
id = 1000
cumulus_based = true

  [parachains.collator]
  name = "parachain-A-1000-collator01"
  command = "parachain-A-template-node-v0.9.32"
  ws_port = 9910

[[parachains]]
id = 1001
cumulus_based = true

  [parachains.collator]
  name = "parachain-B-1001-collator01"
  command = "parachain-B-template-node-v0.9.32"
  ws_port = 9920

[[hrmpChannels]]
sender = 1000
recipient = 1001
maxCapacity = 8
maxMessageSize = 8000

[[hrmpChannels]]
sender = 1001
recipient = 1000
maxCapacity = 8
maxMessageSize = 8000

The question arises.
When I follow the documentation step by step, there is no hrmp.OpenChannelRequested event in the recent time of the relay chain when the transaction is submitted, and ump.ExecutedUpward shows incomplete.

Parachain 1000 XCM Parameter 1:

Parachain 1000 XCM Parameter 2:

Relaychain Error:

Parachain Event:

I followed the steps above and am not sure what step was missed that caused the error in step 5 to occur.


问:
dynamic time warping length limit
I have a sequence of 15 values.
I am looking for the 50 most similar sequences in my time series.
She expressed that DTW finds sequences too short 3-6 values.
Is it possible to limit the k best matches sequences to a minimum of 8 values?
If it is relevant, I enter a sequence of 3 different values (multi-variant).

from dtaidistance.subsequence.dtw import subsequence_alignment
sa = subsequence_alignment(query, series)
best = sa.kbest_matches(50)
```

Title: dynamic time warping length limit


问:
Why doesn't this script also process the subfolders when it should?
I want to move all folders as well as subfolders and files in the subfolders from dir 1 to dir 2 in SharePoint Online via PowerShell. The script already moves all files from the main directory of dir 1 (/sites/customer/shared documents/dir 1) to the main directory of dir 2 (/sites/customer/shared documents/dir 2). But somehow it doesn't move files from subfolders like "/sites/customer/shared documents/dir 1/sub 1".

```<code>#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

Function Move-SPOFilesBetweenFolders
{
  param
    (
        [Parameter(Mandatory=$true)] [string] $SiteURL,
        [Parameter(Mandatory=$true)] [Microsoft.SharePoint.Client.Folder] $SourceFolder,
        [Parameter(Mandatory=$true)] [Microsoft.SharePoint.Client.Folder] $TargetFolder
    )
    Try {
        #Write-host "Copying Files from '$($SourceFolder.ServerRelativeUrl)' to '$($TargetFolder.ServerRelativeUrl)'"
        #Get all Files from the source folder
        $SourceFilesColl = $SourceFolder.Files
        $Ctx.Load($SourceFilesColl)
        $Ctx.ExecuteQuery()

        #Iterate through each file and move
        Foreach($SourceFile in $SourceFilesColl)
        {
            #Get all files from source Folder
            $SourceFile =$Ctx.Web.GetFileByServerRelativeUrl($SourceFile.ServerRelativeUrl)
            $Ctx.Load($SourceFile)
            $Ctx.ExecuteQuery()

            $TargetFileUrl = $SourceFile.ServerRelativeUrl -Replace $SourceFolderURL,$TargetFolderURL

            Try {
                #Move File to destination
                $SourceFile.MoveTo($TargetFileUrl, [Microsoft.SharePoint.Client.MoveOperations]::None)
                $Ctx.ExecuteQuery()
                Write-host -f Green "File Moved to: "$TargetFileURL
                }
            catch {
                Write-host -f Red "File already exists: "$TargetFileURL
                }
        }

        #Process Sub Folders
        $SubFolders = $SourceFolder.Folders
        $Ctx.Load($SubFolders)
        $Ctx.ExecuteQuery()
        Foreach($SubFolder in $SubFolders)
        {
            If($SubFolder.Name -ne "Forms")
            {
                #Prepare Target Folder
                $EnsureFolderURL = $SubFolder.ServerRelativeUrl -Replace $SourceFolderUrl, $TargetFolderUrl
                Try {
                        $Folder=$Ctx.web.GetFolderByServerRelativeUrl($EnsureFolderURL)
                        $Ctx.load($Folder)
                        $Ctx.ExecuteQuery()
                    }
                catch {
                        #Create Folder
                        if(!$Folder.Exists)
                        {
                            $Folder=$Ctx.Web.Folders.Add($EnsureFolderURL)
                            $Ctx.Load($Folder)
                            $Ctx.ExecuteQuery()
                            Write-host "New Folder Created:"$SubFolder.Name -f Yellow
                        }
                    }
                #Call the function recursively to move all files from source folder to target
                Move-SPOFilesBetweenFolders -SiteURL $SiteURL -SourceFolder $SubFolder -TargetFolder $Folder

                #Remove the Source Folder
                $SubFolder.Recycle() | Out-Null
                $Ctx.ExecuteQuery()
            }
        }
    }
    Catch {
        write-host -f Red "Error Moving File:" $_.Exception.Message
    }
}

#Set Parameter values
$SiteURL="https://company.sharepoint.com/sites/customer"
$SourceFolderURL ="/sites/customer/shared documents/dir 1"
$TargetFolderURL ="/sites/customer/shared documents/dir 2"

#Setup Credentials to connect
$Cred= Get-Credential

#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

#Get the source and Target Folders
$SourceFolder=$Ctx.Web.GetFolderByServerRelativeUrl($SourceFolderURL)
$Ctx.Load($SourceFolder)
$TargetFolder=$Ctx.Web.GetFolderByServerRelativeUrl($TargetFolderURL)
$Ctx.Load($TargetFolder)
$Ctx.ExecuteQuery()

#Call the function
Move-SPOFilesBetweenFolders -SiteURL $SiteURL -SourceFolder $SourceFolder -TargetFolder $TargetFolder
</code>```

Only files from the main directory /sites/customer/shared documents/dir 1 have been moved to /sites/customer/shared documents/dir 2. The script should also include subfolders and their files.

Body:
I want to move all folders as well as subfolders and files in the subfolders from dir 1 to dir 2 in SharePoint Online via PowerShell. The script already moves all files from the main directory of dir 1 (/sites/customer/shared documents/dir 1) to the main directory of dir 2 (/sites/customer/shared documents/dir 2). But somehow it doesn't move files from subfolders like "/sites/customer/shared documents/dir 1/sub 1".

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

Function Move-SPOFilesBetweenFolders
{
  param
    (
        [Parameter(Mandatory=$true)] [string] $SiteURL,
        [Parameter(Mandatory=$true)] [Microsoft.SharePoint.Client.Folder] $SourceFolder,
        [Parameter(Mandatory=$true)] [Microsoft.SharePoint.Client.Folder] $TargetFolder
    )
    Try {
        #Write-host "Copying Files from '$($SourceFolder.ServerRelativeUrl)' to '$($TargetFolder.ServerRelativeUrl)'"
        #Get all Files from the source folder
        $SourceFilesColl = $SourceFolder.Files
        $Ctx.Load($SourceFilesColl)
        $Ctx.ExecuteQuery()

        #Iterate through each file and move
        Foreach($SourceFile in $SourceFilesColl)
        {
            #Get all files from source Folder
            $SourceFile =$Ctx.Web.GetFileByServerRelativeUrl($SourceFile.ServerRelativeUrl)
            $Ctx.Load($SourceFile)
            $Ctx.ExecuteQuery()

            $TargetFileUrl = $SourceFile.ServerRelativeUrl -Replace $SourceFolderURL,$TargetFolderURL

            Try {
                #Move File to destination
                $SourceFile.MoveTo($TargetFileUrl, [Microsoft.SharePoint.Client.MoveOperations]::None)
                $Ctx.ExecuteQuery()
                Write-host -f Green "File Moved to: "$TargetFileURL
                }
            catch {
                Write-host -f Red "File already exists: "$TargetFileURL
                }
        }

        #Process Sub Folders
        $SubFolders = $SourceFolder.Folders
        $Ctx.Load($SubFolders)
        $Ctx.ExecuteQuery()
        Foreach($SubFolder in $SubFolders)
        {
            If($SubFolder.Name -ne "Forms")
            {
                #Prepare Target Folder
                $EnsureFolderURL = $SubFolder.ServerRelativeUrl -Replace $SourceFolderUrl, $TargetFolderUrl
                Try {
                        $Folder=$Ctx.web.GetFolderByServerRelativeUrl($EnsureFolderURL)
                        $Ctx.load($Folder)
                        $Ctx.ExecuteQuery()
                    }
                catch {
                        #Create Folder
                        if(!$Folder.Exists)
                        {
                            $Folder=$Ctx.Web.Folders.Add($EnsureFolderURL)
                            $Ctx.Load($Folder)
                            $Ctx.ExecuteQuery()
                            Write-host "New Folder Created:"$SubFolder.Name -f Yellow
                        }
                    }
                #Call the function recursively to move all files from source folder to target
                Move-SPOFilesBetweenFolders -SiteURL $SiteURL -SourceFolder $SubFolder -TargetFolder $Folder

                #Remove the Source Folder
                $SubFolder.Recycle() | Out-Null
                $Ctx.ExecuteQuery()
            }
        }
    }
    Catch {
        write-host -f Red "Error Moving File:" $_.Exception.Message
    }
}

#Set Parameter values
$SiteURL="https://company.sharepoint.com/sites/customer"
$SourceFolderURL ="/sites/customer/shared documents/dir 1"
$TargetFolderURL ="/sites/customer/shared documents/dir 2"

#Setup Credentials to connect
$Cred= Get-Credential

#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

#Get the source and Target Folders
$SourceFolder=$Ctx.Web.GetFolderByServerRelativeUrl($SourceFolderURL)
$Ctx.Load($SourceFolder)
$TargetFolder=$Ctx.Web.GetFolderByServerRelativeUrl($TargetFolderURL)
$Ctx.Load($TargetFolder)
$Ctx.ExecuteQuery()

#Call the function
Move-SPOFilesBetweenFolders -SiteURL $SiteURL -SourceFolder $SourceFolder -TargetFolder $TargetFolder

Only files from the main directory /sites/customer/shared documents/dir 1 have been moved to /sites/customer/shared documents/dir 2. The script should also include subfolders and their files.


问:
how to add delete and update buttons with functionality in vuejs + php/laravel
I have to add delete and update buttons for every table elements.

I tried adding the delete icon by using mdi-icons

but its not in every elements of the table.

So how can solve this problem with this code? Any suggestions for solving my problem inside the current code structure? Also share the best way to achieve my goal is acceptable.

This is my template view

```<code><template>
  <div>
    <v-form>

      <div class="align-center justify-space-between " style="display: flex;">
        <v-text-field label="name" v-model="name" placeholder="Your name" required outlined></v-text-field>
        <v-text-field label="address" v-model="address" placeholder="address" required outlined></v-text-field>
        <v-text-field label="contact" v-model="contact" placeholder="contact" required outlined></v-text-field>
      </div>
      <v-btn type="submit" value="submit" @click="onSubmit" class="black--text">
        {{ btnName }}
      </v-btn>
    </v-form>
    <v-container>
      <template>
        <v-data-table :headers="headers" :items="allStudents" :items-per-page="10" class="elevation-1"></v-data-table>
      </template>
    </v-container>
  </div>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'
export default {
  name: "AboutView",
  data() {
    return {
      btnName: "Save",

      name: '',
      address: '',
      contact: '',

      headers: [
        {
          text: 'Name',
          value: 'name',
        },
        { text: 'Contact', value: 'contact' },
        { text: 'Address', value: 'address' }
      ],
    };
  },
  methods: {
    ...mapActions(["addStudents", "fetchStudents"]),
    onSubmit(event) {
      event.preventDefault();
      let data = {
        name: this.name,
        address: this.address,
        contact: this.contact,
      }
      this.addStudents(data);
    }
  },
  computed: mapGetters(["allStudents"]),
  created() {
    this.fetchStudents();
  }
};
</script>
</code>```

this is my vuex code

```<code>import Axios from "axios";

const state = {
  students: [],
};
const getters = {
  allStudents: (state) => {
    return state.students;
  },
};
const actions = {
  async addStudents({ commit }, payload = {}) {
    console.log("mypayload", payload);
    const response = await Axios.post(
      "http://127.0.0.1:8000/api/students",
      payload
    );
    commit("addStudents", response.data);
  },
  async fetchStudents({ commit }) {
    const response = await Axios.get("http://127.0.0.1:8000/api/students");
    commit("fetchStudents", response.data);
  },
};
const mutations = {
  addStudents: (state, newStudent) => state.students.unshift(newStudent),
  fetchStudents: (state, students) => (state.students = students),
};
export default {
  state,
  getters,
  actions,
  mutations,
};
</code>```

Body:
I have to add delete and update buttons for every table elements.

I tried adding the delete icon by using mdi-icons

but its not in every elements of the table.

So how can solve this problem with this code? Any suggestions for solving my problem inside the current code structure? Also share the best way to achieve my goal is acceptable.

This is my template view

<template>

    <v-form>

        <v-text-field label="name" v-model="name" placeholder="Your name" required outlined></v-text-field>
        <v-text-field label="address" v-model="address" placeholder="address" required outlined></v-text-field>
        <v-text-field label="contact" v-model="contact" placeholder="contact" required outlined></v-text-field>

      <v-btn type="submit" value="submit" @click="onSubmit" class="black--text">
        {{ btnName }}
      </v-btn>
    </v-form>
    <v-container>
      <template>
        <v-data-table :headers="headers" :items="allStudents" :items-per-page="10" class="elevation-1"></v-data-table>
      </template>
    </v-container>

</template>

this is my vuex code

import Axios from "axios";

const state = {
  students: [],
};
const getters = {
  allStudents: (state) => {
    return state.students;
  },
};
const actions = {
  async addStudents({ commit }, payload = {}) {
    console.log("mypayload", payload);
    const response = await Axios.post(
      "http://127.0.0.1:8000/api/students",
      payload
    );
    commit("addStudents", response.data);
  },
  async fetchStudents({ commit }) {
    const response = await Axios.get("http://127.0.0.1:8000/api/students");
    commit("fetchStudents", response.data);
  },
};
const mutations = {
  addStudents: (state, newStudent) => state.students.unshift(newStudent),
  fetchStudents: (state, students) => (state.students = students),
};
export default {
  state,
  getters,
  actions,
  mutations,
};


问:
How to provide mobile app access to view the App located in different tenant?
The provider has created Power BI report, and added it into an app.

I am added as a guest user to the provider's Azure Tenant.

The app has been published and my account (guest account) has been given appropriate permissions.

I can access the app via link in the browser.

How do I access this app via the Power BI mobile app?


问:
Errors in Xcode, impossible to launch my application React Native in my iPad
I have these errors on Xcode. I have already tried to replace JWTStringCoderProtocol by JWTStringCoder__Protocol in the concerned file but it didn't change anything. Same when I wanted to comment out the lines containing JWTClaimsSetCoordinatorProtocol.
Do you know where the problem comes from?

errors in Xcode


问:
I am trying to use use allOf in backstage template file
I want to put conditional check on multiple attributes . Looks like allOf is the way to do it. I was able to successfully use oneOf in backstage template. Somehow allOf is not working for me.

I want to use allOf in backstage template so that I could put a condition on multiple attributes while building user form.


问:
C#: Strange SSE calling convention for Vector3 and Vector4 on x86-64
While playing around with the Vector# classes from System.Numerics, I noticed some very strange code generation occurring specifically with Vector3 and Vector4: Godbolt link.

When float or Vector2 is used as an argument or return type, the value is passed directly in the lower 32/64 bits of an SSE register, as I would expect. However, when using Vector3 or Vector4, it seems that the value is being split across two SSE registers, without storing more than 2 float components per register and using shuffles+moves to assemble/disassemble the components into/from a single register. (In the case of Vector3, it also left- and right-shifts the whole vector in order to zero out the unused component).

What's the reasoning behind this? The only thing I can think of is that whatever calling convention is being used only allows passing individual float/double values in SSE registers, and that this is being worked around by packing two floats as a "double". However, this doesn't seems to coincide with either the Microsoft x64 convention (which passes single floats/doubles in SSE registers, but requires that __m128 values be passed as a pointer) or __vectorcall (which would allow the full __m128 value to be passed in a register without requiring it to be broken up). It would seem that the System V AMD64 ABI allows passing an __m128 in a single SSE register. Is this some non-standard calling convention that C# uses internally, is it using the System V ABI and interpreting Vector3/4 as a union rather than __m128, or what's going on here?


问:
angularjs : ng-pattern-restrict doesn't work with custom directive
i have a custom-directive for inputs, this is the code:

```<code>moduloDirettive.directive('inputDir',function () {
    return {
        restrict : 'EA',
        transclude : 'true',
        replace: true,
        scope : {
            collectorId : '@',
            label : '@',
            model : '=',
            disable : '=?',
            placeholder : '@',
            formName : '=',
            help : '@',
            type : '@',
            change : '&',
            min : '=',
            max : '=',
            fieldName : '@',
            config : '=',
            required : '=',
            tooltip: '=',
            pattern : '=ngPattern',
        },
        templateUrl : currentScriptPath + 'input.html',
        link : function (scope, elm, attrs, ngModelCtrl) {
            if (scope.config) {
                scope.class = scope.config.class;
                scope.type = scope.config.type;
            }

            scope.onChange = function () {
                setTimeout(scope.change, 0);
            }

        },
        controller: ['$scope', '$labelRegistrationDirFactory', function($scope, $labelRegistrationDirFactory){
            if ($scope.label && $scope.label != '' && $scope.collectorId && $scope.collectorId != '') {
                $labelRegistrationDirFactory.register($scope.collectorId,  $scope.fieldName, $scope.label);
            }

        }]
    };
});
</code>```

however, when i try to add ng-pattern-restrict, it doesn't work:

```<code><input-dir label="{{translate('commons.annoProcedura')}}" collector-id="nuovaInserzioneErrors"
                    required="!isPegnoNonPossessorio()" form-name="form" field-name="annoProcedura" model="anno.value"
                       ng-pattern-restrict={{validation.REGEX_YEAR_PROGRESSIVE}}></input-dir>
</code>```

The regex works properly, as when i use the normal input tag it does what's intented, i.e. only making me input a year date.

How do i make the ng-pattern-restrict work with my custom directive? Or alternatively, can i achieve this with ng-change? Thank you.

Body:
i have a custom-directive for inputs, this is the code:

moduloDirettive.directive('inputDir',function () {
    return {
        restrict : 'EA',
        transclude : 'true',
        replace: true,
        scope : {
            collectorId : '@',
            label : '@',
            model : '=',
            disable : '=?',
            placeholder : '@',
            formName : '=',
            help : '@',
            type : '@',
            change : '&',
            min : '=',
            max : '=',
            fieldName : '@',
            config : '=',
            required : '=',
            tooltip: '=',
            pattern : '=ngPattern',
        },
        templateUrl : currentScriptPath + 'input.html',
        link : function (scope, elm, attrs, ngModelCtrl) {
            if (scope.config) {
                scope.class = scope.config.class;
                scope.type = scope.config.type;
            }

            scope.onChange = function () {
                setTimeout(scope.change, 0);
            }

        },
        controller: ['$scope', '$labelRegistrationDirFactory', function($scope, $labelRegistrationDirFactory){
            if ($scope.label && $scope.label != '' && $scope.collectorId && $scope.collectorId != '') {
                $labelRegistrationDirFactory.register($scope.collectorId,  $scope.fieldName, $scope.label);
            }

        }]
    };
});

however, when i try to add ng-pattern-restrict, it doesn't work:

<input-dir label="{{translate('commons.annoProcedura')}}" collector-id="nuovaInserzioneErrors"
                    required="!isPegnoNonPossessorio()" form-name="form" field-name="annoProcedura" model="anno.value"
                       ng-pattern-restrict={{validation.REGEX_YEAR_PROGRESSIVE}}></input-dir>

The regex works properly, as when i use the normal input tag it does what's intented, i.e. only making me input a year date.

How do i make the ng-pattern-restrict work with my custom directive? Or alternatively, can i achieve this with ng-change? Thank you.