问:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'solrDocumentController'
I am creating a spring application by following this tutorial

Here is my Main class

```<code>package com.example.webtool;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.solr.repository.config.EnableSolrRepositories;

@SpringBootApplication
@EnableSolrRepositories(
        basePackages = "com.example.webtool.repository"
)
public class WebtoolApplication {

    public static void main(String[] args) {
        SpringApplication.run(WebtoolApplication.class, args);
    }

}
</code>```

This is my Repository class

```<code>package com.example.webtool.repository;

import java.util.List;
import org.springframework.data.solr.repository.SolrCrudRepository;
import com.example.webtool.model.Document;
import org.springframework.stereotype.Service;

public interface DocumentRepository extends SolrCrudRepository<Document, String> {
    List<Document> findAllByPerson(String person); // find documents whose person name matches the name of the person in the query
    List<Document> findAllByRank(String rank); // find documents whose rank matches the rank of the person in the query

}
</code>```

This is my document class

```<code>package com.example.webtool.model;

import org.apache.solr.client.solrj.beans.Field;
import org.springframework.data.solr.core.mapping.SolrDocument;

@SolrDocument(solrCoreName = "gettingstarted")
public class Document {

    @Field
    private String person;

    @Field
    private String rank;

    @Field
    private String text;

    public Document() { }

    public Document(String person, String rank, String text) {
        this.person = person;
        this.rank = rank;
        this.text = text;

    }

    public String getPerson() {
        return person;
    }

    public void setPerson(String person) {
        this.person = person;
    }

    public String getRank() {
        return rank;
    }

    public void setRank(String rank) {
        this.rank = rank;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

}
</code>```

And this is my controller class

```<code>package com.example.webtool.controller;

import com.example.webtool.model.Document;
import com.example.webtool.repository.DocumentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by Siddharth Sinha
 */

@RestController
public class SolrDocumentController {

    @Autowired
    private DocumentRepository documentRepository;

    @RequestMapping("/")
    public String SampleController() {
        return "THis is a sample page!!!!";
    }

    @PostMapping("/search")
    public List<Document> getDocs(@RequestBody String name) {
        return this.documentRepository.findAllByPerson(name);
    }
}
</code>```

When I am trying to build the application I am getting the exception which is as follows:

```<code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'solrDocumentController': Unsatisfied dependency expressed through field 'documentRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentRepository': Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.solr.repository.support.SimpleSolrRepository]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Required identifier property not found for class com.example.webtool.model.Document!
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
</code>```

What is wrong with my application?

答:
error log has told you:

Required identifier property not found for class com.example.webtool.model.Document!

@Id
@Indexed(name = "id", type = "string")
private String id;
```

Body:
I am creating a spring application by following this tutorial

Here is my Main class

package com.example.webtool;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.solr.repository.config.EnableSolrRepositories;

@SpringBootApplication
@EnableSolrRepositories(
        basePackages = "com.example.webtool.repository"
)
public class WebtoolApplication {

    public static void main(String[] args) {
        SpringApplication.run(WebtoolApplication.class, args);
    }

}

This is my Repository class

package com.example.webtool.repository;

import java.util.List;
import org.springframework.data.solr.repository.SolrCrudRepository;
import com.example.webtool.model.Document;
import org.springframework.stereotype.Service;

public interface DocumentRepository extends SolrCrudRepository<Document, String> {
    List<Document> findAllByPerson(String person); // find documents whose person name matches the name of the person in the query
    List<Document> findAllByRank(String rank); // find documents whose rank matches the rank of the person in the query

}

This is my document class

package com.example.webtool.model;

import org.apache.solr.client.solrj.beans.Field;
import org.springframework.data.solr.core.mapping.SolrDocument;

@SolrDocument(solrCoreName = "gettingstarted")
public class Document {

    @Field
    private String person;

    @Field
    private String rank;

    @Field
    private String text;

    public Document() { }

    public Document(String person, String rank, String text) {
        this.person = person;
        this.rank = rank;
        this.text = text;

    }

    public String getPerson() {
        return person;
    }

    public void setPerson(String person) {
        this.person = person;
    }

    public String getRank() {
        return rank;
    }

    public void setRank(String rank) {
        this.rank = rank;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

}

And this is my controller class

package com.example.webtool.controller;

import com.example.webtool.model.Document;
import com.example.webtool.repository.DocumentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by Siddharth Sinha
 */

@RestController
public class SolrDocumentController {

    @Autowired
    private DocumentRepository documentRepository;

    @RequestMapping("/")
    public String SampleController() {
        return "THis is a sample page!!!!";
    }

    @PostMapping("/search")
    public List<Document> getDocs(@RequestBody String name) {
        return this.documentRepository.findAllByPerson(name);
    }
}

When I am trying to build the application I am getting the exception which is as follows:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'solrDocumentController': Unsatisfied dependency expressed through field 'documentRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentRepository': Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.solr.repository.support.SimpleSolrRepository]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Required identifier property not found for class com.example.webtool.model.Document!
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

What is wrong with my application?


来源: stackexchange

问:
How do you create a parameter list drop down in Power BI?
I have always been able to create drop-down list parameters within SSRS that allow the user to dynamically filter their reports based on one or more values selected from the drop-down list box of multiple values.

Translating now over to Power BI I cannot find any documentation to achieve the same functionality.

I've found a method of turning the slicer into a drop down list box. But it only allows for the selection of 1 value at a time. So it essentially seems to me to be more of a drop-down list of radio buttons.

In SSRS I could create a stored procedure that accepted a value and returned a record set filtered on a specific value(s).

I can see how to do this with Power BI as well but the method I've seen demonstrated, forces the user to select a value before the report is loaded and subsequently loads a pre-rendered report template. Which isn't the same.

So how does one go about creating a report that implements a true drop-down list box allowing for selection of 1 or more values to dynamically generate the result in the report?

Reference links are welcome if a simple answer isn't possible.

答:
This is an out-of-the-box feature in PowerBI

Create a slicer visual and, as you've already discovered, set it to Dropdown type using the upside down carrot icon on the slicer header.  The dropdown list is multi-select by default.  Hold down [ctrl] while making the multiple selections.  However, you can control Multi-Select behavior under the 'paintbrush.'  When the visual is active, click the paintbrush icon under visualizations, expand 'Selection Controls' and you will see several options to manage your slicer's behaviors.

Additionally, you may want to explore the new filter experience, which is still in beta.  https://learn.microsoft.com/en-us/power-bi/power-bi-report-filter-preview

Otherwise, The behavior in SSRS where the report loads from data sources using parameters chosen by users either as parameters in stored procedures or incorporated into dynamic SQL is not replicated in PowerBI.  It's true that there are parameters that can be incorporated in that way with the data set refresh - but these are controlled on the data set, not the report, and are not convenient (or appropriate, really) for report viewers to manipulate.

ContentLicense: CC BY-SA 4.0


问:
Tell Swashbuckle to only look for controllers that have the ApiControllerAttribute
I'm working on a Web MVC project and inside it I want to have some api controllers for external apps to use.

My API controllers have the ApiController attribute on them.

Unfortunately, Swashbuckle picks up ALL the controllers/actions.

Is there a way to tell it to only look for Api controllers?

Thank you.

答:
You can put this in the controller you want to hide from Swashbuckle</p>

```<code>[ApiExplorerSettings(IgnoreApi = true)]
public class UserController : Controller
</code>```

Body:
You can put this in the controller you want to hide from Swashbuckle

[ApiExplorerSettings(IgnoreApi = true)]
public class UserController : Controller


问:
Server side object located in app.js marked as not exported in my index.ejs file
I have a problem with referencing an object that is located in my app.js file. I am running my server using express, and for view engine I am using EJS.

The object is created in the app.js file and is then used in my PowerList.ejs file (index file). But when trying to use it, it gets marked as not exported.

object and function in app.js:

```<code>var number = {count: 0};
var profile = {name: 'My name', age: 21, job: 'My profession', hobbies: ['hiking', 'running', 'coding']};
app.get('/', function (req, res) {
    res.render('PowerList.ejs',{data: profile, number: number});
});
</code>```

objects used in PowerList.ejs:

```<code><section id="history" style="background-color: red; margin: auto; height: 400px; width: 650px; text-align: center; display: none">
    <button id="button">click me</button>
    <p>You have clicked me <%= number.count%> times</p>
</section>
</code>```

What is confusing me is that as you can see in the snippet there is another object called profile which is being used in the same way in my PowerList.ejs file and is not causing any issues.

profile object usage:

```<code><section id="productivity" style="background-color: bisque; margin: auto; height: 400px; width: 650px; text-align: center; display: none">
    <p><strong>Profile name: </strong> <%= profile.name%></p>
    <p><strong>Age: </strong><%= profile.age%></p>
    <p><strong>Job: </strong><%= profile.job%></p>
    <ul><strong>hobbies:</strong>
        <% profile.hobbies.forEach(function (value) {  %>
            <li><%= value %></li>
        <%});%>
    </ul>
</section>
</code>```

I am also using the number object in a javascript file where it gets incremented on a button click. Here it is also marked as not exported plus i get an error when trying to increment it through clicking a button.

javascript file:

```<code>document.getElementById('button').addEventListener('click', loadNumber);

function loadNumber() {
    var xhttp = new XMLHttpRequest();
    xhttp.open('GET', '/', true);
    xhttp.onload = function () {
        if(this.status === 200){
            number.count++;
        }
    };
    xhttp.send();
}
</code>```

error log:

```<code>Uncaught ReferenceError: number is not defined
    at XMLHttpRequest.xhttp.onload (addDelete.js:67)
</code>```

答:
Your error:

```<code>var number = {count: 0};
var profile = {name: 'My name', age: 21, job: 'My profession', hobbies: ['hiking', 'running', 'coding']};
app.get('/', function (req, res) {
    res.render('PowerList.ejs',{data: profile, number:
                                               ^^^^^^^^
});
</code>```

You have two methods to resolve this, or whit the normal:

number: number

or you just remove the ":" and it should be good :)

Body:
I have a problem with referencing an object that is located in my app.js file. I am running my server using express, and for view engine I am using EJS.

The object is created in the app.js file and is then used in my PowerList.ejs file (index file). But when trying to use it, it gets marked as not exported.

object and function in app.js:

var number = {count: 0};
var profile = {name: 'My name', age: 21, job: 'My profession', hobbies: ['hiking', 'running', 'coding']};
app.get('/', function (req, res) {
    res.render('PowerList.ejs',{data: profile, number: number});
});

objects used in PowerList.ejs:

    <button id="button">click me</button>

You have clicked me <%= number.count%> times

What is confusing me is that as you can see in the snippet there is another object called profile which is being used in the same way in my PowerList.ejs file and is not causing any issues.

profile object usage:

Profile name:  <%= profile.name%>

Age: <%= profile.age%>

Job: <%= profile.job%>

hobbies:
        <% profile.hobbies.forEach(function (value) {  %>

<%= value %>

        <%});%>

I am also using the number object in a javascript file where it gets incremented on a button click. Here it is also marked as not exported plus i get an error when trying to increment it through clicking a button.

javascript file:

document.getElementById('button').addEventListener('click', loadNumber);

function loadNumber() {
    var xhttp = new XMLHttpRequest();
    xhttp.open('GET', '/', true);
    xhttp.onload = function () {
        if(this.status === 200){
            number.count++;
        }
    };
    xhttp.send();
}

error log:

Uncaught ReferenceError: number is not defined
    at XMLHttpRequest.xhttp.onload (addDelete.js:67)

Body:
Your error:

var number = {count: 0};
var profile = {name: 'My name', age: 21, job: 'My profession', hobbies: ['hiking', 'running', 'coding']};
app.get('/', function (req, res) {
    res.render('PowerList.ejs',{data: profile, number:
                                               ^^^^^^^^
});

You have two methods to resolve this, or whit the normal:

number: number

or you just remove the ":" and it should be good :)


问:
Writing an iterative function
I'm writing a program that solves a system of lineair equations. I need to run some iterations in order to see my objective value improving. I first wrote the program with writing print functions at the bottom of my file. So I did the iterations myself basically. I now want to write the number of iterations as an imput argument for the function.

I tried working with while and for loops but that did not seem to work for me. So now I tried the format as you can see below. I have not put my entire program here, but just the basic structure of what it does.

def function(A,x,c,iter):
    if iter == 0:
        return x
    else:
        A = 1/2 * A
        c = 1/2 * c
        x1 = 1/2 * x

        iter = iter - 1

        function(A,x1,c,iter)
```

When I have iter = 0, it gives me the immediate value of x. But when iter > 0 I get 'None' back... Can anyone explain why it does this and help me fix my program? Thanks!

答:
```<code>def function(A,x,c,iter):
    if iter == 0:
        return x
    else:
        A = 1/2 * A
        c = 1/2 * c
        x1 = 1/2 * x

        iter = iter - 1

        return function(A,x1,c,iter)
</code>```

You just didn't return the value of the else and Python functions return None when there is not return statement.

Title: Writing an iterative function

Body:
I'm writing a program that solves a system of lineair equations. I need to run some iterations in order to see my objective value improving. I first wrote the program with writing print functions at the bottom of my file. So I did the iterations myself basically. I now want to write the number of iterations as an imput argument for the function.

I tried working with while and for loops but that did not seem to work for me. So now I tried the format as you can see below. I have not put my entire program here, but just the basic structure of what it does.

def function(A,x,c,iter):
    if iter == 0:
        return x
    else:
        A = 1/2 * A
        c = 1/2 * c
        x1 = 1/2 * x

        iter = iter - 1

        function(A,x1,c,iter)

When I have iter = 0, it gives me the immediate value of x. But when iter > 0 I get 'None' back... Can anyone explain why it does this and help me fix my program? Thanks!

Body:
def function(A,x,c,iter):
    if iter == 0:
        return x
    else:
        A = 1/2 * A
        c = 1/2 * c
        x1 = 1/2 * x

        iter = iter - 1

        return function(A,x1,c,iter)

You just didn't return the value of the else and Python functions return None when there is not return statement.


答: Add a return in the last line so the value is returned after executing the function: return function(A,x1,c,iter)

Title: Writing an iterative function


问:
Which programming platform should I use to consume a SOAP service with WS-Security?
I need to consume a SOAP 1.2 web service which uses WS-Security. The platforms I use at work are Delphi 10.2 Tokyo and .Net Core. Neither of these seem to work.

Am I doing something wrong when consuming the web services?

If not, what are my other alternatives for platforms? I'm open to any suggestions. With as much built-in support for the below WSDL as possible. The app I'm building needs to be a Windows app.

When trying with Delphi 10.2 Tokyo's built in WSDL importer (using SOAP 1.2 with Indy), my requests are sent without any SOAP header information. This invalid request throws the error Connection reset by peer.

When trying with .Net Core (using WCF Web Service Reference Provider) I get the error: System.PlatformNotSupportedException: 'TransportSecurityBindingElement.BuildChannelFactoryCore is not supported.'

Presumably due to the required feature not being supported by .Net Core yet: https://github.com/dotnet/wcf/blob/master/release-notes/SupportedFeatures-v2.0.0.md (Security.Message isn't supported)

Below is the WSDL. I have trimmed unnecessary XML from this file, and replaced the actual company name with Example. Hopefully this will give enough of an idea of what the WSDL policies/requirements are.

```<code><?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:i0="http://tempuri.org/"
    xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:tns="www.example.com/ExampleService"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wsa10="http://www.w3.org/2005/08/addressing"
    xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
    xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
    xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    name="ExampleService"
    targetNamespace="www.example.com/ExampleService">
    <wsp:Policy wsu:Id="ExampleAPI_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:TransportToken>
                            <wsp:Policy>
                                <sp:HttpsToken RequireClientCertificate="false" />
                            </wsp:Policy>
                        </sp:TransportToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:Basic256 />
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Strict />
                            </wsp:Policy>
                        </sp:Layout>
                        <sp:IncludeTimestamp />
                    </wsp:Policy>
                </sp:TransportBinding>
                <sp:EndorsingSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                            <wsp:Policy>
                                <sp:BootstrapPolicy>
                                    <wsp:Policy>
                                        <sp:SignedParts>
                                            <sp:Body />
                                            <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
                                        </sp:SignedParts>
                                        <sp:EncryptedParts>
                                            <sp:Body />
                                        </sp:EncryptedParts>
                                        <sp:TransportBinding>
                                            <wsp:Policy>
                                                <sp:TransportToken>
                                                    <wsp:Policy>
                                                        <sp:HttpsToken RequireClientCertificate="false" />
                                                    </wsp:Policy>
                                                </sp:TransportToken>
                                                <sp:AlgorithmSuite>
                                                    <wsp:Policy>
                                                        <sp:Basic256 />
                                                    </wsp:Policy>
                                                </sp:AlgorithmSuite>
                                                <sp:Layout>
                                                    <wsp:Policy>
                                                        <sp:Strict />
                                                    </wsp:Policy>
                                                </sp:Layout>
                                                <sp:IncludeTimestamp />
                                            </wsp:Policy>
                                        </sp:TransportBinding>
                                        <sp:SignedSupportingTokens>
                                            <wsp:Policy>
                                                <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                                                    <wsp:Policy>
                                                        <sp:WssUsernameToken10 />
                                                    </wsp:Policy>
                                                </sp:UsernameToken>
                                            </wsp:Policy>
                                        </sp:SignedSupportingTokens>
                                        <sp:Wss11>
                                            <wsp:Policy />
                                        </sp:Wss11>
                                        <sp:Trust10>
                                            <wsp:Policy>
                                                <sp:MustSupportIssuedTokens />
                                                <sp:RequireClientEntropy />
                                                <sp:RequireServerEntropy />
                                            </wsp:Policy>
                                        </sp:Trust10>
                                    </wsp:Policy>
                                </sp:BootstrapPolicy>
                            </wsp:Policy>
                        </sp:SecureConversationToken>
                    </wsp:Policy>
                </sp:EndorsingSupportingTokens>
                <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy />
                </sp:Wss11>
                <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:MustSupportIssuedTokens />
                        <sp:RequireClientEntropy />
                        <sp:RequireServerEntropy />
                    </wsp:Policy>
                </sp:Trust10>
                <wsaw:UsingAddressing />
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsp:Policy wsu:Id="ExampleAPI2_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:TransportToken>
                            <wsp:Policy>
                                <sp:HttpsToken RequireClientCertificate="false" />
                            </wsp:Policy>
                        </sp:TransportToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:Basic256 />
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Lax />
                            </wsp:Policy>
                        </sp:Layout>
                        <sp:IncludeTimestamp />
                    </wsp:Policy>
                </sp:TransportBinding>
                <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                            <wsp:Policy>
                                <sp:WssUsernameToken10 />
                            </wsp:Policy>
                        </sp:UsernameToken>
                    </wsp:Policy>
                </sp:SignedSupportingTokens>
                <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy />
                </sp:Wss10>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>

        <!-- trimmed away types -->

    </wsdl:types>

    <!-- trimmed away messages -->

    <wsdl:portType name="IAPIService">

        <!-- trimmed away operations -->

    </wsdl:portType>
    <wsdl:binding name="ExampleAPI" type="tns:IAPIService">
        <wsp:PolicyReference URI="#ExampleAPI_policy" />
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />

        <!-- trimmed away operations -->

    </wsdl:binding>
    <wsdl:binding name="ExampleAPI2" type="tns:IAPIService">
        <wsp:PolicyReference URI="#ExampleAPI2_policy" />
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

        <!-- trimmed away operations -->

    </wsdl:binding>
    <wsdl:service name="ExampleService">
        <wsdl:port name="ExampleAPI" binding="tns:ExampleAPI">
            <soap12:address location="https://example.com/apps/api/APIService.svc" />
            <wsa10:EndpointReference>
                <wsa10:Address>https://example.com/apps/api/APIService.svc</wsa10:Address>
            </wsa10:EndpointReference>
        </wsdl:port>
        <wsdl:port name="ExampleAPI2" binding="tns:ExampleAPI2">
            <soap:address location="https://example.com/apps/api/APIService.svc/endpoint2" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
</code>```

答:
There's no specific 'best' platform to consume a webservice.
However, some platforms support the automatic generation of proxy classes better than others.

When trying with Delphi 10.2 Tokyo's built in WSDL importer (using SOAP 1.2 with Indy), my requests are sent without any SOAP header information.

I don't have experience with .NET Core, but when using Delphi 10.2 you need to manually add (Send) the SOAP header before you send your request.

This can be done by casting the webservice instance to ISOAPHeaders

Example:

```<code>procedure TestSendHeader;
var
  MyService: IMySoapWebservice;
  header : TMySoapHeader;
begin
  MyService := GetMySoapService();
  (MyService as ISOAPHeaders).OwnsSentHeaders := True;

  // Create header object
  header := TMySoapHeader.Create;
  // Fill header data
  // header.xyz := ;
  // 'Send' header with the request
  (MyService as ISOAPHeaders).Send(header);

  MyResponse := MyService.DoMyRequest();
end;
</code>```

Setting OwnsSentHeaders to true wil free up the created header object, after the request has been sent.

NOTE: you have to  'Send' the header each time you make a request:

```<code>  // 'Send' header with the request 1
  (MyService as ISOAPHeaders).Send(header);
  MyResponse := MyService.DoMyRequest1();

  // 'Send' header with the request 2
  (MyService as ISOAPHeaders).Send(header);
  MyResponse := MyService.DoMyRequest2();
</code>```

In this case, don’t set OwnsSentHeaders to true and free the header object after you’re done, sending requests.

Body:
I need to consume a SOAP 1.2 web service which uses WS-Security. The platforms I use at work are Delphi 10.2 Tokyo and .Net Core. Neither of these seem to work.

Am I doing something wrong when consuming the web services?

If not, what are my other alternatives for platforms? I'm open to any suggestions. With as much built-in support for the below WSDL as possible. The app I'm building needs to be a Windows app.

When trying with Delphi 10.2 Tokyo's built in WSDL importer (using SOAP 1.2 with Indy), my requests are sent without any SOAP header information. This invalid request throws the error Connection reset by peer.

When trying with .Net Core (using WCF Web Service Reference Provider) I get the error: System.PlatformNotSupportedException: 'TransportSecurityBindingElement.BuildChannelFactoryCore is not supported.'

Presumably due to the required feature not being supported by .Net Core yet: https://github.com/dotnet/wcf/blob/master/release-notes/SupportedFeatures-v2.0.0.md (Security.Message isn't supported)

Below is the WSDL. I have trimmed unnecessary XML from this file, and replaced the actual company name with Example. Hopefully this will give enough of an idea of what the WSDL policies/requirements are.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:i0="http://tempuri.org/"
    xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:tns="www.example.com/ExampleService"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wsa10="http://www.w3.org/2005/08/addressing"
    xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
    xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
    xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    name="ExampleService"
    targetNamespace="www.example.com/ExampleService">
    <wsp:Policy wsu:Id="ExampleAPI_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:TransportToken>
                            <wsp:Policy>
                                <sp:HttpsToken RequireClientCertificate="false" />
                            </wsp:Policy>
                        </sp:TransportToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:Basic256 />
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Strict />
                            </wsp:Policy>
                        </sp:Layout>
                        <sp:IncludeTimestamp />
                    </wsp:Policy>
                </sp:TransportBinding>
                <sp:EndorsingSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                            <wsp:Policy>
                                <sp:BootstrapPolicy>
                                    <wsp:Policy>
                                        <sp:SignedParts>
                                            <sp:Body />
                                            <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" />
                                            <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" />
                                        </sp:SignedParts>
                                        <sp:EncryptedParts>
                                            <sp:Body />
                                        </sp:EncryptedParts>
                                        <sp:TransportBinding>
                                            <wsp:Policy>
                                                <sp:TransportToken>
                                                    <wsp:Policy>
                                                        <sp:HttpsToken RequireClientCertificate="false" />
                                                    </wsp:Policy>
                                                </sp:TransportToken>
                                                <sp:AlgorithmSuite>
                                                    <wsp:Policy>
                                                        <sp:Basic256 />
                                                    </wsp:Policy>
                                                </sp:AlgorithmSuite>
                                                <sp:Layout>
                                                    <wsp:Policy>
                                                        <sp:Strict />
                                                    </wsp:Policy>
                                                </sp:Layout>
                                                <sp:IncludeTimestamp />
                                            </wsp:Policy>
                                        </sp:TransportBinding>
                                        <sp:SignedSupportingTokens>
                                            <wsp:Policy>
                                                <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                                                    <wsp:Policy>
                                                        <sp:WssUsernameToken10 />
                                                    </wsp:Policy>
                                                </sp:UsernameToken>
                                            </wsp:Policy>
                                        </sp:SignedSupportingTokens>
                                        <sp:Wss11>
                                            <wsp:Policy />
                                        </sp:Wss11>
                                        <sp:Trust10>
                                            <wsp:Policy>
                                                <sp:MustSupportIssuedTokens />
                                                <sp:RequireClientEntropy />
                                                <sp:RequireServerEntropy />
                                            </wsp:Policy>
                                        </sp:Trust10>
                                    </wsp:Policy>
                                </sp:BootstrapPolicy>
                            </wsp:Policy>
                        </sp:SecureConversationToken>
                    </wsp:Policy>
                </sp:EndorsingSupportingTokens>
                <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy />
                </sp:Wss11>
                <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:MustSupportIssuedTokens />
                        <sp:RequireClientEntropy />
                        <sp:RequireServerEntropy />
                    </wsp:Policy>
                </sp:Trust10>
                <wsaw:UsingAddressing />
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsp:Policy wsu:Id="ExampleAPI2_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:TransportToken>
                            <wsp:Policy>
                                <sp:HttpsToken RequireClientCertificate="false" />
                            </wsp:Policy>
                        </sp:TransportToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:Basic256 />
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Lax />
                            </wsp:Policy>
                        </sp:Layout>
                        <sp:IncludeTimestamp />
                    </wsp:Policy>
                </sp:TransportBinding>
                <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                            <wsp:Policy>
                                <sp:WssUsernameToken10 />
                            </wsp:Policy>
                        </sp:UsernameToken>
                    </wsp:Policy>
                </sp:SignedSupportingTokens>
                <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy />
                </sp:Wss10>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>

    </wsdl:types>

    <wsdl:portType name="IAPIService">

    </wsdl:portType>
    <wsdl:binding name="ExampleAPI" type="tns:IAPIService">
        <wsp:PolicyReference URI="#ExampleAPI_policy" />
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />

    </wsdl:binding>
    <wsdl:binding name="ExampleAPI2" type="tns:IAPIService">
        <wsp:PolicyReference URI="#ExampleAPI2_policy" />
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

    </wsdl:binding>
    <wsdl:service name="ExampleService">
        <wsdl:port name="ExampleAPI" binding="tns:ExampleAPI">
            <soap12:address location="https://example.com/apps/api/APIService.svc" />
            <wsa10:EndpointReference>
                <wsa10:Address>https://example.com/apps/api/APIService.svc</wsa10:Address>
            </wsa10:EndpointReference>
        </wsdl:port>
        <wsdl:port name="ExampleAPI2" binding="tns:ExampleAPI2">
            <soap:address location="https://example.com/apps/api/APIService.svc/endpoint2" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

Body:
There's no specific 'best' platform to consume a webservice.
However, some platforms support the automatic generation of proxy classes better than others.

When trying with Delphi 10.2 Tokyo's built in WSDL importer (using SOAP 1.2 with Indy), my requests are sent without any SOAP header information.

I don't have experience with .NET Core, but when using Delphi 10.2 you need to manually add (Send) the SOAP header before you send your request.

This can be done by casting the webservice instance to ISOAPHeaders

Example:

procedure TestSendHeader;
var
  MyService: IMySoapWebservice;
  header : TMySoapHeader;
begin
  MyService := GetMySoapService();
  (MyService as ISOAPHeaders).OwnsSentHeaders := True;

  // Create header object
  header := TMySoapHeader.Create;
  // Fill header data
  // header.xyz := ;
  // 'Send' header with the request
  (MyService as ISOAPHeaders).Send(header);

  MyResponse := MyService.DoMyRequest();
end;

Setting OwnsSentHeaders to true wil free up the created header object, after the request has been sent.

NOTE: you have to  'Send' the header each time you make a request:

  // 'Send' header with the request 1
  (MyService as ISOAPHeaders).Send(header);
  MyResponse := MyService.DoMyRequest1();

  // 'Send' header with the request 2
  (MyService as ISOAPHeaders).Send(header);
  MyResponse := MyService.DoMyRequest2();

In this case, don’t set OwnsSentHeaders to true and free the header object after you’re done, sending requests.


问:
Can this join be made into a generic CTE?
Quick preface: I'll say this is running against an oracle db in case that impacts answer, but CTEs are common to other RDBMS that I use (SQL Server, DB2) so I'm hoping for something I'll be able to use in those as well.

```<code>LEFT JOIN
    (SELECT *
     FROM
         (SELECT
              HH.*,
              ROW_NUMBER() OVER (PARTITION BY HH.WORKSHEET_HISTORY_ID
                                 ORDER BY QQ.GOBLIN_HOBBIT_ID DESC) AS "INDICATOR"
          FROM
              ILU.WORKSHEET_HOBBIT_RECOMMENDATIONS HH
          INNER JOIN
              ILU.GOBLIN_HOBBIT QQ ON QQ.GOBLIN_HOBBIT_id = HH.GOBLIN_HOBBIT_id
          INNER JOIN
              ILU.HOBBIT_master ZZ ON ZZ.HOBBIT_master_id = QQ.HOBBIT_master_id
          WHERE
              ZZ.HOBBIT_CODE = '99'
              AND ZZ.ASSOCIATION_CODE <> 'GNDLF') Z
     WHERE
         Z."INDICATOR" = 1) MITHRIL_HOBT ON MITHRIL_HOBT.WORKSHEET_HISTORY_ID = hst.WORKSHEET_HISTORY_ID
</code>```

What I'd like to accomplish here is turning this join into a CTE. I can do that, but what I'm really interested in doing is being able to then call that CTE from my main query with different conditions:

```<code>WHERE
    ZZ.HOBBIT_CODE = '%PARAMETER1'
    AND ZZ.ASSOCIATION_CODE <> '%PARAMETER2'
</code>```

This may not be possible, and that's a valid answer. But to clarify I know that I could accomplish the same thing in other ways (creating a function) and those are fine, I'm just curious if it can be done as a CTE because CTE are easy to write quickly and clean up adhoc queries into more reusable slightly less adhoc queries.

(Finally, a quick description of what the join is structured in the weird way it is already: because I need to get the first row and it was the only way I could figure out to do that that didn't destroy performance. I even added an index where one was missing and the alternate method I used was still looping through the entire table.

FWIW the previous attempt that caused that issue was something like (this is within the SELECT rather than a subquery):

case when (   SELECT 1 FROM
        ILU.WORKSHEET_HOBBIT_RECOMMENDATIONS HH
        INNER JOIN ILU.GOBLIN_HOBBIT QQ
            on QQ.GOBLIN_HOBBIT_id = HH.GOBLIN_HOBBIT_id
        INNER join ILU.HOBBIT_master ZZ
            on ZZ.HOBBIT_master_id = QQ.HOBBIT_master_id
         WHERE ZZ.HOBBIT_CODE='99'
         AND ZZ.ASSOCIATION_CODE <> 'GNDLF'
         and rownum = 1
) is not null then 1 else 0 end as MITHRIL_INDICATOR
```

(ps code is slightly obfuscated , I don't work for mordor)

答:
Oracle does support CTEs, but the docs call it a with clause:

```<code>with CTE1 as
(
select HH.*, row_number()
               over (
                 partition by HH.WORKSHEET_HISTORY_ID
                 order by QQ.GOBLIN_HOBBIT_ID desc
                    ) as "INDICATOR"
FROM ILU.WORKSHEET_HOBBIT_RECOMMENDATIONS HH
INNER JOIN ILU.GOBLIN_HOBBIT QQ
  on QQ.GOBLIN_HOBBIT_id = HH.GOBLIN_HOBBIT_id
INNER join ILU.HOBBIT_master ZZ
  on ZZ.HOBBIT_master_id = QQ.HOBBIT_master_id
WHERE ZZ.HOBBIT_CODE='99'
AND ZZ.ASSOCIATION_CODE <> 'GNDLF'
)
, CTE2 as
(
select *
from CTE1
where INDICATOR = 1
)

select somestuff
from somewhere hst
LEFT join CTE2
  on CTE2.Worksheet_history_id = hst.WORKSHEET_HISTORY_ID
</code>```

Body:
Quick preface: I'll say this is running against an oracle db in case that impacts answer, but CTEs are common to other RDBMS that I use (SQL Server, DB2) so I'm hoping for something I'll be able to use in those as well.

LEFT JOIN
    (SELECT *
     FROM
         (SELECT
              HH.*,
              ROW_NUMBER() OVER (PARTITION BY HH.WORKSHEET_HISTORY_ID
                                 ORDER BY QQ.GOBLIN_HOBBIT_ID DESC) AS "INDICATOR"
          FROM
              ILU.WORKSHEET_HOBBIT_RECOMMENDATIONS HH
          INNER JOIN
              ILU.GOBLIN_HOBBIT QQ ON QQ.GOBLIN_HOBBIT_id = HH.GOBLIN_HOBBIT_id
          INNER JOIN
              ILU.HOBBIT_master ZZ ON ZZ.HOBBIT_master_id = QQ.HOBBIT_master_id
          WHERE
              ZZ.HOBBIT_CODE = '99'
              AND ZZ.ASSOCIATION_CODE <> 'GNDLF') Z
     WHERE
         Z."INDICATOR" = 1) MITHRIL_HOBT ON MITHRIL_HOBT.WORKSHEET_HISTORY_ID = hst.WORKSHEET_HISTORY_ID

What I'd like to accomplish here is turning this join into a CTE. I can do that, but what I'm really interested in doing is being able to then call that CTE from my main query with different conditions:

WHERE
    ZZ.HOBBIT_CODE = '%PARAMETER1'
    AND ZZ.ASSOCIATION_CODE <> '%PARAMETER2'

This may not be possible, and that's a valid answer. But to clarify I know that I could accomplish the same thing in other ways (creating a function) and those are fine, I'm just curious if it can be done as a CTE because CTE are easy to write quickly and clean up adhoc queries into more reusable slightly less adhoc queries.

(Finally, a quick description of what the join is structured in the weird way it is already: because I need to get the first row and it was the only way I could figure out to do that that didn't destroy performance. I even added an index where one was missing and the alternate method I used was still looping through the entire table.

FWIW the previous attempt that caused that issue was something like (this is within the SELECT rather than a subquery):

case when (   SELECT 1 FROM
        ILU.WORKSHEET_HOBBIT_RECOMMENDATIONS HH
        INNER JOIN ILU.GOBLIN_HOBBIT QQ
            on QQ.GOBLIN_HOBBIT_id = HH.GOBLIN_HOBBIT_id
        INNER join ILU.HOBBIT_master ZZ
            on ZZ.HOBBIT_master_id = QQ.HOBBIT_master_id
         WHERE ZZ.HOBBIT_CODE='99'
         AND ZZ.ASSOCIATION_CODE <> 'GNDLF'
         and rownum = 1
) is not null then 1 else 0 end as MITHRIL_INDICATOR

(ps code is slightly obfuscated , I don't work for mordor)

Body:
Oracle does support CTEs, but the docs call it a with clause:

with CTE1 as
(
select HH.*, row_number()
               over (
                 partition by HH.WORKSHEET_HISTORY_ID
                 order by QQ.GOBLIN_HOBBIT_ID desc
                    ) as "INDICATOR"
FROM ILU.WORKSHEET_HOBBIT_RECOMMENDATIONS HH
INNER JOIN ILU.GOBLIN_HOBBIT QQ
  on QQ.GOBLIN_HOBBIT_id = HH.GOBLIN_HOBBIT_id
INNER join ILU.HOBBIT_master ZZ
  on ZZ.HOBBIT_master_id = QQ.HOBBIT_master_id
WHERE ZZ.HOBBIT_CODE='99'
AND ZZ.ASSOCIATION_CODE <> 'GNDLF'
)
, CTE2 as
(
select *
from CTE1
where INDICATOR = 1
)

select somestuff
from somewhere hst
LEFT join CTE2
  on CTE2.Worksheet_history_id = hst.WORKSHEET_HISTORY_ID


问:
R loop for Phi coefficient
I want to perform Phi function pairwise on each column of my dataframe.

This is how it looks like my df

```<code>AnxietyDisorders    ASD AutoimmuneThyroiditis   CeliacDisease
no  no  yes no
yes no  no  no
no  no  no  no
no  no  no  no
no  no  no  no
no  no  no  no
yes no  no  no
no  no  no  no
no  no  no  yes
</code>```

To perform Phi coefficient normally I should perform:

```<code>Phi(df[,1],df[,2]
</code>```

How can I put it in a loop to perform the Phi coefficient for variables pairwise?
Thanks

答:
An option would be combn

```<code>combn(df, 2, FUN = function(x) Phi(x[,1], x[,2]))
</code>```

Title: R loop for Phi coefficient

Body:
I want to perform Phi function pairwise on each column of my dataframe.

This is how it looks like my df

AnxietyDisorders    ASD AutoimmuneThyroiditis   CeliacDisease
no  no  yes no
yes no  no  no
no  no  no  no
no  no  no  no
no  no  no  no
no  no  no  no
yes no  no  no
no  no  no  no
no  no  no  yes

To perform Phi coefficient normally I should perform:

Phi(df[,1],df[,2]

How can I put it in a loop to perform the Phi coefficient for variables pairwise?
Thanks

Body:
An option would be combn

combn(df, 2, FUN = function(x) Phi(x[,1], x[,2]))


问:
Youtube Api doesn't show numbers above 1000000 in json response
I am just trying to understand how this youtube api works.And I am confused .. let say you wonder how many videos exist in youtube related to  the words war or love.. if you execute a query you will see that The "totalResults" field in the response json doesn't show numbers above 1000000.I get the same result everytime </p>

<p>Here is the Api Explorer </p>

答:
Please take into consideration that the value of the property totalResults is no more than an estimate!

Hence, the magic value 1000000 should be understood as an indication given by Google's backend engine that your query's expression isn't narrow enough for it to deserve a better estimation.

Body:
I am just trying to understand how this youtube api works.And I am confused .. let say you wonder how many videos exist in youtube related to  the words war or love.. if you execute a query you will see that The "totalResults" field in the response json doesn't show numbers above 1000000.I get the same result everytime

Here is the Api Explorer


问:
How to add dynamic link at line level?
I am trying to add HTML link at line level of transaction records. Please let me know how we can add the link.

I created one column Inline HTML field on line level of Sales Order and tried to save the link on it. But Netsuite Throwing error "Can not set more than 15 Characters".

答:
How are you trying to add the link. Can you share you code?
From the error it seems you are trying to add the link on the field.linkText.

field.linkText represents the Hyperlink text.
Then you need to setup the URL like in any other field.

Example:

Using URL field on a serverWidget field.

```<code>//Create field. You can always use a standard one
    objItemSublist.addField({
                id : 'custpage_test',
                type : serverWidget.FieldType.URL,
                label : 'Label'
             }).linkText = 'Click Here';

//Set URL
      objRecord.setSublistValue({
                     sublistId:'item',
                     fieldId:'custpage_test',
                     line:i,
                     value: 'https://stackoverflow.com'
            });
</code>```

Title: How to add dynamic link at line level?

Body:
How are you trying to add the link. Can you share you code?
From the error it seems you are trying to add the link on the field.linkText.

field.linkText represents the Hyperlink text.
Then you need to setup the URL like in any other field.

Example:

Using URL field on a serverWidget field.

//Create field. You can always use a standard one
    objItemSublist.addField({
                id : 'custpage_test',
                type : serverWidget.FieldType.URL,
                label : 'Label'
             }).linkText = 'Click Here';

//Set URL
      objRecord.setSublistValue({
                     sublistId:'item',
                     fieldId:'custpage_test',
                     line:i,
                     value: 'https://stackoverflow.com'
            });


问:
How to get JUnit tests to run after JNI .so creation with native-maven plugin
I have a project that creates both a jni .so file and a java .jar file. All this is working as expected except JUnit test execution. I need the JUnit test to run after the native-maven-plugin creates the .so file. JUnit test will always fail when new JNI methods are added because they are running before the shared library has been created. Is the only option to build twice? Meaning build once skipping test then either execute tests separately or run build again to execute the test?</p>

答:
Ok, this was a project structure issue. I was trying to get tests that belonged to a different project to run after my JNI .so was built in my JNI project. What I needed to do was put the JNI integration tests I was creating in src/java/test in the JNI project, not another project and try to order them somehow.

```<code>jni -
     |
     src
       |
       java
           |
           test
</code>```

not

```<code>other project-
              |
              src
                 |
                 java
                     |
                     test
</code>```

of course maven ran the other project test after the other project was built. That is what it suppose to do. Even though the JNI project built a C .so file. The Java rule for testing still apply to the JNI project when it comes to running java tests.

Body:
Ok, this was a project structure issue. I was trying to get tests that belonged to a different project to run after my JNI .so was built in my JNI project. What I needed to do was put the JNI integration tests I was creating in src/java/test in the JNI project, not another project and try to order them somehow.

jni -
     |
     src
       |
       java
           |
           test

not

other project-
              |
              src
                 |
                 java
                     |
                     test

of course maven ran the other project test after the other project was built. That is what it suppose to do. Even though the JNI project built a C .so file. The Java rule for testing still apply to the JNI project when it comes to running java tests.


问:
Are non-generic collections in .NET obsolete?
Put differently:

Is there a good reason to choose a loosely-typed collection over a type-safe one (HashTable vs. Dictionary)? Are they still there only for compatibility?

As far as I understand, generic collections not only are type-safe, but their performance is better.

Here's a comprehensive article on the topic: An Extensive Examination of Data Structures Using C# 2.0.

答: The non-generic collections are so obsolete that they've been removed from the CoreCLR used in Silverlight and Live Mesh.</p>

OwnerDisplayName: guillermooo

ContentLicense: CC BY-SA 3.0

LastEditorDisplayName: guillermooo

OwnerDisplayName: Curt Hagenlocher

ContentLicense: CC BY-SA 2.5


问:
asp Textbox.text property does not change with javascript
I have a

```<code><asp:TextBox ID="tboxUsername" ReadOnly="true" CssClass="fancyInput1" Text="hello" runat="server"></asp:TextBox>
</code>```

and I would like to set the .Text property with javascript. Unfortunately it does not change and when I call the .Text property in the code behind after the javascipt it still shows the default value ("hello").

this is my javascript

function showModalBox(username, title, firstname, lastname, email, phone, street, ctrycode, zipcode, city, companyname, usertyp, isactive) {

            var modalBox = document.getElementById("modalCompanies");
            var tboxUsername = document.getElementById("<%=tboxUsername.ClientID%>"); // this is my textbox
            var tboxTitle = document.getElementById("tboxTitle");
            var tboxFirstname = document.getElementById("tboxFirstname");
            var tboxLastname = document.getElementById("tboxLastname");
            var tboxEmail = document.getElementById("tboxEmail");
            var tboxPhone = document.getElementById("tboxPhone");
            var tboxStreet = document.getElementById("tboxStreet");
            var tboxCtryCode = document.getElementById("tboxCtryCode");
            var tboxZipCode = document.getElementById("tboxZipCode");
            var tboxCity = document.getElementById("tboxCity");
            var tboxCompanyName = document.getElementById("tboxCompanyName");
            var cboxActive = document.getElementById("cboxActive");

            tboxUsername.value = username; // assign the string username to the textbox
            tboxTitle.value = title;
            tboxFirstname.value = firstname;
            tboxLastname.value = lastname;
            tboxEmail.value = email;
            tboxPhone.value = phone;
            tboxStreet.value = street;
            tboxCtryCode.value = ctrycode;
            tboxZipCode.value = zipcode;
            tboxCity.value = city;
            tboxCompanyName.value = companyname;

            modalBox.style.display = "inline";
        }```
</div>
</div>
</p>

<p>And I call this script here</p>

```protected void gvTable_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        gvTable.SelectedIndex = e.NewSelectedIndex;
        string username = (gvTable.SelectedRow.FindControl("lblUsername") as System.Web.UI.WebControls.Label).Text;

        DataTable dt = Connection.Query("SELECT * FROM portalusers WHERE username = '"+username+"'");
        if(dt.Rows.Count > 0)
        {
            string title = dt.Rows[0][dt.Columns.IndexOf("Title")].ToString();
            string firstname = dt.Rows[0][dt.Columns.IndexOf("Firstname")].ToString();
            string lastname = dt.Rows[0][dt.Columns.IndexOf("Lastname")].ToString();
            string email = dt.Rows[0][dt.Columns.IndexOf("Email")].ToString();
            string phone = dt.Rows[0][dt.Columns.IndexOf("Phone")].ToString();
            string street = dt.Rows[0][dt.Columns.IndexOf("Street")].ToString();
            string ctrycode = dt.Rows[0][dt.Columns.IndexOf("CtryCode")].ToString();
            string zipcode = dt.Rows[0][dt.Columns.IndexOf("ZipCode")].ToString();
            string city = dt.Rows[0][dt.Columns.IndexOf("City")].ToString();
            string companyname = dt.Rows[0][dt.Columns.IndexOf("CompanyName")].ToString();
            companyname = companyname.Substring(0, companyname.Length - 1);
            string usertyp = dt.Rows[0][dt.Columns.IndexOf("Usertyp")].ToString();
            string isactive = dt.Rows[0][dt.Columns.IndexOf("Active")].ToString();

            // call the javascript
            ClientScript.RegisterStartupScript(this.GetType(), "showModalBox", $"showModalBox('{username}','{title}','{firstname}','{lastname}','{email}','{phone}','{street}','{ctrycode}','{zipcode}','{city}','{companyname}','{usertyp}','{isactive}')", true);
        }
    }
```

What am I doing wrong?

答: Remove the "disabled" attribute, then change the value, then add the "disabled" attribute back. Some browsers don't allow changes to a disabled control.</p>

Body:
I have a

<asp:TextBox ID="tboxUsername" ReadOnly="true" CssClass="fancyInput1" Text="hello" runat="server"></asp:TextBox>

and I would like to set the .Text property with javascript. Unfortunately it does not change and when I call the .Text property in the code behind after the javascipt it still shows the default value ("hello").

this is my javascript

function showModalBox(username, title, firstname, lastname, email, phone, street, ctrycode, zipcode, city, companyname, usertyp, isactive) {

            var modalBox = document.getElementById("modalCompanies");
            var tboxUsername = document.getElementById("<%=tboxUsername.ClientID%>"); // this is my textbox
            var tboxTitle = document.getElementById("tboxTitle");
            var tboxFirstname = document.getElementById("tboxFirstname");
            var tboxLastname = document.getElementById("tboxLastname");
            var tboxEmail = document.getElementById("tboxEmail");
            var tboxPhone = document.getElementById("tboxPhone");
            var tboxStreet = document.getElementById("tboxStreet");
            var tboxCtryCode = document.getElementById("tboxCtryCode");
            var tboxZipCode = document.getElementById("tboxZipCode");
            var tboxCity = document.getElementById("tboxCity");
            var tboxCompanyName = document.getElementById("tboxCompanyName");
            var cboxActive = document.getElementById("cboxActive");

            tboxUsername.value = username; // assign the string username to the textbox
            tboxTitle.value = title;
            tboxFirstname.value = firstname;
            tboxLastname.value = lastname;
            tboxEmail.value = email;
            tboxPhone.value = phone;
            tboxStreet.value = street;
            tboxCtryCode.value = ctrycode;
            tboxZipCode.value = zipcode;
            tboxCity.value = city;
            tboxCompanyName.value = companyname;

            modalBox.style.display = "inline";
        }

And I call this script here

protected void gvTable_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        gvTable.SelectedIndex = e.NewSelectedIndex;
        string username = (gvTable.SelectedRow.FindControl("lblUsername") as System.Web.UI.WebControls.Label).Text;

        DataTable dt = Connection.Query("SELECT * FROM portalusers WHERE username = '"+username+"'");
        if(dt.Rows.Count > 0)
        {
            string title = dt.Rows[0][dt.Columns.IndexOf("Title")].ToString();
            string firstname = dt.Rows[0][dt.Columns.IndexOf("Firstname")].ToString();
            string lastname = dt.Rows[0][dt.Columns.IndexOf("Lastname")].ToString();
            string email = dt.Rows[0][dt.Columns.IndexOf("Email")].ToString();
            string phone = dt.Rows[0][dt.Columns.IndexOf("Phone")].ToString();
            string street = dt.Rows[0][dt.Columns.IndexOf("Street")].ToString();
            string ctrycode = dt.Rows[0][dt.Columns.IndexOf("CtryCode")].ToString();
            string zipcode = dt.Rows[0][dt.Columns.IndexOf("ZipCode")].ToString();
            string city = dt.Rows[0][dt.Columns.IndexOf("City")].ToString();
            string companyname = dt.Rows[0][dt.Columns.IndexOf("CompanyName")].ToString();
            companyname = companyname.Substring(0, companyname.Length - 1);
            string usertyp = dt.Rows[0][dt.Columns.IndexOf("Usertyp")].ToString();
            string isactive = dt.Rows[0][dt.Columns.IndexOf("Active")].ToString();

            // call the javascript
            ClientScript.RegisterStartupScript(this.GetType(), "showModalBox", $"showModalBox('{username}','{title}','{firstname}','{lastname}','{email}','{phone}','{street}','{ctrycode}','{zipcode}','{city}','{companyname}','{usertyp}','{isactive}')", true);
        }
    }

What am I doing wrong?


问:
Outlook rest api for on premises only setup
I am trying to compare the usage of EWS vs Outlook REST Apis for an application that needs to connect to an on-prem exchange server. From what I understand, Exchange 2016 onwards supports REST Apis which are leveraged by Graph APIs as well internally when it determines that the mailbox is on-prem.

My question is, is there any way my application directly use the REST APIs to talk to the on-prem exchange, similar to EWS, if I dont need to support cloud \ hybrid setups?

For example, can I use https://my-on-prem-exchnagehost/api/v2.0/me/messages to connect to and talk to my-on-prem-exchnagehost?

All resources about the Outlook REST APIs talk about a hybrid deployment but non about on-prem only setups. My intention is to use one implementation for both on-prem and cloud where just the API endpoints change in the application, example https://my-on-prem-exchnagehost/api/v2.0/me/messages for on-prem and https://graph.microsoft.com/api/v2.0/me/messages for cloud.

答: You should note that currently it is NOT supported to use the REST APIs in a pure on-premises environment.  It may work (you can fire requests at the /Api endpoint and may get results), but if you hit any issues you are on your own.  Until Microsoft announces support for on-premises (which at the time of posting has not happened; I am not aware of any plans to change this), then you should not use it.</p>