text:
Q: Responsive Design - Pie Chart I have this pie chart which does not scale down when on a mobile screen.
I have tried including media queries but it doesn't seem to work. I wonder if I have put them in the wrong place? or maybe I need a div style? The code works ok on a computer screen, it's just when I view it on mobile.
<!DOCTYPE html>

<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.material.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.material.mobile.min.css" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Screenshot
Any ideas?

A: Add this jquery for responsive pie-chart
$(window).on("resize", function() {
  kendo.resize($("#example"));
});

Chech this Demo jsfiddle

function createChart() {
            $("#chart").kendoChart({
                title: {
                    position: "bottom",
                    text: "Test Title"
                },
                legend: {
                    visible: false
                },
                chartArea: {
                    background: ""
                },
                seriesDefaults: {
                    labels: {
                        visible: true,
                        background: "transparent",
                        template: "#= category #: \n #= value#%"
                    }
                },
                series: [{
                    type: "pie",
                    startAngle: 150,
                    data: [{
                        category: "Germany",
                        value: 40.4,
                        color: "#007bc7"
                    },{
                        category: "Italy",
                        value: 20.2,
                        color: "#ffb612"
                    },{
                        category: "France",
                        value: 7.1,
                        color: "#39b70c"
                    },{
                        category: "United Kingdom",
                        value: 5.1,
                        color: "#59b1df"
                    },{
                        category: "Spain",
                        value: 5.1,
                        color: "#ca005d"

                    },{
                        category: "Other",
                       value: 18.2,
                        color: "#5ed1b5"

                    },{
                        category: "Netherlands",
                        value: 4.0,
                        color: "#ee720d"
                    }]
                }],
                tooltip: {
                    visible: true,
                    format: "{0}%"
            }
        });
    }

$(document).ready(createChart);
$(document).bind("kendo:skinChange", createChart);

$(window).on("resize", function() {
  kendo.resize($("#example"));
});
table {
  width: 100%;
  border-collapse: collapse;
}
/* Zebra striping */
tr:nth-of-type(odd) {
  background: #eee;
}
th {
  background: #333;
  color: white;
  font-weight: bold;
}
td, th {
  padding: 6px;
  border: 1px solid #ccc;
  text-align: left;
}
@media
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px)  {

/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
    display: block;
}

/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
}

tr { border: 1px solid #ccc; }

td {
    /* Behave  like a "row" */
    border: none;
    border-bottom: 1px solid #eee;
    position: relative;
    padding-left: 50%;
}

td:before {
    /* Now like a table header */
    position: absolute;
    /* Top/left values mimic padding */
    top: 6px;
    left: 6px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
}
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.material.mobile.min.css" />

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

A: add resize function
$(window).resize(createChart);

function createChart() {
            $("#chart").kendoChart({
                title: {
                    position: "bottom",
                    text: "Test Title"
                },
                legend: {
                    visible: false
                },
                chartArea: {
                    background: ""
                },
                seriesDefaults: {
                    labels: {
                        visible: true,
                        background: "transparent",
                        template: "#= category #: \n #= value#%"
                    }
                },
                series: [{
                    type: "pie",
                    startAngle: 150,
                    data: [{
                        category: "Germany",
                        value: 40.4,
                        color: "#007bc7"
                    },{
                        category: "Italy",
                        value: 20.2,
                        color: "#ffb612"
                    },{
                        category: "France",
                        value: 7.1,
                        color: "#39b70c"
                    },{
                        category: "United Kingdom",
                        value: 5.1,
                        color: "#59b1df"
                    },{
                        category: "Spain",
                        value: 5.1,
                        color: "#ca005d"

                    },{
                        category: "Other",
                       value: 18.2,
                        color: "#5ed1b5"

                    },{
                        category: "Netherlands",
                        value: 4.0,
                        color: "#ee720d"
                    }]
                }],
                tooltip: {
                    visible: true,
                    format: "{0}%"
            }
        });
    }

    $(document).ready(createChart);
    $(window).resize(createChart);
    $(document).bind("kendo:skinChange", createChart);
table {
  width: 100%;
  border-collapse: collapse;
}
/* Zebra striping */
tr:nth-of-type(odd) {
  background: #eee;
}
th {
  background: #333;
  color: white;
  font-weight: bold;
}
td, th {
  padding: 6px;
  border: 1px solid #ccc;
  text-align: left;
}
@media
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px)  {

/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
    display: block;
}

/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
}

tr { border: 1px solid #ccc; }

td {
    /* Behave  like a "row" */
    border: none;
    border-bottom: 1px solid #eee;
    position: relative;
    padding-left: 50%;
}

td:before {
    /* Now like a table header */
    position: absolute;
    /* Top/left values mimic padding */
    top: 6px;
    left: 6px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
}
<!DOCTYPE html>

    <base href="https://demos.telerik.com/kendo-ui/pie-charts/index">

    <title></title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.material.mobile.min.css" />

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


text:
Q: REST API - Can not convert XML with JAXB I have a problem with processing an API response. First I am making a connection to get my response:
HttpResponse<String> response = Unirest.get(buildUrl(newOrdersUrl)).basicAuth(login, pass).asString();
        if(response.getStatus() == 200){
            return OrdersConverter.convertOrders(response.getBody());
        } else {
            return null;
        }

With:
public class OrdersConverter {
    public static OrdersType convertOrders(String response) {
        try {
            JAXBContext jc = JAXBContext.newInstance(OrdersType.class);
            Unmarshaller u = jc.createUnmarshaller();
            StringBuffer xmlStr = new StringBuffer(response);

            JAXBElement<OrdersType> o = u.unmarshal(new StreamSource(new StringReader(xmlStr.toString())), OrdersType.class);

            return o.getValue();
        } catch (JAXBException e) {
            return null;
        }
    }
}

With this https://sell.fruugo.com/fruugo-docs/fruugo-product-feed.xsd as Schema
My response String looks like this (with redacted Information)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<o:orders merchantId="Redacted" xmlns:o="https://www.fruugo.com/orders/schema">
    <o:order>
        <o:customerOrderId>Redacted</o:customerOrderId>
        <o:orderId>Redacted</o:orderId>
        <o:orderDate>Redacted</o:orderDate>
        <o:orderReleaseDate>Redacted</o:orderReleaseDate>
        <o:orderStatus>Redacted</o:orderStatus>
        <o:customerLanguageCode>Redacted</o:customerLanguageCode>
        <o:shippingAddress>
            <o:firstName>Redacted</o:firstName>
            <o:lastName>Redacted</o:lastName>
            <o:streetAddress>Redacted</o:streetAddress>
            <o:city>Redacted</o:city>
            <o:province>Redacted</o:province>
            <o:postalCode>Redacted</o:postalCode>
            <o:countryCode>Redacted</o:countryCode>
            <o:phoneNumber>Redacted</o:phoneNumber>
        </o:shippingAddress>
        <o:shippingMethod>Redacted</o:shippingMethod>
        <o:shippingCostInclVAT>Redacted</o:shippingCostInclVAT>
        <o:shippingCostVAT>Redacted</o:shippingCostVAT>
        <o:orderLines>
            <o:orderLine>
                <o:productId>Redacted</o:productId>
                <o:skuId>Redacted</o:skuId>
                <o:skuName>Redacted</o:skuName>
                <o:fruugoProductId>Redacted</o:fruugoProductId>
                <o:fruugoSkuId>Redacted</o:fruugoSkuId>
                <o:currencyCode>Redacted</o:currencyCode>
                <o:itemPriceInclVat>Redacted</o:itemPriceInclVat>
                <o:itemVat>Redacted</o:itemVat>
                <o:totalPriceInclVat>Redacted</o:totalPriceInclVat>
                <o:totalVat>Redacted</o:totalVat>
                <o:vatPercentage>Redacted</o:vatPercentage>
                <o:totalNumberOfItems>Redacted</o:totalNumberOfItems>
                <o:pendingItems>Redacted</o:pendingItems>
                <o:confirmedItems>Redacted</o:confirmedItems>
                <o:shippedItems>Redacted</o:shippedItems>
                <o:cancelledItems>Redacted</o:cancelledItems>
                <o:returnAnnouncedItems>Redacted</o:returnAnnouncedItems>
                <o:returnedItems>Redacted</o:returnedItems>
                <o:itemsWithException>Redacted</o:itemsWithException>
            </o:orderLine>
        </o:orderLines>
    </o:order>
    <o:order>
        <o:customerOrderId>Redacted</o:customerOrderId>
        <o:orderId>Redacted</o:orderId>
        <o:orderDate>Redacted</o:orderDate>
        <o:orderReleaseDate>Redacted</o:orderReleaseDate>
        <o:orderStatus>Redacted</o:orderStatus>
        <o:customerLanguageCode>Redacted</o:customerLanguageCode>
        <o:shippingAddress>
            <o:firstName>Redacted</o:firstName>
            <o:lastName>Redacted</o:lastName>
            <o:streetAddress>Redacted</o:streetAddress>
            <o:city>Redacted</o:city>
            <o:province>Redacted</o:province>
            <o:postalCode>Redacted</o:postalCode>
            <o:countryCode>Redacted</o:countryCode>
            <o:phoneNumber>Redacted</o:phoneNumber>
        </o:shippingAddress>
        <o:shippingMethod>Redacted</o:shippingMethod>
        <o:shippingCostInclVAT>Redacted</o:shippingCostInclVAT>
        <o:shippingCostVAT>Redacted</o:shippingCostVAT>
        <o:orderLines>
            <o:orderLine>
                <o:productId>Redacted</o:productId>
                <o:skuId>Redacted</o:skuId>
                <o:skuName>Redacted</o:skuName>
                <o:fruugoProductId>Redacted</o:fruugoProductId>
                <o:fruugoSkuId>Redacted</o:fruugoSkuId>
                <o:currencyCode>Redacted</o:currencyCode>
                <o:itemPriceInclVat>Redacted</o:itemPriceInclVat>
                <o:itemVat>Redacted</o:itemVat>
                <o:totalPriceInclVat>Redacted</o:totalPriceInclVat>
                <o:totalVat>Redacted</o:totalVat>
                <o:vatPercentage>Redacted</o:vatPercentage>
                <o:totalNumberOfItems>Redacted</o:totalNumberOfItems>
                <o:pendingItems>Redacted</o:pendingItems>
                <o:confirmedItems>Redacted</o:confirmedItems>
                <o:shippedItems>Redacted</o:shippedItems>
                <o:cancelledItems>Redacted</o:cancelledItems>
                <o:returnAnnouncedItems>Redacted</o:returnAnnouncedItems>
                <o:returnedItems>Redacted</o:returnedItems>
                <o:itemsWithException>Redacted</o:itemsWithException>
            </o:orderLine>
        </o:orderLines>
    </o:order>
    <o:order>
        <o:customerOrderId>Redacted</o:customerOrderId>
        <o:orderId>Redacted</o:orderId>
        <o:orderDate>Redacted</o:orderDate>
        <o:orderReleaseDate>Redacted</o:orderReleaseDate>
        <o:orderStatus>Redacted</o:orderStatus>
        <o:customerLanguageCode>Redacted</o:customerLanguageCode>
        <o:shippingAddress>
            <o:firstName>Redacted</o:firstName>
            <o:lastName>Redacted</o:lastName>
            <o:streetAddress>Redacted</o:streetAddress>
            <o:city>Redacted</o:city>
            <o:province>Redacted</o:province>
            <o:postalCode>Redacted</o:postalCode>
            <o:countryCode>Redacted</o:countryCode>
            <o:phoneNumber>Redacted</o:phoneNumber>
        </o:shippingAddress>
        <o:shippingMethod>Redacted</o:shippingMethod>
        <o:shippingCostInclVAT>Redacted</o:shippingCostInclVAT>
        <o:shippingCostVAT>Redacted</o:shippingCostVAT>
        <o:orderLines>
            <o:orderLine>
                <o:productId>Redacted</o:productId>
                <o:skuId>Redacted</o:skuId>
                <o:skuName>Redacted</o:skuName>
                <o:fruugoProductId>Redacted</o:fruugoProductId>
                <o:fruugoSkuId>Redacted</o:fruugoSkuId>
                <o:currencyCode>Redacted</o:currencyCode>
                <o:itemPriceInclVat>Redacted</o:itemPriceInclVat>
                <o:itemVat>Redacted</o:itemVat>
                <o:totalPriceInclVat>Redacted</o:totalPriceInclVat>
                <o:totalVat>Redacted</o:totalVat>
                <o:vatPercentage>Redacted</o:vatPercentage>
                <o:totalNumberOfItems>Redacted</o:totalNumberOfItems>
                <o:pendingItems>Redacted</o:pendingItems>
                <o:confirmedItems>Redacted</o:confirmedItems>
                <o:shippedItems>Redacted</o:shippedItems>
                <o:cancelledItems>Redacted</o:cancelledItems>
                <o:returnAnnouncedItems>Redacted</o:returnAnnouncedItems>
                <o:returnedItems>Redacted</o:returnedItems>
                <o:itemsWithException>Redacted</o:itemsWithException>
            </o:orderLine>
        </o:orderLines>
    </o:order>
</o:orders>

When I convert this response to OrdersType.class I can get my merchantID but I do not get a List of Orders from the OrdersType.class.
What am I missing? Do I need to convert this response to another class to get the list of orders?
UPDATE:
ObjectFactory
/**
 * This object contains factory methods for each
 * Java content interface and Java element interface
 * generated in the model package.
 *
An ObjectFactory allows you to programatically
 * construct new instances of the Java representation
 * for XML content. The Java representation of XML
 * content can consist of schema derived interfaces
 * and classes representing the binding of schema
 * type definitions, element declarations and model
 * groups.  Factory methods for each of these are
 * provided in this class.
 *
 */
@XmlRegistry
public class ObjectFactory {

    private final static QName _Orders_QNAME = new QName("https://www.fruugo.com/orders/schema", "orders");

    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: model
     *
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link ShippingAddressType }
     *
     */
    public ShippingAddressType createShippingAddressType() {
        return new ShippingAddressType();
    }

    /**
     * Create an instance of {@link OrderLinesType }
     *
     */
    public OrderLinesType createOrderLinesType() {
        return new OrderLinesType();
    }

    /**
     * Create an instance of {@link OrderType }
     *
     */
    public OrderType createOrderType() {
        return new OrderType();
    }

    /**
     * Create an instance of {@link ShipmentLinesType }
     *
     */
    public ShipmentLinesType createShipmentLinesType() {
        return new ShipmentLinesType();
    }

    /**
     * Create an instance of {@link ShipmentType }
     *
     */
    public ShipmentType createShipmentType() {
        return new ShipmentType();
    }

    /**
     * Create an instance of {@link ShipmentsType }
     *
     */
    public ShipmentsType createShipmentsType() {
        return new ShipmentsType();
    }

    /**
     * Create an instance of {@link ShipmentLineType }
     *
     */
    public ShipmentLineType createShipmentLineType() {
        return new ShipmentLineType();
    }

    /**
     * Create an instance of {@link AttributeType }
     *
     */
    public AttributeType createAttributeType() {
        return new AttributeType();
    }

    /**
     * Create an instance of {@link AttributesType }
     *
     */
    public AttributesType createAttributesType() {
        return new AttributesType();
    }

    /**
     * Create an instance of {@link OrdersType }
     *
     */
    public OrdersType createOrdersType() {
        return new OrdersType();
    }

    /**
     * Create an instance of {@link OrderLineType }
     *
     */
    public OrderLineType createOrderLineType() {
        return new OrderLineType();
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link OrdersType }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "https://www.fruugo.com/orders/schema", name = "orders")
    public static JAXBElement<OrdersType> createOrders(OrdersType value) {
        return new JAXBElement<OrdersType>(_Orders_QNAME, OrdersType.class, null, value);
    }

}

OrdersType
/**
 *
Java class for OrdersType complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="OrdersType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="order" type="{https://www.fruugo.com/orders/schema}OrderType" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="merchantId" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "OrdersType", propOrder = {
    "order"
})
public class OrdersType {

    protected List<OrderType> order;
    @XmlAttribute(name = "version")
    protected String version;
    @XmlAttribute(name = "merchantId")
    protected String merchantId;

    /**
     * Gets the value of the order 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 order property.
     *
     *

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

     *    getOrder().add(newItem);
     *

     *
     *
     *

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

    /**
     * Gets the value of the version property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getVersion() {
        return version;
    }

    /**
     * Sets the value of the version property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setVersion(String value) {
        this.version = value;
    }

    /**
     * Gets the value of the merchantId property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getMerchantId() {
        return merchantId;
    }

    /**
     * Sets the value of the merchantId property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setMerchantId(String value) {
        this.merchantId = value;
    }

}

OrderType
/**
 *
Java class for OrderType complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="OrderType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="orderId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="orderDate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
 *         <element name="orderReleaseDate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
 *         <element name="orderStatus" type="{https://www.fruugo.com/orders/schema}OrderStatusEnumType"/>
 *         <element name="customerLanguageCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="shippingAddress" type="{https://www.fruugo.com/orders/schema}ShippingAddressType"/>
 *         <element name="shippingMethod" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="shippingCostInclVAT" type="{http://www.w3.org/2001/XMLSchema}float"/>
 *         <element name="shippingCostVAT" type="{http://www.w3.org/2001/XMLSchema}float"/>
 *         <element name="orderLines" type="{https://www.fruugo.com/orders/schema}OrderLinesType"/>
 *         <element name="shipments" type="{https://www.fruugo.com/orders/schema}ShipmentsType" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "OrderType", propOrder = {
    "orderId",
    "orderDate",
    "orderReleaseDate",
    "orderStatus",
    "customerLanguageCode",
    "shippingAddress",
    "shippingMethod",
    "shippingCostInclVAT",
    "shippingCostVAT",
    "orderLines",
    "shipments"
})
public class OrderType {

    @XmlElement(required = true)
    protected String orderId;
    @XmlElement(required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar orderDate;
    @XmlElement(required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar orderReleaseDate;
    @XmlElement(required = true)
    protected OrderStatusEnumType orderStatus;
    @XmlElement(required = true)
    protected String customerLanguageCode;
    @XmlElement(required = true)
    protected ShippingAddressType shippingAddress;
    @XmlElement(required = true)
    protected String shippingMethod;
    protected float shippingCostInclVAT;
    protected float shippingCostVAT;
    @XmlElement(required = true)
    protected OrderLinesType orderLines;
    protected ShipmentsType shipments;

    /**
     * Gets the value of the orderId property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getOrderId() {
        return orderId;
    }

    /**
     * Sets the value of the orderId property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setOrderId(String value) {
        this.orderId = value;
    }

    /**
     * Gets the value of the orderDate property.
     *
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *
     */
    public XMLGregorianCalendar getOrderDate() {
        return orderDate;
    }

    /**
     * Sets the value of the orderDate property.
     *
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *
     */
    public void setOrderDate(XMLGregorianCalendar value) {
        this.orderDate = value;
    }

    /**
     * Gets the value of the orderReleaseDate property.
     *
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *
     */
    public XMLGregorianCalendar getOrderReleaseDate() {
        return orderReleaseDate;
    }

    /**
     * Sets the value of the orderReleaseDate property.
     *
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *
     */
    public void setOrderReleaseDate(XMLGregorianCalendar value) {
        this.orderReleaseDate = value;
    }

    /**
     * Gets the value of the orderStatus property.
     *
     * @return
     *     possible object is
     *     {@link OrderStatusEnumType }
     *
     */
    public OrderStatusEnumType getOrderStatus() {
        return orderStatus;
    }

    /**
     * Sets the value of the orderStatus property.
     *
     * @param value
     *     allowed object is
     *     {@link OrderStatusEnumType }
     *
     */
    public void setOrderStatus(OrderStatusEnumType value) {
        this.orderStatus = value;
    }

    /**
     * Gets the value of the customerLanguageCode property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getCustomerLanguageCode() {
        return customerLanguageCode;
    }

    /**
     * Sets the value of the customerLanguageCode property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setCustomerLanguageCode(String value) {
        this.customerLanguageCode = value;
    }

    /**
     * Gets the value of the shippingAddress property.
     *
     * @return
     *     possible object is
     *     {@link ShippingAddressType }
     *
     */
    public ShippingAddressType getShippingAddress() {
        return shippingAddress;
    }

    /**
     * Sets the value of the shippingAddress property.
     *
     * @param value
     *     allowed object is
     *     {@link ShippingAddressType }
     *
     */
    public void setShippingAddress(ShippingAddressType value) {
        this.shippingAddress = value;
    }

    /**
     * Gets the value of the shippingMethod property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getShippingMethod() {
        return shippingMethod;
    }

    /**
     * Sets the value of the shippingMethod property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setShippingMethod(String value) {
        this.shippingMethod = value;
    }

    /**
     * Gets the value of the shippingCostInclVAT property.
     *
     */
    public float getShippingCostInclVAT() {
        return shippingCostInclVAT;
    }

    /**
     * Sets the value of the shippingCostInclVAT property.
     *
     */
    public void setShippingCostInclVAT(float value) {
        this.shippingCostInclVAT = value;
    }

    /**
     * Gets the value of the shippingCostVAT property.
     *
     */
    public float getShippingCostVAT() {
        return shippingCostVAT;
    }

    /**
     * Sets the value of the shippingCostVAT property.
     *
     */
    public void setShippingCostVAT(float value) {
        this.shippingCostVAT = value;
    }

    /**
     * Gets the value of the orderLines property.
     *
     * @return
     *     possible object is
     *     {@link OrderLinesType }
     *
     */
    public OrderLinesType getOrderLines() {
        return orderLines;
    }

    /**
     * Sets the value of the orderLines property.
     *
     * @param value
     *     allowed object is
     *     {@link OrderLinesType }
     *
     */
    public void setOrderLines(OrderLinesType value) {
        this.orderLines = value;
    }

    /**
     * Gets the value of the shipments property.
     *
     * @return
     *     possible object is
     *     {@link ShipmentsType }
     *
     */
    public ShipmentsType getShipments() {
        return shipments;
    }

    /**
     * Sets the value of the shipments property.
     *
     * @param value
     *     allowed object is
     *     {@link ShipmentsType }
     *
     */
    public void setShipments(ShipmentsType value) {
        this.shipments = value;
    }

}

A: I am pretty sure that the problem is that the structure of the xml (response) does not match the generated classes.
The xsd you provided does not correspond with the classes you provided in the question nor with the xml you try to unmarshal. I think you have some bindings that override the names, etc. of the schema shown in the link, and not all classes are provided to try it on my own.
A way to help you figure it out is to feed the xml and try to unmarshal it with the following code and you will get feedback field by field for the mismatches.
        try {
            File file = new File("/path/to/your/file.xml");
            JAXBContext jaxbContext = JAXBContext.newInstance(YouRootClassForOrder.class);

            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            jaxbUnmarshaller.setEventHandler(
                    new ValidationEventHandler() {
                        public boolean handleEvent(ValidationEvent event ) {
                            throw new RuntimeException(event.getMessage(),
                                    event.getLinkedException());
                        }
                    });
            YouRootClassForOrder pojo = (YouRootClassForOrder) jaxbUnmarshaller.unmarshal(file);
        } catch (JAXBException e) {
            e.printStackTrace();
        }

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there a way to override maxVersion check on a firefox extension? Is there a way to override the use of maxVersion in firefox extensions so if a new firefox update comes out the extension will still work? I think this can be done by setting a new bool in about:config but I am trying to do it from the extension itself.

A: I don't know a way to do it only for a single extension, and it really doesn't make sense.  Inevitably, it will eventually stop working.  You can set it to an arbitrarily high value, though:
<em:maxVersion>100.0</em:maxVersion>

This means you can't distribute it through AMO (for good reason), but you're free to do so independently.

A: How do you mean by overriding maxVersion? maxVersion is there for protecting you and your users from possible BC breaks in Firefox and Gecko. You can set it as high as you want though.
But if you want to prevent Firefox from checking compatibility, creating boolean key  extensions.checkCompatibility and setting it to false is the way to go, though it's advised only when developing extensions.


text:
Q: Get music's date when it was added to windows phone Is it possible to get date when some .mp3 file was added on device? I want it to use for example to show songs that was recently added or sort music by date.

A: As far as I know you won't be able to do that.
You can do limited operations with Music Hub, even if you manage to get a song from MediaLibrary there is no such public property like creation date (or similar).
As for the SD card - you don't have direct access to music files on SD - these are reserved file associations - you won't see that files when you list SD card in your app. Also files on sd have date modified but not 'created'.
Maybe it will change in the future, but for now it's like this.


text:
Q: Problem with importing self written function into Python file while running it in the browser I set up a xampp-server using the highest rated answer of this thread: Running Python scripts with Xampp
It is supposed to run Python-scripts. Starting a simple python file in the browser:
#!C:/Users/gfranosc/Downloads/Python/python.exe

from LambWaveModes import *

print("Content-Type: text/html\n")
print("Hi")
print('Beliebig viele Sachen')
LWM(Steifmat=[[[3.5,1.5,0],[1.5,3.5,0],[0,0,1]],[[103.08e9,2.8189e9,0],[2.8189e9,5.6469e9,0],[0,0,3.2727e9]]],rho=[1,1490],layer_thickness=[1,1],name="dataset_med",folder='dataset_1',color=0)

print('Hier bin ich nun')

The code runs fine, if i comment out the "from LambWaveModes import *" line.
If i dont comment it out i get:

Internal Server Error
  The server encountered an internal error or misconfiguration and was unable to complete your request.
  Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
  More information about this error may be available in the server error log.
  Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
  Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1 Server at localhost Port 80

How can i solve this problem?


text:
Q: Truncating all postgres tables in Jest globalSetup with Prisma I have the following code in my Jest globalSetup.ts: I wish to truncate all tables in the test database at the start of tests. Instead, execution reaches the last statement after a seemingly stochastic number of table truncations. Tables are always processed in the order initially given in tablenames, and tablenames does not change in length, but at some point it stops without entering the catch block. Any ideas?
I do have a table called user which is a reserved word and might be dangerous. I'm following the recipe here but it doesn't say why it's dangerous (and I can't see it anywhere else!)
const setup = async (): void => {
  // whatever you need to setup globally
  console.log('HI');
  const prisma = new PrismaClient();
  const tablenames = await prisma.$queryRaw<Array<{ tablename: string }>>`SELECT tablename FROM pg_tables WHERE schemaname='public'`;
  console.log('table clear');
  console.log('table names:');
  for (const { tablename } of tablenames) {
    console.log(tablename);
  }
  console.log('tablename length: ' + tablenames.length);
  console.log('\n\n')
  for (const { tablename } of tablenames) {
    console.log('tablename length: ' + tablenames.length);
    console.log('running ' + tablename);
    if (tablename !== '_prisma_migrations') {
      //try {
        console.log('clearing ' + tablename);
        console.log(`TRUNCATE TABLE "public"."${tablename}" CASCADE;`)
        await prisma.$executeRawUnsafe(
          `TRUNCATE TABLE "public"."${tablename}" CASCADE;`
        );
      } catch (error) {
        console.log('>>> erroring ' + tablename);
        console.log({ error });

      }
    }
    console.log('this line \n')
  }


text:
Q: SAP business one integration with Magento Is there any opensource solutions available for this ? I am aware about http://www.sboeconnect.com/ but was hoping if there is some other open source library that does this .

A: Since SAP in itself is a commercial (non-free) product, so any integrations of other applications (like Magento or any CRM) with SAP will unlikely be available at free of cost.
As far as SBOeConnect is concerned, it provides one of the best supports as compared to other products related with SAP & Magento.
Hope it helps.


text:
Q: Assembly - Print Character I'm trying to learn assembly language and made some simple steps so far. I can display characters on the screen using their ascii-id, but now I want to store the ids of specific characters into a variable and print them. Unfortunately this does not work :) My code only displays a space on the screen. Thank you for each kind of help!
[BITS 16]
[ORG 0x7C00]

; MOV AL, 48 (works)

MOV AL, [false]
CALL PrintCharacter

JMP $

PrintCharacter:
MOV AH, 0x0E
MOV BH, 0x00
MOV BL, 0x07

INT 0x10
RET

false db 48
true db 49

TIMES 510 - ($ - $$) db 0
DW 0xAA55

A: You need the pair ds:false to point to the address of false, so you need to setup a data segment (via the ds register). Because of your [ORG 0x7c00] directive, the value of the label false is already where it needs to be, so you can just set ds to 0.
xor ax,ax
mov ds,ax

Just put that at the beginning of your code.


text:
Q: PayPal proof of payment - is there a need to store it at our server? I am developing an iPhone app, which I am integrating with PayPal.
I did it successfully using PayPal library. I am testing it on sandbox mode. When I transfer money from one account to the other account, it displays a message "send to server for verification".
Is there a real need to store this PayPal transaction id and other details on our server?

A: While Apple will provide the user with their transaction (payment) history, your program will need to know when a user has paid, in order to make decisions such as allowing them access, or renewing their subscription (if it isn't one-time).
However, I don't know enough about iPhone API to know whether you should store the PayPal information yourself, or make calls to the API in order to make the above decisions.


text:
Q: Append element into a numpy empty array, but he maximum index will be fixed as 2 I want to append some element to a fixed size empty array. But when I append more than 2 elements, the error came out, as:
[1 2]
Traceback (most recent call last):
  File "/home/ctchan127au/Desktop/DSA/WS3/tryNP.py", line 8, in <module>
    stack = np.append(stack[2], 3)
IndexError: index 2 is out of bounds for axis 0 with size 2

Here's my code:
import numpy as np

stack = np.empty(5, dtype=object)

stack = np.append(stack[0], 1)
stack = np.append(stack[1], 2)
print(stack)
stack = np.append(stack[2], 3)
print(stack)

thanks

A: np.empty with object makes an array full of None:
In [12]: stack = np.empty(5, dtype=object)
In [13]: stack
Out[13]: array([None, None, None, None, None], dtype=object)

np.append makes a new array, here joining a None and 1:
In [14]: np.append(stack[0],1)
Out[14]: array([None, 1], dtype=object)

Do you really want to assign that to stack, loosing the original 5 element array?
Using Out[14] instead of that stack assignment, see what the next append does:
In [15]: np.append(Out[14][1],2)
Out[15]: array([1, 2])

And the error line should now be clear.  You are trying to append to a non-existent 3rd element of a 2 element array:
In [16]: np.append(Out[15][2],3)
Traceback (most recent call last):
  Input In [16] in <cell line: 1>
    np.append(Out[15][2],3)
IndexError: index 2 is out of bounds for axis 0 with size 2

np.empty and np.append are NOT list clones.  Pay close attention to what each step does.  Reading the docs is also a good idea, especially if behavior doesn't match your guesses.
I suspect you were trying to replicate this:
In [17]: alist=[]
In [18]: alist.append(1)
In [19]: alist.append(2)
In [20]: alist.append(3)
In [21]: alist
Out[21]: [1, 2, 3]

Or are you trying to assign values, one at a time, to an array:
In [39]: stack = np.zeros(5, dtype=int)
In [40]: stack[0] = 1
In [41]: stack[1] = 2
In [42]: stack[2] = 3
In [43]: stack
Out[43]: array([1, 2, 3, 0, 0])

while lists are designed for growth, especially with end append, "growing/shrinking" numpy arrays is generally not a good idea.  You have to make a new array with each change (I'm glossing over the rarely use resize method).


text:
Q: Deserialize JSON from a JSON array I am using Jackson and I am trying to deserialize a JSON response that looks like the following:
{
    "Warnings": [{
            "Message": "Account code '48s9' has been removed as it does not match a recognised account"
        },
        {
            "Message": "Account code '48s9' has been removed as it does not match a recognised account"
        }
    ]
}

am I correct in saying that the class would look as follows? Is there some way this can be done?
@JsonIgnoreProperties(ignoreUnknown = true)
public class WarningsClass {

  private String Message;

  public String getMessage() {
    return Message;
  }

  public void setMessage(String message) {
    Message = message;
  }

}

A: was able to figure it out:
// import com.fasterxml.jackson.databind.ObjectMapper; // version 2.11.1
// import com.fasterxml.jackson.annotation.JsonProperty; // version 2.11.1
/* ObjectMapper om = new ObjectMapper();
Root root = om.readValue(myJsonString), Root.class); */
public class Warning{
    @JsonProperty("Message")
    public String message;
}

public class WarningsClass{
    @JsonProperty("Warnings")
    public List<Warning> warnings;
}

WarningsClass messageResponse = mapper.readValue(data, WarningsClass.class);

something like this would work


text:
Q: Use react ref as selector for jquery How to use React Ref together with jQuery lib without specified id to the input?
import $ from 'jquery';
import 'jquery.mask.js';

class PhoneComponent extends React.Component {
  ref = React.createRef();

  state = {value: ''};

  componentDidMount() {
    this.renderMask();
  }

  render() {
    return (
      <input ref={this.ref} type="text"/>
    )
  }

  renderMask() {
    const { value } = this.state;
    const options = {
      onKeyPress: (cep, e) => this.ref.current.value = cep
    };
    $(***???***).val(value);
    $(***???***).mask('+38(###)###-##-##', options);
  }

I would like to share experience as far as i found out it

A: As mentioned in react docs, titled "Refs and the DOM"
const node = this.myRef.current;

When the ref attribute is used on an HTML element, the ref created in the constructor with React.createRef() receives the underlying DOM element as its current property.

Also, as mentioned in jQuery docs, titled "How do I select elements when I already have a DOM element?"

If you have a variable containing a DOM element, and want to select elements related to that DOM element, simply wrap it in a jQuery object.
var myDomElement = document.getElementById( "foo" ); // A plain DOM element.
$( myDomElement ).find( "a" ); // Finds all anchors inside the DOM element.

Combining these two descriptions we can say that, to use react ref as a selector for jquery we can simply do:
$( this.ref.current ).val(value);
$( this.ref.current ).mask('+38(###)###-##-##', options);

where, this.ref.current is a plain DOM element.

A: that is so simple but not clear in docs.
The ref.current refers to used DOM element and allows to access it for jQuery
class YourComponent extends React.Component{
  this.ref = React.createRef();
  ...
  doSomething = () => {
    $(this.ref.current).val(value);
    $(this.ref.current).mask(mask, options);
  }
}


text:
Q: Formatting of Redirect URI in Instagram API Calls I'm writing a python script using webpy to grab an authentication token for an Instagram user, and I keep bumping up against "Redirect URI doesn't match original redirect URI". It goes a little something like this:
Step 1
The user first visits http://localhost:8081/join to click a button which sends them off to the Instagram login page, where they're asked to allow the app to access their feed:
class GetCode:

    def POST(self):

        data = web.input()
        username = data.username

        #Get Code...
        sendData = {"client_id": CONFIG['client_id'],"redirect_uri": "http://localhost:8081/request-token","response_type": "code"}
        codeRequest = requests.get('https://api.instagram.com/oauth/authorize/', params=sendData)

        web.seeother(codeRequest.url)

Step 2
The script redirects to http://localhost:8081/request-token with the returned code appended to the URL. This part works just fine at the moment. I then grab the code and try to get an access token. I've tried this part with the python-instagram library and pycurl, as seen below:
class RequestToken:

    def GET(self):
        received = web.input()
        code = received.code

        buffer = StringIO()

        data ={
            "client_id": CONFIG['client_id'],
            "client_secret": CONFIG['client_secret'],
            "grant_type":"authorization_code",
            "redirect_uri":"http://localhost:8081/success/",
            "code":code
        }

        postData = urlencode(data)

        c = pycurl.Curl()
        c.setopt(c.HTTPHEADER, ["Content-type: application/x-www-form-urlencoded"])
        c.setopt(c.URL, 'https://api.instagram.com/oauth/access_token')
        c.setopt(c.POSTFIELDS, postData)
        c.setopt(c.WRITEDATA, buffer)
        c.setopt(c.VERBOSE, True)
        c.perform()

At which point I receive {"code": 400, "error_type": "OAuthException", "error_message": "Redirect URI doesn't match original redirect URI"}
My current client settings look like this:

But no matter what redirect URI I seem to use at this point, I get the same message. Any help is appreciated!

A: The redirect URI that you use in the second call to exchange the code for the access token must match the redirect URI used in the first call to obtain the code. From the documentation:
redirect_uri: the redirect_uri you used in the authorization request. Note: this has to be the same value as in the authorization request.
https://instagram.com/developer/authentication/


text:
Q: Listbox image control binding with SQLite , Image bytes are stored in Database C# I have stored image bytes in SQLite database . when I want to get single image then I got that by id and convert image bytes to bitmap image. But when i want to bind list of data to listBox then I'm not able to bind directly  image control to bytes.
My Xaml code is here.
  <ListBox Background="Transparent" Margin="-5,2,-5,10" BorderThickness="0" MaxHeight="680" Grid.Row="1" x:Name="listBoxobj" SelectionChanged="listBoxobj_SelectionChanged">
    <ListBox.ItemTemplate>
       <DataTemplate>
         <Grid Width="400" Margin="0,-10,0,0" >
           <Grid x:Name="pro_work_grid" Width="400" Height="120" Margin="0,0,0,0"
              VerticalAlignment="Bottom" Background="#31b1b0">
                <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition />
                </Grid.ColumnDefinitions>

     //Image will give here image bytes. not the source.
     // Not know how to bind this with list,,which contain image bytes

     <Image x:Name="work_pic" Source="{Binding image}" Width="120" Height="120"
       Stretch="Fill" VerticalAlignment="Center" Margin="0,0,0,0"
       Grid.ColumnSpan="1" HorizontalAlignment="Left"/>

      <TextBlock x:Name="pro_name1" Foreground="White" VerticalAlignment="Top" Grid.ColumnSpan="2" Margin="130,10,0,0"
       Text="{Binding  category}" FontSize="26" FontWeight="Bold">
       </TextBlock>

       <TextBlock x:Name="pro_title1" VerticalAlignment="Center" Grid.ColumnSpan="2" Margin="130,10,0,0"
        Text="{Binding title}" FontSize="20" Foreground="White">

        </TextBlock>

                        </Grid>

                    </Grid>

                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

I have bind text block to directly by category,and title.. which are coming in List.
when my ListBox page loads then code work,,
  private void ReadContactList_Loaded(object sender, RoutedEventArgs e)
    {
        ReadAllContactsList dbcontacts = new ReadAllContactsList();
        DB_ContactList = dbcontacts.GetAllContacts();//Get all DB contacts
        if (DB_ContactList.Count > 0)
        {
        }
  listBoxobj.ItemsSource = DB_ContactList.OrderByDescending(i => i.Id).ToList();
    }

I'm able to get image from single image bytes. but here is the list of images display,,, so how can I get bytes and convert them into image control and show them separately in image control.
Here is my Listbox items

Would you please help me?? I don't know the proper Syntax,,,Thanks in Advance
I convert image to bytes in this way.
   if (args != null)
        {
            if (args.Files.Count == 0) return;

            view.Activated -= viewActivated;
            StorageFile storageFile = args.Files[0];
            string pro_img_path = storageFile.Path;
            var stream = await storageFile.OpenAsync(Windows.Storage.FileAccessMode.Read);
            filebite = new byte[stream.Size];
            using (DataReader reader = new DataReader(stream))
            {
                await reader.LoadAsync((uint)stream.Size);
                reader.ReadBytes(filebite);
            }

Again to reconvert these bytes to bitmap image.
   using (InMemoryRandomAccessStream ms = new InMemoryRandomAccessStream())
        {

            using (DataWriter writer = new DataWriter(ms.GetOutputStreamAt(0)))
            {
                writer.WriteBytes((byte[])pro_pic_byts);
                writer.StoreAsync().GetResults();
            }

            var img1 = new BitmapImage();
            img1.SetSource(ms);// = ms;
            pro_pic.Source = img1;
        }

A: Depending on how you stored the image bytes, this may work :
public class BinaryToImageConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (value == null) return null;

        if (value is IEnumerable<byte>)
        {
            List<byte> imgData = new List<byte>((IEnumerable<byte>)value);
            BitmapImage rval = new BitmapImage();

            rval.SetSource(new System.IO.MemoryStream(imgData.ToArray()));
            return rval;
        }
        throw new NotImplementedException();
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

Use this converter when binding your ImageSource to your byte[]

A: just added bit code to database class and then bind to bitmapImage
 <Image  Grid.RowSpan="4" HorizontalAlignment="Right" VerticalAlignment="Top" Source="{Binding _contact.bitmapImage}" Stretch="UniformToFill" Margin="5" Width="100" Height="100" Opacity="1" />

  public byte[] Image
    {
        get
        {
            return (_imgBytes);
        }
        set
        {
            _imgBytes = value;
            CreateBitmap();
        }
    }

    private async void CreateBitmap()
    {
        var result = await dbUtils.CreateBitmap(_imgBytes);
        _bitmap = result;
    }

    [Ignore]
    public BitmapImage bitmapImage
    {
        get
        {
            return (_bitmap);
        }
    }


text:
Q: How to calculate translate while zooming in WPF/Surface I'm doing a surface app where I need to scale my scene (zoom) while the user scales with their fingers (i.e pinching)
Currently I have it working ok, but the issue is that I need to zoom in on the center point between the users fingers.
I have the point, but the maths behind the translation is hard to grasp.
When I apply a ScaleTransform to my Canvas scene, it zooms in on the top left of the canvas, i need it to zoom in on the center point of my pinch gesture (which, again, I do have).
How would the maths for the translation work to keep the zoom to appear to zoom in on the center point of the gesture?
Edit:
This is basically what I have:
void Affine2DManipulationDelta(object sender, Affine2DOperationDeltaEventArgs e)
{
    //apply zoom and translate
    if (e.ScaleDelta != 1)
        ApplyZoom(e);
    else if (e.Delta.Length != 0)
        ApplyTranslation(e);
}

private void ApplyZoom(Affine2DOperationDeltaEventArgs e)
{
    //scale
    var newScale = _zoomTransform.ScaleX * e.ScaleDelta;
    newScale = GetCappedZoomLevel(newScale);

    _zoomTransform.ScaleX = newScale;
    _zoomTransform.ScaleY = newScale;
}

private void ApplyTranslation(Affine2DOperationDeltaEventArgs e)
{
    var xDiff = e.ManipulationOrigin.X - _screenStartPoint.X;
    var yDiff = e.ManipulationOrigin.Y - _screenStartPoint.Y;

    var translateX = xDiff + _startOffset.X;
    var translateY = yDiff + _startOffset.Y;

    //bounds testing to limit translation
    var rect = new Rect(0.0, 0.0, ZoomCanvas.RenderSize.Width, ZoomCanvas.RenderSize.Height);
    Rect bounds = ZoomCanvas.TransformToAncestor(MainViewportCanvas).TransformBounds(rect);

    if (CanTranslateX(translateX, bounds))
        _translateTransform.X = translateX;

    if (CanTranslateY(translateY, bounds))
        _translateTransform.Y = translateY;
}

Pretty basic really, but it works to a point...
_zoomTransform is a ScaleTransform, and _translateTransform is a TranslateTransform
MainViewport is a canvas that contains ZoomCanvas which is the canvas that I apply the transforms to.

A: I had to do exactly this myself. Basically, a Surface control that can host arbitrary content and allow the user to pan and zoom (using gestures). The handler for my maniplation processor's Affine2DManipulationDelta is shown below. Hopefully it's fairly self-explanatory and gets you where you need to be.
private void OnManipulationDelta(object sender, Affine2DOperationDeltaEventArgs e)
{
    Debug.Assert(_scrollViewer != null);

    if (CanScale && _scrollViewer != null && e.ScaleDelta != 1)
    {
        var scrollViewerContent = _scrollViewer.Content as UIElement;

        //can't do anything if the content isn't present and isn't a UIElement
        if (scrollViewerContent != null)
        {
            var newScale = Scale * e.ScaleDelta;

            newScale = Math.Max(MinScale, newScale);
            newScale = Math.Min(MaxScale, newScale);

            var origin = e.ManipulationOrigin;
            var pointInContent = _scrollViewer.TranslatePoint(origin, scrollViewerContent);

            var deltaScale = newScale - Scale;
            //width and height changes across the whole image
            var deltaWidth = deltaScale * _scrollViewer.ExtentWidth;
            var deltaHeight = deltaScale * _scrollViewer.ExtentHeight;
            //width and height changes relative to the point in the scroll viewer's content
            deltaWidth = (pointInContent.X / _scrollViewer.ExtentWidth) * deltaWidth;
            deltaHeight = (pointInContent.Y / _scrollViewer.ExtentHeight) * deltaHeight;

            _offset = Vector.Add(_offset, new Vector(deltaWidth, deltaHeight));
            var centerPoint = new Point(origin.X + deltaWidth, origin.Y + deltaHeight);
            centerPoint.Offset(_offset.X, _offset.Y);

            Scale = newScale;

            HorizontalOffset = _scrollViewer.HorizontalOffset + deltaWidth;
            VerticalOffset = _scrollViewer.VerticalOffset + deltaHeight;
        }
    }
    else if (CanPan && e.Delta.Length != 0)
    {
        var newHorizontalOffset = _scrollViewer.HorizontalOffset + (e.Delta.X * -1);
        var newVerticalOffset = _scrollViewer.VerticalOffset + (e.Delta.Y * -1);
        newHorizontalOffset = Math.Max(0, newHorizontalOffset);
        newVerticalOffset = Math.Max(0, newVerticalOffset);
        HorizontalOffset = newHorizontalOffset;
        VerticalOffset = newVerticalOffset;
    }
}

A: Here is my implementation that ended up working just fine
private void ApplyZoom(Affine2DOperationDeltaEventArgs e)
    {
        //scale
        var newScale = _zoomTransform.ScaleX * e.ScaleDelta;
        newScale = GetCappedZoomLevel(newScale);
        var pinchPoint = e.ManipulationOrigin;
        DoZoom(newScale, _transformGroup.Inverse.Transform(pinchPoint), pinchPoint);
    }

    private void DoZoom(double newScale, Point pinchPosition, Point physicalPosition)
    {
        _translateTransform.X = -1 * (pinchPosition.X * newScale - physicalPosition.X);
        _translateTransform.Y = -1 * (pinchPosition.Y * newScale - physicalPosition.Y);
        _zoomTransform.ScaleX = newScale;
        _zoomTransform.ScaleY = newScale;
    }


text:
Q: How to sort a dictionary list with multiple values related to one single key name and convert it to float numbers I'm a beginner at Python and I'm trying to figure out a paper I have to do for school. So the situation is that I have a csvfile under DictReader and want to be able to not only sort all the values related to one key in the dictionary, which is 'CRIM', in ascending order, but also to convert all the data values in float so I can more easily manipulate the information after that
The CSV file data looks like this: {"CRIM": "0,00522"} {"CRIM": "0,06552"} {"CRIM": "0,01903"} {"CRIM": "0,01263"}
I started doing this:
import csv

with open('data. Question 1.csv', newline='') as csvfile:

  data = csv.DictReader(csvfile)

  for line in data:

    list_values = (line['CRIM'])

This makes all the values related to the Key 'CRIM' appear but don't know how to proceed from there.
Can somebody help me?

A: If you just need the a list of all of the float "CRIM" values, you can try this. This assumes that "CRIM" appears in every line, and each float value follows the same format as your sample data.
import csv

list_values = []
with open('data. Question 1.csv', newline='') as csvfile:
    data = csv.DictReader(csvfile)
    for line in data:
        list_values.append(float(line['CRIM'].replace(',','.')))
list_values.sort()


text:
Q: How to build django ajax modal popup forms (with server side forms)? What are good modern patterns or django apps for handling server side forms that appear in a popup? By this I mean:

*

*User action triggers a modal popup window.

*The form is server generated, demand loaded.

*In case of submit error, the server generates a new form.

*In case of success, there's a hook so DOM elements can be updated (the main page does not reload).

Assume common libraries like jquery or bootstrap 3 are available.
Bonus points for DRY solutions: most patterns I've seen are kinda hairball, and the django ajax helpers I've looked into don't address the modal popup well or at all.

A: Here a way that uses plain jquery with a bootstrap styling the popup:
See http://jsfiddle.net/brycenesbitt/afyY2/ .  The trigger in a real app would look like:
$('#edit_foo').on('click', function () {
    $.ajax({
        type: 'GET',
        url: '/ajax/fooForm/',
        },
        success: function (data, textStatus, jqXHR) {
            $('#foo_modal').find('.modal-body').html(data);
            $('#foo_modal').modal('show');
        },
    });
});

The ajax call is expected to return the necessary form as html (no json).
On submit you'll need a hack because the jquery ajax error function won't return data:
If the return code is 204 "no content" clean up and exit.
If the return code is 200 redisplay the form with server side error notes.
See also this nice, but code-heavy, live form validation: http://www.the-art-of-web.com/javascript/ajax-validate/ and this grid of django ajax tools https://www.djangopackages.com/grids/g/ajax/ , none of which I particujlarly recommend.

A: There's a grid of Django ajax tools at https://www.djangopackages.com/grids/g/ajax/ you could look into.

A: This is how I did it:
$(document).on('submit', 'div.modal-body form', function(e) {

    var form_el = $(this);

    e.preventDefault();
    $.ajax({
        type: $(this).attr('method'),
        url: $(this).attr('action'),
        data: $(this).serialize(),
        success: function (xhr, ajaxOptions, thrownError) {
            if ( $(xhr).find('.errorlist').length > 0 ) {

                form_el.parents('.modal-body').html(xhr);

            } else {

                form_el.parents('.modal-body').html('
Form was properly processed!
');

            }
        },
        error: function (xhr, ajaxOptions, thrownError) {

            form_el.parents('.modal-body').html(xhr);
        }
    });
});

So basically what this does is:

*

*Watches the entire document for a submit event coming from a form
element that is inside div.modal-body (bootstrap modal). If that event
fires, then it gets captured in here.

*I obtain the action and method using $(this), so no need to hard code

*On success, if the result contains the class errorlist that means an error occurred, so instead of redirecting I capture that and I update the form to show the form including its error messages.

*Otherwise, I update the modal saying that it was able to submit properly.


text:
Q: error C2436 member function or nested class in constructor initializer list I have a function pointer declared in my header, like this:
typedef void (intCB)(int );

and I have a class member declared like this:
private:
  intCB m_intCB;

In my constructor's initialization list I want to initialize it with 0:
MyClass::MyClass : m_intCB(0)
{
   #ifdef SOMETHING
   m_intCB = &someOtherFunc;
   #endif
}

Only if a specific define is in place, I want to set m_intCB to it, if not I want to keep it on 0. The problem with the above code is that I receive:
error C2436: 'm_intCB' : member function or nested class in constructor initializer list

How can I fix it?

A: That's not a function pointer, you are missing a *. Try:
typedef void (*intCB)(int);

A: Your typedef is wrong, it should be typedef void (*intCB)(int );

A: Function pointer is a pointer, so don't miss *
typedef void (*intCB)(int);

A: And:
MyClass::MyClass : m_intCB(0)

should be:
MyClass::MyClass() : m_intCB(0)

A: functioin pointer typedef Should be:
typedef void (*intCB)(int); //You missed the *


text:
Q: Using the compare method to compare multiple words to an external file I have a program that takes input from 1 file, saves each word from that file as an item in an arrayList, and then searches for each word in another file. From there I need it to see if a word from another string is in the same line as as the words searched for. The logic is a bit confusing so I will give you an example:
This is the input from the first file:
Tuna, Salmon, Hake.

It then saves each item into an arrayList:
{Tuna,Salmon,Hake}

From there it will search a file with the following data:
It costs $5 for tuna that is seared and chunky.
We are out of stock on hake.
It costs $6 for sardines that are tinned.
It costs $4 for tuna that is seared.

So then program would then search the above file and see that tuna is in the 1st and 4th lines and that hake is in the 2nd line, and that salmon does not appear.
From here I want to have a list of words for example:
Seared, chunky, out of stock.

And compare this list to see if they are in the same line as the other words so that it prints out:
Tuna is seared and chunky
Hake is out of stock
Tuna is seared

So far I have code that works perfectly, but it only works for 1 word. An example of my code is below:
while((strLine1 = br1.readLine()) != null){
            for(String list: listOfWords){
            Pattern p = Pattern.compile(list);
            Matcher m = p.matcher(strLine1);

    String strLine2 = "seared" ;

        int start = 0;
        while (m.find(start)) {
            System.out.printf("Word found: %s at index %d to %d.%n", m.group(), m.start(), m.end());
            if(strLine1.contains(strLine2)){
               System.out.println(list + " is " + strLine2);
                        }
            start = m.end();
                }
            }
          }

So what this code will print out is:
Tuna is seared (referring to line 1)
Tuna is seared (referring to line 4)

I think in order to achieve this, I could use and or in my if statement or try an arrayList for strLine2, but for the latter, the contains method cannot compare a string to an arrayList.
Let me know if my explanation is confusing or if you have any ideas as to how I can achieve my goals. Thanks

A: I'm not sure but I thought yo want to find all words that are in your list..
and in this line
if(strLine1.contains(strLine2)){

you always check if "seared" is in the actual line could it be, that you have to change this line and search for the word of your list?
if(strLine1.contains(list)){

So now you get all your words.

A: Got it working with an arrayList and an advanced for loop.
String[] strLine2 = {"seared","chunky","out of stock"} ;

        int start = 0;
        while (m.find(start)) {
            System.out.printf("Word found: %s at index %d to %d.%n", m.group(), m.start(), m.end());
            for(String lineWords: strLine2){
            if(strLine1.contains(lineWords)){
               System.out.println(list + " is " + lineWords);
                        }
            }
            start = m.end();

        }


text:
Q: Change Git "branch point" to an earlier commit From my main feature branch, I started a new feature branch. When I completed this feature, I started another new feature branch. Is it possible to change the branch point of the second sub-feature branch so that it branches from the main feature branch?
i.e., I have this:
A --> B --> C --> D --> E --> F
      ^           ^           ^
      |           |           |
   Head of     Head of     Head of
    feat0       feat1       feat2

I want to turn it into this:
        .--> E --> F
       /
A --> B
       \
        `--> C --> D

The changes in C and D are (almost) mutually exclusive to those in E and F.
I thought that maybe rebase --onto would do the trick. At F I did git rebase --onto B. That moved the head of feat2 to B, losing E and F; definitely not what I want!
My second thought is that I could do an interactive rebase at F from B, dropping C and D, tweaking any commits that cause conflicts. That seems to have worked, but it was unnecessarily messy and involved.
Is there a better way?

A: You can do this via:
git rebase D F --onto B

The full form of any rebase has 3 arguments:

*

*the upstream (old base) (D)

*the branch (F)

*the new base (B)

The "graft", identified by the base & branch will be "treated as diffs" and replayed atop the new base, i.e. a "re-base".
Any time you use rebase with fewer arguments, one or more of these arguments are being inferred based on the location of current HEAD, etc.
This operation can also be done via cherry-pick, as rebasing and cherry-picking are conceptually identical.
To explain what was happening with git rebase --onto B not doing what you wanted, let's first look at the most common rebase use-case, starting with:
  * feat-a (HEAD)
  |
  *
 /
* - main

Suppose other people contribute, so main gets advanced, e.g. after a fetch:
*   main
| * feat-a (HEAD)
| |
| *
|/
*   main-old

A git rebase main is inferred to mean git rebase main-old feat-a --onto main because:
       --onto <newbase>
           Starting point at which to create the new commits. If the --onto option is not specified, the starting point is <upstream>. May be any valid commit, and not just an existing branch name.

       <upstream>
           Upstream branch to compare against. May be any valid commit, not just an existing branch name. Defaults to the configured upstream for the current branch.

       <branch>
           Working branch; defaults to HEAD.

Resulting in:
*  feat-a (HEAD)
|
*
|
*   main
|
*   main-old

i.e. "Replay feat-a branch in relation to main-old on (newer) main"
When you ran git rebase --onto B, the shared ancestor between F (HEAD) and B is... B, so that's where your branch ended up pointing.

A: Since there is a very recent question on SO about lost commits because of a forced push, it's worth pointing out that you could achieve your goal without rebasing.

*

*feat0 is easy - no work

*feat1 is easy - no work

*feat2b (new branch):

*

*Create feat2b from feat0 (B)

*Cherry-pick E and F

This isn't sophisticated, but it's hard to get this wrong.


text:
Q: How to make Adam Shaw's FullCalendar Responsive I have searched and searched but cant find any way to make the plugin responsive, does the plugin even have any such option? if not have any one made it responsive?
I think i can make the most part responsive using css but what about drag & drop functionality any suggestion guys?

A: It has almost all feature required for a calendar including drag and drop.
You can check documentation.


text:
Q: Inheritance in Java with generic elements I apologize if these empty values/variables are not generic elements, I am really not sure about terminology in Java.
We are given this code:
public class AbstrClass <T, S> {
  private T value1;
  protected S value2;

  protected AbstrClass (T value1, S value2) {
    this.value1 = value1;
    this.value2 = value2;
 }

  public T getValue1() {
    return value1;
 }

  public S getValue2() {
    return value2;
}

}

public class Impl extends AbstrClass<String, Double> {

  protected Integer value2;

  public Impl (String value1, int value2) {
    super("Ferdinand", (double) value2);
    this.value2 = value2 + value2;
}

  public void incrementValue2 (Integer value) {
    super.value2 += value;
}

public static void main(String[] args) {

  Impl impl = new Impl("Horst", 21);
  System.out.println(impl.getValue1());
  System.out.println(impl.getValue2());
  impl.incrementValue2(42);
  System.out.println(impl.value2);
  System.out.println(impl.getValue2());
}
}

And then we are asked what the result was if we run the code / the main method and why.
I am not sure if my reasoning is correct:

*

*Ferdinand -> b/c it executes a method it inherits from the base AbstrClass, and since there is already a value, it prints out that one.

*21.0 -> b/c it exectues a method  it inherits from AbstrClass, but there is no value in it, so it gives out the given value of 21, but as a double, since it is defined in Impl as a double value.

*42 -> this one I really don't get.

*63.0 -> again this exectues from AbstrClass, (see question 2), and we add the 42 from the increment method, which results in 63.

Is my reasoning correct, and why does the third System.out.println result in 42?

A: That confusion is caused by something called field hidding. When you have the same field name in multiple classes in the same inheritance hierarchy you have multiple distinct fields.
So there is a Impl.value2 and a AbstrClass.value, there is a difference if you call this.value2 or super.value2 in Impl.
System.out.println(((AbstrClass<String,Double>) impl).value2);

will print 63.0

A: In the constructor of Impl is written:
this.value2 = value2 + value2;

Meaning for given input of 21, value2 will have the value of 42.
impl.incrementValue2(42); only affects the variable of the same name in the super class.
System.out.println(impl.value2); will print the value of the variable value2 of Impl - which was set to 42 in the constructor.
Your overall reasoning is good while not 100% on point

*

*it calls getValue1 on the base class which prints value1. value1 was set in the constructor of the parent class to whatever was passed in as first argument. The constructor of Impl ignores its first parameter and always passes "Ferdinand" so the super constructor

*it calls getValue2 on the base class which prints value2 of the base class. The fact that Impl has a variable of the same name does not matter. Your reasoning for the .0 is correct.

*see the base part of the answer

*Maybe specify a bit more precisely why the value of the value2 in the super class changed`

A: Your reasoning is correct. For the third output, calling impl.value2 will get the value2 declared in the implementation, not the one of the parent class. This is because unlike methods, member field access is not resolved polymorphically, instead it is resolved at compile time. In other words, the field access expression o.x will access the field x that belongs to the type used to declare o regardless of the actual type of o at runtime.
The value2 in the subclass is said to hide the one in the parent class since it has the same name.

A: It comes down to this:

*

*methods can be overridden

*fields can not be overridden

ie super.foo will always refer to the field foo  in the superclass, even if you have a field of the same name in the subclass.


text:
Q: Spring Social and Angular I'm looking for some samples or articles that explain how to integrate spring social to my micro-services architecture, more specifically to my authorization server. Can sommeone explain how can i add spring social (Facebook and google) to the flow?
As i mentioned before, i'm using angular as a front-end application, right now i'm handling password flow, the user enter his username and password and get a JWT token, this token is used in each resource server calls. This is my security config and authorization config :
@EnableAuthorizationServer
@Configuration
public class ServersConfig extends AuthorizationServerConfigurerAdapter {

    @Value("${security.oauth2.client-id}")
    private String clientId;
    @Value("${security.oauth2.signing-key}")
    private String signingKey;
    @Value("${security.oauth2.grant-type.password}")
    private String grantTypePassword;
    @Value("${security.oauth2.grant-type.authorization-code}")
    private String grantTypeAuthorizationCode;
    @Value("${security.oauth2.grant-type.refresh-token}")
    private String grantTypeRefreshToken;
    @Value("${security.oauth2.scope.web}")
    private String scopeWeb;
    @Value("${security.oauth2.scope.mobile}")
    private String scopeMobile;
    @Value("${security.oauth2.resources-ids.buy-sell}")
    private String resourcesIdBuySell;
    @Value("${security.oauth2.resources-ids.gateway}")
    private String resourcesIdGateway;
    @Value("${security.oauth2.resources-ids.upload}")
    private String resourcesIdUpload;
    @Value("${security.oauth2.access-token-validity-seconds}")
    private String accessTokenValiditySeconds;

    @Autowired
    @Qualifier("authenticationManagerBean")
    private AuthenticationManager authenticationManager;

    @Bean
    public JwtAccessTokenConverter accessTokenConverter() {
        JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
        converter.setSigningKey(signingKey);
        return converter;
    }

    @Bean
    public TokenStore tokenStore() {
        return new JwtTokenStore(accessTokenConverter());
    }

    @Bean
    public DefaultTokenServices tokenServices() {
        DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
        defaultTokenServices.setTokenStore(tokenStore());
        defaultTokenServices.setSupportRefreshToken(true);
        return defaultTokenServices;
    }

    @Override
    public void configure(ClientDetailsServiceConfigurer configurer) throws Exception {
        configurer.inMemory().withClient(clientId).secret(signingKey).autoApprove(true)
                .authorizedGrantTypes(grantTypeAuthorizationCode, grantTypePassword, grantTypeRefreshToken)
                .scopes(scopeWeb, scopeMobile).resourceIds(resourcesIdBuySell, resourcesIdGateway, resourcesIdUpload);
    }

    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        endpoints.tokenStore(tokenStore()).accessTokenConverter(accessTokenConverter())
                .authenticationManager(authenticationManager);
    }
}

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    @Override
    @Bean
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }

    @Bean
    public UserDetailsService userDetailsService() {
        return new UserServiceImpl();
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userDetailsServiceBean()).passwordEncoder(passwordEncoder());
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().antMatchers("/oauth/token", "/oauth/authorize", "/oauth/confirm_access").permitAll()
                .anyRequest().authenticated().and().csrf().disable().cors().and()
                .userDetailsService(userDetailsService());
    }

    @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring().antMatchers(HttpMethod.OPTIONS);
    }
}

A: Depends on what OAuthServer you're using. Personally i'm using a ASP.NET Core back end with IdentityServer and it has support for external logins https://identityserver4.readthedocs.io/en/release/quickstarts/4_external_authentication.html
I've also tried this on nodeJS using passportJS http://www.passportjs.org/docs/
Both of these OAuthServers have support for facebook and google, you just have to wire up your claims based on the data you received from either facebook or google.


text:
Q: Redis configuration for production I'm developing project with redis.My redis configuration is normal redis setup configuration.
I don't know how should I do redis configuration? Master-Slave? Cluster?
Do you have anything suggestion redis configuration for production?

A: Standard approach would be to have one master and at least one slave.  Depending on your I/O requirements and number of ops/sec, you can always have multiple read-only slaves.  Slaves can be read from but not written to.  So you'll want to design your application to take advantage of doing round-robin requests to the slaves and writes only to the single master.
Depending on your data storage/backup requirement, you can set fsync for append-only mode to be every second.  So while this means you can lose up to one second worth of data, it's really much less than that because your slaves serve as hot backups, and they will have the data within milliseconds.
You'll at least want to do a BGSAVE every hour to get a dump.rdp produced.  You can then save this file live while the server is still running, and store it to some off-site backup facility.
But if you're just using Redis as a standard memcache replacement and don't care about data, then you can ignore all of this.  Much of it will be changing in Redis Cluster in the 3.0 version.

A: It depends on what your Read/Writes requirements are. Could you give us more informations on that matter ?

I think 10,000 people use instant my application.I persist member login token on redis.It's important for me.If I don't write redis, member don't login on application.

Even a Redis single instance will be enough to process 10K users (start redis-bench to the throughput available), so just to be sure use a Master/Slave configuration with autopromotion of the slave if the master goes down.
Since you want persistence, use RDB (maybe along with AOF), see this topic on Redisio.


text:
Q: Can't get the conditions values from method I start an initial values in this method(SuccessRate) and change the values with the conditions. And I return the values. I'm expecting the values to be 0.9 but instead I get the value 0 when I use that method in my main method. What is wrong with my code? Thank you for reading my problems.
using System;
class Name
{
static void Main()
{
  Console.WriteLine (Assembly.Answer(5));

}
}
static class Assembly
{

public static double Answer(int speed)
{
    double success_rate = 0;
    if(speed == 0)
    {
       success_rate=0;

    }
    else if(speed >0 && speed <=4)
    {
      success_rate = 1;

    }
    else if(speed >=5 && speed <=8)
    {
        success_rate = 90/100;

    }

    else
    {
        success_rate = 1;
    }
    return success_rate;
}
}


text:
Q: No callback from iOS LinkedIn SDK I'm using the LinkedIn SDK and am trying to authenticate with LinkedIn, but I don't get a callback from LinkedIn to my app. I'm using the following code
 [LISDKSessionManager createSessionWithAuth:[NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION, LISDK_EMAILADDRESS_PERMISSION, nil]
                                      state:nil // @"some state"
                     showGoToAppStoreDialog:YES
                               successBlock:^(NSString *returnState) {}
                                 errorBlock:^(NSError *error) {}];

I am using the correct appId in the Info.plist and all my bundles are added to the LinkedIn dev center. I've also tried to use different versions of the SDK.

A: This might be trivial, but in your question you're not actually doing anything in your callback blocks, you're just passing in an empty block.
In the success block, check the [[LISDKSessionManager sharedInstance] session] for a valid user session.  In the error block, check the error object's description and alert the user if necessary:
[LISDKSessionManager
createSessionWithAuth:[NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION, nil]
    state:nil
    showGoToAppStoreDialog:YES
    successBlock:^(NSString *returnState) {
        NSLog(@"Success!");
        LISDKSession *session = [[LISDKSessionManager sharedInstance] session];
    }
    errorBlock:^(LISDKAuthError *error) {
        NSLog(@"Error: %@", [error localizedDescription]);
    }
];

More potential reasons this could happen:
You're app isn't set up for App Transport Security properly.  Set NSAllowsArbitraryLoads to true in the NSAppTransportSecurity settings in your Info.plist or whitelist the LinkedIn URLs:
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>linkedin.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>

Also make sure you whitelist LinkedIn's URL schemes:
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>linkedin</string>
    <string>linkedin-sdk2</string>
    <string>linkedin-sdk</string>
</array>


text:
Q: String manipulation in jQuery I have a div which collapses clicking on a text header. I want to change the header from "+ filters" to "- filters" accordingly (when the div is collapsed or expanded)
How can I perform this with jQuery?
if (headerDiv.text() starts with "+")
    replace "+" with "-"
else
    replace "-" with "+"

A: I would do:
var plus_string = "+";
var minus_string = "-";

if($("div.header").hasClass("plus")){
    $("div.header").removeClass("plus");
    $("div.header").addClass("minus");
    $("div.header").append(plus_string);
    $("span.plus").remove();
 } else (... the reverse of the above...)

This because i would use the class plus and minus to handle a bit of css to change the appearance of the header div. As you're probably already doing that, you can play a bit with it like this :)

A: Never mind, I figured it out
if ($(header).text().trim().charAt(0) == "+")
    $(header).text($(header).text().replace("+", "-"));
else
    $(header).text($(header).text().replace("-", "+"));

If this is not the correct way, I'd appreciate a heads up

A: keep it simple, why do you need to parse it out? your just replacing one string with another.
if(headerDiv.text() == '+ filters')
{
    headerDiv.text() == '- filters';
}
elseif(headerDiv.text() == '- filters')
{
    headerDiv.text() == '+ filters';
}


text:
Q: Delphi Dynamic method invocation Does anyone know of a free library for Delphi 2009 and below that allows you to invoke methods dynamically?
I have started writing my own code for this but I have the feeling that it is beyond me.
Thanks

A: Your question is rather vague. Besides late-binding and scripting, it can mean using  a method which name you do not know until runtime.
This falls in two categories, COM methods (using variant types) or Delphi methods being found and called using RTTI. Although RTTI has changed in the latest Delphi versions, I think that  http://www.blong.com/Conferences/BorConUK98/DelphiRTTI/CB140.htm would apply to D2009

A: "Invoke methods dynamically" can mean a number of different things.  Simple late-binding is built into the language in the form of methods declared as virtual or dynamic, and you probably use them all the time, particularly the virtual ones.
But talking about "invoking methods dynamically" generally gets into scripting territory, making it possible to take an object and let the end-user decide, at runtime, which method to call by using the method's name.  If you want that, you need a scripting library for Delphi.
DWS (Delphi Web Script) works quite well, and the author claims that it supports D2009, though active development work takes place on XE.  Also, as the name implies, DWS is designed primarily with web development in mind, and so the framework for binding scripts to objects in native code-land is a lot more complicated than it probably should be.
The other major alternative is RemObjects's PascalScript library.  It supports earlier versions than D2009, and its system for object binding is a lot simpler than DWS's.  Unfortunately, it's also much slower and not well supported by the author.  But, especially for simple scripts, either one should make you able to allow users to dynamically automate stuff in your program.


text:
Q: Select features by matching attributes of two shapefiles? I have one line shapefile with lot of road sections and a point shapefile, some of these points are outside my area of interest.
The files have one attribute in common and I would like to do selection, where I select only those points that have matching attribute value with the line shapefile.
Is this possible in some meaningful way?

I believe that in this particular case I could do line buffers and use those to select the point in buffer area - but I was wondering if its possible to match the values "straight away" with each other.

A: With both layers loaded in your table of contents, go to the properties of your point layer.  In the properties go to the Join tab and click the + button to add a new join, using the line layer as your target.  If your line layer has a field you know is populated in all records, you can do a select from your point layer for the NOT NULL records in that field, eliminating the non-matching records.
This is an awkward work around.  It would be better if QGIS had a "Keep only matching records" type join.  Another, simpler work around would be to import your data into either a PostGIS or Spatialite database.  Then you could do an INNER JOIN on the two tables, which would only return rows that have a match in both tables.


text:
Q: Can I avoid such cumbersome try...catch block Usually, when dealing with Java IO code, here is what I wrote
    FileOutputStream out = null;
    try
    {
        out = new FileOutputStream("myfile.txt");
        // More and more code goes here...
    }
    catch (Exception e)
    {
    }
    finally
    {
        // I put the close code in finally block, to enture the opened
        // file stream is always closed even there is exception happened.
        if (out != null) {
            // Another try catch block, troublesome.
            try {
                out.close();
            } catch (IOException ex) {
            }
        }
    }

As you can see, while I try to close the file stream, I need to deal with another try...catch block.
Look troublesome :(
Is there any way I can avoid? I don't feel comfortable in putting the close code in non-finally block, as exception caused by other codes will make no chance for "close" being called.

A: Automatic Resource Management is coming in Java 7 which will automatically provide handling of this.  Until then, objects such as OutputStream, InputStream and others implement the Closeable interface since Java 5.  I suggest you provide a utility method to safe close these.  These methods generally eat exceptions so make sure that you only use them when you want to ignore exceptions (e.g. in finally method).  For example:
public class IOUtils {
    public static void safeClose(Closeable c) {
        try {
            if (c != null)
                c.close();
        } catch (IOException e) {
        }
    }
}

Note that the close() method can be called multiple times, if it is already closed subsequent calls will have no effect, so also provide a call to close during the normal operation of the try block where an exception will not be ignored.  From the Closeable.close documentation:

If the stream is already closed then invoking this method has no effect

So close the output stream in the regular flow of the code and the safeClose method will only perform close if something failed in the try block:
FileOutputStream out = null;
try {
    out = new FileOutputStream("myfile.txt");
    //...
    out.close();
    out = null;
} finally {
    IOUtils.safeClose(out);
}

A: Discussion at
Try-catch-finally and then again a try catch
and
Is there a preference for nested try/catch blocks?
basically, the question is whether a close() exception is worth catching.

A: Project Lombok provides a @Cleanup annotation that removes the need for try catch blocks all together. Here's an example.

A: It is very important that you close streams in a finally. You can simplify this process with a utility method such as:
public static void closeStream(Closeable closeable) {
    if(null != closeable) {
      try {
        closeable.close();
      } catch(IOException ex) {
        LOG.warning("Failed to properly close closeable.", ex);
      }
    }
  }

I make it a point of at least logging a stream close failure. The usage then becomes:
FileOutputStream out = null;
try
{
    out = new FileOutputStream("myfile.txt");
    // More and more code goes here...
}
catch (Exception e)
{
}
finally
{
    closeStream(out);
}

In Java 7 I believe that streams will be closed automatically and the need for such blocks should be mostly redundant.

A: I tend to use utility functions for this:
public static void safeClose(OutputStream out) {
  try {
    out.close();
  } catch (Exception e) {
    // do nothing
  }
}

which changes the code to the slightly more palatable:
FileOutputStream out = null;
try {
  out = new FileOutputStream("myfile.txt");
  // do stuff
} catch (Exception e) {
  // do something
} finally {
  safeClose(out);
}

You can't really do much better in Java at least until Java 7 when (hopefully) ARM ("Automatic Resource Management") blocks will help somewhat.

A: Write a method that looks something like below; call from your finally block...
static void wrappedClose(OutputStream os) {
  if (os != null) {
    try {
      os.close();
    }
    catch (IOException ex) {
       // perhaps log something here?
    }
  }

A: Separate your try/catch and try/finally blocks.
try
{
    FileOutputStream out = new FileOutputStream("myfile.txt");
    try
    {
        // More and more code goes here...
    }
    finally
    {
        out.close();
    }
}
catch (Exception e)
{
    //handle all exceptions
}

The outer catch will also catch anything thrown by the close.


text:
Q: Why is it not possible for me to access default value of @RequestParam without using quotes? I am using the Spring framework for this particular project, but I am wondering why I get an error 500 when I try to access http://localhost:8080/greeting when parser.parseExpression(name) param is not surrounded by quotes. When the code is parser.parseExpression("'"+name+"'"); everything works. Why is that the case?
@GetMapping("/greeting")
@ResponseBody
public Greeting greeting(@RequestParam(defaultValue = "World") String name) {
    //value = "name",

    Expression exp = parser.parseExpression("'"+name+"'");
    String message = (String) exp.getValue();
    System.out.println(message);
    return new Greeting(counter.incrementAndGet(), String.format(template, message));
}