问:
CXF Client - unexpected XML tag. expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {null}html
I am trying to call webservice with Apache CXF.

I generated java classes from wsdl file located here.

Here is my main method:

```<code>public static void main(String[] args) throws Exception {
    ObslugaKomunikatowService service = new ObslugaKomunikatowService();
    ObslugaKomunikatow client = service.getObslugaKomunikatowPort();
    client.zapiszKomunikatZB(new KomunikatZBMT());
}
</code>```

This code crashes with this exception:

```<code>Exception in thread "main" com.sun.xml.internal.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: unexpected XML tag. expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {null}html
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:304)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:268)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:217)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
    at com.sun.proxy.$Proxy34.zapiszKomunikatZB(Unknown Source)
    at pl.opencare.zsmoplclient.ZSMOPLClient.main(ZSMOPLClient.java:98)
Caused by: com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML tag. expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {null}html
    at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:261)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:205)
    at com.oracle.webservices.internal.impl.encoding.StreamDecoderImpl.decode(StreamDecoderImpl.java:49)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:234)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:151)
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:299)
    ... 15 more
</code>```

There is generated service class:

```<code>package pl.gov.csioz.zsmopl.ws;

import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.Service;

/**
 * This class was generated by Apache CXF 3.2.5
 * 2018-07-11T11:38:29.954+02:00
 * Generated source version: 3.2.5
 *
 */
@WebServiceClient(name = "ObslugaKomunikatowService",
                  wsdlLocation = "file:ZSMOPL.wsdl",
                  targetNamespace = "http://csioz.gov.pl/zsmopl/ws/")
public class ObslugaKomunikatowService extends Service {

    public final static URL WSDL_LOCATION;

    public final static QName SERVICE = new QName("http://csioz.gov.pl/zsmopl/ws/", "ObslugaKomunikatowService");
    public final static QName ObslugaKomunikatowPort = new QName("http://csioz.gov.pl/zsmopl/ws/", "ObslugaKomunikatowPort");
    static {
        URL url = null;
        try {
            url = new URL("file:ZSMOPL.wsdl");
        } catch (MalformedURLException e) {
            java.util.logging.Logger.getLogger(ObslugaKomunikatowService.class.getName())
                .log(java.util.logging.Level.INFO,
                     "Can not initialize the default wsdl from {0}", "file:ZSMOPL.wsdl");
        }
        WSDL_LOCATION = url;
    }

    public ObslugaKomunikatowService(URL wsdlLocation) {
        super(wsdlLocation, SERVICE);
    }

    public ObslugaKomunikatowService(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    public ObslugaKomunikatowService() {
        super(WSDL_LOCATION, SERVICE);
    }

    public ObslugaKomunikatowService(WebServiceFeature ... features) {
        super(WSDL_LOCATION, SERVICE, features);
    }

    public ObslugaKomunikatowService(URL wsdlLocation, WebServiceFeature ... features) {
        super(wsdlLocation, SERVICE, features);
    }

    public ObslugaKomunikatowService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
        super(wsdlLocation, serviceName, features);
    }

    /**
     *
     * @return
     *     returns ObslugaKomunikatow
     */
    @WebEndpoint(name = "ObslugaKomunikatowPort")
    public ObslugaKomunikatow getObslugaKomunikatowPort() {
        return super.getPort(ObslugaKomunikatowPort, ObslugaKomunikatow.class);
    }

    /**
     *
     * @param features
     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
     * @return
     *     returns ObslugaKomunikatow
     */
    @WebEndpoint(name = "ObslugaKomunikatowPort")
    public ObslugaKomunikatow getObslugaKomunikatowPort(WebServiceFeature... features) {
        return super.getPort(ObslugaKomunikatowPort, ObslugaKomunikatow.class, features);
    }

}
</code>```

There is generted port class:

```<code>package pl.gov.csioz.zsmopl.ws;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
 * This class was generated by Apache CXF 3.2.5
 * 2018-07-11T11:38:29.942+02:00
 * Generated source version: 3.2.5
 *
 */
@WebService(targetNamespace = "http://csioz.gov.pl/zsmopl/ws/", name = "ObslugaKomunikatow")
@XmlSeeAlso({pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ObjectFactory.class, pl.gov.csioz.zsmopl.mt.ObjectFactory.class})
public interface ObslugaKomunikatow {

    @WebMethod(action = "zapiszKomunikatZB")
    @RequestWrapper(localName = "zapiszKomunikatZB", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatZB")
    @ResponseWrapper(localName = "zapiszKomunikatZBResponse", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatZBResponse")
    @WebResult(name = "identyfikatorKomunikatu", targetNamespace = "")
    public pl.gov.csioz.zsmopl.mt.IdentyfikatorKomunikatuMT zapiszKomunikatZB(
        @WebParam(name = "komunikatZB", targetNamespace = "")
        pl.gov.csioz.zsmopl.mt.KomunikatZBMT komunikatZB
    ) throws BladTworzeniaIdentyfikatoraKomunikatu, BladDostepnosci;

    @WebMethod(action = "zapiszKomunikatOS")
    @RequestWrapper(localName = "zapiszKomunikatOS", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatOS")
    @ResponseWrapper(localName = "zapiszKomunikatOSResponse", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatOSResponse")
    @WebResult(name = "identyfikatorKomunikatu", targetNamespace = "")
    public pl.gov.csioz.zsmopl.mt.IdentyfikatorKomunikatuMT zapiszKomunikatOS(
        @WebParam(name = "komunikatOS", targetNamespace = "")
        pl.gov.csioz.zsmopl.mt.KomunikatOSMT komunikatOS
    ) throws BladTworzeniaIdentyfikatoraKomunikatu, BladDostepnosci;

    @WebMethod(action = "zapiszKomunikatPD")
    @RequestWrapper(localName = "zapiszKomunikatPD", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatPD")
    @ResponseWrapper(localName = "zapiszKomunikatPDResponse", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatPDResponse")
    @WebResult(name = "identyfikatorKomunikatu", targetNamespace = "")
    public pl.gov.csioz.zsmopl.mt.IdentyfikatorKomunikatuMT zapiszKomunikatPD(
        @WebParam(name = "komunikatPD", targetNamespace = "")
        pl.gov.csioz.zsmopl.mt.KomunikatPDMT komunikatPD
    ) throws BladTworzeniaIdentyfikatoraKomunikatu, BladDostepnosci;
}
</code>```

And generated class that I am trying to send:

```<code>package pl.gov.csioz.zsmopl.mt;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 * Komunikat zg�oszenia brak�w.
 *
 *
 * <p>Java class for KomunikatZBMT complex type.
 *
 * <p>The following schema fragment specifies the expected content contained within this class.
 *
 * ```
 * <complexType name="KomunikatZBMT">
 *   <complexContent>
 *     <extension base="{http://csioz.gov.pl/zsmopl/mt/}KomunikatMT">
 *       <sequence>
 *         <element name="idMPDPodmiotuRaportujacego" type="{http://csioz.gov.pl/zsmopl/mt/}IdentyfikatorMPDPodmiotuMT"/>
 *         <element name="komunikatTransakcja" type="{http://csioz.gov.pl/zsmopl/mt/}KomunikatTransakcjaZBMT" maxOccurs="unbounded"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 * ```
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "KomunikatZBMT", propOrder = {
    "idMPDPodmiotuRaportujacego",
    "komunikatTransakcja"
})
public class KomunikatZBMT
    extends KomunikatMT
{

    @XmlElement(required = true)
    protected IdentyfikatorMPDPodmiotuMT idMPDPodmiotuRaportujacego;
    @XmlElement(required = true)
    protected List<KomunikatTransakcjaZBMT> komunikatTransakcja;

    /**
     * Gets the value of the idMPDPodmiotuRaportujacego property.
     *
     * @return
     *     possible object is
     *     {@link IdentyfikatorMPDPodmiotuMT }
     *
     */
    public IdentyfikatorMPDPodmiotuMT getIdMPDPodmiotuRaportujacego() {
        return idMPDPodmiotuRaportujacego;
    }

    /**
     * Sets the value of the idMPDPodmiotuRaportujacego property.
     *
     * @param value
     *     allowed object is
     *     {@link IdentyfikatorMPDPodmiotuMT }
     *
     */
    public void setIdMPDPodmiotuRaportujacego(IdentyfikatorMPDPodmiotuMT value) {
        this.idMPDPodmiotuRaportujacego = value;
    }

    /**
     * Gets the value of the komunikatTransakcja property.
     *
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the komunikatTransakcja property.
     *
     * <p>
     * For example, to add a new item, do as follows:
     * ```
     *    getKomunikatTransakcja().add(newItem);
     * ```
     *
     *
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link KomunikatTransakcjaZBMT }
     *
     *
     */
    public List<KomunikatTransakcjaZBMT> getKomunikatTransakcja() {
        if (komunikatTransakcja == null) {
            komunikatTransakcja = new ArrayList<KomunikatTransakcjaZBMT>();
        }
        return this.komunikatTransakcja;
    }

}
</code>```

Do you know what's causing this exception?

答:
Maybe this helps others:
I also got the error message

```<code>Exception in thread "main" com.sun.xml.internal.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: unexpected XML tag. expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {null}html
</code>```

Or in german:

```<code>Unerwartetes Tag. Erwartet: {http://schemas.xmlsoap.org/soap/envelope/}Envelope, gefunden: {null}html
</code>```

I didn't change anything and the request was answered before without any problems until the error occured.

Finally the reason was, that the server was not available and returned an internal server error (500) response and a HTML error message. If you want to see the HTTP errors you can turn HTTP logging on by setting this system properties in your code:

```<code>System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true")
    System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true")
    System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true")
    System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true")
    System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", "999999")
</code>```

Body:
I am trying to call webservice with Apache CXF.

I generated java classes from wsdl file located here.

Here is my main method:

public static void main(String[] args) throws Exception {
    ObslugaKomunikatowService service = new ObslugaKomunikatowService();
    ObslugaKomunikatow client = service.getObslugaKomunikatowPort();
    client.zapiszKomunikatZB(new KomunikatZBMT());
}

This code crashes with this exception:

Exception in thread "main" com.sun.xml.internal.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: unexpected XML tag. expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {null}html
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:304)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:268)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:217)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
    at com.sun.proxy.$Proxy34.zapiszKomunikatZB(Unknown Source)
    at pl.opencare.zsmoplclient.ZSMOPLClient.main(ZSMOPLClient.java:98)
Caused by: com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML tag. expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {null}html
    at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:261)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:205)
    at com.oracle.webservices.internal.impl.encoding.StreamDecoderImpl.decode(StreamDecoderImpl.java:49)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:234)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:151)
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:299)
    ... 15 more

There is generated service class:

package pl.gov.csioz.zsmopl.ws;

import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.Service;

/**
 * This class was generated by Apache CXF 3.2.5
 * 2018-07-11T11:38:29.954+02:00
 * Generated source version: 3.2.5
 *
 */
@WebServiceClient(name = "ObslugaKomunikatowService",
                  wsdlLocation = "file:ZSMOPL.wsdl",
                  targetNamespace = "http://csioz.gov.pl/zsmopl/ws/")
public class ObslugaKomunikatowService extends Service {

    public final static URL WSDL_LOCATION;

    public final static QName SERVICE = new QName("http://csioz.gov.pl/zsmopl/ws/", "ObslugaKomunikatowService");
    public final static QName ObslugaKomunikatowPort = new QName("http://csioz.gov.pl/zsmopl/ws/", "ObslugaKomunikatowPort");
    static {
        URL url = null;
        try {
            url = new URL("file:ZSMOPL.wsdl");
        } catch (MalformedURLException e) {
            java.util.logging.Logger.getLogger(ObslugaKomunikatowService.class.getName())
                .log(java.util.logging.Level.INFO,
                     "Can not initialize the default wsdl from {0}", "file:ZSMOPL.wsdl");
        }
        WSDL_LOCATION = url;
    }

    public ObslugaKomunikatowService(URL wsdlLocation) {
        super(wsdlLocation, SERVICE);
    }

    public ObslugaKomunikatowService(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    public ObslugaKomunikatowService() {
        super(WSDL_LOCATION, SERVICE);
    }

    public ObslugaKomunikatowService(WebServiceFeature ... features) {
        super(WSDL_LOCATION, SERVICE, features);
    }

    public ObslugaKomunikatowService(URL wsdlLocation, WebServiceFeature ... features) {
        super(wsdlLocation, SERVICE, features);
    }

    public ObslugaKomunikatowService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
        super(wsdlLocation, serviceName, features);
    }

    /**
     *
     * @return
     *     returns ObslugaKomunikatow
     */
    @WebEndpoint(name = "ObslugaKomunikatowPort")
    public ObslugaKomunikatow getObslugaKomunikatowPort() {
        return super.getPort(ObslugaKomunikatowPort, ObslugaKomunikatow.class);
    }

    /**
     *
     * @param features
     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the features parameter will have their default values.
     * @return
     *     returns ObslugaKomunikatow
     */
    @WebEndpoint(name = "ObslugaKomunikatowPort")
    public ObslugaKomunikatow getObslugaKomunikatowPort(WebServiceFeature... features) {
        return super.getPort(ObslugaKomunikatowPort, ObslugaKomunikatow.class, features);
    }

}

There is generted port class:

package pl.gov.csioz.zsmopl.ws;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
 * This class was generated by Apache CXF 3.2.5
 * 2018-07-11T11:38:29.942+02:00
 * Generated source version: 3.2.5
 *
 */
@WebService(targetNamespace = "http://csioz.gov.pl/zsmopl/ws/", name = "ObslugaKomunikatow")
@XmlSeeAlso({pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ObjectFactory.class, pl.gov.csioz.zsmopl.mt.ObjectFactory.class})
public interface ObslugaKomunikatow {

    @WebMethod(action = "zapiszKomunikatZB")
    @RequestWrapper(localName = "zapiszKomunikatZB", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatZB")
    @ResponseWrapper(localName = "zapiszKomunikatZBResponse", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatZBResponse")
    @WebResult(name = "identyfikatorKomunikatu", targetNamespace = "")
    public pl.gov.csioz.zsmopl.mt.IdentyfikatorKomunikatuMT zapiszKomunikatZB(
        @WebParam(name = "komunikatZB", targetNamespace = "")
        pl.gov.csioz.zsmopl.mt.KomunikatZBMT komunikatZB
    ) throws BladTworzeniaIdentyfikatoraKomunikatu, BladDostepnosci;

    @WebMethod(action = "zapiszKomunikatOS")
    @RequestWrapper(localName = "zapiszKomunikatOS", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatOS")
    @ResponseWrapper(localName = "zapiszKomunikatOSResponse", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatOSResponse")
    @WebResult(name = "identyfikatorKomunikatu", targetNamespace = "")
    public pl.gov.csioz.zsmopl.mt.IdentyfikatorKomunikatuMT zapiszKomunikatOS(
        @WebParam(name = "komunikatOS", targetNamespace = "")
        pl.gov.csioz.zsmopl.mt.KomunikatOSMT komunikatOS
    ) throws BladTworzeniaIdentyfikatoraKomunikatu, BladDostepnosci;

    @WebMethod(action = "zapiszKomunikatPD")
    @RequestWrapper(localName = "zapiszKomunikatPD", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatPD")
    @ResponseWrapper(localName = "zapiszKomunikatPDResponse", targetNamespace = "http://csioz.gov.pl/zsmopl/ws/obslugakomunikatow/", className = "pl.gov.csioz.zsmopl.ws.obslugakomunikatow.ZapiszKomunikatPDResponse")
    @WebResult(name = "identyfikatorKomunikatu", targetNamespace = "")
    public pl.gov.csioz.zsmopl.mt.IdentyfikatorKomunikatuMT zapiszKomunikatPD(
        @WebParam(name = "komunikatPD", targetNamespace = "")
        pl.gov.csioz.zsmopl.mt.KomunikatPDMT komunikatPD
    ) throws BladTworzeniaIdentyfikatoraKomunikatu, BladDostepnosci;
}

And generated class that I am trying to send:

package pl.gov.csioz.zsmopl.mt;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 * Komunikat zg�oszenia brak�w.
 *
 *
 *
Java class for KomunikatZBMT complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="KomunikatZBMT">
 *   <complexContent>
 *     <extension base="{http://csioz.gov.pl/zsmopl/mt/}KomunikatMT">
 *       <sequence>
 *         <element name="idMPDPodmiotuRaportujacego" type="{http://csioz.gov.pl/zsmopl/mt/}IdentyfikatorMPDPodmiotuMT"/>
 *         <element name="komunikatTransakcja" type="{http://csioz.gov.pl/zsmopl/mt/}KomunikatTransakcjaZBMT" maxOccurs="unbounded"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "KomunikatZBMT", propOrder = {
    "idMPDPodmiotuRaportujacego",
    "komunikatTransakcja"
})
public class KomunikatZBMT
    extends KomunikatMT
{

    @XmlElement(required = true)
    protected IdentyfikatorMPDPodmiotuMT idMPDPodmiotuRaportujacego;
    @XmlElement(required = true)
    protected List<KomunikatTransakcjaZBMT> komunikatTransakcja;

    /**
     * Gets the value of the idMPDPodmiotuRaportujacego property.
     *
     * @return
     *     possible object is
     *     {@link IdentyfikatorMPDPodmiotuMT }
     *
     */
    public IdentyfikatorMPDPodmiotuMT getIdMPDPodmiotuRaportujacego() {
        return idMPDPodmiotuRaportujacego;
    }

    /**
     * Sets the value of the idMPDPodmiotuRaportujacego property.
     *
     * @param value
     *     allowed object is
     *     {@link IdentyfikatorMPDPodmiotuMT }
     *
     */
    public void setIdMPDPodmiotuRaportujacego(IdentyfikatorMPDPodmiotuMT value) {
        this.idMPDPodmiotuRaportujacego = value;
    }

    /**
     * Gets the value of the komunikatTransakcja property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the komunikatTransakcja property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getKomunikatTransakcja().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link KomunikatTransakcjaZBMT }
     *
     *
     */
    public List<KomunikatTransakcjaZBMT> getKomunikatTransakcja() {
        if (komunikatTransakcja == null) {
            komunikatTransakcja = new ArrayList<KomunikatTransakcjaZBMT>();
        }
        return this.komunikatTransakcja;
    }

}

Do you know what's causing this exception?

Body:
Maybe this helps others:
I also got the error message

Exception in thread "main" com.sun.xml.internal.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: unexpected XML tag. expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {null}html

Or in german:

Unerwartetes Tag. Erwartet: {http://schemas.xmlsoap.org/soap/envelope/}Envelope, gefunden: {null}html

I didn't change anything and the request was answered before without any problems until the error occured.

Finally the reason was, that the server was not available and returned an internal server error (500) response and a HTML error message. If you want to see the HTTP errors you can turn HTTP logging on by setting this system properties in your code:

System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true")
    System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true")
    System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true")
    System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true")
    System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", "999999")


来源: stackexchange

问:
C# Beginner, trying to change a fixed background color of a form with text in a textbox
I am a total beginner with c#, i am learning with Udemy.

I have done just a little start but now i want to test for my own.

i have learned how to use a button to change the background color of a form.

```<code>BackColor = Color.Red; etc.
</code>```

I am now trying to make a textbox where i can write in for example Red, Blue, Green ect and the click a button, then the form will change to that color.
I want to have fixed colors i can choose from so i am guessing i need to make fixed colors in the formload "tab"?

```<code>private void FrmColorCalculator_Load(object sender, EventArgs e)

            Color red = Color.Red;
            Color green = Color.Green;
</code>```

should this be in formload? how to make fixed colors? i get an errormessages saying "cannot convert system.drawing.color to string, but thats not what i want to do, i want the color to change.

If someone would be willing to kick me in the right direction?

答:
if you want to change form color you can do this by editing the property BackColor,

```<code>Form form1= new Form();

private void FrmColorCalculator_Load(object sender, EventArgs e){

     form1.BackColor = Color.Red;
}
</code>```

f you mean a WPF Window you can use the Background property.
From within the Window's code:

```<code>Background = Brushes.LightPink;
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am a total beginner with c#, i am learning with Udemy.

I have done just a little start but now i want to test for my own.

i have learned how to use a button to change the background color of a form.

BackColor = Color.Red; etc.

I am now trying to make a textbox where i can write in for example Red, Blue, Green ect and the click a button, then the form will change to that color.
I want to have fixed colors i can choose from so i am guessing i need to make fixed colors in the formload "tab"?

private void FrmColorCalculator_Load(object sender, EventArgs e)

            Color red = Color.Red;
            Color green = Color.Green;

should this be in formload? how to make fixed colors? i get an errormessages saying "cannot convert system.drawing.color to string, but thats not what i want to do, i want the color to change.

If someone would be willing to kick me in the right direction?

Body:
if you want to change form color you can do this by editing the property BackColor,

Form form1= new Form();

private void FrmColorCalculator_Load(object sender, EventArgs e){

     form1.BackColor = Color.Red;
}

f you mean a WPF Window you can use the Background property.
From within the Window's code:

Background = Brushes.LightPink;


问:
Spring Boot app freezes on startup using Hibernate

2021-05-30 17:35:18.765  INFO 9812 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2021-05-30 17:35:19.462  INFO 9812 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.

2021-05-30 17:35:19.519  INFO 9812 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
```

After that, it just hangs indefinitely. No more debug messages are outputted, and nothing happens. I've let it sit there for hours, but nothing.
I have no idea why it's just freezing.

[log of freezing and after 30 minutes it's working (click on this link for view image)   image for log

check this image after freezing it's working fine but after 30 minutes.
I don't why it takes 30 or 40 minutes to launch.

答: try disabling hibernate schemavalidation i.e. set spring.jpa.hibernate.ddl-auto=none</p>

Body:
2021-05-30 17:35:18.765  INFO 9812 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2021-05-30 17:35:19.462  INFO 9812 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.

2021-05-30 17:35:19.519  INFO 9812 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect

After that, it just hangs indefinitely. No more debug messages are outputted, and nothing happens. I've let it sit there for hours, but nothing.
I have no idea why it's just freezing.

[log of freezing and after 30 minutes it's working (click on this link for view image)   image for log

check this image after freezing it's working fine but after 30 minutes.
I don't why it takes 30 or 40 minutes to launch.


问:
@property decorator type hints
Can I somehow tell mypy the type of my getter (salary) ?

```<code>from typing import Any
class MyProperty:
    def __init__(self, getter) -> None:
        self.getter = getter

    def __get__(self, obj, objtype=None) -> Any:
        return self.getter(obj)

class Person:
    def __init__(self) -> None:
        self.x = 7400.5

    @MyProperty
    def salary(self) -> float:
        return self.x

def check(something: str) -> None:
    # should issue: ... incompatible type float; expected str
    pass

p = Person()
check(p.salary) # <----- Success: no issues found in 1 source file
</code>```

Note that this is less ambitious than this related post.

答:
You can use generics and annotate your functions correspondingly. So you basically define a TypeVar and annotate the function that should be decorated to return that type and also the get function to return that type.

from typing import Any, Callable, TypeVar, Generic
T = TypeVar("T")

class MyProperty(Generic[T]):
    def __init__(self, getter: Callable[[Any], T]) -> None:
        self.getter = getter

    def __get__(self, obj, objtype=None) -> T:
        return self.getter(obj)

class Person:
    def __init__(self) -> None:
        self.x = 7400.5

    @MyProperty
    def salary(self) -> float:
        return self.x

```

Title: @property decorator type hints

Body:
Can I somehow tell mypy the type of my getter (salary) ?

from typing import Any
class MyProperty:
    def __init__(self, getter) -> None:
        self.getter = getter

    def __get__(self, obj, objtype=None) -> Any:
        return self.getter(obj)

class Person:
    def __init__(self) -> None:
        self.x = 7400.5

    @MyProperty
    def salary(self) -> float:
        return self.x

def check(something: str) -> None:
    # should issue: ... incompatible type float; expected str
    pass

p = Person()
check(p.salary) # <----- Success: no issues found in 1 source file

Note that this is less ambitious than this related post.


问:
Only 1 item is showed in recyclerView and it doesn't even scroll down
I'm starting android development and i was creating a simple recyclerview.
I think code is completely fine but when i run the app only one item is displayed and it isn't even scrolling down.

Here is my main xml file.

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

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:layout_marginTop="4dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.494"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

And this is my main java file.

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

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    RecyclerView r;
    String arr[]={"1","2","3","4","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        r=findViewById(R.id.rv);
        r.setLayoutManager(new LinearLayoutManager(this));
        CustomAdapter c=new CustomAdapter(arr);
        r.setAdapter(c);
    }
}
</code>```

This is my customadapter class and its xml file.

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

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {

    private String[] localDataSet;

    /**
     * Provide a reference to the type of views that you are using
     * (custom ViewHolder).
     */
    public static class ViewHolder extends RecyclerView.ViewHolder {
        private final TextView textView;

        public ViewHolder(View view) {
            super(view);
            // Define click listener for the ViewHolder's View

            textView = (TextView) view.findViewById(R.id.textView2);
        }

        public TextView getTextView() {
            return textView;
        }
    }

    /**
     * Initialize the dataset of the Adapter.
     *
     * @param dataSet String[] containing the data to populate views to be used
     * by RecyclerView.
     */
    public CustomAdapter(String[] dataSet) {
        localDataSet = dataSet;
    }

    // Create new views (invoked by the layout manager)
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        // Create a new view, which defines the UI of the list item
        View view = LayoutInflater.from(viewGroup.getContext())
                .inflate(R.layout.mylayout, viewGroup, false);

        return new ViewHolder(view);
    }

    // Replace the contents of a view (invoked by the layout manager)
    @Override
    public void onBindViewHolder(ViewHolder viewHolder, final int position) {

        // Get element from your dataset at this position and replace the
        // contents of the view with that element
        viewHolder.getTextView().setText(localDataSet[viewHolder.getAdapterPosition()]);
    }

    // Return the size of your dataset (invoked by the layout manager)
    @Override
    public int getItemCount() {
        return localDataSet.length;
    }
}
</code>```

And it's xml file.

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="124dp"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:layout_weight="1"
            android:text="TextView" />
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

Any help will be appreciated:)

答:
Try this code for the xml.file

It is a mix of suggestions you already received in the first answer and comment: Dont use fixed height and constrain the bottom of you recycler view to the bottom of the parent layout.

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

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

Body:
I'm starting android development and i was creating a simple recyclerview.
I think code is completely fine but when i run the app only one item is displayed and it isn't even scrolling down.

Here is my main xml file.

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

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:layout_marginTop="4dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.494"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

And this is my main java file.

package com.example.creatingrecyclerview;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    RecyclerView r;
    String arr[]={"1","2","3","4","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        r=findViewById(R.id.rv);
        r.setLayoutManager(new LinearLayoutManager(this));
        CustomAdapter c=new CustomAdapter(arr);
        r.setAdapter(c);
    }
}

This is my customadapter class and its xml file.

package com.example.creatingrecyclerview;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {

    private String[] localDataSet;

    /**
     * Provide a reference to the type of views that you are using
     * (custom ViewHolder).
     */
    public static class ViewHolder extends RecyclerView.ViewHolder {
        private final TextView textView;

        public ViewHolder(View view) {
            super(view);
            // Define click listener for the ViewHolder's View

            textView = (TextView) view.findViewById(R.id.textView2);
        }

        public TextView getTextView() {
            return textView;
        }
    }

    /**
     * Initialize the dataset of the Adapter.
     *
     * @param dataSet String[] containing the data to populate views to be used
     * by RecyclerView.
     */
    public CustomAdapter(String[] dataSet) {
        localDataSet = dataSet;
    }

    // Create new views (invoked by the layout manager)
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        // Create a new view, which defines the UI of the list item
        View view = LayoutInflater.from(viewGroup.getContext())
                .inflate(R.layout.mylayout, viewGroup, false);

        return new ViewHolder(view);
    }

    // Replace the contents of a view (invoked by the layout manager)
    @Override
    public void onBindViewHolder(ViewHolder viewHolder, final int position) {

        // Get element from your dataset at this position and replace the
        // contents of the view with that element
        viewHolder.getTextView().setText(localDataSet[viewHolder.getAdapterPosition()]);
    }

    // Return the size of your dataset (invoked by the layout manager)
    @Override
    public int getItemCount() {
        return localDataSet.length;
    }
}

And it's xml file.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="124dp"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:layout_weight="1"
            android:text="TextView" />
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Any help will be appreciated:)

Body:
Try this code for the xml.file

It is a mix of suggestions you already received in the first answer and comment: Dont use fixed height and constrain the bottom of you recycler view to the bottom of the parent layout.

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

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>


问:
If I use XSLT will I get HTML pages?
I was watching this course online and it went into xml.  We used XSLT to take an XML doc and an XSL doc and get a page that displays in the browser.  However, there was no HTML page anywhere, unless it only exists temporarily for the browser to display it.

Suppose you are developing RDF applications or publishing RDF linked data and you want RDFa, which is XHTML with RDF specified in the attributes.  How would this be accomplished?

Maybe it would run on the server and actually save the resulting XHTML file, or more correctly the XHTML with RDFa document.

Can someone explain how this works?  I want to have RDFa documents that can be indexed by search engines and I have RDF files in XML format.
Thanks,
Bruce

答:
If you're doing the XSLT transformation on the server and sending HTML back to the browser, search engine spiders will see the same HTML that a browser would.  Doesn't matter that it's dynamically generated (rather than stored in an HTML file) on the server.

If you publish the actual XML files from the server and you're relying on the browser to do the XSLT transformation into HTML, a good spider will probably do the same thing, but if you're publishing raw XML, why not just publish the RDF that way?  You don't need to put it into HTML.

ContentLicense: CC BY-SA 3.0

Title: If I use XSLT will I get HTML pages?


问:
How to combine 2 arrays with the condition that 2 and 5 values will be from the second array?
There are two arrays:

```<code>$arrOne = [1, 3, 4];
$arrTwo = [2, 5,];
$newArr = [];
</code>```

How to merge to get like this;

$newArr = [1, 2, 3, 4, 5];

Now displays through one, this option is not suitable.

```<code>foreach ($arrOne as $k => $v) {
 $newArr[] = $v;
 $newArr[] = $arrTwo[$k];
}
</code>```

Here is another example. Tthe values can be different in the array.

```<code>$arrOne = [154, 32, 15];
$arrTwo = [682, 124,];
</code>```

Again for this example it is necessary that the values from the second array always be at 2 and 5 positions in the new array:

```<code>$newArr = [154, 682, 32, 15, 124];
</code>```

答:
You can use array_merge and sort functions to achieve this as following:

```<code>$newArr = array_merge($arrOne, $arrTwo);  // it will be [1, 3, 4, 2, 5]
sort($newArr); // it will sort array [1, 2, 3, 4, 5]
</code>```

You can use $newArr now which have sorted data

Body:
There are two arrays:

$arrOne = [1, 3, 4];
$arrTwo = [2, 5,];
$newArr = [];

How to merge to get like this;

$newArr = [1, 2, 3, 4, 5];

Now displays through one, this option is not suitable.

foreach ($arrOne as $k => $v) {
 $newArr[] = $v;
 $newArr[] = $arrTwo[$k];
}

Here is another example. Tthe values can be different in the array.

$arrOne = [154, 32, 15];
$arrTwo = [682, 124,];

Again for this example it is necessary that the values from the second array always be at 2 and 5 positions in the new array:

$newArr = [154, 682, 32, 15, 124];

Body:
You can use array_merge and sort functions to achieve this as following:

$newArr = array_merge($arrOne, $arrTwo);  // it will be [1, 3, 4, 2, 5]
sort($newArr); // it will sort array [1, 2, 3, 4, 5]

You can use $newArr now which have sorted data


问:
Delete duplicate rows in mySQL in same table
I have this script running to check for duplicates in my table:

select s.id, t.*
from [stuff] s
join (
   select name, city, count(*) as qty
   from [stuff]
   group by name, city
   having count(*) > 1
) t on s.name = t.name and s.city = t.city
```
<p>This works fine and returns the ID's of the duplicate rows:</p>
<pre class="lang-py prettyprint-override"><code>myresult = cur.fetchall()
print(myresult)
</code>```

Example output:

```<code>[(84,), (85,), (339,), (340,), (351,), (352,), (416,), (417,), (511,), (512,), (532,), (533,),
(815,), (816,), (978,), (979,), (1075,), (1076,), (1385,), (1386,), (1512,)]
</code>```

Now I want to delete records 84, 339, 351, 416, etc.
What would be the most convenient way to do so?

答:
MySQL provides you with the DELETE JOIN statement that allows you to remove duplicate rows quickly.

The following statement deletes duplicate rows and keeps the highest id:

DELETE t1 FROM table_name t1
INNER JOIN table_name t2
WHERE
    t1.id < t2.id AND
    t1.unique_col = t2.unique_col;
```
<p>In case you want to delete duplicate rows and keep the lowest id, you can use the following statement:</p>
<pre class="lang-sql prettyprint-override"><code>DELETE t1 FROM table_name t1
INNER JOIN table_name t2
WHERE
    t1.id > t2.id AND
    t1.unique_col = t2.unique_col;

</code>```

Body:
I have this script running to check for duplicates in my table:

select s.id, t.*
from [stuff] s
join (
   select name, city, count(*) as qty
   from [stuff]
   group by name, city
   having count(*) > 1
) t on s.name = t.name and s.city = t.city

This works fine and returns the ID's of the duplicate rows:

myresult = cur.fetchall()
print(myresult)

Example output:

[(84,), (85,), (339,), (340,), (351,), (352,), (416,), (417,), (511,), (512,), (532,), (533,),
(815,), (816,), (978,), (979,), (1075,), (1076,), (1385,), (1386,), (1512,)]

Now I want to delete records 84, 339, 351, 416, etc.
What would be the most convenient way to do so?

Body:
MySQL provides you with the DELETE JOIN statement that allows you to remove duplicate rows quickly.

The following statement deletes duplicate rows and keeps the highest id:

DELETE t1 FROM table_name t1
INNER JOIN table_name t2
WHERE
    t1.id < t2.id AND
    t1.unique_col = t2.unique_col;

In case you want to delete duplicate rows and keep the lowest id, you can use the following statement:

DELETE t1 FROM table_name t1
INNER JOIN table_name t2
WHERE
    t1.id > t2.id AND
    t1.unique_col = t2.unique_col;


问:
Issue when trying to set one of div as selected in React JS
I have following code.

I'm trying to store a value in my state and every time the user goes to the previous step he can see what he has selected and after that he can change and move on to the next step.

At the first step, everything works good. For example, the user selects the second text and proceeds to the next step, and when he returns to this step, he sees that the second text has already been selected...

The problem is with the second step, I write all the same, but it doesn't work for the second step. When I am clicking on one of the div's in second step nothing was happened. There is no error. Please help me to figure out what's the problem

Here is my code.

App file

```<code>    export default function App() {
     const [selected, setSelected] = useState(1);
     const [term, setTerm] = useState(1);

     const [current, setCurrent] = useState(0);

     const [data, setData] = useState({
       firstName: "bob",
       lastName: "Forest",
       age: 47
     });
      const steps = [
        {
          title: "Package Choose",
          content: (
            <PackageChoose
              setCurrent={setCurrent}
              data={data}
              setData={setData}
              selected={selected}
              setSelected={setSelected}
            />
         ),
          id: 0
        },
        {
          title: "Term",
          content: (
           <Term
            setCurrent={setCurrent}
            data={data}
            selected={term}
            setTerm={setTerm}
            setData={setData}
        />
          ),
          id: 1
        },
        {
          title: "Last step",
          content: <LastStep setCurrent={setCurrent} data={data} />,
          id: 2
        }
      ];
      return (
        <div className="App">
          <div>{steps[current].content}</div>
        </div>
      );
    }
</code>```

first step package choose file

```<code>    const PackageChoose = ({
      setCurrent,
      data,
      setData,
      setSelected,
      selected
    }) => {
      return (
        <div>
          <div
            onClick={() => {
              setData({ ...data, packageType: "choice" });
            }}
          >
            <SelectCard
              id={1}
              selected={selected}
              onSelect={setSelected}
              text="text 1"
            />
          </div>
          <div
            onClick={() => {
              setData({ ...data, packageType: "select" });
            }}
          >
            <SelectCard
              id={2}
              selected={selected}
              onSelect={setSelected}
              text="text 2"
             />
          </div>
          <button onClick={() => setCurrent(1)}>Next</button>
        </div>
      );
   };

</code>```

second step Term file

```<code>   const Term = ({ setCurrent, data, setData, term, setTerm }) => {
      return (
        <div>
          <button onClick={() => setCurrent(0)}>Prev</button>
          <div
            onClick={() => {
              setData({ ...data, termType: "30 day" });
            }}
          >
            <SelectCard
              id={1}
              selected={term}
              onSelect={setTerm}
              text=" term text 1"
            />
         </div>
          <div
            onClick={() => {
              setData({ ...data, termType: "90 day" });
            }}
          >
            <SelectCard
              id={2}
              selected={term}
              onSelect={setTerm}
              text="term text 2"
            />
          </div>
          <button onClick={() => setCurrent(2)}>Next</button>
            </div>
      );
    };
</code>```

SelectCard  file , in this file I am using onSelect

```<code>   const SelectCard = ({ id, selected, onSelect, text }) => {
      const myClassName =
        id === selected
          ? Styles.selectCardWrapperActives
          : Styles.selectCardWrapper;

      return (
        <div className={classNames(myClassName)} onClick={() => onSelect(id)}>
          <div> {text} </div>
        </div>
      );
     };
</code>```

Please help me to understand how can I fix this problem in my code.

Thanks.

答:
You use variable "ssetTerm" on second step, it's misspelled.

Variable "setTerm" would be undefined, so it's not a function.

Body:
I have following code.

I'm trying to store a value in my state and every time the user goes to the previous step he can see what he has selected and after that he can change and move on to the next step.

At the first step, everything works good. For example, the user selects the second text and proceeds to the next step, and when he returns to this step, he sees that the second text has already been selected...

The problem is with the second step, I write all the same, but it doesn't work for the second step. When I am clicking on one of the div's in second step nothing was happened. There is no error. Please help me to figure out what's the problem

Here is my code.

App file

    export default function App() {
     const [selected, setSelected] = useState(1);
     const [term, setTerm] = useState(1);

     const [current, setCurrent] = useState(0);

     const [data, setData] = useState({
       firstName: "bob",
       lastName: "Forest",
       age: 47
     });
      const steps = [
        {
          title: "Package Choose",
          content: (
            <PackageChoose
              setCurrent={setCurrent}
              data={data}
              setData={setData}
              selected={selected}
              setSelected={setSelected}
            />
         ),
          id: 0
        },
        {
          title: "Term",
          content: (
           <Term
            setCurrent={setCurrent}
            data={data}
            selected={term}
            setTerm={setTerm}
            setData={setData}
        />
          ),
          id: 1
        },
        {
          title: "Last step",
          content: <LastStep setCurrent={setCurrent} data={data} />,
          id: 2
        }
      ];
      return (

{steps[current].content}

      );
    }

first step package choose file

    const PackageChoose = ({
      setCurrent,
      data,
      setData,
      setSelected,
      selected
    }) => {
      return (

 {
              setData({ ...data, packageType: "choice" });
            }}
          >
            <SelectCard
              id={1}
              selected={selected}
              onSelect={setSelected}
              text="text 1"
            />

 {
              setData({ ...data, packageType: "select" });
            }}
          >
            <SelectCard
              id={2}
              selected={selected}
              onSelect={setSelected}
              text="text 2"
             />

          <button onClick={() => setCurrent(1)}>Next</button>

      );
   };

second step Term file

   const Term = ({ setCurrent, data, setData, term, setTerm }) => {
      return (

          <button onClick={() => setCurrent(0)}>Prev</button>

 {
              setData({ ...data, termType: "30 day" });
            }}
          >
            <SelectCard
              id={1}
              selected={term}
              onSelect={setTerm}
              text=" term text 1"
            />

 {
              setData({ ...data, termType: "90 day" });
            }}
          >
            <SelectCard
              id={2}
              selected={term}
              onSelect={setTerm}
              text="term text 2"
            />

          <button onClick={() => setCurrent(2)}>Next</button>

      );
    };

SelectCard  file , in this file I am using onSelect

   const SelectCard = ({ id, selected, onSelect, text }) => {
      const myClassName =
        id === selected
          ? Styles.selectCardWrapperActives
          : Styles.selectCardWrapper;

      return (

 onSelect(id)}>

 {text}

      );
     };

Please help me to understand how can I fix this problem in my code.

Thanks.


问:
How can I change 'long' to 'int' without changing 'long long' using perl/awk/etc
I want to change all the longs to ints (in preparation for 64 bit code).  I have a perl line that does:

```<code>s/(\s*long\s+)(?!long)/ int /g
</code>```

which comes close.  It changes long to int and long long to long int.

Any editing method is good as long as it can be scripted or operate on multiple files.

```<code>*Sample:  input              desired output*
   long abd;                   int abd;
int longname;               int longname;
int reallylongname;         int reallylongname;
float reallylong longname;  float reallylong longname;
double namelong             double namelong
long abc long               int abc int
long long abc               long long abc
long    long hhhh           long    long hhhh
long long hhhh              long long hhhh
long abd( long kjhh         int abd( int kjhh
</code>```

答:
```<code>foreach my $line (@lines_in_the_file) {
    $line =~ s/\blong long\b/SOMETHINGFUNKY/g;
}

foreach my $line (@lines_in_the_file) {
    $line =~ s/\blong\b/int/g;
}

foreach my $line (@lines_in_the_file) {
    $line =~ s/SOMETHINGFUNKY/long long/g;
}
</code>```

Body:
I want to change all the longs to ints (in preparation for 64 bit code).  I have a perl line that does:

s/(\s*long\s+)(?!long)/ int /g

which comes close.  It changes long to int and long long to long int.

Any editing method is good as long as it can be scripted or operate on multiple files.

*Sample:  input              desired output*
   long abd;                   int abd;
int longname;               int longname;
int reallylongname;         int reallylongname;
float reallylong longname;  float reallylong longname;
double namelong             double namelong
long abc long               int abc int
long long abc               long long abc
long    long hhhh           long    long hhhh
long long hhhh              long long hhhh
long abd( long kjhh         int abd( int kjhh


问:
How to have the python program version only in setup.cfg for runtime and packaging?
I am looking for a way to specify my python program version (not the interpreter) exclusively in setup.cfg and use it at runtime in my python program - it appears to be the modern way to use only setup.cfg and omit setup.py altogether, as documented here:  https://setuptools.pypa.io/en/latest/userguide/declarative_config.html

This topic seems quite involved with a lengthy discussion spanning years and no clear answer, as described here: Standard way to embed version into Python package?

What I'd like to achieve is that my setup.cfg has the version number (and all other relevant package data) and make that version available to my program at runtime.

Example setup.cfg

```<code>[metadata]
name = my_app
version = 0.1.3
author = foo
...
</code>```

and then in my runtime access that version number:

```<code>2022-02-04T23:01:28.177 INFO root::============= Welcome to my_app version 0.1.3, PID: 52296 =============
</code>```

How can I achieve that ?

答:
Two options I can think of – I'd go with the first.

1. Use setup.cfg's attr: support to read the version from the source

setup.cfg

```<code>[metadata]
version = attr:my_app.__version__
</code>```

my_app/init.py

```<code># ...
__version__ = '0.1.3'
</code>```

2. Use importlib.metadata to read the version from the installation metadata

(New in Python 3.8, has backports for older Pythons)

```<code>from importlib.metadata import version

my_version = version('my_app')
</code>```

Body:
I am looking for a way to specify my python program version (not the interpreter) exclusively in setup.cfg and use it at runtime in my python program - it appears to be the modern way to use only setup.cfg and omit setup.py altogether, as documented here:  https://setuptools.pypa.io/en/latest/userguide/declarative_config.html

This topic seems quite involved with a lengthy discussion spanning years and no clear answer, as described here: Standard way to embed version into Python package?

What I'd like to achieve is that my setup.cfg has the version number (and all other relevant package data) and make that version available to my program at runtime.

Example setup.cfg

[metadata]
name = my_app
version = 0.1.3
author = foo
...

and then in my runtime access that version number:

2022-02-04T23:01:28.177 INFO root::============= Welcome to my_app version 0.1.3, PID: 52296 =============

How can I achieve that ?

Body:
Two options I can think of – I'd go with the first.

1. Use setup.cfg's attr: support to read the version from the source

setup.cfg

[metadata]
version = attr:my_app.__version__

my_app/init.py

# ...
__version__ = '0.1.3'

2. Use importlib.metadata to read the version from the installation metadata

(New in Python 3.8, has backports for older Pythons)

from importlib.metadata import version

my_version = version('my_app')


问:
Create masked textbox but hide masked characters when empty
I want to validate text taken from a textbox and display it in a specific format.

I have tried using a MaskedTextBox, but when the textbox is empty it shows the empty blank lines (underscores) in the text box.

How can I avoid that and show the masked textbox like a simple empty (still masked) textbox?

Also, I want data like csc-(somenumber). Can I add some random number automatically after 'csc-' characters?

答:
The reason the masked text box is showing a blank line is because underscore "_" is the default prompt character for a masked text box.  You have two options for changing this.

If you want the prompt to be visible while the user is editing the text but hidden otherwise, set the HidePromptOnLeave property to true.

```<code>MaskedTextBox1.HidePromptOnLeave = True
</code>```

If you never want to have the underscore as the prompt character, you can change the PromptChar property to be a space " ".  You cannot make the PromptChar nothing, the field must have a value.

```<code>MaskedTextBox1.PromptChar = " "
</code>```

Body:
The reason the masked text box is showing a blank line is because underscore "_" is the default prompt character for a masked text box.  You have two options for changing this.

If you want the prompt to be visible while the user is editing the text but hidden otherwise, set the HidePromptOnLeave property to true.

MaskedTextBox1.HidePromptOnLeave = True

If you never want to have the underscore as the prompt character, you can change the PromptChar property to be a space " ".  You cannot make the PromptChar nothing, the field must have a value.

MaskedTextBox1.PromptChar = " "


问:
"Script" 1 : 1" evaluating expression error in mule 4
I am trying to set the payload with a soap envelope, header, and body.

then substring payload by payload.indexOf("?>")+2

Based on the following expression:

```<code><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://decisionresearch.com/RateMaker">
<soapenv:Header/>
<soapenv:Body>
#[payload.substring(payload.indexOf("?>")+2)]
</soapenv:Body>
</soapenv:Envelope>
</code>```

Input Request: https://github.com/Manikandan99/Map_request/blob/main/Request_map.xml

Expected output: https://github.com/Manikandan99/Map_request/blob/main/Response_map.xml

Mule FLow:

```<code><flow name="map_requestFlow" doc:id="21d0d652-3766-47ed-95aa-a451f62c5776" >
        <http:listener doc:name="Listener" doc:id="7312114b-2857-40b3-98cd-f52b628b3a28" config-ref="HTTP_Listener_config" path="/map"/>
        <ee:transform doc:name="Transform Message" doc:id="7f061325-473b-4f63-8e95-990827b03259" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/xml
---
payload]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <logger level="INFO" doc:name="Logger" doc:id="21051f39-bb9f-412c-af73-f65051317757" message="#[payload]"/>
        <set-payload value='#[<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://decisionresearch.com/RateMaker">

<soapenv:Header/>

<soapenv:Body>

#[payload.substring(payload.indexOf("?>")+2)]

</soapenv:Body>

</soapenv:Envelope>]' doc:name="Set Payload" doc:id="faf2bc3b-e7a3-4708-910b-daeb05bb5f6e" />
</flow>
</code>```

Error message : https://github.com/Manikandan99/Map_request/blob/main/Error.txt

How to encapsulate soap with current payload?

答:
That's wrong because of several reasons. First you can not use an expression inside an expression. Second you are trying to generate XML with strings, when DataWeave already does generates valid XML. Using strings directly is very very error prone. Whenever you see string manipulation to generate or parse XML, you should be questioning the reason.

Instead use DataWeave to generate the XML completely in a simple transform:

%dw 2.0
output application/xml
ns soapenv http://schemas.xmlsoap.org/soap/envelope/
---
{
    soapenv#Envelop: {
        soapenv#Header: null,
        soapenv#Body: payload
    }
}
```
<p>Output (assuming the input has format application/xml):</p>
<pre class="lang-xml prettyprint-override"><code><?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelop xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header/>
  <soapenv:Body>
    <ns0:rate xmlns:ns0="http://decisionresearch.com/RateMaker">
      <ns0:BrokerData>
        <ns0:taxa>TOPA/CISG01/ALL</ns0:taxa>
        <ns0:effectiveMode>effective</ns0:effectiveMode>
        <ns0:requestDate>20190101</ns0:requestDate>
        <ns0:function>rate</ns0:function>
      </ns0:BrokerData>
      <ns0:RateRequest>
        <ns0:Policy>
          <PolType>CNPK</PolType>
          <ClassCode>CANDIS</ClassCode>
          <Zip>80003</Zip>
          <State>CO</State>
          <EffDate>20211117</EffDate>
          <ExpDate>20221117</ExpDate>
          <Payroll>1200</Payroll>
          <OHPayroll/>
          <WAPayroll/>
          <FTE>5</FTE>
          <OccAgg>1000000/2000000</OccAgg>
          <DmgPrem>500000</DmgPrem>
          <MedPay>10000</MedPay>
          <EmpBen>Yes</EmpBen>
          <StopGap>None</StopGap>
          <OHStopGap>None</OHStopGap>
          <WAStopGap>None</WAStopGap>
          <HNO>1000000</HNO>
          <AssBat>100000/200000</AssBat>
          <PerLocAgg>Yes</PerLocAgg>
          <NumLoc>1</NumLoc>
          <WSUB>0</WSUB>
          <PICO>No</PICO>
          <AIML>0</AIML>
          <AIVS>0</AIVS>
          <AIPA>0</AIPA>
          <AIMA>0</AIMA>
          <AILL>0</AILL>
          <LLEA>0</LLEA>
          <AIDP>0</AIDP>
          <BAIV>No</BAIV>
          <WACombo>No</WACombo>
          <IRPMGL>2</IRPMGL>
          <LPDPGL>1.00</LPDPGL>
        </ns0:Policy>
        <ns0:Location>
          <LocationRef>Location-465697646-800339871</LocationRef>
          <State>CO</State>
          <Zip>80003</Zip>
        </ns0:Location>
        <ns0:Class>
          <Id>Risk-1296379588-1802098261</Id>
          <Number>1</Number>
          <ClassCode>CANDIS</ClassCode>
          <Exposure>2000000</Exposure>
          <GLBR>25</GLBR>
          <IsPrimary>Yes</IsPrimary>
        </ns0:Class>
      </ns0:RateRequest>
    </ns0:rate>
  </soapenv:Body>
</soapenv:Envelop>
</code>```

Body:
I am trying to set the payload with a soap envelope, header, and body.

then substring payload by payload.indexOf("?>")+2

Based on the following expression:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://decisionresearch.com/RateMaker">
<soapenv:Header/>
<soapenv:Body>
#[payload.substring(payload.indexOf("?>")+2)]
</soapenv:Body>
</soapenv:Envelope>

Input Request: https://github.com/Manikandan99/Map_request/blob/main/Request_map.xml

Expected output: https://github.com/Manikandan99/Map_request/blob/main/Response_map.xml

Mule FLow:

<flow name="map_requestFlow" doc:id="21d0d652-3766-47ed-95aa-a451f62c5776" >
        <http:listener doc:name="Listener" doc:id="7312114b-2857-40b3-98cd-f52b628b3a28" config-ref="HTTP_Listener_config" path="/map"/>
        <ee:transform doc:name="Transform Message" doc:id="7f061325-473b-4f63-8e95-990827b03259" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/xml
---
payload]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <logger level="INFO" doc:name="Logger" doc:id="21051f39-bb9f-412c-af73-f65051317757" message="#[payload]"/>
        <set-payload value='#[<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://decisionresearch.com/RateMaker">

<soapenv:Header/>

<soapenv:Body>

#[payload.substring(payload.indexOf("?>")+2)]

</soapenv:Body>

</soapenv:Envelope>]' doc:name="Set Payload" doc:id="faf2bc3b-e7a3-4708-910b-daeb05bb5f6e" />
</flow>

Error message : https://github.com/Manikandan99/Map_request/blob/main/Error.txt

How to encapsulate soap with current payload?

Body:
That's wrong because of several reasons. First you can not use an expression inside an expression. Second you are trying to generate XML with strings, when DataWeave already does generates valid XML. Using strings directly is very very error prone. Whenever you see string manipulation to generate or parse XML, you should be questioning the reason.

Instead use DataWeave to generate the XML completely in a simple transform:

%dw 2.0
output application/xml
ns soapenv http://schemas.xmlsoap.org/soap/envelope/
---
{
    soapenv#Envelop: {
        soapenv#Header: null,
        soapenv#Body: payload
    }
}

Output (assuming the input has format application/xml):

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelop xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header/>
  <soapenv:Body>
    <ns0:rate xmlns:ns0="http://decisionresearch.com/RateMaker">
      <ns0:BrokerData>
        <ns0:taxa>TOPA/CISG01/ALL</ns0:taxa>
        <ns0:effectiveMode>effective</ns0:effectiveMode>
        <ns0:requestDate>20190101</ns0:requestDate>
        <ns0:function>rate</ns0:function>
      </ns0:BrokerData>
      <ns0:RateRequest>
        <ns0:Policy>
          <PolType>CNPK</PolType>
          <ClassCode>CANDIS</ClassCode>
          <Zip>80003</Zip>
          <State>CO</State>
          <EffDate>20211117</EffDate>
          <ExpDate>20221117</ExpDate>
          <Payroll>1200</Payroll>
          <OHPayroll/>
          <WAPayroll/>
          <FTE>5</FTE>
          <OccAgg>1000000/2000000</OccAgg>
          <DmgPrem>500000</DmgPrem>
          <MedPay>10000</MedPay>
          <EmpBen>Yes</EmpBen>
          <StopGap>None</StopGap>
          <OHStopGap>None</OHStopGap>
          <WAStopGap>None</WAStopGap>
          <HNO>1000000</HNO>
          <AssBat>100000/200000</AssBat>
          <PerLocAgg>Yes</PerLocAgg>
          <NumLoc>1</NumLoc>
          <WSUB>0</WSUB>
          <PICO>No</PICO>
          <AIML>0</AIML>
          <AIVS>0</AIVS>
          <AIPA>0</AIPA>
          <AIMA>0</AIMA>
          <AILL>0</AILL>
          <LLEA>0</LLEA>
          <AIDP>0</AIDP>
          <BAIV>No</BAIV>
          <WACombo>No</WACombo>
          <IRPMGL>2</IRPMGL>
          <LPDPGL>1.00</LPDPGL>
        </ns0:Policy>
        <ns0:Location>
          <LocationRef>Location-465697646-800339871</LocationRef>
          <State>CO</State>
          <Zip>80003</Zip>
        </ns0:Location>
        <ns0:Class>
          <Id>Risk-1296379588-1802098261</Id>
          <Number>1</Number>
          <ClassCode>CANDIS</ClassCode>
          <Exposure>2000000</Exposure>
          <GLBR>25</GLBR>
          <IsPrimary>Yes</IsPrimary>
        </ns0:Class>
      </ns0:RateRequest>
    </ns0:rate>
  </soapenv:Body>
</soapenv:Envelop>


问:
Cannot install Robot Operating System in Debian 11.2.0 after following official documentation
I need to install Robot Operating System on my Debian Virtualbox instance for school. I followed the official docs. The first obstacle I found was when I needed to run sudo add-apt-repository universe which returned Error: 'universe' is invalid. Fortunately this post solved that problem.

However a few steps later there is a problem. I ran sudo apt update but it says Malformed entry 1 in list file /etc/apt/sources.list.d/ros2.list (Component), so I checked the file with nano. These are the contents:

```<code>deb [arch=amd64 signed-by=usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu main
</code>```

I don't know what exactly is the malformed part. I deleted the ones within square brackets and it still returns the same error. There was a post I read that told me to delete the offending file, but it's of no use as installing ros-rolling-desktop will fail because packages.ros.org is deleted. So far I am stuck and I'm out of ideas.

It's a shame they didn't put more care into their documentation.

答:
I used to facing this problem though my system is Ubuntu 18.04, I think of these questions may have universal solution.
As for my method,I tried many ways to solve it but I can't remember which way can run.
Method：
1.try this：
sudo rm /etc/apt/sources.list.d/ros-latest.list
if you can't install this then try to search on this web:
https://download.docker.com/linux/ubuntu， then try to download.

2.(I don't know this way should be OK)
cat /etc/apt/sources.list.d/ros-latest.list
sudo vim /etc/apt/sources.list.d/ros-latest.list
check it row by row, add a 'space' fore the signal '$' which seems to be
' $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null'

if it can't run correctly,please return it.

Body:
I need to install Robot Operating System on my Debian Virtualbox instance for school. I followed the official docs. The first obstacle I found was when I needed to run sudo add-apt-repository universe which returned Error: 'universe' is invalid. Fortunately this post solved that problem.

However a few steps later there is a problem. I ran sudo apt update but it says Malformed entry 1 in list file /etc/apt/sources.list.d/ros2.list (Component), so I checked the file with nano. These are the contents:

deb [arch=amd64 signed-by=usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu main

I don't know what exactly is the malformed part. I deleted the ones within square brackets and it still returns the same error. There was a post I read that told me to delete the offending file, but it's of no use as installing ros-rolling-desktop will fail because packages.ros.org is deleted. So far I am stuck and I'm out of ideas.

It's a shame they didn't put more care into their documentation.


问:
How to add space in a code area using HTML CSS
I'm building a widget. So users have to copy-paste a code from my website into their HTML.

I want to do 2 things.

I want to add spaces in the code area like shown below. The space between different lines is to make code friendly to users.

There will be a copy code snippet button. On clicking on it users can copy the code.

I'm worried if I have
 in the code that will get copied
along as well. Which I don't want.

```<code><code>{` <!-- Start of  client code snippet -->

            <script>

                (function (w, d, s, o, f, js, fjs) {
                    w[o] =
                        w[o] ||
                        function () {
                            (w[o].q = w[o].q || []).push(arguments);
                        };
                    (js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
                    js.id = o;
                    js.src = f;
                    js.async = 1;
                    fjs.parentNode.insertBefore(js, fjs);
                })(window, document, "script", "_hw", "./widget.js");
                _hw("init", { debug: true, clientID: "abcd" });

             </script>

            <!-- End of client code snippet -->

           `} </code>

</code>```

答:
Use <code>```</code> Tag</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><code>
```
    (function (w, d, s, o, f, js, fjs) {
        w[o] =
            w[o] ||
            function () {
                (w[o].q = w[o].q || []).push(arguments);
            };
        (js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
        js.id = o;
        js.src = f;
        js.async = 1;
        fjs.parentNode.insertBefore(js, fjs);
    })(window, document, "script", "_hw", "./widget.js");
    _hw("init", { debug: true, clientID: "abcd" });
```
</code></code>```
</div>
</div>
</p>

Body:
I'm building a widget. So users have to copy-paste a code from my website into their HTML.

I want to do 2 things.

I want to add spaces in the code area like shown below. The space between different lines is to make code friendly to users.

There will be a copy code snippet button. On clicking on it users can copy the code.

I'm worried if I have
 in the code that will get copied
along as well. Which I don't want.

{`

           `}

Body:
Use <pre> Tag

<code>
<pre>
    (function (w, d, s, o, f, js, fjs) {
        w[o] =
            w[o] ||
            function () {
                (w[o].q = w[o].q || []).push(arguments);
            };
        (js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
        js.id = o;
        js.src = f;
        js.async = 1;
        fjs.parentNode.insertBefore(js, fjs);
    })(window, document, "script", "_hw", "./widget.js");
    _hw("init", { debug: true, clientID: "abcd" });
</pre>
</code>


问:
android gps source code
I'm working on the android source code. I need to find the network main code and the gps main code. I found the network file I was looking for:

/Android_Working_Directory/system/netd/client/NetdClient.cpp

But I couldn't find the gps file.
What I need to do is to log any interactions with this features.
Any thoughts?

Title: android gps source code

Body: frameworks/base/location/java/android/location


问:
Android studio: Error while waiting for device: The emulator process for AVD ____ has terminated
When I try to open a wearos AVD, there is always such an error. It only appears when I turn on wearos AVD, and everything is normal when I turn on mobile AVD. I have searched a lot on the Internet, which is useless. Here are the methods I have tried for these things:

1.uninstall and reinstall the emulator;

2.uninstall and reinstall Android Studio;

3.create the AVD with diffrent images;

4.restart my computer;

The app is fine because I have tested it on my Physical device. \

My computer:macOS 12.2, 154.62GB used(total 1T), Apple Silicon M1Pro(10cpu cores and 16 gpu cores) 16Gb ram.

Thanks in advance.\
error screenshot

答:
Well, after looking for information on the web, i finally figure this out.

The reason is: I am using a M1pro Macbook, and google haven't got any arm64-v8a WearOS Image. But they got arm64-v8a android image, so android is fine.

Hope this will give you some help.


问:
Green screening in Python using Pillow
i am learning green screenin in python i have understood this phase

Importing image and loading it in a variables

Loading pixels

Creating a new image

The part I want to understand better is where RGB values used for boolean statements come from.

I have watched a tutorial from Youtube but the video has no explanation, it's a follow-along kind of video. The part I am wondering is how one got the (RGB) values and determining which values to use when doing the boolean statements. This is the video that I am referring to.

code screenshot

```<code>for x in range (0, width):
    for y in range (0, height):
        (r, g, b) = pixels_harvester[x,y]
        if r <= 150 and g >= 215 and b <= 60:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 145 and g >= 210 and b <= 145:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 155 and g >= 210 and b <= 155:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 230 and g >= 254 and b <= 230:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 164 and g >= 165 and b <= 84:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 66 and g >= 120 and b <= 45:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 130 and g >= 200 and b <= 130:
            pixels_harvester[x,y] = pixels_field[x,y]
        pixels_combined_image[x,y] = pixels_harvester[x,y]

</code>```

答:
You can consider an image as a matrix (2D array, or list of lists) of pixels, on which we iterate with a nested for loop.
In a color image, each pixel has 3 color channels: Red,Green,Blue.

```<code>pixels_harvester[x,y]
</code>```

will then be a pixel, represented in python as a tuple with R,G,B values to unpack.
The following if-checks are to determine whether we are checking a bright green pixel (you can see the g >= ...), and if so, substituting the pixel in pixel_harvester with the one in pixels_field, resulting in a "green screen" effect.

The video explains this a few minutes later, and besides this there are many more green-screening techniques already made and with better performace.

Title: Green screening in Python using Pillow

Body:
i am learning green screenin in python i have understood this phase

Importing image and loading it in a variables

Loading pixels

Creating a new image

The part I want to understand better is where RGB values used for boolean statements come from.

I have watched a tutorial from Youtube but the video has no explanation, it's a follow-along kind of video. The part I am wondering is how one got the (RGB) values and determining which values to use when doing the boolean statements. This is the video that I am referring to.

code screenshot

for x in range (0, width):
    for y in range (0, height):
        (r, g, b) = pixels_harvester[x,y]
        if r <= 150 and g >= 215 and b <= 60:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 145 and g >= 210 and b <= 145:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 155 and g >= 210 and b <= 155:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 230 and g >= 254 and b <= 230:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 164 and g >= 165 and b <= 84:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 66 and g >= 120 and b <= 45:
            pixels_harvester[x,y] = pixels_field[x,y]
        elif r <= 130 and g >= 200 and b <= 130:
            pixels_harvester[x,y] = pixels_field[x,y]
        pixels_combined_image[x,y] = pixels_harvester[x,y]

Body:
You can consider an image as a matrix (2D array, or list of lists) of pixels, on which we iterate with a nested for loop.
In a color image, each pixel has 3 color channels: Red,Green,Blue.

pixels_harvester[x,y]

will then be a pixel, represented in python as a tuple with R,G,B values to unpack.
The following if-checks are to determine whether we are checking a bright green pixel (you can see the g >= ...), and if so, substituting the pixel in pixel_harvester with the one in pixels_field, resulting in a "green screen" effect.

The video explains this a few minutes later, and besides this there are many more green-screening techniques already made and with better performace.


问:
MySqlConversionException when accessing DateTime field from DataReader
I have a C# application over MySql, using MySQL Connector; I'm trying to make a
DataReader request, the query executes fine, however, when trying to access a DateTime field, i'm getting MySqlConversionException {"Unable to convert MySQL date/time value to System.DateTime"}

this is the prototype

```<code>if (dr != null && !dr.Read()) return;

sesion.Id = Convert.ToInt32(dr["id"]);
sesion.Usuario = Convert.ToInt32(dr["usuario"]);
sesion.Estado = Convert.ToByte(dr["estado"]);
// doesn't work
sesion.FchCreacion = Convert.ToDateTime(dr["fch_creacion"]);
</code>```

Any suggestions?
Thanks in advance

答:
I'd suggest it may be a culture specific error - is the applicaiton on the same server as the DB, and do they have the same culture settings?

Also, is the column definitely a datetime in MySQL?

OwnerDisplayName: Jhonny D. Cano -Leftware-

ContentLicense: CC BY-SA 2.5

Body:
I have a C# application over MySql, using MySQL Connector; I'm trying to make a
DataReader request, the query executes fine, however, when trying to access a DateTime field, i'm getting MySqlConversionException {"Unable to convert MySQL date/time value to System.DateTime"}

this is the prototype

if (dr != null && !dr.Read()) return;

sesion.Id = Convert.ToInt32(dr["id"]);
sesion.Usuario = Convert.ToInt32(dr["usuario"]);
sesion.Estado = Convert.ToByte(dr["estado"]);
// doesn't work
sesion.FchCreacion = Convert.ToDateTime(dr["fch_creacion"]);

Any suggestions?
Thanks in advance

OwnerDisplayName: ck


问:
jQuery - how to pass in options to a function that creates a datatable from a JSON object
I have the following that creates a datatable from a JSON object

```<code>(function( $ ){
   $.fn.create_datatable_from_json = function(json_object) {
        var table = this.DataTable({
           data: json_object,
           columns: Object.keys(json_object[0]).map(function(item) {
             return { data: item, title: item }
           })
        })
      return table;
   };
})( jQuery );
</code>```

My question is how would I use another parameter to the function to set the options of the datatable, keeping the first two options (data and columns) alone?

For instance, if I wanted to do:

```<code>"scrollX": true,
"scrollY": 500,
"paging": false
</code>```

I would call something like:

```<code>options = {"scrollX": true,"scrollY": 500,"paging": false}
$('#test').create_datatable_from_json(json_object,options);
</code>```

How would I then use options

答:
The best way would be to first create an object with all data you want to pass to DataTable, then iterate over options to add their keys to your data object :

$.fn.create_datatable_from_json = function(json_object,options) {
    var data={
       data: json_object,
       columns: Object.keys(json_object[0]).map(function(item) {
         return { data: item, title: item }
       })
    };
    for(x in options)
        data[x]=options[x];
    var table = this.DataTable(data);
    return table;
};
```

It even lets you overwrite columns if you need to.

Body:
I have the following that creates a datatable from a JSON object

(function( $ ){
   $.fn.create_datatable_from_json = function(json_object) {
        var table = this.DataTable({
           data: json_object,
           columns: Object.keys(json_object[0]).map(function(item) {
             return { data: item, title: item }
           })
        })
      return table;
   };
})( jQuery );

My question is how would I use another parameter to the function to set the options of the datatable, keeping the first two options (data and columns) alone?

For instance, if I wanted to do:

"scrollX": true,
"scrollY": 500,
"paging": false

I would call something like:

options = {"scrollX": true,"scrollY": 500,"paging": false}
$('#test').create_datatable_from_json(json_object,options);

How would I then use options

Body:
The best way would be to first create an object with all data you want to pass to DataTable, then iterate over options to add their keys to your data object :

$.fn.create_datatable_from_json = function(json_object,options) {
    var data={
       data: json_object,
       columns: Object.keys(json_object[0]).map(function(item) {
         return { data: item, title: item }
       })
    };
    for(x in options)
        data[x]=options[x];
    var table = this.DataTable(data);
    return table;
};

It even lets you overwrite columns if you need to.


问:
Fetch table value using Accessor In Laravel 8 for image
My model name is 'data' and the field name is 'image'.

In the Model when I try to fetch the URL of the image it shows this error Undefined property: App\Models\Data::$image using $this->image;.

But when I try to fetch name using $this->name It's working fine.

I also attached the screenshot of DB for better understanding.

Note: I add use Storage; In the model.

Please help me for solving the issue.

Controller

Model

答:
I get the answer Reference
https://laravel.com/docs/8.x/eloquent-mutators#defining-an-accessor</p>
```<code>public function getImageAttribute($image)
{
    $Img_Url = $image;
    return $ImgUrl;
}
</code>```

Body:
I get the answer Reference
https://laravel.com/docs/8.x/eloquent-mutators#defining-an-accessor

public function getImageAttribute($image)
{
    $Img_Url = $image;
    return $ImgUrl;
}


问:
How to get array of random doubles in C?
I want to generate an array with random doubles but get an "Segmentation Fault" instead of the result. When I use the same code but replace double with float, everything works. How is that?
Code below works:

```<code>#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int N = 1048576;

int main(void) {
    srand(time(NULL));

    float B[N];

    for (int i = 0; i < N; i++) {
        B[i] = (float)rand() / RAND_MAX;
    }

    printf("B[0]=%lf\n", B[0]);

    return 0;
}
</code>```

And code below gives me segmentation fault

```<code>#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int N = 1048576;

int main(void) {
    srand(time(NULL));

    double B[N];

    for (int i = 0; i < N; i++) {
        B[i] = (double)rand() / RAND_MAX;
    }

    printf("B[0]=%lf\n", B[0]);

    return 0;
}
</code>```

I'm a noob in C, so any detailed explanation would be appreciated.

答:
You want to allocate the memory with malloc instead of using the stack.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void) {
  srand(time(NULL));

  size_t N = 1234567ull;
  double *array = malloc(sizeof(double) * N);

  if (array == NULL) {
      perror("array allocation");
      return EXIT_FAILURE;
  }

  for (size_t i = 0ull; i < N; i++) {
    array[i] = (double) rand() / RAND_MAX;
  }

  printf("%f\n", array[0]);
  free(array);
  return EXIT_SUCCESS;
}
```

Body:
I want to generate an array with random doubles but get an "Segmentation Fault" instead of the result. When I use the same code but replace double with float, everything works. How is that?
Code below works:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int N = 1048576;

int main(void) {
    srand(time(NULL));

    float B[N];

    for (int i = 0; i < N; i++) {
        B[i] = (float)rand() / RAND_MAX;
    }

    printf("B[0]=%lf\n", B[0]);

    return 0;
}

And code below gives me segmentation fault

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int N = 1048576;

int main(void) {
    srand(time(NULL));

    double B[N];

    for (int i = 0; i < N; i++) {
        B[i] = (double)rand() / RAND_MAX;
    }

    printf("B[0]=%lf\n", B[0]);

    return 0;
}

I'm a noob in C, so any detailed explanation would be appreciated.


问:
Counting different Characters in Swift
I am new to swift and I am trying to count the different characters in a string but my code returns the value for the whole String

for example:

```<code>var string aString = "aabb"
aString.characters.count()             //returns 5

counter = 0
let a = "a"

for a in aString.characters {
  counter++
}                                      //equally returns 5
</code>```

Can somebody explain why this is happening and how I could count the different chars?

答:
Construct a dictionary out of a sequence of (key, value) pairs. If we can guarantee that the keys are unique, we can use Dictionary(uniqueKeysWithValues:).

```<code>func characterFrequencies(of string: String) -> Dictionary<String.Element, Int> {
    let frequencyPair = string.map { ($0, 1) }
    return Dictionary(frequencyPair, uniquingKeysWith: +)
}
</code>```

Usage : print(characterFrequencies(of: "Happy"))
Result : ["a": 1, "H": 1, "y": 1, "p": 2]

Title: Counting different Characters in Swift

Body:
I am new to swift and I am trying to count the different characters in a string but my code returns the value for the whole String

for example:

var string aString = "aabb"
aString.characters.count()             //returns 5

counter = 0
let a = "a"

for a in aString.characters {
  counter++
}                                      //equally returns 5

Can somebody explain why this is happening and how I could count the different chars?

Body:
Construct a dictionary out of a sequence of (key, value) pairs. If we can guarantee that the keys are unique, we can use Dictionary(uniqueKeysWithValues:).

func characterFrequencies(of string: String) -> Dictionary<String.Element, Int> {
    let frequencyPair = string.map { ($0, 1) }
    return Dictionary(frequencyPair, uniquingKeysWith: +)
}

Usage : print(characterFrequencies(of: "Happy"))
Result : ["a": 1, "H": 1, "y": 1, "p": 2]


问:
Mplot3D plot freezes when plotting in PyCharm Professional
Recently when I am doing MatPlotLib 3D plots in PyCharm, the debugging and the plot window are freezing when excuting the plt.show() command. In the top bar of the plot is mentioned (Not Responding). This happens both in PyCharm Community edition 2019 and PyCharm Professional 2021. I am running v3.8 of Python. If I execute plt.show(Block=True), the interactive 3D plot will come up, but I will need to close the figure to continue the debugging.

Does anyone have an idea how I can plot the figure with plt.show(), get up the interactive window, and continue debugging while still having the interactive window open? This worked in my previous version of Python v3.7, but the problem happened recently when upgrading to v3.8.

答:
I recently faced the same issue when using matplotlib to plot. This seems to be related to a change in the order of precedence that matplotlib uses to pick its default backend. According to the matplotlibrc file that is bundled with the Python package, the order used to be

MacOSX Qt5Agg Gtk3Agg TkAgg WxAgg Agg

in previous versions (e.g., v3.4.2), while in more recent versions (e.g., v3.5.0) it has been be changed to

MacOSX QtAgg Gtk4Agg Gtk3Agg TkAgg WxAgg Agg

For me, setting the backend to Qt5Agg right after importing matplotlib in Python via

```<code>import matplotlib
matplotlib.use("Qt5Agg")
</code>```

indeed solved the "Not responding" issue. Alternatively, we can specify it through the environment variable MPLBACKEND=Qt5Agg.
Likely, we could also set Qt5Agg as default backend in matplotlibrc either by modifying the bundled matplotlibrc file or by providing our own.

PS: Not sure whether the core issue that prevents the QtAgg backend from working correctly is in PyCharm, matplotlib, or PyQt...

Body:
I recently faced the same issue when using matplotlib to plot. This seems to be related to a change in the order of precedence that matplotlib uses to pick its default backend. According to the matplotlibrc file that is bundled with the Python package, the order used to be

MacOSX Qt5Agg Gtk3Agg TkAgg WxAgg Agg

in previous versions (e.g., v3.4.2), while in more recent versions (e.g., v3.5.0) it has been be changed to

MacOSX QtAgg Gtk4Agg Gtk3Agg TkAgg WxAgg Agg

For me, setting the backend to Qt5Agg right after importing matplotlib in Python via

import matplotlib
matplotlib.use("Qt5Agg")

indeed solved the "Not responding" issue. Alternatively, we can specify it through the environment variable MPLBACKEND=Qt5Agg.
Likely, we could also set Qt5Agg as default backend in matplotlibrc either by modifying the bundled matplotlibrc file or by providing our own.

PS: Not sure whether the core issue that prevents the QtAgg backend from working correctly is in PyCharm, matplotlib, or PyQt...