问:
pass a template with N parameters, as a template parameter, specified with N-1 parameters
I have template class A1 which takes a template template parameter T.

Also, I have a class, like A2 which not satisfy template template parameter of A1, but with help of using can satisfy it.

So, the question is, can I inline apply an adapted A2 to A1? I mean something like commented out lines.

As you can see, it is not crucial, because I already handle it, but I just ask.

```<code>template<template<int A, char B> typename T>
class A1 /* : public T<5, 'a'> */ {};

template<int A, char B, bool C> class A2{};

template<int A, char B, typename D> class A4{};

template<int A, char B>
using A3 = A2<A, B, true>;

template<int A, char B, bool C = true> class A5{};

int main()
{
    A1<A3> a;
    A1<A5> b;

    // Avoid name pollution (or other reason)
//  A1<A2<_,_,false>> c;
//  A1<A4<_,_,int>> d;
    return 0;
}
</code>```

答:
If you would be fine with writing this:

```<code>A1< Add_true<A2>::type > c;
</code>```

Then you are almost there:

```<code>template<int A, char B>
using A3 = A2<A, B, true>;
</code>```

Instead of writing the template explicitly you can write a template that "uses" the desired template:

```<code>template< template <int A,char B,bool> typename T>
struct Add_true {
    template <int A,char B> using type = T<A,B,true>;
};
</code>```

Live example

I think it should be straightforward to turn that into a Add_bool that lets you add either true or false. I never experimented with variadic template template parameters, but I think it would be fun to extend this to "bind" arbitrary template parameters.

PS It never occured to me that binding template parameters is that simple. Thank you for the question :)

PPS If your question was actually to bind true without any other helper type / function, then to my knowledge that is not possible.

Body:
I have template class A1 which takes a template template parameter T.

Also, I have a class, like A2 which not satisfy template template parameter of A1, but with help of using can satisfy it.

So, the question is, can I inline apply an adapted A2 to A1? I mean something like commented out lines.

As you can see, it is not crucial, because I already handle it, but I just ask.

template<template<int A, char B> typename T>
class A1 /* : public T<5, 'a'> */ {};

template<int A, char B, bool C> class A2{};

template<int A, char B, typename D> class A4{};

template<int A, char B>
using A3 = A2;

template<int A, char B, bool C = true> class A5{};

int main()
{
    A1<A3> a;
    A1<A5> b;

    // Avoid name pollution (or other reason)
//  A1<A2<_,_,false>> c;
//  A1<A4<_,_,int>> d;
    return 0;
}

Body:
If you would be fine with writing this:

A1< Add_true<A2>::type > c;

Then you are almost there:

template<int A, char B>
using A3 = A2<A, B, true>;

Instead of writing the template explicitly you can write a template that "uses" the desired template:

template< template <int A,char B,bool> typename T>
struct Add_true {
    template <int A,char B> using type = T<A,B,true>;
};

Live example

I think it should be straightforward to turn that into a Add_bool that lets you add either true or false. I never experimented with variadic template template parameters, but I think it would be fun to extend this to "bind" arbitrary template parameters.

PS It never occured to me that binding template parameters is that simple. Thank you for the question :)

PPS If your question was actually to bind true without any other helper type / function, then to my knowledge that is not possible.


来源: stackexchange

问:
Is it possible to federate Azure Active Directory using Google Cloud Identity with SAML SSO?
I know that it is possible to do this without SAML by using B2B SSO.

However I'd like to know if there's the possibility to sign on to azure ad using google but with SAML SSO.

答: According to the following GCP document click here , you are able to federating Azure Active Directory using Google Cloud Identity with SAML SSO. For detailed information regarding the configuration please follow the above mentioned link.</p>

ContentLicense: CC BY-SA 4.0


问:
Configuring CORS with Grails 3 and Spring Security REST
I'm trying to figure out how to plug an Angular 2 frontend (running on localhost:4200) into a Grails 3 backend (running on localhost:8080) so I need to enable CORS support in the grails app.

I found this Github project (https://github.com/appcela/grails3-cors-interceptor-spring-security-rest-sample-app) that shows how to enable CORS using the grails3-cors-interceptor plugin. I'm running this very application as a test backend and I'm putting a breakpoint in CorsService.processPreflight() to check when it's called. And when I do a GET on /api/books, the browser sends an OPTIONS call first that goes through the breakpoint, but the following GET doesn't seem to go there and I can't figure out why. Any idea?

答:
With the latest version of Grails 3 you just need to enable CORS if your running your applications locally grails run-app. My version is Grails Version: 3.3.10.
Groovy grails.cors.enabled=true

ContentLicense: CC BY-SA 3.0


问:
Knockoutjs not updating UI when programmatically updating an observable
Why is the dropdown not updating when I programmatically update the observable and open the modal? Here is all the code
https://jsfiddle.net/krob636/jes9bvLw/119/

Changing the observable updates the dropdown if I try changing the element's value first. Click Launch modal button then click the Observable button. The selected id changes but not the dropdown. Now click the Element button, then click Observable button again. The dropdown does change.

Javascript

```<code>this.selectedSimulators = ko.observableArray().extend({notify: 'always'});

this.simulators = ko.observableArray([
  new Simulator(1, 1, 1, "CH-53E", "APT", "APT 2F190-2"),
  new Simulator(2, 1, 1, "CH-53E", "EAET", "EAET 2H164-2"),
  new Simulator(3, 1, 1, "CH-53E", "WST", "WST 2F174-2")
]);

this.openModal = function() {
  $('#exampleModal').modal('show');
  this.selectedSimulators(1);

  // UI does not update without calling this
 //$("#ddSims").val(1);
}
</code>```

HTML

```<code>  <select class="form-control" id="ddSims" multiple="multiple" data-bind="options: simulators,
      optionsText: 'typeAndSerialNumber',
      optionsValue: 'id',
      selectedOptions: selectedSimulators,
      multiselect: {includeSelectAllOption: true}">
 </select>

 <button type="button" class="btn btn-primary" data-bind="event: {click: openModal}">
    Launch modal
  </button>
</code>```

答: You're mixing observables and observableArrays. selectedSimulators is an array, but then you're setting it to a value of 1 instead of pushing a value of 1 to the array. Try self.selectedSimulators.push(1); instead.

Body:
Why is the dropdown not updating when I programmatically update the observable and open the modal? Here is all the code
https://jsfiddle.net/krob636/jes9bvLw/119/

Changing the observable updates the dropdown if I try changing the element's value first. Click Launch modal button then click the Observable button. The selected id changes but not the dropdown. Now click the Element button, then click Observable button again. The dropdown does change.

Javascript

this.selectedSimulators = ko.observableArray().extend({notify: 'always'});

this.simulators = ko.observableArray([
  new Simulator(1, 1, 1, "CH-53E", "APT", "APT 2F190-2"),
  new Simulator(2, 1, 1, "CH-53E", "EAET", "EAET 2H164-2"),
  new Simulator(3, 1, 1, "CH-53E", "WST", "WST 2F174-2")
]);

this.openModal = function() {
  $('#exampleModal').modal('show');
  this.selectedSimulators(1);

  // UI does not update without calling this
 //$("#ddSims").val(1);
}

HTML

  <select class="form-control" id="ddSims" multiple="multiple" data-bind="options: simulators,
      optionsText: 'typeAndSerialNumber',
      optionsValue: 'id',
      selectedOptions: selectedSimulators,
      multiselect: {includeSelectAllOption: true}">
 </select>

 <button type="button" class="btn btn-primary" data-bind="event: {click: openModal}">
    Launch modal
  </button>


问:
Wait 5 seconds before executing next line
This function below doesn’t work like I want it to; being a JS novice I can’t figure out why.

I need it to wait 5 seconds before checking whether the newState is -1.

Currently, it doesn’t wait, it just checks straight away.

```<code>function stateChange(newState) {
  setTimeout('', 5000);

  if(newState == -1) {
    alert('VIDEO HAS STOPPED');
  }
}
</code>```

答:
This solution comes from React Native's documentation for a refresh control:

```<code>function wait(timeout) {
    return new Promise(resolve => {
        setTimeout(resolve, timeout);
    });
}
</code>```

To apply this to the OP's question, you could use this function in coordination with await:

```<code>await wait(5000);
if (newState == -1) {
    alert('Done');
}
</code>```

Body:
This function below doesn’t work like I want it to; being a JS novice I can’t figure out why.

I need it to wait 5 seconds before checking whether the newState is -1.

Currently, it doesn’t wait, it just checks straight away.

function stateChange(newState) {
  setTimeout('', 5000);

  if(newState == -1) {
    alert('VIDEO HAS STOPPED');
  }
}

Body:
This solution comes from React Native's documentation for a refresh control:

function wait(timeout) {
    return new Promise(resolve => {
        setTimeout(resolve, timeout);
    });
}

To apply this to the OP's question, you could use this function in coordination with await:

await wait(5000);
if (newState == -1) {
    alert('Done');
}


问:
Getting error when deploying a Google Cloud Function after Node upgrade
I updated Brew then updated Node from 10.12.0 -> 13.8.0

Now, I get the following error when trying to deploy a Google Cloud Function

```<code>firebase deploy --only functions:createJWT
</code>```

i  functions: preparing functions directory for
  uploading...

Error: Error parsing triggers: Failed to load gRPC binary module
  because it was not installed for the current system Expected
  directory: node-v79-darwin-x64-unknown Found:
  [node-v64-darwin-x64-unknown] This problem can often be fixed by
  running "npm rebuild" on the current system Original error: Cannot
  find module
  '/Users/.../cloud-functions/functions/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown/grpc_node.node'
  Require stack:
  - /Users/.../cloud-functions/functions/node_modules/grpc/src/grpc_extension.js
  - /Users/.../cloud-functions/functions/node_modules/grpc/src/client_interceptors.js
  - /Users/.../cloud-functions/functions/node_modules/grpc/src/client.js
  - /Users/.../cloud-functions/functions/node_modules/grpc/index.js
  - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/service.js
  - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/operation.js
  - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/index.js
  - /Users/.../cloud-functions/functions/node_modules/@google-cloud/logging/src/index.js
  - /Users/.../cloud-functions/functions/index.js
  - /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js

Try running "npm install" in your functions directory before
  deploying.

Tried npm rebuild and npm install in my functions directory and nothing works

Furthermore...could this issue be due to the fact that GCF Node runtime enviroment is Node10 and I have installed Node13 on my machine? - according to these docs:

https://cloud.google.com/functions/docs/concepts/nodejs-10-runtime

I am struggling to revert back to Node10, have tried by running brew install node@10 and get this:

Then tried running the following command as per output above to symlink it to /usr/local but still no luck

```<code>echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bash_profile
</code>```

答: Trying to deploy to an unsupported Google Function execution environment won't work. According to the google docs the current supported environments are Node8 and Node10(beta), re-installing Node10 worked for me.

Body:
I updated Brew then updated Node from 10.12.0 -> 13.8.0

Now, I get the following error when trying to deploy a Google Cloud Function

firebase deploy --only functions:createJWT

i  functions: preparing functions directory for
  uploading...

Error: Error parsing triggers: Failed to load gRPC binary module
  because it was not installed for the current system Expected
  directory: node-v79-darwin-x64-unknown Found:
  [node-v64-darwin-x64-unknown] This problem can often be fixed by
  running "npm rebuild" on the current system Original error: Cannot
  find module
  '/Users/.../cloud-functions/functions/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown/grpc_node.node'
  Require stack:
  - /Users/.../cloud-functions/functions/node_modules/grpc/src/grpc_extension.js
  - /Users/.../cloud-functions/functions/node_modules/grpc/src/client_interceptors.js
  - /Users/.../cloud-functions/functions/node_modules/grpc/src/client.js
  - /Users/.../cloud-functions/functions/node_modules/grpc/index.js
  - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/service.js
  - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/operation.js
  - /Users/.../cloud-functions/functions/node_modules/@google-cloud/common-grpc/src/index.js
  - /Users/.../cloud-functions/functions/node_modules/@google-cloud/logging/src/index.js
  - /Users/.../cloud-functions/functions/index.js
  - /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js

Try running "npm install" in your functions directory before
  deploying.

Tried npm rebuild and npm install in my functions directory and nothing works

Furthermore...could this issue be due to the fact that GCF Node runtime enviroment is Node10 and I have installed Node13 on my machine? - according to these docs:

https://cloud.google.com/functions/docs/concepts/nodejs-10-runtime

I am struggling to revert back to Node10, have tried by running brew install node@10 and get this:

Then tried running the following command as per output above to symlink it to /usr/local but still no luck

echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bash_profile


问:
JAXB annotation for class hierarchy
Hey,
I have 2 classes.
When I'm trying to create an XML structure from them, I only get the root element (A).
Why? Am I using wrong annotations?</p>

```<code>@XmlRootElement(name = "a")
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class A{
    @XmlElement
    int a;

    protected A(){
    }
 }

@XmlAccessorType(XmlAccessType.FIELD)
public class B extends A{
    @XmlElement
    int b;

    protected B(){
    }
}
</code>```

答:
You probably need to use @XmlSeeAlso annotation in your top class:

```<code>@XmlSeeAlso(B.class)
@XmlRootElement(name = "a")
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class A{
</code>```

I wrote 'probably', because it depends on how do you set up your JAXB context. Basically you need to make sure all the classes which are supposed to be serialized are known to JAXB. If your B class is not mentioned anywhere else (e.g. as a property type of one of classes which
are already known to JAXB), then JAXB has no chance to know how to serialize instances of B. The intention of @XmlSeeAlso annotation is to make sure JAXB looks into these listed classes too.

UPDATE:

Alternatively you can provide the list of all the subclasses when creating the JAXBContext object using JAXBContext.newInstance(Class...), e.g.:

```<code>   JAXBContext.newInstance(A.class, B.class);
</code>```

instead of

```<code>   JAXBContext.newInstance(A.class);
</code>```

which you probably already do.

But my opinion this is a worse solution, because it makes you think of related classes every time you use JAXB in your code. In the top solution you set the relations once forever.

Title: JAXB annotation for class hierarchy

Body:
Hey,
I have 2 classes.
When I'm trying to create an XML structure from them, I only get the root element (A).
Why? Am I using wrong annotations?

@XmlRootElement(name = "a")
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class A{
    @XmlElement
    int a;

    protected A(){
    }
 }

@XmlAccessorType(XmlAccessType.FIELD)
public class B extends A{
    @XmlElement
    int b;

    protected B(){
    }
}

Body:
You probably need to use @XmlSeeAlso annotation in your top class:

@XmlSeeAlso(B.class)
@XmlRootElement(name = "a")
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class A{

I wrote 'probably', because it depends on how do you set up your JAXB context. Basically you need to make sure all the classes which are supposed to be serialized are known to JAXB. If your B class is not mentioned anywhere else (e.g. as a property type of one of classes which
are already known to JAXB), then JAXB has no chance to know how to serialize instances of B. The intention of @XmlSeeAlso annotation is to make sure JAXB looks into these listed classes too.

UPDATE:

Alternatively you can provide the list of all the subclasses when creating the JAXBContext object using JAXBContext.newInstance(Class...), e.g.:

   JAXBContext.newInstance(A.class, B.class);

instead of

   JAXBContext.newInstance(A.class);

which you probably already do.

But my opinion this is a worse solution, because it makes you think of related classes every time you use JAXB in your code. In the top solution you set the relations once forever.


问:
Laravel ,in bladeview count with groupBy
I have this in my blade

```<code>{{$apartment -> messages() -> count()}}
</code>```

This gives me back the total of messages relating to an apartment. However, I would like the count to be differentiated according to the "created_at", for example with groupBy and then return the total for each date. Is it possible to do this?

答:
You may do this by Laravel query builder either this way:

$apartment->messages()
    ->selectRaw('count(*) as count, date(created_at) as created_date')
    ->groupBy('created_date')
    ->get()
```

<p>Or:</p>

<pre class="lang-php prettyprint-override"><code>use Illuminate\Support\Facades\DB;

$apartment->messages()
    ->selectRaw('count(*) as count')
    ->groupBy(DB::raw('date(created_at)'))
    ->get()
</code>```

Body:
I have this in my blade

{{$apartment -> messages() -> count()}}

This gives me back the total of messages relating to an apartment. However, I would like the count to be differentiated according to the "created_at", for example with groupBy and then return the total for each date. Is it possible to do this?

Body:
You may do this by Laravel query builder either this way:

$apartment->messages()
    ->selectRaw('count(*) as count, date(created_at) as created_date')
    ->groupBy('created_date')
    ->get()

Or:

use Illuminate\Support\Facades\DB;

$apartment->messages()
    ->selectRaw('count(*) as count')
    ->groupBy(DB::raw('date(created_at)'))
    ->get()


问:
Loop to match & paste to another sheet
I have two sheets in one workbook. One sheet ("Data") has data. The data is the Name (column C), and 4 columns (D:I) of questions with answers that match the name across the row.

I am trying to copy the answers on the Data sheet for column D if the name in Data column C matches to a name listed in the Presentation sheet.

For column D:

-If name in sheet "Data" column C cell matches sheet "Presentation" A1 cell

-Paste data from sheet "Data" column D cell j to sheet "Presentation" column A cell k where j and k are integer counters that count the rows

Nothing is happening when I execute this code and I really don't understand why.

```<code>Sub TestLogic()

Dim colD As Range
Set colD = Worksheets("Data").Range("D3:D23344")

Dim j As Integer
'j is row counter on Data
j = 3
Dim k As Integer
'k is the row counter on Presentation
k = 4

'Iterate through all cells in Column D
For Each Cell In colD

    'If Drop down on Presentation is equal to Center name on Data
    If Worksheets("Presentation").Cells(1, "A").Value = Worksheets("Data").Cells(j, "C").Value Then

        'Copy all matching cells to Presentation
            Worksheets("Data").Cells(j, "D") = Worksheets("Presentation").Cells(k, "A")

        End If
        j = j + 1
        k = k + 1
    Next Cell

End Sub
</code>```

答:
I agree with the answer @BigBen gave. Also, you have k = k + 1 outside the for loop which will create gaps every time the if then statement is not met. I reworked a little of the code to help:</p>

```<code>Dim rc As Long, ws_Data As Worksheet, ws_Pres As Worksheet, k As Long

Set ws_Data = ActiveWorkbook.Worksheets("Data")
Set ws_Pres = ActiveWorkbook.Worksheets("Presentation")

rc = ws_Data.Range("D" & Rows.count).End(xlUp).Row
k = 4

'Iterate through all used cells
For i = 3 To rc

    'If Drop down on Presentation is equal to Center name on Data
    If ws_Pres.Range("A1") = ws_Data.Range("C" & i) Then
        'Copy all matching cells to Presentation
        ws_Pres.Range("A" & k) = ws_Data.Range("D" & i)
        k = k + 1
    End If

Next
</code>```

Title: Loop to match & paste to another sheet

Body:
I have two sheets in one workbook. One sheet ("Data") has data. The data is the Name (column C), and 4 columns (D:I) of questions with answers that match the name across the row.

I am trying to copy the answers on the Data sheet for column D if the name in Data column C matches to a name listed in the Presentation sheet.

For column D:

-If name in sheet "Data" column C cell matches sheet "Presentation" A1 cell

-Paste data from sheet "Data" column D cell j to sheet "Presentation" column A cell k where j and k are integer counters that count the rows

Nothing is happening when I execute this code and I really don't understand why.

Sub TestLogic()

Dim colD As Range
Set colD = Worksheets("Data").Range("D3:D23344")

Dim j As Integer
'j is row counter on Data
j = 3
Dim k As Integer
'k is the row counter on Presentation
k = 4

'Iterate through all cells in Column D
For Each Cell In colD

    'If Drop down on Presentation is equal to Center name on Data
    If Worksheets("Presentation").Cells(1, "A").Value = Worksheets("Data").Cells(j, "C").Value Then

        'Copy all matching cells to Presentation
            Worksheets("Data").Cells(j, "D") = Worksheets("Presentation").Cells(k, "A")

        End If
        j = j + 1
        k = k + 1
    Next Cell

End Sub

Body:
I agree with the answer @BigBen gave. Also, you have k = k + 1 outside the for loop which will create gaps every time the if then statement is not met. I reworked a little of the code to help:

Dim rc As Long, ws_Data As Worksheet, ws_Pres As Worksheet, k As Long

Set ws_Data = ActiveWorkbook.Worksheets("Data")
Set ws_Pres = ActiveWorkbook.Worksheets("Presentation")

rc = ws_Data.Range("D" & Rows.count).End(xlUp).Row
k = 4

'Iterate through all used cells
For i = 3 To rc

    'If Drop down on Presentation is equal to Center name on Data
    If ws_Pres.Range("A1") = ws_Data.Range("C" & i) Then
        'Copy all matching cells to Presentation
        ws_Pres.Range("A" & k) = ws_Data.Range("D" & i)
        k = k + 1
    End If

Next


问:
Selenium Error: no display specified
I've installed selenium-server-standalone-2.42.2.jar in a debian virtual box

and installed Firefox 29.0

and trying to run the following script with phpunit which is the only file in the directory:

```<code><?php
class TestLogin extends PHPUnit_Extensions_Selenium2TestCase{

    public function setUp()
    {
            $this->setHost('localhost');
            $this->setPort(4444);
            $this->setBrowser('firefox');
            $this->setBrowserUrl('http://debian-vm/phpUnitTutorial');
    }

    public function testHasLoginForm()
    {
            $this->url('index.php');

            $username = $this->byName('username');
            $password = $this->byName('password');

            $this->assertEquals('', $username->value());
            $this->assertEquals('', $password->value());
    }
}
</code>```

I get the following error:

```<code>1) TestLogin::testHasLoginForm
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Unable to connect to host
127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
</code>```

What does this mean?

I've red several threads and apparently I had to do the following which I tried:

1)to type this in the command shell

```<code>export PATH=:0;
</code>```

Result: I got the same error.

2) I've installed vnc4server and getting debian-vm:1 as a application I then set export PATH=debian-vm:1 run it with realvnc and in the viewer (which works) I got the same problem.

答:
The following is not the right variable:

$ export PATH=:0;

That defines where to find executables, such as in /bin, /usr/local/bin.
You're working with X11 variants and in that context, :0 refers to DISPLAY localhost:0.
So you probably intended the following:

$ export DISPLAY=:0

But as others have pointed out there needs to actually be an Xserver (virtual or otherwise) at that DISPLAY address.  You can't just make up a value and hope it will work.

To find a list of DISPLAYs that your user is authorized to connect to you can use the following, then set your DISPLAY variable according (host:displayNumber, or :displayNumber if on the local host):

$ xauth list

Title: Selenium Error: no display specified

Body:
I've installed selenium-server-standalone-2.42.2.jar in a debian virtual box

and installed Firefox 29.0

and trying to run the following script with phpunit which is the only file in the directory:

<?php
class TestLogin extends PHPUnit_Extensions_Selenium2TestCase{

    public function setUp()
    {
            $this->setHost('localhost');
            $this->setPort(4444);
            $this->setBrowser('firefox');
            $this->setBrowserUrl('http://debian-vm/phpUnitTutorial');
    }

    public function testHasLoginForm()
    {
            $this->url('index.php');

            $username = $this->byName('username');
            $password = $this->byName('password');

            $this->assertEquals('', $username->value());
            $this->assertEquals('', $password->value());
    }
}

I get the following error:

1) TestLogin::testHasLoginForm
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Unable to connect to host
127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified

What does this mean?

I've red several threads and apparently I had to do the following which I tried:

1)to type this in the command shell

export PATH=:0;

Result: I got the same error.

2) I've installed vnc4server and getting debian-vm:1 as a application I then set export PATH=debian-vm:1 run it with realvnc and in the viewer (which works) I got the same problem.


问:
Php.ini production vs development
I'm using XAMPP to develop on my localhost.  I would like to remove the PHP notices and keep only the warnings.  I know this is done through the php.ini file, however I'm having trouble locating it.  I followed the path in phpinfo() and it led me to /xampp/php. Inside this folder are two php.ini files: one for production and one for development.  I have set them both to the error reporting level I'd like, however I still receive notices which makes me believe that neither of these actually control error reporting.  I'm using the latest version of XAMPP.  So I guess my question is where is the true php.ini and what are these two other versions?

答:
My issue is that I was editing the php.ini-production and overlooked the standard php.ini file.

I edited the php.ini file by adding extension=php_odbc.dll and it fixed the error.

Title: Php.ini production vs development


问:
How to create proc entry under /proc/driver?
I want to create a file under a /proc/driver directory. I would like to use a macro like proc_root_driver (or something else provided) rather than use "driver/MODULE_NAME" explicitly. I use create_proc_entry :

```<code>struct proc_dir_entry *simpleproc_fops_entry;
simpleproc_fops_entry = create_proc_entry(MODULE_NAME, 0400, NULL /* proc_root_dir */);
</code>```

After googling, I found suggestion to use proc_root_driver, but when  I use it, I get the error

proc_root_driver undeclared in this function

And also, proc_root_driver is not available in linux/proc_fs.h.

I have tried to declare structure like this:

```<code>struct proc_dir_entry proc_root;
struct proc_dir_entry *proc_root_driver = &proc_root;
</code>```

The compilation errors gone, but the file didn't appear under /proc/driver or /proc. How can I make create an entry in /proc?

答:
Looking at proc_fs.h, proc_root_driver is defined as :

```<code>extern struct proc_dir_entry *proc_root_driver;
</code>```

so long as CONFIG_PROC_FS is enabled. If you have CONFIG_PROC_FS selected when you configure your kernel, you should be able to use it as you suggested yourself i.e. :

```<code>#include <linux/proc_fs.h>
struct proc_dir_entry * procfile
procfile = create_proc_entry("myprocfile", 0400, proc_root_driver);
</code>```

If this does not work, check that you have CONFIG_PROC_FS set. To make sure, you can compile your source file with the -E option and check that the create_proc_entry call includes a non NULL parameter as the last parameter. If it is NULL, or the call is not there at all, then CONFIG_PROC_FS is not enabled.

Body:
I want to create a file under a /proc/driver directory. I would like to use a macro like proc_root_driver (or something else provided) rather than use "driver/MODULE_NAME" explicitly. I use create_proc_entry :

struct proc_dir_entry *simpleproc_fops_entry;
simpleproc_fops_entry = create_proc_entry(MODULE_NAME, 0400, NULL /* proc_root_dir */);

After googling, I found suggestion to use proc_root_driver, but when  I use it, I get the error

proc_root_driver undeclared in this function

And also, proc_root_driver is not available in linux/proc_fs.h.

I have tried to declare structure like this:

struct proc_dir_entry proc_root;
struct proc_dir_entry *proc_root_driver = &proc_root;

The compilation errors gone, but the file didn't appear under /proc/driver or /proc. How can I make create an entry in /proc?

Body:
Looking at proc_fs.h, proc_root_driver is defined as :

extern struct proc_dir_entry *proc_root_driver;

so long as CONFIG_PROC_FS is enabled. If you have CONFIG_PROC_FS selected when you configure your kernel, you should be able to use it as you suggested yourself i.e. :

#include <linux/proc_fs.h>
struct proc_dir_entry * procfile
procfile = create_proc_entry("myprocfile", 0400, proc_root_driver);

If this does not work, check that you have CONFIG_PROC_FS set. To make sure, you can compile your source file with the -E option and check that the create_proc_entry call includes a non NULL parameter as the last parameter. If it is NULL, or the call is not there at all, then CONFIG_PROC_FS is not enabled.

OwnerDisplayName: Hermes

ContentLicense: CC BY-SA 2.5


问:
Is there a way to intercept setters and getters in C#?
In both Ruby and PHP (and I guess other languages as well) there are some utility methods that are called whenever a property is set. ( *instance_variable_set* for Ruby, *__set* for PHP).

So, let's say I have a C# class like this:

```<code>public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}
</code>```

Now, let's say that if any property setter from the Person class is called, I want to call another method first, and then continue with the default behaviour of the setter, and the same applies for the property setters.

Is this possible?

Edit:
I want to do this without defining a backing field.

答: Mocking frameworks can do this, as well as IoC libraries like Unity. The only other way to do such a thing would be to use IL-rewriting (as previously mentioned).</p>

Body:
In both Ruby and PHP (and I guess other languages as well) there are some utility methods that are called whenever a property is set. ( *instance_variable_set* for Ruby, *__set* for PHP).

So, let's say I have a C# class like this:

public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

Now, let's say that if any property setter from the Person class is called, I want to call another method first, and then continue with the default behaviour of the setter, and the same applies for the property setters.

Is this possible?

Edit:
I want to do this without defining a backing field.


问:
ADB over Wi-Fi is extremely slow on one PC, great on another
I'm trying to learn how to develop for Android, and I'd like to be able to test on my device instead of an emulator. The USB port on my phone is getting pretty loose, and I'd rather not mess it up with the scores of hours I'll be using it to test.

I enabled ADB over Wi-Fi on my desktop, and it worked flawlessly. This desktop runs Windows 7 and on my home network.

I then installed Android Studio and enabled ADB over Wi-Fi on my laptop, which runs Windows 10 and on my work network (which has no secondary login and is much faster). It works, but it's EXTREMELY slow. When I hit the "run" button in android studio, I thought it had frozen. But I used adb install, and it worked - but very slowly. It took about 5 minutes to install an apk.

I've done a lot of searching but it seems that everyone seems to dismiss this problem as "a problem with your device" or "a problem with your cable (even though it's over Wi-Fi?)". Or in one case, the solution applied to a Mac.

Does anyone know how to fix this?

答:
Switching my computer to use ethernet significantly improved the situation and  having the phone on and unlocked seems to improve things a fair amount as well.

I was having this issue for quite some time and I had given up on actually fixing this. Based on internet speed tests I was getting about 10 Mbps on my desktop with a low-end USB 3.0 WiFi adapter and 80 Mbps on my phone, but when I tried to use adb over WiFi I would get below 1 Mbps. Many times installing an essentially bare app would take over 5 minutes.

More recently I switched my desktop over to ethernet (situation finally permitted me to do so), and the speed on my desktop jumped up to match my phone (80 Mbps), but more importantly the adb transfer speed jumped up to around 80 Mbps as well. This was with the screen off. With some additional testing I determined that having the phone unlocked approximately doubles the speed, as I was seeing over 160 Mbps. Now what used to take minutes usually takes a few seconds.

I suspect that my low-end WiFi adapter may have just been messing things up; some other behavior on the network made me suspect that data was being retransmitted many times due to failure to ACK packets, which would definitely result in much lower speeds. This is probably actionable for very few people.

On the other hand, based on a sample size of one having the phone unlocked could halve the wait time, and this is more actionable. It also makes sense, the phone is likely in a sleep mode when locked. You could use FLAG_KEEP_SCREEN_ON on every activity when the app is in debug mode to try to keep the transfer rates high.


问:
Only Crashlytics data is migrated from Fabric to Firebase, Analytics data isn't migrated
I migrated our previous crash data attained from Fabric to Firebase a few days ago.  Firebase is now displaying the crashlytics related data from Fabric, however, the data related to analytics(latest release, retention etc.) is nowhere to be found.

Fabric shows the data has been migrated successfully on both OS(Android, iOS) but only our Android OS is showing this problem
(I can find analytics data for our  iOS OS in Firebase)

In addition, I found out that the Firebase analytics library was not imported on our Android Application.
After importing and integrating the library I am now able to view the analytics related data provided by Firebase.
But the problem of the migrated Fabric Analytics data being absent is still present.

Is there possible way to find and see the analytics data(migrated from Fabric) for our Android OS?

答: Great question!Your Answers metrics and events data will not be transferred from the Fabric dashboard to the Firebase console. In order to continue getting similar metrics and more from the Firebase console, as well as the crash-free users statistic you're used to seeing in Fabric, I recommend that you install Google Analytics in your app. Firebase will no longer process any incoming Answers data or display it, but it will not cause any crashes in your app or affect your end-users.</p>


答:
You cant use automatic properties. You would have to dinfe the property out the old fashion way with a backing field and call the method manually.</p>

```<code>public class Person
{
    private string _FirstName;
    public string FirstName
    {
        get
        {
            return _FirstName;
        }
        set
        {
            SomeMethod();
            _FirstName = value;
        }
    }
    private void SomeMethod()
    {
        //do something
    }

}
</code>```

Title: Is there a way to intercept setters and getters in C#?

Body:
You cant use automatic properties. You would have to dinfe the property out the old fashion way with a backing field and call the method manually.

public class Person
{
    private string _FirstName;
    public string FirstName
    {
        get
        {
            return _FirstName;
        }
        set
        {
            SomeMethod();
            _FirstName = value;
        }
    }
    private void SomeMethod()
    {
        //do something
    }

}


问:
MySQL / MariaDB LOAD DATA INFILE with CSV without an id column (primary key) and trying to auto increment via the DBMS does not recognize SET command
I have created a table that has the following definition:

```<code>CREATE TABLE vacayhome.photo (
  id INT NOT NULL AUTO_INCREMENT,
  url_path CHAR NOT NULL,
  caption CHAR NOT NULL,
  space_type CHAR NOT NULL,
  is_main BOOLEAN NOT NULL,
  listing_id INT NOT NULL,
  PRIMARY KEY (id),
  FOREIGN KEY (listing_id) REFERENCES listing (id)
    ON UPDATE RESTRICT
);
</code>```

The data I'm trying to insert to this table has the following form:

```<code>url_path,caption,space_type,is_main,listing_id
JFK/015ec48e93480.jpg,An interior designer dream,,true,10000000
JFK/9184bd57e9f80.jpg,"Ready for you, YASS",,false,10000000
BCN/5ccd9b138c76.jpg,"Stay -- you're welcome",,false,10000001
BCN/5fbb3a5ac2b30.jpg,Warm sunlight throughout,,false,10000001
</code>```

And this is my LOAD DATA statement into the empty table from the MariaDB and MySQL documentation:

```<code>ALTER TABLE photo DISABLE KEYS;
BEGIN;
LOAD DATA INFILE '/path/to/photos.csv' INTO TABLE photo
  FIELDS
    OPTIONALLY ENCLOSED BY '"'
    TERMINATED BY ','
  LINES
    TERMINATED BY '\n'
  IGNORE 1 ROWS (url_path,caption,space_type,is_main,listing_id);
  SET id=NULL;
COMMIT;
ALTER TABLE photo ENABLE KEYS;
</code>```

The OPTIONALLY ENCLOSED BY is being used for the CHAR columns that have a comma in the text, and the IGNORE 1 ROWS is used to ignore the header row.

When I try to load the data, I get the following error:

```<code>ERROR 1193 (HY000) at line 33: Unknown system variable 'id'
</code>```

I've also tried adding SET id = NULL from answers in other StackOverflow posts like this one. What am I doing wrong?

答:
You have an extra semicolon before the SET ID=NULL; directive.
Below code ran successfully in my local MySQL environment:

```<code>ALTER TABLE photo DISABLE KEYS;
BEGIN;
LOAD DATA LOCAL INFILE '/path/to/photos.csv' INTO TABLE photo
  FIELDS
    OPTIONALLY ENCLOSED BY '"'
    TERMINATED BY ','
  LINES
    TERMINATED BY '\n'
  IGNORE 1 ROWS (url_path,caption,space_type,is_main,listing_id)
  SET id=NULL;
COMMIT;
ALTER TABLE photo ENABLE KEYS;
</code>```

You might want to check the column types as well (for example, use VARCHAR instead). Good luck.

Body:
I have created a table that has the following definition:

CREATE TABLE vacayhome.photo (
  id INT NOT NULL AUTO_INCREMENT,
  url_path CHAR NOT NULL,
  caption CHAR NOT NULL,
  space_type CHAR NOT NULL,
  is_main BOOLEAN NOT NULL,
  listing_id INT NOT NULL,
  PRIMARY KEY (id),
  FOREIGN KEY (listing_id) REFERENCES listing (id)
    ON UPDATE RESTRICT
);

The data I'm trying to insert to this table has the following form:

url_path,caption,space_type,is_main,listing_id
JFK/015ec48e93480.jpg,An interior designer dream,,true,10000000
JFK/9184bd57e9f80.jpg,"Ready for you, YASS",,false,10000000
BCN/5ccd9b138c76.jpg,"Stay -- you're welcome",,false,10000001
BCN/5fbb3a5ac2b30.jpg,Warm sunlight throughout,,false,10000001

And this is my LOAD DATA statement into the empty table from the MariaDB and MySQL documentation:

ALTER TABLE photo DISABLE KEYS;
BEGIN;
LOAD DATA INFILE '/path/to/photos.csv' INTO TABLE photo
  FIELDS
    OPTIONALLY ENCLOSED BY '"'
    TERMINATED BY ','
  LINES
    TERMINATED BY '\n'
  IGNORE 1 ROWS (url_path,caption,space_type,is_main,listing_id);
  SET id=NULL;
COMMIT;
ALTER TABLE photo ENABLE KEYS;

The OPTIONALLY ENCLOSED BY is being used for the CHAR columns that have a comma in the text, and the IGNORE 1 ROWS is used to ignore the header row.

When I try to load the data, I get the following error:

ERROR 1193 (HY000) at line 33: Unknown system variable 'id'

I've also tried adding SET id = NULL from answers in other StackOverflow posts like this one. What am I doing wrong?

Body:
You have an extra semicolon before the SET ID=NULL; directive.
Below code ran successfully in my local MySQL environment:

ALTER TABLE photo DISABLE KEYS;
BEGIN;
LOAD DATA LOCAL INFILE '/path/to/photos.csv' INTO TABLE photo
  FIELDS
    OPTIONALLY ENCLOSED BY '"'
    TERMINATED BY ','
  LINES
    TERMINATED BY '\n'
  IGNORE 1 ROWS (url_path,caption,space_type,is_main,listing_id)
  SET id=NULL;
COMMIT;
ALTER TABLE photo ENABLE KEYS;

You might want to check the column types as well (for example, use VARCHAR instead). Good luck.


问:
Why are my data elements being copied instead of moved?
I'm performing some tests about move semantics, and my class behavior seems weird for me.

Given the mock class VecOfInt:

```<code>class VecOfInt {
public:
    VecOfInt(size_t num) : m_size(num), m_data(new int[m_size]) {}
    ~VecOfInt() { delete[] m_data; }
    VecOfInt(VecOfInt const& other) : m_size(other.m_size),  m_data(new int[m_size]) {
        std::cout << "copy..." <<std::endl;
        std::copy(other.m_data, other.m_data + m_size, m_data);
    }
    VecOfInt(VecOfInt&& other) : m_size(other.m_size) {
        std::cout << "move..." << std::endl;
        m_data = other.m_data;
        other.m_data = nullptr;
    }
    VecOfInt& operator=(VecOfInt const& other) {
        std::cout << "copy assignment..." << std::endl;
        m_size = other.m_size;
        delete m_data;
        m_data = nullptr;
        m_data = new int[m_size];
        m_data = other.m_data;
        return *this;
    }
    VecOfInt& operator=(VecOfInt&& other) {
        std::cout << "move assignment..." << std::endl;
        m_size = other.m_size;
        m_data = other.m_data;
        other.m_data = nullptr;
        return *this;
    }
private:
    size_t m_size;
    int* m_data;
};
</code>```

OK CASE

When I insert a single value in-place:

```<code>int main() {
    std::vector<VecOfInt> v;
    v.push_back(10);
    return 0;
}
</code>```

Then it gives me the following output (what I think is fine):

move...

WEIRD CASE

When I insert three different values in-place:

```<code>int main() {
    std::vector<VecOfInt> v;
    v.push_back(10);
    v.push_back(20);
    v.push_back(30);
    return 0;
}
</code>```

Then the output calls the copy constructor 3 times:

move...
move...
copy...
move...
copy...
copy...

What I'm missing here?

答:
Move construction and move assignment aren't used by std::vector when reallocating unless they are noexcept or if there is no copying alternatives. Here is your example with noexcept added :

```<code>class VecOfInt {
public:
    VecOfInt(size_t num) : m_size(num), m_data(new int[m_size]) {}
    ~VecOfInt() { delete[] m_data; }
    VecOfInt(VecOfInt const& other) : m_size(other.m_size),  m_data(new int[m_size]) {
        std::cout << "copy..." <<std::endl;
        std::copy(other.m_data, other.m_data + m_size, m_data);
    }
    VecOfInt(VecOfInt&& other) noexcept : m_size(other.m_size) {
        std::cout << "move..." << std::endl;
        m_data = other.m_data;
        other.m_data = nullptr;
    }
    VecOfInt& operator=(VecOfInt const& other) {
        std::cout << "copy assignment..." << std::endl;
        m_size = other.m_size;
        delete m_data;
        m_data = nullptr;
        m_data = new int[m_size];
        m_data = other.m_data;
        return *this;
    }
    VecOfInt& operator=(VecOfInt&& other) noexcept {
        std::cout << "move assignment..." << std::endl;
        m_size = other.m_size;
        m_data = other.m_data;
        other.m_data = nullptr;
        return *this;
    }
private:
    size_t m_size;
    int* m_data;
};
</code>```

A live live example outputs :

```<code>move...
move...
move...
move...
move...
move...
</code>```

This is done to keep exception safety. When resizing a std::vector fails, it will try to leave the vector as it was before the attempt. But if a move operation throws half way through reallocation, there is no safe way to undo the moves that have already been made successfully. They very well may also throw. The safest solution is to copy if moving might throw.

Body:
I'm performing some tests about move semantics, and my class behavior seems weird for me.

Given the mock class VecOfInt:

class VecOfInt {
public:
    VecOfInt(size_t num) : m_size(num), m_data(new int[m_size]) {}
    ~VecOfInt() { delete[] m_data; }
    VecOfInt(VecOfInt const& other) : m_size(other.m_size),  m_data(new int[m_size]) {
        std::cout << "copy..." <<std::endl;
        std::copy(other.m_data, other.m_data + m_size, m_data);
    }
    VecOfInt(VecOfInt&& other) : m_size(other.m_size) {
        std::cout << "move..." << std::endl;
        m_data = other.m_data;
        other.m_data = nullptr;
    }
    VecOfInt& operator=(VecOfInt const& other) {
        std::cout << "copy assignment..." << std::endl;
        m_size = other.m_size;
        delete m_data;
        m_data = nullptr;
        m_data = new int[m_size];
        m_data = other.m_data;
        return *this;
    }
    VecOfInt& operator=(VecOfInt&& other) {
        std::cout << "move assignment..." << std::endl;
        m_size = other.m_size;
        m_data = other.m_data;
        other.m_data = nullptr;
        return *this;
    }
private:
    size_t m_size;
    int* m_data;
};

OK CASE

When I insert a single value in-place:

int main() {
    std::vector<VecOfInt> v;
    v.push_back(10);
    return 0;
}

Then it gives me the following output (what I think is fine):

move...

WEIRD CASE

When I insert three different values in-place:

int main() {
    std::vector<VecOfInt> v;
    v.push_back(10);
    v.push_back(20);
    v.push_back(30);
    return 0;
}

Then the output calls the copy constructor 3 times:

move...
move...
copy...
move...
copy...
copy...

What I'm missing here?

Body:
Move construction and move assignment aren't used by std::vector when reallocating unless they are noexcept or if there is no copying alternatives. Here is your example with noexcept added :

class VecOfInt {
public:
    VecOfInt(size_t num) : m_size(num), m_data(new int[m_size]) {}
    ~VecOfInt() { delete[] m_data; }
    VecOfInt(VecOfInt const& other) : m_size(other.m_size),  m_data(new int[m_size]) {
        std::cout << "copy..." <<std::endl;
        std::copy(other.m_data, other.m_data + m_size, m_data);
    }
    VecOfInt(VecOfInt&& other) noexcept : m_size(other.m_size) {
        std::cout << "move..." << std::endl;
        m_data = other.m_data;
        other.m_data = nullptr;
    }
    VecOfInt& operator=(VecOfInt const& other) {
        std::cout << "copy assignment..." << std::endl;
        m_size = other.m_size;
        delete m_data;
        m_data = nullptr;
        m_data = new int[m_size];
        m_data = other.m_data;
        return *this;
    }
    VecOfInt& operator=(VecOfInt&& other) noexcept {
        std::cout << "move assignment..." << std::endl;
        m_size = other.m_size;
        m_data = other.m_data;
        other.m_data = nullptr;
        return *this;
    }
private:
    size_t m_size;
    int* m_data;
};

A live live example outputs :

move...
move...
move...
move...
move...
move...

This is done to keep exception safety. When resizing a std::vector fails, it will try to leave the vector as it was before the attempt. But if a move operation throws half way through reallocation, there is no safe way to undo the moves that have already been made successfully. They very well may also throw. The safest solution is to copy if moving might throw.


问:
Why chart.js charts are not plotting data in Safari (works in Chrome)
I have several charts that I have created in chart.js and they work fine in chrome but when I view them in Safari two of the charts have no data plotted just the shell of the chart shows up.

The code for these is exactly the same. I am pulling in csv file. The only difference that I can see is that the CSVs that don't work contain the month as well as the year in the data. How can I fix the code so that it will show up in Safari as well as Chrome? Is it my date settings. I am also getting this weird message in Chrome (see below, also looks related to date issues).

This type of data works ok:

```<code>"1980","2.4"

"1981","2.6"

"1982","2.7"
</code>```

This data does not:

```<code>"May 2016","6.9"

"June 2016","6.8"

"July 2016","7.0"
</code>```

Here is my code:

```<code>window.addEventListener('load', setup);

      async function setup() {
        var ctx = document.getElementById('myChart').getContext('2d');
        var dollar = await getData();
        var myChart = new Chart(ctx, {
          type: 'line',
          data: {
            labels: dollar.years,
            datasets: [
              {label: 'Unemployment rate',
                data: dollar.vals,
                borderColor: 'rgb(153,222,101)',
                backgroundColor: 'rgb(153,222,101, 0.2)',
                pointRadius: 0,
                borderWidth: 6,
                pointHitRadius: 10,
                }]
              },

options: {
layout: {
padding: {
  left: 0,
  right: 15,
  top: 0,
  bottom: 0}
  },
responsive: true,
title: {
display: false
},

legend: {
display: false
},

scales: {
yAxes: [{
ticks: {
min: 3,
max: 8,
stepSize: 1
}
}],

xAxes: [{
type: "time",
time: {
unit: "year",
tooltipFormat: "YYYY"
},

gridLines: {
display: true,
drawOnChartArea: false,
},

ticks: {
display: true,
maxTicksLimit: 5,
maxRotation: 0,
minRotation: 0,
padding: 1
},
}],
}
}
        });
        }
</code>```

This is the error I have been getting in Chrome.

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.

答:
The problem is with parsing the date string. Chart js uses moment adapter for date strings and this type ("May 2016") of format might not be easily parsed in some browsers, to see what kind of formats you can use check https://momentjs.com/docs/#/parsing/string-formats/

The code below should work for the second set of data

window.addEventListener('load', setup);
var formatDate = (dateString) => {
  return moment(dateString, "MMM YYYY").toDate()
}

async function setup() {
  var ctx = document.getElementById('myChart').getContext('2d');
  var dollar = await getData();
  var myChart = new Chart(ctx, {
    type: 'line',
    data: {
      labels: dollar.years.map(year => formatDate(year)),
      datasets: [{
        label: 'Unemployment rate',
        data: dollar.vals,
        borderColor: 'rgb(153,222,101)',
        backgroundColor: 'rgb(153,222,101, 0.2)',
        pointRadius: 0,
        borderWidth: 6,
        pointHitRadius: 10,
      }]
    },

    options: {
      layout: {
        padding: {
          left: 0,
          right: 15,
          top: 0,
          bottom: 0
        }
      },
      responsive: true,
      title: {
        display: false
      },

      legend: {
        display: false
      },

      scales: {
        yAxes: [{
          ticks: {
            min: 3,
            max: 8,
            stepSize: 1
          }
        }],

        xAxes: [{
          type: "time",
          time: {
            unit: "year",
            tooltipFormat: "YYYY"
          },

          gridLines: {
            display: true,
            drawOnChartArea: false,
          },

          ticks: {
            display: true,
            maxTicksLimit: 5,
            maxRotation: 0,
            minRotation: 0,
            padding: 1
          },
        }],
      }
    }
  });
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script></code>```

Body:
I have several charts that I have created in chart.js and they work fine in chrome but when I view them in Safari two of the charts have no data plotted just the shell of the chart shows up.

The code for these is exactly the same. I am pulling in csv file. The only difference that I can see is that the CSVs that don't work contain the month as well as the year in the data. How can I fix the code so that it will show up in Safari as well as Chrome? Is it my date settings. I am also getting this weird message in Chrome (see below, also looks related to date issues).

This type of data works ok:

"1980","2.4"

"1981","2.6"

"1982","2.7"

This data does not:

"May 2016","6.9"

"June 2016","6.8"

"July 2016","7.0"

Here is my code:

window.addEventListener('load', setup);

      async function setup() {
        var ctx = document.getElementById('myChart').getContext('2d');
        var dollar = await getData();
        var myChart = new Chart(ctx, {
          type: 'line',
          data: {
            labels: dollar.years,
            datasets: [
              {label: 'Unemployment rate',
                data: dollar.vals,
                borderColor: 'rgb(153,222,101)',
                backgroundColor: 'rgb(153,222,101, 0.2)',
                pointRadius: 0,
                borderWidth: 6,
                pointHitRadius: 10,
                }]
              },

options: {
layout: {
padding: {
  left: 0,
  right: 15,
  top: 0,
  bottom: 0}
  },
responsive: true,
title: {
display: false
},

legend: {
display: false
},

scales: {
yAxes: [{
ticks: {
min: 3,
max: 8,
stepSize: 1
}
}],

xAxes: [{
type: "time",
time: {
unit: "year",
tooltipFormat: "YYYY"
},

gridLines: {
display: true,
drawOnChartArea: false,
},

ticks: {
display: true,
maxTicksLimit: 5,
maxRotation: 0,
minRotation: 0,
padding: 1
},
}],
}
}
        });
        }

This is the error I have been getting in Chrome.

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.

Body:
The problem is with parsing the date string. Chart js uses moment adapter for date strings and this type ("May 2016") of format might not be easily parsed in some browsers, to see what kind of formats you can use check https://momentjs.com/docs/#/parsing/string-formats/

The code below should work for the second set of data

window.addEventListener('load', setup);
var formatDate = (dateString) => {
  return moment(dateString, "MMM YYYY").toDate()
}

async function setup() {
  var ctx = document.getElementById('myChart').getContext('2d');
  var dollar = await getData();
  var myChart = new Chart(ctx, {
    type: 'line',
    data: {
      labels: dollar.years.map(year => formatDate(year)),
      datasets: [{
        label: 'Unemployment rate',
        data: dollar.vals,
        borderColor: 'rgb(153,222,101)',
        backgroundColor: 'rgb(153,222,101, 0.2)',
        pointRadius: 0,
        borderWidth: 6,
        pointHitRadius: 10,
      }]
    },

    options: {
      layout: {
        padding: {
          left: 0,
          right: 15,
          top: 0,
          bottom: 0
        }
      },
      responsive: true,
      title: {
        display: false
      },

      legend: {
        display: false
      },

      scales: {
        yAxes: [{
          ticks: {
            min: 3,
            max: 8,
            stepSize: 1
          }
        }],

        xAxes: [{
          type: "time",
          time: {
            unit: "year",
            tooltipFormat: "YYYY"
          },

          gridLines: {
            display: true,
            drawOnChartArea: false,
          },

          ticks: {
            display: true,
            maxTicksLimit: 5,
            maxRotation: 0,
            minRotation: 0,
            padding: 1
          },
        }],
      }
    }
  });
}

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>


问:
Writing characteristic does not works after set up notification
After reeding this article and answer on stackoverflow I wrote this BluetoothGattCallback:

```<code>private BluetoothGattCallback bluetoothGattCallback = new BluetoothGattCallback() {
    @Override
    public void onConnectionStateChange(final BluetoothGatt gatt, final int status, final int newState) {
        if (status == GATT_SUCCESS) {
            if (newState == BluetoothProfile.STATE_CONNECTED) {
                // We successfully connected, proceed with service discovery
                Log.i(TAG, "We successfully connected, proceed with service discovery");
                stopScan();
                gatt.discoverServices();

            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                // We successfully disconnected on our own request
                Log.i(TAG, "We successfully disconnected on our own request");
                gatt.close();
            } else {

            }
        } else {
            // An error happened...
            gatt.close();
        }
    }

    @Override
    public void onServicesDiscovered(BluetoothGatt gatt, int status) {
        Log.i(TAG, "We are onServiceDiscovered");
        BluetoothGattCharacteristic characteristic =
                gatt.getService(Beacon.BEACON_SERVICE_UUID)
                        .getCharacteristic(Beacon.BEACON_CHAR_UUID);

        BluetoothGattDescriptor descriptor =
                characteristic.getDescriptor(convertFromInteger(0x2902));

        descriptor.setValue(
                BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);

        gatt.writeDescriptor(descriptor);

        gatt.setCharacteristicNotification(characteristic, true);

        writeCharacteristic();
    }

    @Override
    public void onDescriptorWrite(BluetoothGatt gatt, final BluetoothGattDescriptor descriptor, int status) {
        Log.i(TAG, "onWrite");

    }

    @Override
    public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
        Log.i(TAG, "We are onCharacteristicChanged");
        dev_data_hendler.sendMessage(Message.obtain(dev_data_hendler, 0, characteristic.getValue()));
    }
};
</code>```

where writeCharacteristic is:

```<code>private void writeCharacteristic() {

    class writeTask implements Runnable {
        byte [] bytes;
        writeTask(byte[] to_write){bytes = to_write;}

        public void run() {
            if (gatt == null) {
                Log.e(TAG, "lost connection");
            }

            if (gatt.getService(Beacon.BEACON_SERVICE_UUID) == null) {
                Log.e(TAG, "service not found!");
            }

            if (gatt.getService(Beacon.BEACON_SERVICE_UUID).getCharacteristic(Beacon.BEACON_CHAR_UUID) == null) {
                Log.e(TAG, "char not found!");
            }
            BluetoothGattCharacteristic characteristic = gatt.getService(Beacon.BEACON_SERVICE_UUID).getCharacteristic(Beacon.BEACON_CHAR_UUID);

            characteristic.setWriteType(WRITE_TYPE_DEFAULT);
            characteristic.setValue(bytes);
            if (gatt.writeCharacteristic(characteristic)) {
                Log.i(TAG, "Char written" + flag);
                flag++;
            } else {
                Log.e(TAG, "Char writing failure");
            }
        }
    }
    Thread t = new Thread(new writeTask(new byte[] {(byte)0x05, (byte)0x01}));
    t.start();
    try {
        t.sleep(150);
    } catch (InterruptedException e) {
        Log.i(TAG, "interrupted exception");
    }

}
</code>```

and gatt.writeCharacteristic(characteristic) returns false. Writing and setting up notifications work well but separately. If I write on characteristic first, writeCharacteristic returns true, but my device has no reaction on this. It works only separetely

答: On Android you need to wait for a write/read to complete before you can do the next one. So you need to queue your writes/reads...</p>

Body:
After reeding this article and answer on stackoverflow I wrote this BluetoothGattCallback:

private BluetoothGattCallback bluetoothGattCallback = new BluetoothGattCallback() {
    @Override
    public void onConnectionStateChange(final BluetoothGatt gatt, final int status, final int newState) {
        if (status == GATT_SUCCESS) {
            if (newState == BluetoothProfile.STATE_CONNECTED) {
                // We successfully connected, proceed with service discovery
                Log.i(TAG, "We successfully connected, proceed with service discovery");
                stopScan();
                gatt.discoverServices();

            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                // We successfully disconnected on our own request
                Log.i(TAG, "We successfully disconnected on our own request");
                gatt.close();
            } else {

            }
        } else {
            // An error happened...
            gatt.close();
        }
    }

    @Override
    public void onServicesDiscovered(BluetoothGatt gatt, int status) {
        Log.i(TAG, "We are onServiceDiscovered");
        BluetoothGattCharacteristic characteristic =
                gatt.getService(Beacon.BEACON_SERVICE_UUID)
                        .getCharacteristic(Beacon.BEACON_CHAR_UUID);

        BluetoothGattDescriptor descriptor =
                characteristic.getDescriptor(convertFromInteger(0x2902));

        descriptor.setValue(
                BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);

        gatt.writeDescriptor(descriptor);

        gatt.setCharacteristicNotification(characteristic, true);

        writeCharacteristic();
    }

    @Override
    public void onDescriptorWrite(BluetoothGatt gatt, final BluetoothGattDescriptor descriptor, int status) {
        Log.i(TAG, "onWrite");

    }

    @Override
    public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
        Log.i(TAG, "We are onCharacteristicChanged");
        dev_data_hendler.sendMessage(Message.obtain(dev_data_hendler, 0, characteristic.getValue()));
    }
};

where writeCharacteristic is:

private void writeCharacteristic() {

    class writeTask implements Runnable {
        byte [] bytes;
        writeTask(byte[] to_write){bytes = to_write;}

        public void run() {
            if (gatt == null) {
                Log.e(TAG, "lost connection");
            }

            if (gatt.getService(Beacon.BEACON_SERVICE_UUID) == null) {
                Log.e(TAG, "service not found!");
            }

            if (gatt.getService(Beacon.BEACON_SERVICE_UUID).getCharacteristic(Beacon.BEACON_CHAR_UUID) == null) {
                Log.e(TAG, "char not found!");
            }
            BluetoothGattCharacteristic characteristic = gatt.getService(Beacon.BEACON_SERVICE_UUID).getCharacteristic(Beacon.BEACON_CHAR_UUID);

            characteristic.setWriteType(WRITE_TYPE_DEFAULT);
            characteristic.setValue(bytes);
            if (gatt.writeCharacteristic(characteristic)) {
                Log.i(TAG, "Char written" + flag);
                flag++;
            } else {
                Log.e(TAG, "Char writing failure");
            }
        }
    }
    Thread t = new Thread(new writeTask(new byte[] {(byte)0x05, (byte)0x01}));
    t.start();
    try {
        t.sleep(150);
    } catch (InterruptedException e) {
        Log.i(TAG, "interrupted exception");
    }

}

and gatt.writeCharacteristic(characteristic) returns false. Writing and setting up notifications work well but separately. If I write on characteristic first, writeCharacteristic returns true, but my device has no reaction on this. It works only separetely


问:
git log: parsing who worked on the repository and when
I'd like to create some statistics for open source projects. I'd like to extract the information when a certain person started to work on a git repository and when they finished on it... or the first and the last commit by an author, with a date.

I can manually extract this information from git log output. However, is there a git built-in way, or one-liner shell script that would help me to analyse this.

Find all repo authors from git log

Get their first and last commit date

答:
For usernames and commits amount

git shortlog -sne | awk '{print $1 " " $2}'
```

<p>Last commit date</p>

<pre class="lang-sh prettyprint-override"><code>git log --pretty=format:"%ad by %an" --date=iso | sort -r | awk '{if (!seen[$5]++) print}'

</code>```

First commit date

git log --pretty=format:"%ad by %an" --date=iso | sort | awk '{if (!seen[$5]++) print}'

```

Body:
For usernames and commits amount

git shortlog -sne | awk '{print $1 " " $2}'

Last commit date

git log --pretty=format:"%ad by %an" --date=iso | sort -r | awk '{if (!seen[$5]++) print}'

First commit date

git log --pretty=format:"%ad by %an" --date=iso | sort | awk '{if (!seen[$5]++) print}'


问:
Vuetify 2: How to adjust the v-navigation-drawer to not to change the position of the v-content
I think trying to describe it can get confusing, so from the images, I think the problem is going to be much clearer...

Follow the link my Codepen

If I use app in v-navigation-drawer, it comes close to what I would like, but I don't want v-navigation-drawer to occupy the entire side, overlapping the main bar (v-app-bar). What I would like you to occupy only the side, but "without" overlapping the main bar (v-app-bar), but mostly, don't "throw" the v-content to the bottom of the screen

```<code><v-navigation-drawer v-model="drawer">
</code>```

```<code><v-navigation-drawer v-model="drawer" app>
</code>```

答:
remove  tag around <v-navigation-drawer> and simply override vuetify css using !important

here is a working example: Live Demo

Body:
I think trying to describe it can get confusing, so from the images, I think the problem is going to be much clearer...

Follow the link my Codepen

If I use app in v-navigation-drawer, it comes close to what I would like, but I don't want v-navigation-drawer to occupy the entire side, overlapping the main bar (v-app-bar). What I would like you to occupy only the side, but "without" overlapping the main bar (v-app-bar), but mostly, don't "throw" the v-content to the bottom of the screen

<v-navigation-drawer v-model="drawer">

<v-navigation-drawer v-model="drawer" app>

Body:
remove <header> tag around <v-navigation-drawer> and simply override vuetify css using !important

here is a working example: Live Demo


答:
Your move constructor does not have the specifier noexcept.

Declare it like

```<code>VecOfInt(VecOfInt&& other) noexcept : m_size(other.m_size) {
    std::cout << "move..." << std::endl;
    m_data = other.m_data;
    other.m_data = nullptr;
}
</code>```

Otherwise the class template std::vector will call the copy constructor.

Title: Why are my data elements being copied instead of moved?

Body:
Your move constructor does not have the specifier noexcept.

Declare it like

VecOfInt(VecOfInt&& other) noexcept : m_size(other.m_size) {
    std::cout << "move..." << std::endl;
    m_data = other.m_data;
    other.m_data = nullptr;
}

Otherwise the class template std::vector will call the copy constructor.


问:
Logback - can you define appender name and class from env variables?
I want to have dynamic logback appender properties which can easily be added to the logback config file, however trying to set the class and name of the appender(which are in a xml attributes instead of elements under the appender element).

So here is my application.yml(hardcoded the values for the example, but in the real world use case those will be passed as env variables from Helm, during the deploy to K8s cluster):

```<code>log:
  config:
    appender:
      name: CONSOLE
      class: ch.qos.logback.core.ConsoleAppender
</code>```

And here is how I try to access those in logback-spring.xml(spring boot version - 2.2.4.RELEASE

```<code><?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- use Spring default values like patterns -->
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
    <!-- declaration of ENV properties:   -->
    <springProperty name="LOG_CONFIG_APPENDER_NAME" source="log.config.appender.name"/>
    <springProperty name="LOG_CONFIG_APPENDER_CLASS" source="log.config.appender.class"/>

    <appender name="${LOG_CONFIG_APPENDER_NAME}" class="${LOG_CONFIG_APPENDER_CLASS}">
        <encoder>
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
            <charset>utf8</charset>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="${LOG_CONFIG_APPENDER_NAME}"/>
    </root>
</configuration>
</code>```

This leads to the following exception:

```<code>ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [${LOG_CONFIG_APPENDER_CLASS}]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ${LOG_CONFIG_APPENDER_CLASS}
</code>```

So my question is: is it possible to define the appender name and class dynamically ?

答:
I have ended up doing it in Groovy, as mapping the config to the Spring profiles does not work for me and my team, as we are using the dev profile for both our local and our shared dev env(hosted on K8s cluster).

I am not proud of it, but ended doing it with a simple if:

```<code>def loggingType = System.getenv('LOGGING_TYPE')
def loggingLevelEnvVar = System.getenv('CUSTOM_LOGGING_LEVEL')
def loggingLevel = loggingLevelEnvVar == null ? INFO : Level.valueOf(loggingLevelEnvVar)
// please do not use a coloured pattern for consoles that will be scrapped
def loggingPattern = System.getenv('LOGGING_LEVEL_PATTERN')
...
if ('JSON'.equalsIgnoreCase(loggingType)) {
    appender('CONSOLE', ConsoleAppender) {
        encoder(LayoutWrappingEncoder) {
            layout(JsonLayout) {
                timestampFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"
                timestampFormatTimezoneId = 'Etc/UTC'
                appendLineSeparator = true
                jsonFormatter(JacksonJsonFormatter) {
                    prettyPrint = false
                }
            }
        }
    }
} else {
    appender('CONSOLE', ConsoleAppender) {
        encoder(PatternLayoutEncoder) {
            pattern = loggingPattern
        }
    }
}
...
</code>```

Body:
I want to have dynamic logback appender properties which can easily be added to the logback config file, however trying to set the class and name of the appender(which are in a xml attributes instead of elements under the appender element).

So here is my application.yml(hardcoded the values for the example, but in the real world use case those will be passed as env variables from Helm, during the deploy to K8s cluster):

log:
  config:
    appender:
      name: CONSOLE
      class: ch.qos.logback.core.ConsoleAppender

And here is how I try to access those in logback-spring.xml(spring boot version - 2.2.4.RELEASE

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>

    <springProperty name="LOG_CONFIG_APPENDER_NAME" source="log.config.appender.name"/>
    <springProperty name="LOG_CONFIG_APPENDER_CLASS" source="log.config.appender.class"/>

    <appender name="${LOG_CONFIG_APPENDER_NAME}" class="${LOG_CONFIG_APPENDER_CLASS}">
        <encoder>
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
            <charset>utf8</charset>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="${LOG_CONFIG_APPENDER_NAME}"/>
    </root>
</configuration>

This leads to the following exception:

ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [${LOG_CONFIG_APPENDER_CLASS}]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ${LOG_CONFIG_APPENDER_CLASS}

So my question is: is it possible to define the appender name and class dynamically ?

Body:
I have ended up doing it in Groovy, as mapping the config to the Spring profiles does not work for me and my team, as we are using the dev profile for both our local and our shared dev env(hosted on K8s cluster).

I am not proud of it, but ended doing it with a simple if:

def loggingType = System.getenv('LOGGING_TYPE')
def loggingLevelEnvVar = System.getenv('CUSTOM_LOGGING_LEVEL')
def loggingLevel = loggingLevelEnvVar == null ? INFO : Level.valueOf(loggingLevelEnvVar)
// please do not use a coloured pattern for consoles that will be scrapped
def loggingPattern = System.getenv('LOGGING_LEVEL_PATTERN')
...
if ('JSON'.equalsIgnoreCase(loggingType)) {
    appender('CONSOLE', ConsoleAppender) {
        encoder(LayoutWrappingEncoder) {
            layout(JsonLayout) {
                timestampFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"
                timestampFormatTimezoneId = 'Etc/UTC'
                appendLineSeparator = true
                jsonFormatter(JacksonJsonFormatter) {
                    prettyPrint = false
                }
            }
        }
    }
} else {
    appender('CONSOLE', ConsoleAppender) {
        encoder(PatternLayoutEncoder) {
            pattern = loggingPattern
        }
    }
}
...


问:
Security Claims in DBCommandInterceptor
i am currently using EF and .NET Core 3 through Radzen to build an application. This is working fine, but I want to add additional logging to the database. In order to do so, I would like to make use of the DBCommandInterceptor as shown here to do some post query commands.

Is it possible to get the Claims of the Microsoft Authorization in this Interceptor class? In my normal controller class, I can simply call

```<code>var userId = User.FindFirst(ClaimTypes.Name).Value;
</code>```

This doesn't work in the Interceptor and to be honest, my knowledge about that framework is very poor. I cannot even tell you why I can access the User reference in my ObjectController against the DBCommandInterceptor

答:
If you add the Interceptor in DbContext.OnConfiguring, you can pass any state to it you want.

So require your DbContext to accept an Identity, or with a service dependency it can use to access the user.  something like:

```<code>public class Db : DbContext
{
    ClaimsIdentity user;
    public Db(ClaimsIdentity user)
    {
        this.user = user;
    }
</code>```

Then configure the Interceptor to accept the User, or the DbContext instance.  eg

```<code>protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.UseSqlServer("Server=localhost;Database=EFCore3Test;Integrated Security = true", a => a.UseRelationalNulls(true))
                  .ConfigureWarnings(c => c.Log((RelationalEventId.CommandExecuting, LogLevel.Information)))
                  .UseLoggerFactory(MyLoggerFactory)
                  .AddInterceptors(new MyCommandInterceptor(this));

    base.OnConfiguring(optionsBuilder);
}
</code>```

And have the interceptor use the constructor argument:

```<code>public class MyCommandInterceptor : DbCommandInterceptor
{
    private Db db;
    public MyCommandInterceptor(Db db)
    {
        this.db = db;
    }

    public override InterceptionResult<DbDataReader> ReaderExecuting(DbCommand command, CommandEventData eventData, InterceptionResult<DbDataReader> result)
    {
        var userId = db.user.FindFirst(ClaimTypes.Name).Value;
        //. . .
        return base.ReaderExecuting(command, eventData, result);
    }

}
</code>```

Title: Security Claims in DBCommandInterceptor

Body:
i am currently using EF and .NET Core 3 through Radzen to build an application. This is working fine, but I want to add additional logging to the database. In order to do so, I would like to make use of the DBCommandInterceptor as shown here to do some post query commands.

Is it possible to get the Claims of the Microsoft Authorization in this Interceptor class? In my normal controller class, I can simply call

var userId = User.FindFirst(ClaimTypes.Name).Value;

This doesn't work in the Interceptor and to be honest, my knowledge about that framework is very poor. I cannot even tell you why I can access the User reference in my ObjectController against the DBCommandInterceptor

Body:
If you add the Interceptor in DbContext.OnConfiguring, you can pass any state to it you want.

So require your DbContext to accept an Identity, or with a service dependency it can use to access the user.  something like:

public class Db : DbContext
{
    ClaimsIdentity user;
    public Db(ClaimsIdentity user)
    {
        this.user = user;
    }

Then configure the Interceptor to accept the User, or the DbContext instance.  eg

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.UseSqlServer("Server=localhost;Database=EFCore3Test;Integrated Security = true", a => a.UseRelationalNulls(true))
                  .ConfigureWarnings(c => c.Log((RelationalEventId.CommandExecuting, LogLevel.Information)))
                  .UseLoggerFactory(MyLoggerFactory)
                  .AddInterceptors(new MyCommandInterceptor(this));

    base.OnConfiguring(optionsBuilder);
}

And have the interceptor use the constructor argument:

public class MyCommandInterceptor : DbCommandInterceptor
{
    private Db db;
    public MyCommandInterceptor(Db db)
    {
        this.db = db;
    }

    public override InterceptionResult<DbDataReader> ReaderExecuting(DbCommand command, CommandEventData eventData, InterceptionResult<DbDataReader> result)
    {
        var userId = db.user.FindFirst(ClaimTypes.Name).Value;
        //. . .
        return base.ReaderExecuting(command, eventData, result);
    }

}


问:
How to convert JOINs to INs clauses?
I have followed this link and several others where they showed how to go in a particular direction but not the other.

My original query written with JOINs:

```<code>SELECT DISTINCT * FROM membership
JOIN rental ON membership.MEM_NUM = rental.MEM_NUM
JOIN detailrental ON rental.RENT_NUM = detailrental.RENT_NUM
WHERE DETAIL_DUEDATE < DETAIL_RETURNDATE
GROUP BY membership.MEM_NUM;
</code>```

I have tried to use INs here: (It doesn't not work)

```<code>SELECT DISTINCT * FROM membership
WHERE membership.MEM_NUM IN (SELECT rental.MEM_NUM FROM rental)
WHERE rental.RENT_NUM IN (SELECT detailrental.RENT_NUM FROM detailrental)
WHERE DETAIL_DUEDATE < DETAIL_RETURNDATE;
</code>```

ERD:

My overall purpose is to answer this question while using the IN clause:
Lists all details of members who returned their rented DVDs late

Here's the database file:
https://pastebin.com/wBjmHcfX

答:
I don't know why you try do do this.

Because i don't think that will be faster.

I' added also the GROUP By Clause.

```<code>SELECT DISTINCT * FROM membership
WHERE membership.MEM_NUM IN (SELECT rental.MEM_NUM
                             FROM rental
                             WHERE rental.RENT_NUM IN (SELECT detailrental.RENT_NUM
                                                       FROM detailrental
                                                       WHERE DETAIL_DUEDATE < DETAIL_RETURNDATE)
                            )
GROUP BY membership.MEM_NUM;
</code>```

An example based on your data

```<code>CREATE TABLE `price` (
  `PRICE_CODE` decimal(2,0) NOT NULL,
  `PRICE_DESCRIPTION` varchar(20) NOT NULL,
  `PRICE_RENTFEE` decimal(5,2) DEFAULT NULL,
  `PRICE_DAILYLATEFEE` decimal(5,2) DEFAULT NULL,
  PRIMARY KEY (`PRICE_CODE`)
);
</code>```
```
✓
```

```<code>CREATE TABLE `movie` (
  `MOVIE_NUM` decimal(8,0) NOT NULL,
  `MOVIE_TITLE` varchar(75) NOT NULL,
  `MOVIE_YEAR` decimal(4,0) DEFAULT NULL,
  `MOVIE_COST` decimal(5,2) DEFAULT NULL,
  `MOVIE_GENRE` varchar(50) DEFAULT NULL,
  `PRICE_CODE` decimal(2,0) DEFAULT NULL,
  PRIMARY KEY (`MOVIE_NUM`),
  KEY `PRICE_CODE` (`PRICE_CODE`),
  CONSTRAINT `movie_ibfk_1` FOREIGN KEY (`PRICE_CODE`) REFERENCES `price` (`PRICE_CODE`)
);
</code>```
```
✓
```

```<code>CREATE TABLE `video` (
  `VID_NUM` decimal(8,0) NOT NULL,
  `VID_INDATE` date DEFAULT NULL,
  `MOVIE_NUM` decimal(8,0) DEFAULT NULL,
  PRIMARY KEY (`VID_NUM`),
  KEY `MOVIE_NUM` (`MOVIE_NUM`),
  CONSTRAINT `video_ibfk_1` FOREIGN KEY (`MOVIE_NUM`) REFERENCES `movie` (`MOVIE_NUM`)
);
</code>```
```
✓
```

```<code>CREATE TABLE `membership` (
  `MEM_NUM` decimal(8,0) NOT NULL,
  `MEM_FNAME` varchar(30) NOT NULL,
  `MEM_LNAME` varchar(30) NOT NULL,
  `MEM_STREET` varchar(120) DEFAULT NULL,
  `MEM_CITY` varchar(50) DEFAULT NULL,
  `MEM_STATE` char(2) DEFAULT NULL,
  `MEM_ZIP` char(5) DEFAULT NULL,
  `MEM_BALANCE` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`MEM_NUM`)
);
</code>```
```
✓
```

```<code>CREATE TABLE `rental` (
  `RENT_NUM` decimal(8,0) NOT NULL,
  `RENT_DATE` date DEFAULT NULL,
  `MEM_NUM` decimal(8,0) DEFAULT NULL,
  PRIMARY KEY (`RENT_NUM`),
  KEY `MEM_NUM` (`MEM_NUM`),
  CONSTRAINT `rental_ibfk_1` FOREIGN KEY (`MEM_NUM`) REFERENCES `membership` (`MEM_NUM`)
);
</code>```
```<code>CREATE TABLE `price` (
  `PRICE_CODE` decimal(2,0) NOT NULL,
  `PRICE_DESCRIPTION` varchar(20) NOT NULL,
  `PRICE_RENTFEE` decimal(5,2) DEFAULT NULL,
  `PRICE_DAILYLATEFEE` decimal(5,2) DEFAULT NULL,
  PRIMARY KEY (`PRICE_CODE`)
);
</code>```0

```<code>CREATE TABLE `price` (
  `PRICE_CODE` decimal(2,0) NOT NULL,
  `PRICE_DESCRIPTION` varchar(20) NOT NULL,
  `PRICE_RENTFEE` decimal(5,2) DEFAULT NULL,
  `PRICE_DAILYLATEFEE` decimal(5,2) DEFAULT NULL,
  PRIMARY KEY (`PRICE_CODE`)
);
</code>```1
```<code>CREATE TABLE `price` (
  `PRICE_CODE` decimal(2,0) NOT NULL,
  `PRICE_DESCRIPTION` varchar(20) NOT NULL,
  `PRICE_RENTFEE` decimal(5,2) DEFAULT NULL,
  `PRICE_DAILYLATEFEE` decimal(5,2) DEFAULT NULL,
  PRIMARY KEY (`PRICE_CODE`)
);
</code>```2

```<code>INSERT INTO `membership` VALUES (102,'TAMI','DAWSON','2632 TAKLI CIRCLE','NORENE','TN','37136',11.00),(103,'CURT','KNIGHT','4025 CORNELL COURT','FLATGAP','KY','41219',6.00),(104,'JAMAL','MELENDEZ','788 EAST 145TH AVENUE','QUEBECK','TN','38579',0.00),(105,'IVA','MCCLAIN','6045 MUSKET BALL CIRCLE','SUMMIT','KY','42783',15.00),(106,'MIRANDA','PARKS','4469 MAXWELL PLACE','GERMANTOWN','TN','38183',0.00),(107,'ROSARIO','ELLIOTT','7578 DANNER AVENUE','COLUMBIA','TN','38402',5.00),(108,'MATTIE','GUY','4390 EVERGREEN STREET','LILY','KY','40740',0.00),(109,'CLINT','OCHOA','1711 ELM STREET','GREENEVILLE','TN','37745',10.00),(110,'LEWIS','ROSALES','4524 SOUTHWIND CIRCLE','COUNCE','TN','38326',0.00),(111,'STACY','MANN','2789 EAST COOK AVENUE','MURFREESBORO','TN','37132',8.00),(112,'LUIS','TRUJILLO','7267 MELVIN AVENUE','HEISKELL','TN','37754',3.00),(113,'MINNIE','GONZALES','6430 VASILI DRIVE','WILLISTON','TN','38076',0.00);
INSERT INTO `price` VALUES (1,'Standard',3.00,1.00),(2,'New Release',4.50,3.00),(3,'Discount',2.50,1.00),(4,'Weekly Special',2.00,0.50);
INSERT INTO `movie` VALUES (1234,'The Cesar Family Christmas',2014,39.95,'FAMILY',2),(1235,'Smokey Mountain Wildlife',2011,59.95,'ACTION',3),(1236,'Richard Goodhope',2015,59.95,'DRAMA',2),(1237,'Beatnik Fever',2014,29.95,'COMEDY',2),(1238,'Constant Companion',2015,89.95,'DRAMA',NULL),(1239,'Where Hope Dies',2005,25.49,'DRAMA',3),(1245,'Time to Burn',2015,45.49,'ACTION',3),(1246,'What He Doesn\'t Know',2013,58.29,'COMEDY',1);
INSERT INTO `video` VALUES (34341,'2014-01-22',1235),(34342,'2014-01-22',1235),(34366,'2016-03-02',1236),(34367,'2016-03-02',1236),(34368,'2016-03-02',1236),(34369,'2016-03-02',1236),(44392,'2015-10-21',1237),(44397,'2015-10-21',1237),(54321,'2015-06-18',1234),(54324,'2015-06-18',1234),(54325,'2015-06-18',1234),(59237,'2016-02-14',1237),(61353,'2013-01-28',1245),(61354,'2013-01-28',1245),(61367,'2015-07-30',1246),(61369,'2015-07-30',1246),(61388,'2014-01-25',1239);
INSERT INTO `rental` VALUES (1001,'2016-03-01',103),(1002,'2016-03-01',105),(1003,'2016-03-02',102),(1004,'2016-03-02',110),(1005,'2016-03-02',111),(1006,'2016-03-02',107),(1007,'2016-03-02',104),(1008,'2016-03-03',105),(1009,'2016-03-03',111);
INSERT INTO `detailrental` VALUES (1001,34342,2.00,'2016-03-04','2016-03-02',NULL),(1001,34366,3.50,'2016-03-04','2016-03-02',3.00),(1001,61353,2.00,'2016-03-04','2016-03-03',1.00),(1002,59237,3.50,'2016-03-04','2016-03-04',3.00),(1003,54325,3.50,'2016-03-04','2016-03-09',3.00),(1003,61369,2.00,'2016-03-06','2016-03-09',1.00),(1003,61388,0.00,'2016-03-06','2016-03-09',1.00),(1004,34341,2.00,'2016-03-07','2016-03-07',1.00),(1004,34367,3.50,'2016-03-05','2016-03-07',3.00),(1004,44392,3.50,'2016-03-05','2016-03-07',3.00),(1005,34342,2.00,'2016-03-07','2016-03-05',1.00),(1005,44397,3.50,'2016-03-05','2016-03-05',3.00),(1006,34366,3.50,'2016-03-05','2016-03-04',3.00),(1006,61367,2.00,'2016-03-07',NULL,1.00),(1007,34368,3.50,'2016-03-05',NULL,3.00),(1008,34369,3.50,'2016-03-05','2016-03-05',3.00),(1009,54324,3.50,'2016-03-05',NULL,3.00);
</code>```
```
✓

✓

✓

✓

✓

✓
```

```<code>SELECT DISTINCT * FROM membership
WHERE membership.MEM_NUM IN (SELECT rental.MEM_NUM
                             FROM rental
                             WHERE rental.RENT_NUM IN (SELECT detailrental.RENT_NUM
                                                       FROM detailrental
                                                       WHERE DETAIL_DUEDATE < DETAIL_RETURNDATE)
                            )
GROUP BY membership.MEM_NUM;
</code>```
```
MEM_NUM | MEM_FNAME | MEM_LNAME | MEM_STREET            | MEM_CITY | MEM_STATE | MEM_ZIP | MEM_BALANCE
------: | :-------- | :-------- | :-------------------- | :------- | :-------- | :------ | ----------:
    102 | TAMI      | DAWSON    | 2632 TAKLI CIRCLE     | NORENE   | TN        | 37136   |       11.00
    110 | LEWIS     | ROSALES   | 4524 SOUTHWIND CIRCLE | COUNCE   | TN        | 38326   |        0.00
```

db<>fiddle here

Title: How to convert JOINs to INs clauses?

Body:
I have followed this link and several others where they showed how to go in a particular direction but not the other.

My original query written with JOINs:

SELECT DISTINCT * FROM membership
JOIN rental ON membership.MEM_NUM = rental.MEM_NUM
JOIN detailrental ON rental.RENT_NUM = detailrental.RENT_NUM
WHERE DETAIL_DUEDATE < DETAIL_RETURNDATE
GROUP BY membership.MEM_NUM;

I have tried to use INs here: (It doesn't not work)

SELECT DISTINCT * FROM membership
WHERE membership.MEM_NUM IN (SELECT rental.MEM_NUM FROM rental)
WHERE rental.RENT_NUM IN (SELECT detailrental.RENT_NUM FROM detailrental)
WHERE DETAIL_DUEDATE < DETAIL_RETURNDATE;

ERD:

My overall purpose is to answer this question while using the IN clause:
Lists all details of members who returned their rented DVDs late

Here's the database file:
https://pastebin.com/wBjmHcfX

Body:
I don't know why you try do do this.

Because i don't think that will be faster.

I' added also the GROUP By Clause.

SELECT DISTINCT * FROM membership
WHERE membership.MEM_NUM IN (SELECT rental.MEM_NUM
                             FROM rental
                             WHERE rental.RENT_NUM IN (SELECT detailrental.RENT_NUM
                                                       FROM detailrental
                                                       WHERE DETAIL_DUEDATE < DETAIL_RETURNDATE)
                            )
GROUP BY membership.MEM_NUM;

An example based on your data

CREATE TABLE `price` (
  `PRICE_CODE` decimal(2,0) NOT NULL,
  `PRICE_DESCRIPTION` varchar(20) NOT NULL,
  `PRICE_RENTFEE` decimal(5,2) DEFAULT NULL,
  `PRICE_DAILYLATEFEE` decimal(5,2) DEFAULT NULL,
  PRIMARY KEY (`PRICE_CODE`)
);

✓

CREATE TABLE `movie` (
  `MOVIE_NUM` decimal(8,0) NOT NULL,
  `MOVIE_TITLE` varchar(75) NOT NULL,
  `MOVIE_YEAR` decimal(4,0) DEFAULT NULL,
  `MOVIE_COST` decimal(5,2) DEFAULT NULL,
  `MOVIE_GENRE` varchar(50) DEFAULT NULL,
  `PRICE_CODE` decimal(2,0) DEFAULT NULL,
  PRIMARY KEY (`MOVIE_NUM`),
  KEY `PRICE_CODE` (`PRICE_CODE`),
  CONSTRAINT `movie_ibfk_1` FOREIGN KEY (`PRICE_CODE`) REFERENCES `price` (`PRICE_CODE`)
);

✓

CREATE TABLE `video` (
  `VID_NUM` decimal(8,0) NOT NULL,
  `VID_INDATE` date DEFAULT NULL,
  `MOVIE_NUM` decimal(8,0) DEFAULT NULL,
  PRIMARY KEY (`VID_NUM`),
  KEY `MOVIE_NUM` (`MOVIE_NUM`),
  CONSTRAINT `video_ibfk_1` FOREIGN KEY (`MOVIE_NUM`) REFERENCES `movie` (`MOVIE_NUM`)
);

✓

CREATE TABLE `membership` (
  `MEM_NUM` decimal(8,0) NOT NULL,
  `MEM_FNAME` varchar(30) NOT NULL,
  `MEM_LNAME` varchar(30) NOT NULL,
  `MEM_STREET` varchar(120) DEFAULT NULL,
  `MEM_CITY` varchar(50) DEFAULT NULL,
  `MEM_STATE` char(2) DEFAULT NULL,
  `MEM_ZIP` char(5) DEFAULT NULL,
  `MEM_BALANCE` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`MEM_NUM`)
);

✓

CREATE TABLE `rental` (
  `RENT_NUM` decimal(8,0) NOT NULL,
  `RENT_DATE` date DEFAULT NULL,
  `MEM_NUM` decimal(8,0) DEFAULT NULL,
  PRIMARY KEY (`RENT_NUM`),
  KEY `MEM_NUM` (`MEM_NUM`),
  CONSTRAINT `rental_ibfk_1` FOREIGN KEY (`MEM_NUM`) REFERENCES `membership` (`MEM_NUM`)
);

✓

CREATE TABLE `detailrental` (
  `RENT_NUM` decimal(8,0) NOT NULL,
  `VID_NUM` decimal(8,0) NOT NULL,
  `DETAIL_FEE` decimal(5,2) DEFAULT NULL,
  `DETAIL_DUEDATE` date DEFAULT NULL,
  `DETAIL_RETURNDATE` date DEFAULT NULL,
  `DETAIL_DAILYLATEFEE` decimal(5,2) DEFAULT NULL,
  PRIMARY KEY (`RENT_NUM`,`VID_NUM`),
  KEY `VID_NUM` (`VID_NUM`),
  CONSTRAINT `detailrental_ibfk_1` FOREIGN KEY (`RENT_NUM`) REFERENCES `rental` (`RENT_NUM`),
  CONSTRAINT `detailrental_ibfk_2` FOREIGN KEY (`VID_NUM`) REFERENCES `video` (`VID_NUM`)
);

✓

INSERT INTO `membership` VALUES (102,'TAMI','DAWSON','2632 TAKLI CIRCLE','NORENE','TN','37136',11.00),(103,'CURT','KNIGHT','4025 CORNELL COURT','FLATGAP','KY','41219',6.00),(104,'JAMAL','MELENDEZ','788 EAST 145TH AVENUE','QUEBECK','TN','38579',0.00),(105,'IVA','MCCLAIN','6045 MUSKET BALL CIRCLE','SUMMIT','KY','42783',15.00),(106,'MIRANDA','PARKS','4469 MAXWELL PLACE','GERMANTOWN','TN','38183',0.00),(107,'ROSARIO','ELLIOTT','7578 DANNER AVENUE','COLUMBIA','TN','38402',5.00),(108,'MATTIE','GUY','4390 EVERGREEN STREET','LILY','KY','40740',0.00),(109,'CLINT','OCHOA','1711 ELM STREET','GREENEVILLE','TN','37745',10.00),(110,'LEWIS','ROSALES','4524 SOUTHWIND CIRCLE','COUNCE','TN','38326',0.00),(111,'STACY','MANN','2789 EAST COOK AVENUE','MURFREESBORO','TN','37132',8.00),(112,'LUIS','TRUJILLO','7267 MELVIN AVENUE','HEISKELL','TN','37754',3.00),(113,'MINNIE','GONZALES','6430 VASILI DRIVE','WILLISTON','TN','38076',0.00);
INSERT INTO `price` VALUES (1,'Standard',3.00,1.00),(2,'New Release',4.50,3.00),(3,'Discount',2.50,1.00),(4,'Weekly Special',2.00,0.50);
INSERT INTO `movie` VALUES (1234,'The Cesar Family Christmas',2014,39.95,'FAMILY',2),(1235,'Smokey Mountain Wildlife',2011,59.95,'ACTION',3),(1236,'Richard Goodhope',2015,59.95,'DRAMA',2),(1237,'Beatnik Fever',2014,29.95,'COMEDY',2),(1238,'Constant Companion',2015,89.95,'DRAMA',NULL),(1239,'Where Hope Dies',2005,25.49,'DRAMA',3),(1245,'Time to Burn',2015,45.49,'ACTION',3),(1246,'What He Doesn\'t Know',2013,58.29,'COMEDY',1);
INSERT INTO `video` VALUES (34341,'2014-01-22',1235),(34342,'2014-01-22',1235),(34366,'2016-03-02',1236),(34367,'2016-03-02',1236),(34368,'2016-03-02',1236),(34369,'2016-03-02',1236),(44392,'2015-10-21',1237),(44397,'2015-10-21',1237),(54321,'2015-06-18',1234),(54324,'2015-06-18',1234),(54325,'2015-06-18',1234),(59237,'2016-02-14',1237),(61353,'2013-01-28',1245),(61354,'2013-01-28',1245),(61367,'2015-07-30',1246),(61369,'2015-07-30',1246),(61388,'2014-01-25',1239);
INSERT INTO `rental` VALUES (1001,'2016-03-01',103),(1002,'2016-03-01',105),(1003,'2016-03-02',102),(1004,'2016-03-02',110),(1005,'2016-03-02',111),(1006,'2016-03-02',107),(1007,'2016-03-02',104),(1008,'2016-03-03',105),(1009,'2016-03-03',111);
INSERT INTO `detailrental` VALUES (1001,34342,2.00,'2016-03-04','2016-03-02',NULL),(1001,34366,3.50,'2016-03-04','2016-03-02',3.00),(1001,61353,2.00,'2016-03-04','2016-03-03',1.00),(1002,59237,3.50,'2016-03-04','2016-03-04',3.00),(1003,54325,3.50,'2016-03-04','2016-03-09',3.00),(1003,61369,2.00,'2016-03-06','2016-03-09',1.00),(1003,61388,0.00,'2016-03-06','2016-03-09',1.00),(1004,34341,2.00,'2016-03-07','2016-03-07',1.00),(1004,34367,3.50,'2016-03-05','2016-03-07',3.00),(1004,44392,3.50,'2016-03-05','2016-03-07',3.00),(1005,34342,2.00,'2016-03-07','2016-03-05',1.00),(1005,44397,3.50,'2016-03-05','2016-03-05',3.00),(1006,34366,3.50,'2016-03-05','2016-03-04',3.00),(1006,61367,2.00,'2016-03-07',NULL,1.00),(1007,34368,3.50,'2016-03-05',NULL,3.00),(1008,34369,3.50,'2016-03-05','2016-03-05',3.00),(1009,54324,3.50,'2016-03-05',NULL,3.00);

✓

✓

✓

✓

✓

✓

SELECT DISTINCT * FROM membership
WHERE membership.MEM_NUM IN (SELECT rental.MEM_NUM
                             FROM rental
                             WHERE rental.RENT_NUM IN (SELECT detailrental.RENT_NUM
                                                       FROM detailrental
                                                       WHERE DETAIL_DUEDATE < DETAIL_RETURNDATE)
                            )
GROUP BY membership.MEM_NUM;

MEM_NUM | MEM_FNAME | MEM_LNAME | MEM_STREET            | MEM_CITY | MEM_STATE | MEM_ZIP | MEM_BALANCE
------: | :-------- | :-------- | :-------------------- | :------- | :-------- | :------ | ----------:
    102 | TAMI      | DAWSON    | 2632 TAKLI CIRCLE     | NORENE   | TN        | 37136   |       11.00
    110 | LEWIS     | ROSALES   | 4524 SOUTHWIND CIRCLE | COUNCE   | TN        | 38326   |        0.00

db<>fiddle here


问:
Updates to Custom App through Apple Business Manager
We recently built a Custom app for internal employees and distributed it using redemption codes from Apple Business Manager. I pushed an app update that is approved and users with new redemption codes are able to download the new version. How do existing users with the old version get the new version update? So far the apps on phones have had no push notification asking to update or no automatic updates have happened. It will be very inconvenient to send new redemption codes every time there is a bug fix or update. How is this handled?</p>

答: The updates are handled automatically. Once the new app version is approved on App Store, it seems to take 3-4 days for the apps already installed on users' phones to automatically receive the update. </p>


问:
Jenkins pass value of Active Choices Parameter
I have a jenkins job with "Active Choices Parameter" and "Active Choices Reactive Parameter".

```<code>pipeline {
   agent { label 'Agent_Name' }

   stages {
      stage('Build') {
         steps {
            script {
                def res=build job: 'App_Build', parameters: [string(name: 'ActiveChoicesParam', value: 'Dev'),string(name: 'ActiveChoicesReactiveParam', value: 'Server1')]
            }
         }
      }
   }
}
</code>```

I am trying to call the jenkins job and pass parameter values using pipeline script. However, I am getting the following error:

The parameter 'ActiveChoicesParam' did not have the type expected by
App_Build. Converting to Active Choices Parameter.

The parameter 'ActiveChoicesReactiveParam' did not have the type expected by
App_Build. Converting to Active Choices Reactive Parameter.

They (Dev and Server1) are valid values - How can I pass these values?

答:
Try setting up as new StringParameterValue's</p>

```<code>build(job: "App_Build",
    parameters: [
        new StringParameterValue('ActiveChoicesParam', 'Dev'),
        new StringParameterValue('ActiveChoicesReactiveParam', 'Server1')
    ],
)
</code>```

Body:
I have a jenkins job with "Active Choices Parameter" and "Active Choices Reactive Parameter".

pipeline {
   agent { label 'Agent_Name' }

   stages {
      stage('Build') {
         steps {
            script {
                def res=build job: 'App_Build', parameters: [string(name: 'ActiveChoicesParam', value: 'Dev'),string(name: 'ActiveChoicesReactiveParam', value: 'Server1')]
            }
         }
      }
   }
}

I am trying to call the jenkins job and pass parameter values using pipeline script. However, I am getting the following error:

The parameter 'ActiveChoicesParam' did not have the type expected by
App_Build. Converting to Active Choices Parameter.

The parameter 'ActiveChoicesReactiveParam' did not have the type expected by
App_Build. Converting to Active Choices Reactive Parameter.

They (Dev and Server1) are valid values - How can I pass these values?

Body:
Try setting up as new StringParameterValue's

build(job: "App_Build",
    parameters: [
        new StringParameterValue('ActiveChoicesParam', 'Dev'),
        new StringParameterValue('ActiveChoicesReactiveParam', 'Server1')
    ],
)