问:
Best practice for multiple user types in AWS Cognito?
I need two user groups that have different permissions/routing based on the type of account they sign up under.

Should I create one user pool and separate into two groups then assign to different identity pools based on group membership? Should I create two separate user pools? Or should I just have one user pool and assign to identity pools some other way? How do I automatically set groups/pools at signup?

Finally, how would I go about configuring this in Amplify.configure and implementing in signup? IE right now I have: Amplify.configure({
  Auth: {
    mandatorySignIn: false,
    region: config.cognito.REGION,
    userPoolId: config.cognito.USER_POOL_ID,
    identityPoolId: config.cognito.IDENTITY_POOL_ID,
    userPoolWebClientId: config.cognito.APP_CLIENT_ID
  },

How would I configure multiple pools/groups?

答:
The easiest and arguably the best way to go about this is using the cognito groups. For every goup that you add, a new role is created to which you can attach whatever policies you require. In Identity pool make sure you select "Choose role from token" under authentication providers and Authenticated role selection. </p>

<p>You have to write your own backend logic to add a user to group. </p>

Body:
The easiest and arguably the best way to go about this is using the cognito groups. For every goup that you add, a new role is created to which you can attach whatever policies you require. In Identity pool make sure you select "Choose role from token" under authentication providers and Authenticated role selection.

You have to write your own backend logic to add a user to group.


来源: stackexchange

问:
Oracle performance issue with massive inserts and truncates (AWR attached)
I'm using Oracle to synchronize events between two nodes of my application server (never mind why/if that's the best way/etc. This is a given).

To do so, I'm using an "events" table that one node (the "active") writes new events to and the other node (the "passive") reads from. The table looks like:

Event UUID (UUID) || Event ID (long)  ||  Event Data (several columns of different types)

The event ID is a number constantly increasing (application controlled, not a sequence) that signifies the revision the internal model would be at after applying the event data. The Event UUID has unique constraint. I have a single index on the event ID to facilitate the select SQL - "Select ... where Event_ID > XXX order by Event_ID" where the XXX is the internal revision number of the passive node. Once in a while I truncate the table (using "truncate reuse storage").

[Actually, I use three such tables in a round-robin order so I could always truncate the one I'm about to write to the my passive node can have time to "catch up"].

After several hours of inserting and truncating where everything is fine I start getting a lot of "noise" from the database and response time drops dramatically. This can go on for an hour or two (or even more), then all of the sudden it stops and response time return to its normal level. The AWR reports point toward the truncate statement and a bit toward the insert statements. I suspect something is going on with DBWR - but I can't pinpoint. Note that this performance degradation happens even when the secondary node (the one running the "SELECT" statements) is off - so it's pure insert/truncate. Note2: This issue does NOT reproduce on MSSQL.

The question: why is this happening? What can I do to stop it? Are there alternatives to this design (the closer the alternative to the current design the better).

Update 1: I might have mislead with the title. This is not a single massive insert but a trickle of inserts as the events are generated in the application server.

Update 2: AWR compare of a sample from the first period (good) and the second period (bad) is at http://pastehtml.com/view/1eirn20.html

Update 3: new AWR diff at http://pastehtml.com/view/1eirn20.html

Update 4: Solved. Apparently it WAS the storage (thanks ik_zelf!). Just goes to show - abstractions aren't really abstract. At the end, it's a magnetized spinning plate.

答: In the awr reports is a clear indication that the io time doubles in the bad period compared to the first period. Check the storage usage. It could very well be that the storage is shared between systems and that - for example - an other system is taking a backup and causes a bad period. Check the logs of all connected systems/backups an try to connect the times to your test findings.</p>

ContentLicense: CC BY-SA 3.0


问:
SQL Query between two dates from sub query
I have to filter my result by two columns from sub query,so I have join them like below which works fine.

```<code>select * from EDM_STATUS_REPORT_DATA LEFT JOIN
(
   Select DocumentID, LogDate
   From [LM_StateEvents]
   Where 1=1

) table2
ON
   EDM_STATUS_REPORT_DATA.LLObjID=table2.DocumentID
   AND EDM_STATUS_REPORT_DATA.StatusDate = table2.LogDate
WHERE table2.DocumentID IS NOT NULL
</code>```

However the EDM_STATUS_REPORT_DATA.StatusDate in main query is not going to be the same value from sub query.It would have maximum of +5 seconds difference.  So I have to search like using between table2.LogDate and table2.LogDate + 5 seconds.

How can I achieve this.

Below is the sample data and Expected output.

答:
You could use a DATEDIFF to make sure the difference does not exceed 5 seconds:

```<code>select * from EDM_STATUS_REPORT_DATA LEFT JOIN
(
   Select DocumentID, LogDate
   From [LM_StateEvents]
   Where 1=1

) table2
ON
   EDM_STATUS_REPORT_DATA.LLObjID=table2.DocumentID
   AND DATEDIFF(second,EDM_STATUS_REPORT_DATA.StatusDate,table2.LogDate) between -5 and 5
WHERE table2.DocumentID IS NOT NULL
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have to filter my result by two columns from sub query,so I have join them like below which works fine.

select * from EDM_STATUS_REPORT_DATA LEFT JOIN
(
   Select DocumentID, LogDate
   From [LM_StateEvents]
   Where 1=1

) table2
ON
   EDM_STATUS_REPORT_DATA.LLObjID=table2.DocumentID
   AND EDM_STATUS_REPORT_DATA.StatusDate = table2.LogDate
WHERE table2.DocumentID IS NOT NULL

However the EDM_STATUS_REPORT_DATA.StatusDate in main query is not going to be the same value from sub query.It would have maximum of +5 seconds difference.  So I have to search like using between table2.LogDate and table2.LogDate + 5 seconds.

How can I achieve this.

Below is the sample data and Expected output.

Body:
You could use a DATEDIFF to make sure the difference does not exceed 5 seconds:

select * from EDM_STATUS_REPORT_DATA LEFT JOIN
(
   Select DocumentID, LogDate
   From [LM_StateEvents]
   Where 1=1

) table2
ON
   EDM_STATUS_REPORT_DATA.LLObjID=table2.DocumentID
   AND DATEDIFF(second,EDM_STATUS_REPORT_DATA.StatusDate,table2.LogDate) between -5 and 5
WHERE table2.DocumentID IS NOT NULL


问:
create new numpy nd-array by multiple two columns
I have a NumPy array that includes two columns, one for key and another for num of instances. For example:

```<code> key | num_of_instances
 ----------------------
  99  | 2
  88  | 3
  77  | 1
</code>```

I want to flat this to 1-d array in this structure:

```<code> [99, 99, 88, 88, 88, 77]
</code>```

i.e. every key in the original 2D-array should appear in the new 1D-array like that the num of instances in the 2nd col in the original array.

答:
The solution that works for me includes use in repeat function.  This function repeats elements of an array and has some configuration options for 1-D, n-D, etc like written here.

```<code>data = data.astype(str).astype(int) # this line solved the casting type error I tackled before
one_dimension_data = np.repeat(data[:,0],data[:,1])
</code>```

thanks for  @user3483203 about his informative comments.

Body:
I have a NumPy array that includes two columns, one for key and another for num of instances. For example:

 key | num_of_instances
 ----------------------
  99  | 2
  88  | 3
  77  | 1

I want to flat this to 1-d array in this structure:

 [99, 99, 88, 88, 88, 77]

i.e. every key in the original 2D-array should appear in the new 1D-array like that the num of instances in the 2nd col in the original array.

Body:
The solution that works for me includes use in repeat function.  This function repeats elements of an array and has some configuration options for 1-D, n-D, etc like written here.

data = data.astype(str).astype(int) # this line solved the casting type error I tackled before
one_dimension_data = np.repeat(data[:,0],data[:,1])

thanks for  @user3483203 about his informative comments.


问:
Rendering a partial view in Layout and declare a controller for it in asp.net core
I have the following scenario

```<code> @model CashUnited.Models.HomeViewModel
 <html lang="en">
 <head>
   <title>@ViewData["Title"] - test</title>
 </head>
 <body>
   <partial name="_Header" model="@Html.DisplayNameFor(model=>model)"/>
 </body>
</html>
</code>```

my partial view Code

```<code><select>
@{
   foreach (string item in Model.companiesLst)
   {
      <option value="@item">@item</option>
   }
}
</code>```

How and where I can Fill Model.companiesLst from the controller? I can't seem to figure it out in asp.net Core

答: Check out this answer: https://stackoverflow.com/a/52470112/6694514. It seems to fix a similar issue to the one you are having.</p>

Body:
I have the following scenario

 @model CashUnited.Models.HomeViewModel

   <title>@ViewData["Title"] - test</title>

   <partial name="_Header" model="@Html.DisplayNameFor(model=>model)"/>

my partial view Code

<select>
@{
   foreach (string item in Model.companiesLst)
   {
      <option value="@item">@item</option>
   }
}

How and where I can Fill Model.companiesLst from the controller? I can't seem to figure it out in asp.net Core


问:
How to sum float numbers in the format hours and minutes?
How to sum float numbers in the format hours and minutes?

Those. if  calculate two such numbers 0.35+3.45 then it should be = 4.20, not 3.80

var arr = [0.15, 0.2, 3.45, 0.4, 2, 0.3, 5.2, 1, 1.4, 1.1, 2.4, 1, 3.4]

var sum = 0.0;

arr.forEach(function(item) {
  console.log(sum);
  sum += parseFloat(item);
});```
</div>
</div>
</p>

<p>The result should be like this:</p>

```0
0.15
0.35
4.20
5.0
7.0
7.30
12.50
13.50
15.30
16.40
19.20
20.20
```

答:
The standard way to reduce a modulus is to add the deficit after the add if an overflow was caused. This is how you'd do BCD addition using binary hardware for instance.

Although you can do addition using floats in this way, there's a question of whether you should. The problems with using float numbers to operate on what are basically integer quantities are well known, and I'm not going to rehash them here.

Normally, the addition on float fractions works implicitly with a modulus of 1.0, an overflow out of the fraction increments the integer part. If we interpret the point as the hours.minutes separator, then we want the fraction to overflow at 0.6. This needs the deficit of 0.4 to be added at the appropriate time.

```<code>function add_float_hours_minutes(a, b)
{
  var trial_sum = a+b;
  // did an actual overflow occur, has the integer part incremented?
  if ( Math.floor(trial_sum) > Math.floor(a)+Math.floor(b) )  {
    trial_sum += 0.4;
  }
  // has the fractional part exceeded its allotted 60 minutes?
  if ( trial_sum-Math.floor(trial_sum) >= 0.6)  {
    trial_sum += 0.4;
  }
  return trial_sum;
}

var arr = [0.15, 0.2, 3.45, 0.4, 2, 0.3, 5.2, 1, 1.4, 1.1, 2.4, 1, 3.4]

var sum = 0.0;

arr.forEach(function(item) {
  console.log(sum);
  // sum += parseFloat(item);
  sum = add_float_hours_minutes(sum, parseFloat(item));
});
</code>```

which produces the following output, correct to within a rounding to what the OP asked for

```<code>0
0.15
0.35
4.2
5.000000000000001
7.000000000000001
7.300000000000001
12.5
13.5
15.3
16.400000000000002
19.2
20.2
</code>```

I've left the final formatting to two decimal places as an exercise for the reader. The 15 trailing digits in all their glory illustrate part of why using floats is not the best way to do this.

Also, consider what happens when you want to include seconds, or days. The two rather more standard ways of either float seconds, or a tuple of integers, suddenly look a lot more sensible.

Body:
How to sum float numbers in the format hours and minutes?

Those. if  calculate two such numbers 0.35+3.45 then it should be = 4.20, not 3.80

var arr = [0.15, 0.2, 3.45, 0.4, 2, 0.3, 5.2, 1, 1.4, 1.1, 2.4, 1, 3.4]

var sum = 0.0;

arr.forEach(function(item) {
  console.log(sum);
  sum += parseFloat(item);
});

The result should be like this:

0
0.15
0.35
4.20
5.0
7.0
7.30
12.50
13.50
15.30
16.40
19.20
20.20

Body:
The standard way to reduce a modulus is to add the deficit after the add if an overflow was caused. This is how you'd do BCD addition using binary hardware for instance.

Although you can do addition using floats in this way, there's a question of whether you should. The problems with using float numbers to operate on what are basically integer quantities are well known, and I'm not going to rehash them here.

Normally, the addition on float fractions works implicitly with a modulus of 1.0, an overflow out of the fraction increments the integer part. If we interpret the point as the hours.minutes separator, then we want the fraction to overflow at 0.6. This needs the deficit of 0.4 to be added at the appropriate time.

function add_float_hours_minutes(a, b)
{
  var trial_sum = a+b;
  // did an actual overflow occur, has the integer part incremented?
  if ( Math.floor(trial_sum) > Math.floor(a)+Math.floor(b) )  {
    trial_sum += 0.4;
  }
  // has the fractional part exceeded its allotted 60 minutes?
  if ( trial_sum-Math.floor(trial_sum) >= 0.6)  {
    trial_sum += 0.4;
  }
  return trial_sum;
}

var arr = [0.15, 0.2, 3.45, 0.4, 2, 0.3, 5.2, 1, 1.4, 1.1, 2.4, 1, 3.4]

var sum = 0.0;

arr.forEach(function(item) {
  console.log(sum);
  // sum += parseFloat(item);
  sum = add_float_hours_minutes(sum, parseFloat(item));
});

which produces the following output, correct to within a rounding to what the OP asked for

0
0.15
0.35
4.2
5.000000000000001
7.000000000000001
7.300000000000001
12.5
13.5
15.3
16.400000000000002
19.2
20.2

I've left the final formatting to two decimal places as an exercise for the reader. The 15 trailing digits in all their glory illustrate part of why using floats is not the best way to do this.

Also, consider what happens when you want to include seconds, or days. The two rather more standard ways of either float seconds, or a tuple of integers, suddenly look a lot more sensible.


问:
Running multiple instances of an application with different arguments using eclipse
I'm trying to build client server program.
So I should run my program simultaneously with diffrent ports.
The program gets the port through the arguments.

What is the way to do that?
Thank you

答: When creating launch configurations (as @Konstantin mentions)  and adding parameters to the Arguments>Program Arguments tab you can use a variable so that eclipse will ask you for the parameter on every launch.  ex: -port ${string_prompt}


问:
using sum and countifs to get a percentage of 'yes'es across multiple columns by month and team - is there a simpler way?
I've been asked to create a summary for some google form responses, and though I have a working solution, I can't help but feel there must be a more elegant one.

The form collects data related to case checking - every month each team (there's 100+ teams) has to check a certain number of cases based on how many staff are in their team, and enter the results for each case they've checked in the google form. The team that have set this up want me to summarise the data by team, month, and section of the form (preliminary questions, case recording, outcomes, etc). There are 8 sections on the live form, ranging from 1-13 questions, all with Yes/No/NA/blank answers.

(honestly, it's not how I'd have approached setting all this up, but that is out of my hands!)

So they're essentially looking for a live monthly summary with team names down the side, section names along the top, and a %age completed that will keep up with entries as they come in (where we can also use importrange and query to pull the relevant bits into other google sheet summaries, as and when needed).

What I've currently got is this:

```<code>=iferror(sum(countifs('Form Responses'!$B:$B,$A3,'Form
 Responses'!$F:$F,"Yes",'Form Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$G:$G,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$H:$H,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$I:$I,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$J:$J,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$K:$K,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)))/(countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1))*6),0)
</code>```

It works, but it feels like a bit of a brute-force-and-ignorance solution. I've tried countifs & array, I've looked a pivot but I can't get the section groups, I've had a play with query but I can't figure out how to ask it to count all Yeses in multiple columns at once.

Is there a more elegant solution, or do I have to resign myself to setting up the next financial year's summaries like this?

Edit:

答:
You can use plain array boolean multiplication to achieve the count, as trues are converted to 1s and false are converted to 0s:

```<code>=TO_PERCENT(ARRAYFORMULA(
    SUM((f!F1:K="Yes")*(f!E1:E>=B1)*(f!E1:E<EDATE(B1,1))*(f!B:B=A3))/
    SUM(6*(f!E1:E>=B1)*(f!E1:E<EDATE(B1,1))*(f!B:B=A3))
    )
  )
</code>```

Renamed Form Responses to f

Numerator: SUM of

Question filter (f!F:K =Yes) and

Month filter (f!E:E is within month of B1) and

Team filter(B:B = A3)

Denominator: 6 times the SUM of

Month filter (f!E:E is within month of B1) and

Team filter(B:B = A3)

Body:
I've been asked to create a summary for some google form responses, and though I have a working solution, I can't help but feel there must be a more elegant one.

The form collects data related to case checking - every month each team (there's 100+ teams) has to check a certain number of cases based on how many staff are in their team, and enter the results for each case they've checked in the google form. The team that have set this up want me to summarise the data by team, month, and section of the form (preliminary questions, case recording, outcomes, etc). There are 8 sections on the live form, ranging from 1-13 questions, all with Yes/No/NA/blank answers.

(honestly, it's not how I'd have approached setting all this up, but that is out of my hands!)

So they're essentially looking for a live monthly summary with team names down the side, section names along the top, and a %age completed that will keep up with entries as they come in (where we can also use importrange and query to pull the relevant bits into other google sheet summaries, as and when needed).

What I've currently got is this:

=iferror(sum(countifs('Form Responses'!$B:$B,$A3,'Form
 Responses'!$F:$F,"Yes",'Form Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$G:$G,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$H:$H,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$I:$I,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$J:$J,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)),countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$K:$K,"Yes",'Form
 Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1)))/(countifs('Form
 Responses'!$B:$B,$A3,'Form Responses'!$E:$E,">="&$B$1,'Form
 Responses'!$E:$E,"<"&edate($B$1,1))*6),0)

It works, but it feels like a bit of a brute-force-and-ignorance solution. I've tried countifs & array, I've looked a pivot but I can't get the section groups, I've had a play with query but I can't figure out how to ask it to count all Yeses in multiple columns at once.

Is there a more elegant solution, or do I have to resign myself to setting up the next financial year's summaries like this?

Edit:

Body:
You can use plain array boolean multiplication to achieve the count, as trues are converted to 1s and false are converted to 0s:

=TO_PERCENT(ARRAYFORMULA(
    SUM((f!F1:K="Yes")*(f!E1:E>=B1)*(f!E1:E<EDATE(B1,1))*(f!B:B=A3))/
    SUM(6*(f!E1:E>=B1)*(f!E1:E<EDATE(B1,1))*(f!B:B=A3))
    )
  )

Renamed Form Responses to f

Numerator: SUM of

Question filter (f!F:K =Yes) and

Month filter (f!E:E is within month of B1) and

Team filter(B:B = A3)

Denominator: 6 times the SUM of

Month filter (f!E:E is within month of B1) and

Team filter(B:B = A3)


问:
Problem generating manifest. Could not load assembly Microsoft.Windows.SDK.Contracts when installing nuget Microsoft.Toolkit.Forms.UI.Controls.Webview
I'm getting the following errors after installing the nuget package Microsoft.Toolkit.Forms.UI.Controls.Webview:

Severity Code    Description Project File    Line    Suppression State
  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.MediaControlContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Activation.ActivationCameraSettingsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Perception.Automation.Core.PerceptionAutomationCoreContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Preview.Notes.PreviewNotesContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Web.Http.Diagnostics.HttpDiagnosticsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.DevicesLowLevelContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.Scanners.ScannerDeviceContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.UI.Xaml.Hosting.HostingContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.AppRecording.AppRecordingContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Management.Deployment.Preview.DeploymentPreviewContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.Printers.Extensions.ExtensionsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Gaming.XboxLive.StorageApiContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Networking.NetworkOperators.NetworkOperatorsFdnContract.WinMD' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Gaming.UI.GamingUIProviderContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Graphics.Printing3D.Printing3DContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.StartupTaskContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.UI.Core.AnimationMetrics.AnimationMetricsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.System.SystemManagementContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Services.Maps.LocalSearchContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Activation.WebUISearchActivatedEventsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.UI.ViewManagement.ViewManagementViewScalingContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Networking.Connectivity.WwanContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.AppBroadcasting.AppBroadcastingContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Globalization.GlobalizationJapanesePhoneticAnalyzerContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Services.Maps.GuidanceContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Security.ExchangeActiveSyncProvisioning.EasContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.System.Profile.SystemManufacturers.SystemManufacturersContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.UI.WebUI.Core.WebUICommandBarContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.Capture.CameraCaptureUIContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Phone.StartScreen.DualSimTileContract.WinMD' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.Devices.CallControlContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Phone.PhoneContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Calls.LockScreenCallContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Gaming.Preview.GamesEnumerationContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.System.UserProfile.UserProfileLockScreenContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Calls.CallsVoipContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Calls.CallsPhoneContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Storage.Provider.CloudFilesContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.CommunicationBlocking.CommunicationBlockingContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.Capture.AppCaptureMetadataContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Foundation.UniversalApiContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.UI.Shell.SecurityAppManagerContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Wallet.WalletContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.SmartCards.SmartCardBackgroundTriggerContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Gaming.UI.GameChatOverlayContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.Capture.GameBarContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.AI.MachineLearning.MachineLearningContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.System.Profile.ProfileHardwareTokenContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.Sms.LegacySmsApiContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Preview.InkWorkspace.PreviewInkWorkspaceContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Networking.XboxLive.XboxLiveSecureSocketsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.Custom.CustomDeviceContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.UI.Core.CoreWindowDialogsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.UI.Xaml.Core.Direct.XamlDirectContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.System.Profile.ProfileRetailInfoContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Embedded.DeviceLockdown.DeviceLockdownContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.System.UserProfile.UserProfileContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.Capture.AppBroadcastContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.UI.ApplicationSettings.ApplicationsSettingsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.SmartCards.SmartCardEmulatorContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.FullTrustAppContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Search.Core.SearchCoreContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.WinMD' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.System.Profile.ProfileSharedModeContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Background.BackgroundAlarmApplicationContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Search.SearchContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Networking.NetworkOperators.LegacyNetworkOperatorsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Gaming.Input.GamingInputPreviewContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.Protection.ProtectionRenewalContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Security.EnterpriseData.EnterpriseDataContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Calls.Background.CallsBackgroundContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Networking.Sockets.ControlChannelTriggerContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Activation.ActivatedEventsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.SocialInfo.SocialInfoContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Management.Workplace.WorkplaceSettingsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Resources.Management.ResourceIndexerContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.Portable.PortableDeviceContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.   OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.Playlists.PlaylistsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Media.Capture.AppCaptureContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.ApplicationModel.Activation.ContactActivatedEventsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.    OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Services.TargetedContent.TargetedContentContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Services.Store.StoreContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.  OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Devices.Printers.PrintersContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

  Error       Problem generating manifest. Could not load file or assembly 'C:\Users\Vladimir.nuget\packages\microsoft.windows.sdk.contracts\10.0.18362.2005\ref\netstandard2.0\Windows.Foundation.FoundationContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format. OutlookAddIn

Here's what I have done:

Switch to PackageReference as default. Tools -> Options -> Nuget Package Manager -> General -> Default to PackageReference.

Migrated nuget packages to PackageReference. Right-click reference and selected migrate to packagereference.

Installed nuget for Microsoft Microsoft.Toolkit.Forms.UI.Controls.Webview. I was initially getting the error regarding PackageReference but the previous steps fixed it.

I'm now getting the errors above, and they're all related to the Contracts nuget. I've installed and uninstalled this nuget with no results.

答: I've been in contact with the owners of the SDK, and we've done some testing on this. It seems like if you're using a VSTO AddIn project, the SDK will throw these errors. Any other projects have worked fine. What I've done instead is create a form in a different project, and referenced the WebView form in my addin project. This workaround solved my issue.</p>


问:
How to make leaf of Primefaces Tree component as Commandlink
I'm generating Primefaces Tree component as

```<code>root = new DefaultTreeNode("Root", null);
List<String> categories = reportService.getCategories();

    for (String categoryName : categories) {
        TreeNode Rnode = new DefaultTreeNode(categoryName, root);
        List<String> reportNames = reportService
                .getReportNames(categoryName);

        for (String reportName : reportNames) {
            Rnode.getChildren().add(new DefaultTreeNode(reportName));
        }
    }
</code>```

and Xhtml looks like this

```<code>    <p:tree value="#{reportManagedBean.root}" var="node">
        <p:treeNode>
            <p:outputLabel value="#{node}"/>
        </p:treeNode>
    </p:tree>
</code>```

How do I make only the leaf node as CommandLink and rest as OutputLabel?

答:
You can use the nodeVar attribute to access the current TreeNode instance and determine whether or not the current node is a leaf:

```<code><h:form>
    <p:tree value="#{reportManagedBean.root}" var="data" nodeVar="node">
        <p:treeNode>
            <h:outputLabel value="#{data}"
                rendered="#{not empty node.children}" />
            <h:commandLink value="Do something: #{data}"
                rendered="#{empty node.children}" />
        </p:treeNode>
    </p:tree>
</h:form>
</code>```

Body:
I'm generating Primefaces Tree component as

root = new DefaultTreeNode("Root", null);
List<String> categories = reportService.getCategories();

    for (String categoryName : categories) {
        TreeNode Rnode = new DefaultTreeNode(categoryName, root);
        List<String> reportNames = reportService
                .getReportNames(categoryName);

        for (String reportName : reportNames) {
            Rnode.getChildren().add(new DefaultTreeNode(reportName));
        }
    }

and Xhtml looks like this

How do I make only the leaf node as CommandLink and rest as OutputLabel?

Body:
You can use the nodeVar attribute to access the current TreeNode instance and determine whether or not the current node is a leaf:

<h:form>
    <p:tree value="#{reportManagedBean.root}" var="data" nodeVar="node">
        <p:treeNode>
            <h:outputLabel value="#{data}"
                rendered="#{not empty node.children}" />
            <h:commandLink value="Do something: #{data}"
                rendered="#{empty node.children}" />
        </p:treeNode>
    </p:tree>
</h:form>


问:
Karate: Match a dynamic child response with the Parent API response
I have a scenario where a portion of the Parent API response is from a child API. If the child API response(which is dynamic) has only one array element then no need to match that in parent API response, if array size > 1 then I need to match from index 1 on wards with parent API response.

```<code>* def child =  {"array1":[{"mbr1":{"id":"A1"}},{"mbr2":{"id":"A2"}}]}
</code>```

There is no specific order for the child api response and array1 can have "n" number of array elements(mbr1,mbr2,mbr3, etc)

If the child API response is like above then the parent will look like below:

```<code>* def parent =  {"parent":{"muid":"1234"},"elg":[{"EID":"E123"},{"members":[{"mbr2":{"id":"A2"}}]}]}
</code>```

So in parent API response towards the end child api response is populated, only if the above mentioned conditions are satisfied.
If child API returns only one element then the parent API response will look like the below:

```<code>* def parent = {"parent":{"muid":"1234"},"elg":[{"EID":"E123"}]}
</code>```

So how do I do a match to see whether the child is present in parent if child returns 200 OK and the child array length > 1?
So I am looking for a solution for the below scenario:

```<code>if (child responseStatus == 200){
    if (child.array1.length > 1){
        for (i = 1;i <= child.array1.length; i++){
            parent.elg[1].members[i] contains child.arrays1[i]
        }
    }
}
</code>```

答:
Here you go:

```<code>* copy last = child.array1
* remove last[0]
* def multi = {"parent":{"muid":"1234"},"elg":[{"EID":"E123"},{"members":"#(last)"}]}
* def expected = child.array1.length == 1 ? {"parent":{"muid":"1234"},"elg":[{"EID":"E123"}]} : multi
* match parent == expected
</code>```

Now I'm quite sure you (or anyone else in your team) will have a really hard time understanding how on earth that works. Which brings me to the advice I have for you.

Most teams don't do this kind of dynamic complex gymnastics. That is not how you should approach tests.

You have 2 scenarios. One case where your have 1 element in child. And other cases.

Please write two separate Scenario-s and make sure the data you pass to whatever service is guaranteed to return a specific shape. If you can't do this, it probably means it is so dynamic, there is no point in you testing it - maybe it should not be the focus of your validation in the first place.

So your test becomes simple.

```<code>Scenario: first case
# send request1, get child and parent
# match parent == {"parent":{"muid":"1234"},"elg":[{"EID":"E123"}]}

Scenario: second case
# send request2, get child and parent
# match parent == {"parent":{"muid":"1234"},"elg":[{"EID":"E123"},{"members":[{"mbr2":{"id":"A2"}}]}]}
</code>```

For another example of how to simplify bad tests, see this: https://stackoverflow.com/a/54126724/143475

Body:
I have a scenario where a portion of the Parent API response is from a child API. If the child API response(which is dynamic) has only one array element then no need to match that in parent API response, if array size > 1 then I need to match from index 1 on wards with parent API response.

* def child =  {"array1":[{"mbr1":{"id":"A1"}},{"mbr2":{"id":"A2"}}]}

There is no specific order for the child api response and array1 can have "n" number of array elements(mbr1,mbr2,mbr3, etc)

If the child API response is like above then the parent will look like below:

* def parent =  {"parent":{"muid":"1234"},"elg":[{"EID":"E123"},{"members":[{"mbr2":{"id":"A2"}}]}]}

So in parent API response towards the end child api response is populated, only if the above mentioned conditions are satisfied.
If child API returns only one element then the parent API response will look like the below:

* def parent = {"parent":{"muid":"1234"},"elg":[{"EID":"E123"}]}

So how do I do a match to see whether the child is present in parent if child returns 200 OK and the child array length > 1?
So I am looking for a solution for the below scenario:

if (child responseStatus == 200){
    if (child.array1.length > 1){
        for (i = 1;i <= child.array1.length; i++){
            parent.elg[1].members[i] contains child.arrays1[i]
        }
    }
}

Body:
Here you go:

* copy last = child.array1
* remove last[0]
* def multi = {"parent":{"muid":"1234"},"elg":[{"EID":"E123"},{"members":"#(last)"}]}
* def expected = child.array1.length == 1 ? {"parent":{"muid":"1234"},"elg":[{"EID":"E123"}]} : multi
* match parent == expected

Now I'm quite sure you (or anyone else in your team) will have a really hard time understanding how on earth that works. Which brings me to the advice I have for you.

Most teams don't do this kind of dynamic complex gymnastics. That is not how you should approach tests.

You have 2 scenarios. One case where your have 1 element in child. And other cases.

Please write two separate Scenario-s and make sure the data you pass to whatever service is guaranteed to return a specific shape. If you can't do this, it probably means it is so dynamic, there is no point in you testing it - maybe it should not be the focus of your validation in the first place.

So your test becomes simple.

Scenario: first case
# send request1, get child and parent
# match parent == {"parent":{"muid":"1234"},"elg":[{"EID":"E123"}]}

Scenario: second case
# send request2, get child and parent
# match parent == {"parent":{"muid":"1234"},"elg":[{"EID":"E123"},{"members":[{"mbr2":{"id":"A2"}}]}]}

For another example of how to simplify bad tests, see this: https://stackoverflow.com/a/54126724/143475


问:
Excel like Data Grid Control in PHP
I need an excel-like data grid control to use in PHP. The most important feature I am looking for is the capability to 'add a comment' to each cell, like it happens in excel.

Any ideas, please share.

Thanks.

答: ExtJS can help you: http://www.sencha.com/products/extjs/examples/</p>

Title: Excel like Data Grid Control in PHP


问:
How to disable selinux while spinning up a redhat vm in alicloud using cloud init
How to disable selinux while spinning up a redhat vm in alicloud using cloud init.
I have tried with below code but it doesn't work

sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
sudo sestatus

any suggestion ?

答:
You can use write_file in cloud init like in the documentation here

before encode in Base 64 is recommended.

You want to have this on your /etc/sysconfig/selinux

```<code>SELINUX=disabled
SELINUXTYPE=targeted
</code>```

Use this cloud-init:

```<code>#cloud-config
# vim: syntax=yaml
#
# This is the configuration syntax that the write_files module
# will know how to understand. encoding can be given b64 or gzip or (gz+b64).
# The content will be decoded accordingly and then written to the path that is
# provided.
#
# Note: Content strings here are truncated for example purposes.
write_files:
-   encoding: b64
    content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4...
    owner: root:root
    path: /etc/sysconfig/selinux
    permissions: '0644'
</code>```

Body:
You can use write_file in cloud init like in the documentation here

before encode in Base 64 is recommended.

You want to have this on your /etc/sysconfig/selinux

SELINUX=disabled
SELINUXTYPE=targeted

Use this cloud-init:

#cloud-config
# vim: syntax=yaml
#
# This is the configuration syntax that the write_files module
# will know how to understand. encoding can be given b64 or gzip or (gz+b64).
# The content will be decoded accordingly and then written to the path that is
# provided.
#
# Note: Content strings here are truncated for example purposes.
write_files:
-   encoding: b64
    content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4...
    owner: root:root
    path: /etc/sysconfig/selinux
    permissions: '0644'


问:
Hybrid between replicaset and daemonset
Is there such a thing as a hybrid between a replicaset and a daemonset.
I want to specify that I always want to have 2 pods up. But those pods must
never be on the same node. (and I have like 10 nodes)
Is there a way I can achieve this?</p>

答:
In a deployment or replicaSet you can use podAffinity and podAntiaffinity.

Inter-pod affinity and anti-affinity allow you to constrain which nodes your pod is eligible to be scheduled, based on labels on pods that are already running on the node rather than based on labels on nodes.

The rules are of the form “this pod should (or, in the case of anti-affinity, shouldn't) run in an X if that X is already running one or more pods that meet rule Y”. Y is expressed as a LabelSelector with an optional associated list of namespaces.

```<code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: k8s.gcr.io/nginx-slim:0.8
        ports:
        - containerPort: 80
          name: web
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - nginx
            topologyKey: "kubernetes.io/hostname"
</code>```

Above example nginx pod1 and pod2 will never be scheduled on same node.

Find more details in the official docs.

Title: Hybrid between replicaset and daemonset

Body:
In a deployment or replicaSet you can use podAffinity and podAntiaffinity.

Inter-pod affinity and anti-affinity allow you to constrain which nodes your pod is eligible to be scheduled, based on labels on pods that are already running on the node rather than based on labels on nodes.

The rules are of the form “this pod should (or, in the case of anti-affinity, shouldn't) run in an X if that X is already running one or more pods that meet rule Y”. Y is expressed as a LabelSelector with an optional associated list of namespaces.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: k8s.gcr.io/nginx-slim:0.8
        ports:
        - containerPort: 80
          name: web
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - nginx
            topologyKey: "kubernetes.io/hostname"

Above example nginx pod1 and pod2 will never be scheduled on same node.

Find more details in the official docs.


问:
How to prove equality from equality of Some
I want to prove equality of two nat numbers in Coq:</p>

```<code>a, b : nat
Heq : Some a = Some b
============================
a = b
</code>```

答:
I think it is instructive to write the basic lemma down:

```<code>Definition some_inj A (x y : A) (h_eq : Some x = Some y) : x = y :=
  match h_eq with
  | eq_refl _ => eq_refl
  end.
</code>```

Actually, that seems surprising; indeed Coq is elaborating the match to help the user, and the reality is a bit more ugly, as witnessed by the term:

```<code>Print some_inj.

Definition some_inj A (x y : A) (h_eq : Some x = Some y) : x = y :=
  match h_eq in (_ = option_y)
        return match option_y with
               | Some y => x = y
               | None => IDProp
               end
  with
  | eq_refl => eq_refl
  end.
</code>```

So indeed the return type of the match is doing quite a bit of work to tell Coq that the constructor is injective.

Body:
I want to prove equality of two nat numbers in Coq:

a, b : nat
Heq : Some a = Some b
============================
a = b

Body:
I think it is instructive to write the basic lemma down:

Definition some_inj A (x y : A) (h_eq : Some x = Some y) : x = y :=
  match h_eq with
  | eq_refl _ => eq_refl
  end.

Actually, that seems surprising; indeed Coq is elaborating the match to help the user, and the reality is a bit more ugly, as witnessed by the term:

Print some_inj.

Definition some_inj A (x y : A) (h_eq : Some x = Some y) : x = y :=
  match h_eq in (_ = option_y)
        return match option_y with
               | Some y => x = y
               | None => IDProp
               end
  with
  | eq_refl => eq_refl
  end.

So indeed the return type of the match is doing quite a bit of work to tell Coq that the constructor is injective.


问:
Laravel Eloquent: select records where one field equals another
I apologize if this is duplicated. Is it possible in Eloquent ORM to select records where one field equals another? In MySQL this means:

```<code>SELECT Id, Url, ModelId
WHERE Url LIKE CONCAT('%', ModelId, '%')

</code>```

Is it possible to do so in Eloquent or I'm bound to using raw queries?

答:
On field equalling another in the query builder (and eloquent) is whereColumn('Url', 'LIKE', 'ModelId') but since you have additional things in the second part you will need to use raw queries like e.g.

DB::table('table')
   ->select('Id', 'Url', 'ModelId')
   ->where('Url', 'LIKE', DB::raw("CONCAT('%', ModelId, '%')"));
```

Body:
I apologize if this is duplicated. Is it possible in Eloquent ORM to select records where one field equals another? In MySQL this means:

SELECT Id, Url, ModelId
WHERE Url LIKE CONCAT('%', ModelId, '%')

Is it possible to do so in Eloquent or I'm bound to using raw queries?


问:
Truth tables in code? How to structure state machine?
I have a (somewhat) large truth table / state machine that I need to implement in my code (embedded C). I anticipate the behavior specification of this state machine to change in the future, and so I'd like to keep this easily modifiable in the future.

My truth table has 4 inputs and 4 outputs. I have it all in an Excel spreadsheet, and if I could just paste that into my code with a little formatting, that would be ideal.

I was thinking I would like to access my truth table like so:

```<code>u8 newState[] = decisionTable[input1][input2][input3][input4];
</code>```

And then I could access the output values with:

```<code>setOutputPin( LINE_0, newState[0] );
setOutputPin( LINE_1, newState[1] );
setOutputPin( LINE_2, newState[2] );
setOutputPin( LINE_3, newState[3] );
</code>```

But in order to get that, it looks like I would have to do a fairly confusing table like so:

```<code>static u8 decisionTable[][][][][] =
 {{{{ 0, 0, 0, 0 },
    { 0, 0, 0, 0 }},
   {{ 0, 0, 0, 0 },
    { 0, 0, 0, 0 }}},
  {{{ 0, 0, 1, 1 },
    { 0, 1, 1, 1 }},
   {{ 0, 1, 0, 1 },
    { 1, 1, 1, 1 }}}},
 {{{{ 0, 1, 0, 1 },
    { 1, 1, 1, 1 }},
   {{ 0, 1, 0, 1 },
    { 1, 1, 1, 1 }}},
  {{{ 0, 1, 1, 1 },
    { 0, 1, 1, 1 }},
   {{ 0, 1, 0, 1 },
    { 1, 1, 1, 1 }}}};
</code>```

Those nested brackets can be somewhat confusing -- does anyone have a better idea for how I can keep a pretty looking table in my code?

Thanks!

Edit based on HUAGHAGUAH's answer:

Using an amalgamation of everyone's input (thanks -- I wish I could "accept" 3 or 4 of these answers), I think I'm going to try it as a two dimensional array. I'll index into my array using a small bit-shifting macro:

```<code>#define SM_INPUTS( in0, in1, in2, in3 ) ((in0 << 0) | (in1 << 1) | (in2 << 2) | (in3 << 3))
</code>```

And that will let my truth table array look like this:

```<code>static u8 decisionTable[][] = {
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 1, 1 },
{ 0, 1, 1, 1 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 },
{ 0, 1, 1, 1 },
{ 0, 1, 1, 1 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 }};
</code>```

And I can then access my truth table like so:

```<code>decisionTable[ SM_INPUTS( line1, line2, line3, line4 ) ]
</code>```

I'll give that a shot and see how it works out. I'll also be replacing the 0's and 1's with more helpful #defines that express what each state means, along with /**/ comments that explain the inputs for each line of outputs. Thanks for the help, everyone!

答:
Personally, I'd read it from a configuration file. CSV, perhaps, which is easy to export to from Excel. Or you could just copy and paste from Excel into plain text, which gives you space-separated values, which is equally easy to import.

This also means, given that you are working with C, that you won't have to recompile your code each time the decision table changes.

OwnerDisplayName: HanClinto

ContentLicense: CC BY-SA 2.5

Body:
I have a (somewhat) large truth table / state machine that I need to implement in my code (embedded C). I anticipate the behavior specification of this state machine to change in the future, and so I'd like to keep this easily modifiable in the future.

My truth table has 4 inputs and 4 outputs. I have it all in an Excel spreadsheet, and if I could just paste that into my code with a little formatting, that would be ideal.

I was thinking I would like to access my truth table like so:

u8 newState[] = decisionTable[input1][input2][input3][input4];

And then I could access the output values with:

setOutputPin( LINE_0, newState[0] );
setOutputPin( LINE_1, newState[1] );
setOutputPin( LINE_2, newState[2] );
setOutputPin( LINE_3, newState[3] );

But in order to get that, it looks like I would have to do a fairly confusing table like so:

static u8 decisionTable[][][][][] =
 {{{{ 0, 0, 0, 0 },
    { 0, 0, 0, 0 }},
   {{ 0, 0, 0, 0 },
    { 0, 0, 0, 0 }}},
  {{{ 0, 0, 1, 1 },
    { 0, 1, 1, 1 }},
   {{ 0, 1, 0, 1 },
    { 1, 1, 1, 1 }}}},
 {{{{ 0, 1, 0, 1 },
    { 1, 1, 1, 1 }},
   {{ 0, 1, 0, 1 },
    { 1, 1, 1, 1 }}},
  {{{ 0, 1, 1, 1 },
    { 0, 1, 1, 1 }},
   {{ 0, 1, 0, 1 },
    { 1, 1, 1, 1 }}}};

Those nested brackets can be somewhat confusing -- does anyone have a better idea for how I can keep a pretty looking table in my code?

Thanks!

Edit based on HUAGHAGUAH's answer:

Using an amalgamation of everyone's input (thanks -- I wish I could "accept" 3 or 4 of these answers), I think I'm going to try it as a two dimensional array. I'll index into my array using a small bit-shifting macro:

#define SM_INPUTS( in0, in1, in2, in3 ) ((in0 << 0) | (in1 << 1) | (in2 << 2) | (in3 << 3))

And that will let my truth table array look like this:

static u8 decisionTable[][] = {
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 1, 1 },
{ 0, 1, 1, 1 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 },
{ 0, 1, 1, 1 },
{ 0, 1, 1, 1 },
{ 0, 1, 0, 1 },
{ 1, 1, 1, 1 }};

And I can then access my truth table like so:

decisionTable[ SM_INPUTS( line1, line2, line3, line4 ) ]

I'll give that a shot and see how it works out. I'll also be replacing the 0's and 1's with more helpful #defines that express what each state means, along with /**/ comments that explain the inputs for each line of outputs. Thanks for the help, everyone!

LastEditorDisplayName: Im safe against SQL injection

OwnerDisplayName: Ben


问:
Query database with Ajax and classic ASP
I'm trying to modify a script from w3scools to use a combination of asp and ajax to query a database and return results.

Here is the code:

```<code><html>
<head>
<script type="text/javascript">
function showCustomer(str)
{
    var xmlhttp;
    if (str=="")
    {
        document.getElementById("txtHint").innerHTML="";
        return;
    }
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET","getcustomer.asp?q="+str,true);
    xmlhttp.send();
}
</script>
</head>
<body>

<form action="">
    <select name="customers" onchange="showCustomer(this.value)">
        <option value="">Select a customer:</option>
        <option value="ALFKI">Alfreds Futterkiste</option>
    </select>
</form>
<br />

<div id="txtHint">Customer info will be listed here...</div>

</body>
</html>
</code>```

I would like to replace the select field with 2 input fields.

Can someone please tell me how to amend the javascript so that both the input values are passed with the querystring and what needs to be changed on the form to call the function.

Thanks

答:
It depends exactly how you want the page to operate. Can you be a bit more specific?

When you say 'input values' do you mean a text box?

I'm assuming in the following example that you'll have two fields and a button for submitting:

```<code><form action="">
    <label for="MyTextBox1>Enter some text:</label>
    <input type="text" id="MyTextBox1" />

    <label for="MyTextBox1>Enter some text:</label>
    <input type="text" id="MyTextBox2" />

    <input type="button" onclick="showCustomer();" />
</form>
</code>```

The definition of your JavaScript function will change from

```<code>function showCustomer(str)
</code>```

to

```<code>function showCustomer()
</code>```

And you'll need to remove any associated str code.

To pick up these values use document.getElementById:

```<code>var val1 = document.getElementById("MyTextBox1").value);
var val2 = document.getElementById("MyTextBox1").value);
xmlhttp.open("GET","getcustomer.asp?q="+ val1 +"&r=" + val2 ,true);
</code>```

This is very rough and ready, but a good starting point.

Body:
I'm trying to modify a script from w3scools to use a combination of asp and ajax to query a database and return results.

Here is the code:

<form action="">
    <select name="customers" onchange="showCustomer(this.value)">
        <option value="">Select a customer:</option>
        <option value="ALFKI">Alfreds Futterkiste</option>
    </select>
</form>

Customer info will be listed here...

I would like to replace the select field with 2 input fields.

Can someone please tell me how to amend the javascript so that both the input values are passed with the querystring and what needs to be changed on the form to call the function.

Thanks

Body:
It depends exactly how you want the page to operate. Can you be a bit more specific?

When you say 'input values' do you mean a text box?

I'm assuming in the following example that you'll have two fields and a button for submitting:

<form action="">
    <label for="MyTextBox1>Enter some text:</label>
    <input type="text" id="MyTextBox1" />

    <label for="MyTextBox1>Enter some text:</label>
    <input type="text" id="MyTextBox2" />

    <input type="button" onclick="showCustomer();" />
</form>

The definition of your JavaScript function will change from

function showCustomer(str)

to

function showCustomer()

And you'll need to remove any associated str code.

To pick up these values use document.getElementById:

var val1 = document.getElementById("MyTextBox1").value);
var val2 = document.getElementById("MyTextBox1").value);
xmlhttp.open("GET","getcustomer.asp?q="+ val1 +"&r=" + val2 ,true);

This is very rough and ready, but a good starting point.


问:
Can you make parameters for a factory function type safe?
I'm adding typescript type definitions to my Lua library and I've run in to bit of a block,

in Lua I pass a function to my library which returns a factory

If it was JS it would be something like this:

```<code>const Factory = Library((params) => {console.log(params.text)});
</code>```

and later you would

```<code>const instance = Factory({text: "Hello world"});
instance();
</code>```

I have typescript definition for the factory that requires a function arg and returns the correct class type, but I also want type definitions to work for the function's param argument.

```<code>export function Library(chunk:(params:object)=>void):(params:object)=>instance;
</code>```

(The usecase would be, import the function, load it with my library, and create stuff with the factory, and I'm wondering if it's possible to make the various param objects type safe)

答:
You could add a type parameter for object:

```<code>export function Library<T>(chunk: (params: T) => void): (params: T) => instance
</code>```

Body:
I'm adding typescript type definitions to my Lua library and I've run in to bit of a block,

in Lua I pass a function to my library which returns a factory

If it was JS it would be something like this:

const Factory = Library((params) => {console.log(params.text)});

and later you would

const instance = Factory({text: "Hello world"});
instance();

I have typescript definition for the factory that requires a function arg and returns the correct class type, but I also want type definitions to work for the function's param argument.

export function Library(chunk:(params:object)=>void):(params:object)=>instance;

(The usecase would be, import the function, load it with my library, and create stuff with the factory, and I'm wondering if it's possible to make the various param objects type safe)

Body:
You could add a type parameter for object:

export function Library<T>(chunk: (params: T) => void): (params: T) => instance


问:
how to disable button when clicked in react js for quiz
I want to disable the button which i have clicked when i choose an option in my quiz and the rest of the quiz options are enabled ...any ideas on how to do it for these options ? i know we have to use disabled={pass a function} but don't know how to cooperate that with the options

This is my quiz.js:

```<code>render() {
    const { userAns, options, scores, currentQuest } = this.state;

    return (
      <div>
        <div>
          <ProgressBar animated now={this.state.currentQuest * 10} />
        </div>{" "}
        {this.state.questions}
        <br></br> {this.state.scores}
        <br></br>
        <p style={{ textAlign: "center" }}>Q{this.state.currentQuest}</p>
        {this.state.pictures}
        <br></br>
        {options.map((option, id) => (
          <Button
            size="lg"
            block
            key={id}
            className={`ui floating message options
      ${userAns === option ? "selected" : null}
     `}
            onClick={() => this.checkAns(option)}
          >
            {option}
          </Button>
        ))}
        <div className="hrLine"></div>
        <br></br>
        <Button onClick={() => this.checkAns()}>CHECK</Button>
        {currentQuest < Quizdata.length - 1 && (
          <Button
            disabled={this.state.disabled}
            onClick={() => {
              this.nextQuestion();
            }}
          >
            NEXT
          </Button>
        )}
        <br></br>
        {currentQuest === Quizdata.length - 1 && (
          <Button
            onClick={() => {
              this.finishQuiz();

            }}
          >
            Finish
          </Button>
        )}
      </div>
    );
  }
</code>```

答:
You don't need to pass a function to the disabled attribute, this is a 'boolean` value, Now you have to keep track of the options that you've been clicked.

I'm assuming that you have an array of options so first of all you need to convert that to an object of objects so you can access any option with a unique key:

```<code>const options = {
 0:{
    isSelected: false,
    value: 'your value 0',
 },
 1:{
    isSelected: false,
    value: 'your value 1',
 },
 2:{
    isSelected: false,
    value: 'your value 2',
 };
}
</code>```

This way you are able to track every options and the current state.

With this change your code has to change a bit here, you need to access the option by the key of the object this way options[optionKey].

I've used Object.keysthat creates an array of the keys of the object that you pass it, then you iterate through the array and map the key with the options object here is the docs that refer to this method in case you've never used it:

```<code>Object.keys(options).map((optionKey, id) => (
          <Button
            size="lg"
            block
            disabled={ options[optionKey].isSelected }
            key={optionKey}
            className={`ui floating message options
      ${userAns === options[optionKey] ? "selected" : null}
     `}
            onClick={() => this.checkAns(options[optionKey])}
          >
            {options[optionKey].value}
          </Button>
   ))}
</code>```

Body:
I want to disable the button which i have clicked when i choose an option in my quiz and the rest of the quiz options are enabled ...any ideas on how to do it for these options ? i know we have to use disabled={pass a function} but don't know how to cooperate that with the options

This is my quiz.js:

render() {
    const { userAns, options, scores, currentQuest } = this.state;

    return (

          <ProgressBar animated now={this.state.currentQuest * 10} />

{" "}
        {this.state.questions}

 {this.state.scores}

Q{this.state.currentQuest}

        {this.state.pictures}

        {options.map((option, id) => (
          <Button
            size="lg"
            block
            key={id}
            className={`ui floating message options
      ${userAns === option ? "selected" : null}
     `}
            onClick={() => this.checkAns(option)}
          >
            {option}
          </Button>
        ))}

        <Button onClick={() => this.checkAns()}>CHECK</Button>
        {currentQuest < Quizdata.length - 1 && (
          <Button
            disabled={this.state.disabled}
            onClick={() => {
              this.nextQuestion();
            }}
          >
            NEXT
          </Button>
        )}

        {currentQuest === Quizdata.length - 1 && (
          <Button
            onClick={() => {
              this.finishQuiz();

            }}
          >
            Finish
          </Button>
        )}

    );
  }

Body:
You don't need to pass a function to the disabled attribute, this is a 'boolean` value, Now you have to keep track of the options that you've been clicked.

I'm assuming that you have an array of options so first of all you need to convert that to an object of objects so you can access any option with a unique key:

const options = {
 0:{
    isSelected: false,
    value: 'your value 0',
 },
 1:{
    isSelected: false,
    value: 'your value 1',
 },
 2:{
    isSelected: false,
    value: 'your value 2',
 };
}

This way you are able to track every options and the current state.

With this change your code has to change a bit here, you need to access the option by the key of the object this way options[optionKey].

I've used Object.keysthat creates an array of the keys of the object that you pass it, then you iterate through the array and map the key with the options object here is the docs that refer to this method in case you've never used it:

Object.keys(options).map((optionKey, id) => (
          <Button
            size="lg"
            block
            disabled={ options[optionKey].isSelected }
            key={optionKey}
            className={`ui floating message options
      ${userAns === options[optionKey] ? "selected" : null}
     `}
            onClick={() => this.checkAns(options[optionKey])}
          >
            {options[optionKey].value}
          </Button>
   ))}


问:
How to convert xml to excel file programmatically
I have a xml document holding a small data for my project where I want to convert my xml to an excel file (microsoft office excel 2003 and over)

How can I do this programmatically?

答:
For array elements separate with ',' comma and reuse the same column name

1) XML Functions

```<code>public static class XMLFunctions
{
    public static List<Tuple<string, string>> GetXMlTagsAndValues(string xml)
    {
        var xmlList = new List<Tuple<string, string>>();

        var doc = XDocument.Parse(xml);

        foreach (var element in doc.Descendants())
        {
            // we don't care about the parent tags
            if (element.Descendants().Count() > 0)
            {
                continue;
            }

            var path = element.AncestorsAndSelf().Select(e => e.Name.LocalName).Reverse();
            var xPath = string.Join("/", path);

            xmlList.Add(Tuple.Create(xPath, element.Value));
        }

        return xmlList;
    }

    public static System.Data.DataTable CreateDataTableFromXmlFile(string xmlFilePath)
    {
        System.Data.DataTable Dt = new System.Data.DataTable();
        string input = File.ReadAllText(xmlFilePath);

        var xmlTagsAndValues = GetXMlTagsAndValues(input);
        var columnList = new List<string>();

        foreach(var xml in xmlTagsAndValues)
        {
            if(!columnList.Contains(xml.Item1))
            {
                columnList.Add(xml.Item1);
                Dt.Columns.Add(xml.Item1, typeof(string));
            }
        }

        DataRow dtrow = Dt.NewRow();
        var columnList2 = new Dictionary<string, string>();

        foreach (var xml in xmlTagsAndValues)
        {
            if (!columnList2.Keys.Contains(xml.Item1))
            {
                dtrow[xml.Item1] = xml.Item2;
                columnList2.Add(xml.Item1, xml.Item2);
            }
            else
            {   // Here we are using the same column but appending the next value
                dtrow[xml.Item1] = columnList2[xml.Item1] + "," + xml.Item2;

                columnList2[xml.Item1] = columnList2[xml.Item1] + "," + xml.Item2;
            }

        }

        Dt.Rows.Add(dtrow);

        return Dt;
    }
}
</code>```

2) Full Excel class

```<code>using Microsoft.Office.Interop.Excel;
using _Excel = Microsoft.Office.Interop.Excel;

public class Excel
{
    string path = "";
    Application excel = new _Excel.Application();
    Workbook wb;
    Worksheet ws;
    public Range xlRange;

    static bool saveChanges = false;
    static int excelRow = 0;
    static List<string> columnHeaders = new List<string>();

    public Excel(string path, int Sheet = 1)
    {
        this.path = path;
        wb = excel.Workbooks.Open(path);
        ws = wb.Worksheets[Sheet];
        xlRange = ws.UsedRange;
        excelRow = 0;
        columnHeaders = new List<string>();
    }

    public void SaveFile(bool save = true)
    {
        saveChanges = save;
    }

    public void Close()
    {
        wb.Close(saveChanges);
        System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);
        excel.Quit();
    }

    public void XMLToExcel(string xmlFilePath)
    {
        var dt = XMLFunctions.CreateDataTableFromXmlFile(xmlFilePath);
        AddDataTableToExcel(dt);
    }

    public void AddDataTableToExcel(System.Data.DataTable table)
    {
        // Creating Header Column In Excel
        for (int i = 0; i < table.Columns.Count; i++)
        {
            if (!columnHeaders.Contains(table.Columns[i].ColumnName))
            {
                ws.Cells[1, columnHeaders.Count() + 1] = table.Columns[i].ColumnName;
                columnHeaders.Add(table.Columns[i].ColumnName);
            }
        }

        // Get the rows
        for (int k = 0; k < table.Columns.Count; k++)
        {
            var columnNumber = columnHeaders.FindIndex(x => x.Equals(table.Columns[k].ColumnName));

            ws.Cells[excelRow + 2, columnNumber + 1] = table.Rows[0].ItemArray[k].ToString();
        }

        excelRow++;
        SaveFile(true);
    }
}
</code>```

3) Call it

```<code>var excel = new Excel(excelFilename);

foreach (var filePath in files)
{
    excel.XMLToExcel(filePath);
}

excel.Close();
</code>```

For array elements having appended incremented column names (ex. column_2)

Create Data Table From XmlFile Redone

```<code>public static System.Data.DataTable CreateDataTableFromXmlFile(string xmlFilePath)
{
    System.Data.DataTable Dt = new System.Data.DataTable();

    string input = File.ReadAllText(xmlFilePath);

    var xmlTagsAndValues = GetXMlTagsAndValues(input);
    var columnList = new List<string>();

    foreach (var xml in xmlTagsAndValues)
    {
        if (!columnList.Contains(xml.Item1))
        {
            columnList.Add(xml.Item1);
            Dt.Columns.Add(xml.Item1, typeof(string));
        }
        else
        {
            var columnName = xml.Item1;

            do
            {
                columnName = columnName.Increment();
            } while (columnList.Contains(columnName));

            columnList.Add(columnName);
            Dt.Columns.Add(columnName, typeof(string));

        }
    }

    DataRow dtrow = Dt.NewRow();
    var columnList2 = new Dictionary<string, string>();

    foreach (var xml in xmlTagsAndValues)
    {
        if (!columnList2.Keys.Contains(xml.Item1))
        {
            dtrow[xml.Item1] = xml.Item2;
            columnList2.Add(xml.Item1, xml.Item2);
        }
        else
        {
            var columnName = xml.Item1;

            do
            {
                columnName = columnName.Increment();
            } while (columnList2.Keys.Contains(columnName));

            dtrow[columnName] = xml.Item2;
            columnList2[columnName] = xml.Item2;
        }
    }

    Dt.Rows.Add(dtrow);

    return Dt;
}
</code>```

String Extensions

```<code>public static class StringExtensions
{
    public static string Increment(this string str)
    {
        if (!str.Contains("_"))
        {
            str += "_2";
            return str;
        }

        var number = int.Parse(str.Substring(str.LastIndexOf('_') + 1));

        var stringBefore = StringFunctions.GetUntilOrEmpty(str, "_");

        return $"{stringBefore}_{++number}";
    }
}
</code>```

Using GetUntilOrEmpty

Body:
For array elements separate with ',' comma and reuse the same column name

1) XML Functions

public static class XMLFunctions
{
    public static List<Tuple<string, string>> GetXMlTagsAndValues(string xml)
    {
        var xmlList = new List<Tuple<string, string>>();

        var doc = XDocument.Parse(xml);

        foreach (var element in doc.Descendants())
        {
            // we don't care about the parent tags
            if (element.Descendants().Count() > 0)
            {
                continue;
            }

            var path = element.AncestorsAndSelf().Select(e => e.Name.LocalName).Reverse();
            var xPath = string.Join("/", path);

            xmlList.Add(Tuple.Create(xPath, element.Value));
        }

        return xmlList;
    }

    public static System.Data.DataTable CreateDataTableFromXmlFile(string xmlFilePath)
    {
        System.Data.DataTable Dt = new System.Data.DataTable();
        string input = File.ReadAllText(xmlFilePath);

        var xmlTagsAndValues = GetXMlTagsAndValues(input);
        var columnList = new List<string>();

        foreach(var xml in xmlTagsAndValues)
        {
            if(!columnList.Contains(xml.Item1))
            {
                columnList.Add(xml.Item1);
                Dt.Columns.Add(xml.Item1, typeof(string));
            }
        }

        DataRow dtrow = Dt.NewRow();
        var columnList2 = new Dictionary<string, string>();

        foreach (var xml in xmlTagsAndValues)
        {
            if (!columnList2.Keys.Contains(xml.Item1))
            {
                dtrow[xml.Item1] = xml.Item2;
                columnList2.Add(xml.Item1, xml.Item2);
            }
            else
            {   // Here we are using the same column but appending the next value
                dtrow[xml.Item1] = columnList2[xml.Item1] + "," + xml.Item2;

                columnList2[xml.Item1] = columnList2[xml.Item1] + "," + xml.Item2;
            }

        }

        Dt.Rows.Add(dtrow);

        return Dt;
    }
}

2) Full Excel class

using Microsoft.Office.Interop.Excel;
using _Excel = Microsoft.Office.Interop.Excel;

public class Excel
{
    string path = "";
    Application excel = new _Excel.Application();
    Workbook wb;
    Worksheet ws;
    public Range xlRange;

    static bool saveChanges = false;
    static int excelRow = 0;
    static List<string> columnHeaders = new List<string>();

    public Excel(string path, int Sheet = 1)
    {
        this.path = path;
        wb = excel.Workbooks.Open(path);
        ws = wb.Worksheets[Sheet];
        xlRange = ws.UsedRange;
        excelRow = 0;
        columnHeaders = new List<string>();
    }

    public void SaveFile(bool save = true)
    {
        saveChanges = save;
    }

    public void Close()
    {
        wb.Close(saveChanges);
        System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);
        excel.Quit();
    }

    public void XMLToExcel(string xmlFilePath)
    {
        var dt = XMLFunctions.CreateDataTableFromXmlFile(xmlFilePath);
        AddDataTableToExcel(dt);
    }

    public void AddDataTableToExcel(System.Data.DataTable table)
    {
        // Creating Header Column In Excel
        for (int i = 0; i < table.Columns.Count; i++)
        {
            if (!columnHeaders.Contains(table.Columns[i].ColumnName))
            {
                ws.Cells[1, columnHeaders.Count() + 1] = table.Columns[i].ColumnName;
                columnHeaders.Add(table.Columns[i].ColumnName);
            }
        }

        // Get the rows
        for (int k = 0; k < table.Columns.Count; k++)
        {
            var columnNumber = columnHeaders.FindIndex(x => x.Equals(table.Columns[k].ColumnName));

            ws.Cells[excelRow + 2, columnNumber + 1] = table.Rows[0].ItemArray[k].ToString();
        }

        excelRow++;
        SaveFile(true);
    }
}

3) Call it

var excel = new Excel(excelFilename);

foreach (var filePath in files)
{
    excel.XMLToExcel(filePath);
}

excel.Close();

For array elements having appended incremented column names (ex. column_2)

Create Data Table From XmlFile Redone

public static System.Data.DataTable CreateDataTableFromXmlFile(string xmlFilePath)
{
    System.Data.DataTable Dt = new System.Data.DataTable();

    string input = File.ReadAllText(xmlFilePath);

    var xmlTagsAndValues = GetXMlTagsAndValues(input);
    var columnList = new List<string>();

    foreach (var xml in xmlTagsAndValues)
    {
        if (!columnList.Contains(xml.Item1))
        {
            columnList.Add(xml.Item1);
            Dt.Columns.Add(xml.Item1, typeof(string));
        }
        else
        {
            var columnName = xml.Item1;

            do
            {
                columnName = columnName.Increment();
            } while (columnList.Contains(columnName));

            columnList.Add(columnName);
            Dt.Columns.Add(columnName, typeof(string));

        }
    }

    DataRow dtrow = Dt.NewRow();
    var columnList2 = new Dictionary<string, string>();

    foreach (var xml in xmlTagsAndValues)
    {
        if (!columnList2.Keys.Contains(xml.Item1))
        {
            dtrow[xml.Item1] = xml.Item2;
            columnList2.Add(xml.Item1, xml.Item2);
        }
        else
        {
            var columnName = xml.Item1;

            do
            {
                columnName = columnName.Increment();
            } while (columnList2.Keys.Contains(columnName));

            dtrow[columnName] = xml.Item2;
            columnList2[columnName] = xml.Item2;
        }
    }

    Dt.Rows.Add(dtrow);

    return Dt;
}

String Extensions

public static class StringExtensions
{
    public static string Increment(this string str)
    {
        if (!str.Contains("_"))
        {
            str += "_2";
            return str;
        }

        var number = int.Parse(str.Substring(str.LastIndexOf('_') + 1));

        var stringBefore = StringFunctions.GetUntilOrEmpty(str, "_");

        return $"{stringBefore}_{++number}";
    }
}

Using GetUntilOrEmpty