text:
Q: WSO2 API Manager 1.6.0 - What is the correct database configuration? I have an installation of APIM 1.6.0 and a configuration as follows for each component.
Databases:
WSO2CarbonDB, WSO2UM_DB, WSO2REG_DB, WSO2AM_DB
I've left the entry in all of the registry.xml files that points to carbon by default, and added the gov registry configuration:
<currentDBConfig>wso2registry</currentDBConfig>
<dbConfig name="wso2registry">
    <dataSource>jdbc/WSO2CarbonDB</dataSource>
</dbConfig>
<dbConfig name="govregistry">
        <dataSource>jdbc/WSO2REG_DB</dataSource>
    </dbConfig>
    <remoteInstance url="https://localhost:9446/registry">
        <id>gov</id>
        <dbConfig>govregistry</dbConfig>
        <readOnly>false</readOnly>
        <enableCache>true</enableCache>
        <registryRoot>/</registryRoot>
    </remoteInstance>
    <mount path="/_system/governance" overwrite="true">
        <instanceId>gov</instanceId>
        <targetPath>/_system/governance</targetPath>
    </mount>
    <mount path="/_system/config" overwrite="true">
        <instanceId>gov</instanceId>
        <targetPath>/_system/nodes</targetPath>
    </mount>

For the user-mgt.xml file I left the original carbon entry and added the user db entry:
   <Property name="dataSource">jdbc/WSO2CarbonDB</Property>
   <UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">
<Property name="dataSource">jdbc/WSO2UM_DB</Property>

In the api-manager.xml file I added:
 <DataSourceName>jdbc/WSO2AM_DB</DataSourceName>

This was done on the Publisher node, Store node, Gateway node, and KeyManager node.
What I expected would happen was that all of the components would use the databases as follows:

*

*WSO2UM_DB would get used for UM_ tables interaction from all
components.

*WSO2REG_DB would get used for REG_ tables interaction from all
components.

*WSO2AM_DB would get used for API_ tables interaction from all
components.

*I really didn't expect the WSO2CarbonDB to get used.

What I have seen from database traces is that the following happens:

*

*WSO2AM_DB is used by the Publisher for API_ tables. (I have not seen any other components access yet).

*WSO2UM_DB is used by all components for UM_ tables.

*WSO2REG_DB is used by all components for REG_ tables.

*WSO2CarbonDB is used by all components for both UM_ and REG_ tables updates.

The thing that suprised me was that for all components: Publisher, Store, Gateway, and Key Manager the WSO2CarbonDB was used for both UM_ and REG_ tables.  This was for inserts, updates, deletes, and selects.
Is that expected?  Or should I have removed/updated the WSO2CarbonDB to be the User or Registry database?

A: If you need jdbc/WSO2UM_DB to be the database for the user store of all the comonents, then you have to change the default datasource property value to be jdbc/WSO2UM_DB in user-mgt.xml. So you don't need to keep the jdbc/WSO2CarbonDB in there.
<Property name="dataSource">jdbc/WSO2UM_DB</Property>

WSO2REG_DB to be the database for registry in all components, configure registry.xml same as your given configuration. Then gov and conf registry space of all of those will get pointed to WSO2REG_DB.
Also note that default WSO2CarbonDB will be used as the local registry of each and every component.

A: You could create all the database scripts into one single database schema. Point all your datasource (master-datasources.xml) to this database and schema.

A: Here is my master-datasources.xml; it is used by Puppet. Puppet is replacing the <%= %> tags during provisioning.
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">

    <providers>
        <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
    </providers>

    <datasources>

        <datasource>
            <name>WSO2_CARBON_DB</name>
            <description>The datasource used for registry and user manager</description>
            <jndiConfig>
                <name>jdbc/WSO2CarbonDB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url><%= jdbc_url %></url>
                    <username><%= jdbc_username %></username>
                    <password><%= jdbc_password %></password>
                    <driverClassName>oracle.jdbc.OracleDriver</driverClassName>
                    <maxActive>90</maxActive>
                    <maxWait>80000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
        </datasource>

        <datasource>
            <name>WSO2AM_DB</name>
            <description>The datasource used for API Manager database</description>
            <jndiConfig>
                <name>jdbc/WSO2AM_DB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url><%= jdbc_url %></url>
                    <username><%= jdbc_username %></username>
                    <password><%= jdbc_password %></password>
                    <driverClassName>oracle.jdbc.OracleDriver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
        </datasource>

         <datasource>
            <name>WSO2AM_STATS_DB</name>
            <description>The datasource used for getting statistics to API Manager</description>
            <jndiConfig>
                <name>jdbc/WSO2AM_STATS_DB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url><%= jdbc_url %></url>
                    <username><%= jdbc_username %></username>
                    <password><%= jdbc_password %></password>
                    <driverClassName>oracle.jdbc.OracleDriver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
         </datasource>

        <!-- For an explanation of the properties, see: http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html -->
        <!--datasource>
            <name>SAMPLE_DATA_SOURCE</name>
            <jndiConfig>
                <name></name>
                <properties>
                    <property name="java.naming.factory.initial"></property>
                    <property name="java.naming.provider.url"></property>
                </properties>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>

                    <defaultAutoCommit></defaultAutoCommit>
                    <defaultReadOnly></defaultReadOnly>
                    <defaultTransactionIsolation>NONE|READ_COMMITTED|READ_UNCOMMITTED|REPEATABLE_READ|SERIALIZABLE</defaultTransactionIsolation>
                    <defaultCatalog></defaultCatalog>
                    <username></username>
                    <password svns:secretAlias="WSO2.DB.Password"></password>
                    <maxActive></maxActive>
                    <maxIdle></maxIdle>
                    <initialSize></initialSize>
                    <maxWait></maxWait>

                    <dataSourceClassName>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</dataSourceClassName>
                    <dataSourceProps>
                        <property name="url">jdbc:mysql://localhost:3306/Test1</property>
                        <property name="user">root</property>
                        <property name="password">123</property>
                    </dataSourceProps>

                </configuration>
            </definition>
        </datasource-->
    </datasources>

</datasources-configuration>


text:
Q: The signature or decryption was invalid I need to hit a webservice using Java over https. I have been provided with keys and certificates in a jks store. I have also been provided with sample soap message below which works on soap UI
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:clic="http://www.xxxx.com/xxx/schema/foundation/service/TestSchema">
   <SOAP-ENV:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsu:Timestamp wsu:Id="TS-10205c90-231b-4430-8ec1-429e022d1c79">
            <wsu:Created>2018-07-23T13:00:06.981Z</wsu:Created>
            <wsu:Expires>2018-12-23T13:16:46.981Z</wsu:Expires>
         </wsu:Timestamp>
         <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="Gd9c929cb-1e7f-42b6-93dc-a48ed8bdcd33">MIIC9DCCAl2gAwIBAgICASAwDQYJKoZIhvcNAQEFBQAwgZUxCzAJBgNVBAYTAklOMRQwEgYDVQQIDAtNYWhhcmFzaHRyYTEPMA0GA1UEBwwGTXVtYmFpMRQwEgYDVQQKDAszaS1pbmZvdGVjaDENMAsGA1UECwwEQURNUzENMAsGA1UEAwwEd3NjYTErMCkGCSqGSIb3DQEJARYcc3dhdGkuc2hpbmRlQDNpLWluZm90ZWNoLmNvbTAeFw0xODA3MTAxNTA2NTlaFw0xOTA3MTAxNTA2NTlaMGwxCzAJBgNVBAYTAmluMRQwEgYDVQQIEwttYWhhcmFzaHRyYTEPMA0GA1UEBxMGbXVtYmFpMRQwEgYDVQQKEwszaS1pbmZvdGVjaDENMAsGA1UECxMEYWRtczERMA8GA1UEAxMId3NzZXJ2ZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKoNuOqHEg2gwhJqU5/qJ97+nBZU5pR7plAvGjfsqdTRb8Qd/UBRkVWPaSWxVJm6yERi4km2qwoOetDiPRnedj32QJu2tUs0N52lTG/DGAHBHkinkUOTNfBwWlWSz8hvpCuz7GvbSGi1EQyOGBJq6OgDaSYbmwpHXDhYl6iaW/MjAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBSVjKcFNjOT+RJyfHywsmDe3odF2zAfBgNVHSMEGDAWgBTpiJNUrifNvox2jit80t/e9BlxLjANBgkqhkiG9w0BAQUFAAOBgQBEpijq5vKRmWEZFUt9RTJ1cw6vpQbKSyhKOm7Sv1YgxHjzP5uGjddSkl8QmBBoHp5FIS/z1lBuRyMVNDChUrxqUR3Mz+qt+dM/xDJzYYA5oFkV3JAtZg5Re1uc0xq5uRkn5Qo5t5oj9RTN4a5zr9oK+AIxORSTWz33WUq7cHhJ0g==</wsse:BinarySecurityToken>
         <xenc:EncryptedKey Id="EK-5a112e0f-279e-43f2-b3ee-5a7044951d8d" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
            <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
            <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
               <wsse:SecurityTokenReference>
                  <wsse:Reference URI="#Gd9c929cb-1e7f-42b6-93dc-a48ed8bdcd33" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
               </wsse:SecurityTokenReference>
            </ds:KeyInfo>
            <xenc:CipherData>
               <xenc:CipherValue>dBTVGkwYgWNXBZ/20oAugPl57b5iE82sM344mvqppDfXYzIgWegF7KDI696xIbvyz1CqAFw/Km645180FuFKVsbXPYp5nTKs4QMNfivVu10QBksKaguKiRiowmSUNx5WUXef4x+qEbOqDjNbS98DdflpfOsJchOvdhBFSwUMf6o=</xenc:CipherValue>
            </xenc:CipherData>
            <xenc:ReferenceList>
               <xenc:DataReference URI="#ED-c1e7ddcc-207d-4ebb-a165-64aebd752871"/>
            </xenc:ReferenceList>
         </xenc:EncryptedKey>
         <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-68055fd0-3aa4-4947-a7b6-a6ed2966a464">MIIC9DCCAl2gAwIBAgICASEwDQYJKoZIhvcNAQEFBQAwgZUxCzAJBgNVBAYTAklOMRQwEgYDVQQIDAtNYWhhcmFzaHRyYTEPMA0GA1UEBwwGTXVtYmFpMRQwEgYDVQQKDAszaS1pbmZvdGVjaDENMAsGA1UECwwEQURNUzENMAsGA1UEAwwEd3NjYTErMCkGCSqGSIb3DQEJARYcc3dhdGkuc2hpbmRlQDNpLWluZm90ZWNoLmNvbTAeFw0xODA3MTAxNTE5NDZaFw0xOTA3MTAxNTE5NDZaMGwxCzAJBgNVBAYTAmluMRQwEgYDVQQIEwttYWhhcmFzaHRyYTEPMA0GA1UEBxMGbXVtYmFpMRQwEgYDVQQKEwszaS1pbmZvdGVjaDENMAsGA1UECxMEYWRtczERMA8GA1UEAxMId3NjbGllbnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANM9PR5tuVI5sLvEvCu2dPPZmxvvJEMPHnCo8sKz1WGxlp9xyqjxln0o2tsSQXEwlpaWoVypMSvEDPVXxTRpypaJ2n1aD6Zda4X4lDda7G4nd//EalItZxrZ4cYmk4SueIz4JPmg1JyQfdoFg+8LAoJXuGjNcHN6+d8BQjJh+oD1AgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBQAaGiDClvXpk9AdblQa8w4oCRTdjAfBgNVHSMEGDAWgBTpiJNUrifNvox2jit80t/e9BlxLjANBgkqhkiG9w0BAQUFAAOBgQCBMmVzYVpNtQs5KqhQ/q7QcU2gkoQqaGbkngY2CgvDl7w65lJo7lB2dn0H/rDrTxzcTAusp71RzSpzCE8zTkkh8bWjghpDKBcp2s5rTxsGuNf2fHT7EHyIq/wxX/DAY6Z2t6Wb3BYIo9Xe7NN9+UEmi0aHxxZ5TzH0sbIviZ1x2Q==</wsse:BinarySecurityToken>
         <ds:Signature Id="SIG-af07415f-9af5-447b-ab52-6ed562332323" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:SignedInfo>
               <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces PrefixList="wsa SOAP-ENV" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
               </ds:CanonicalizationMethod>
               <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
               <ds:Reference URI="#id-73d18922-a97d-4ef4-a3ce-a5476e2c876b">
                  <ds:Transforms>
                     <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                  </ds:Transforms>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                  <ds:DigestValue>mek5MuRjirVXt8ly13SqLfVl7NA=</ds:DigestValue>
               </ds:Reference>
               <ds:Reference URI="#id-20cca316-6e2e-4434-a3a4-b855da57bb6e">
                  <ds:Transforms>
                     <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces PrefixList="SOAP-ENV" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                     </ds:Transform>
                  </ds:Transforms>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                  <ds:DigestValue>TRCFwe1ZqDRAg4QSXZbZyGUDWIs=</ds:DigestValue>
               </ds:Reference>
               <ds:Reference URI="#id-26419ab7-c125-4c16-a41e-c8e1051577ef">
                  <ds:Transforms>
                     <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces PrefixList="SOAP-ENV" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                     </ds:Transform>
                  </ds:Transforms>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                  <ds:DigestValue>hGs9BeHV6gWNzRt2bIOO6ufip6c=</ds:DigestValue>
               </ds:Reference>
               <ds:Reference URI="#id-3fefc90b-632a-426f-b8f7-74a99ec4f82a">
                  <ds:Transforms>
                     <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces PrefixList="SOAP-ENV" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                     </ds:Transform>
                  </ds:Transforms>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                  <ds:DigestValue>jGO5ckp7b9JDGeLjDu2b9jyzSJ4=</ds:DigestValue>
               </ds:Reference>
               <ds:Reference URI="#id-ec181695-d50a-4579-94a4-410e8fd4e422">
                  <ds:Transforms>
                     <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                  </ds:Transforms>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                  <ds:DigestValue>7lPYMD7/qYqiiw60hXnXoE7+hpc=</ds:DigestValue>
               </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>0vyKSyRw2br6F4AEGfynFw8HwlYOebJMdNASuwP6+Cch3hhteoydJ8H9JVqxiqRAnYHnR9Cx/rhRzkXhDLvBV9/NFw9EdrHBmdbAnbYVwfLA5dTndLPHUk+fvrvs7YjfjsNOlUNYhIZhnvfMt9MUoNKJlI62r5ijkPWIgpwIqLA=</ds:SignatureValue>
            <ds:KeyInfo Id="KI-3883121d-1f56-46aa-98f2-e6c4be09b4f7">
               <wsse:SecurityTokenReference wsu:Id="STR-0b7f8424-870e-4c49-8b32-6c7748a08537">
                  <wsse:Reference URI="#X509-68055fd0-3aa4-4947-a7b6-a6ed2966a464" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
               </wsse:SecurityTokenReference>
            </ds:KeyInfo>
         </ds:Signature>
      </wsse:Security>
      <wsa:To SOAP-ENV:mustUnderstand="1" wsu:Id="id-ec181695-d50a-4579-94a4-410e8fd4e422" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">none</wsa:To>
      <wsa:From>
         <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
      </wsa:From>
      <wsa:ReplyTo wsu:Id="id-3fefc90b-632a-426f-b8f7-74a99ec4f82a" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
      </wsa:ReplyTo>
      <wsa:FaultTo>
         <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
      </wsa:FaultTo>
       <wsa:FromSoap>
         <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
      </wsa:FromSoap>

      <wsa:Action wsu:Id="id-20cca316-6e2e-4434-a3a4-b855da57bb6e" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">http://www.xxxx.com/xxx/definitions/service/RequestTestAgreement</wsa:Action>
      <wsa:MessageID wsu:Id="id-26419ab7-c125-4c16-a41e-c8e1051577ef" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">urn:uuid:97d1f396-3f51-41db-ad62-2633f13fed32</wsa:MessageID>
   </SOAP-ENV:Header>
    <SOAP-ENV:Body wsu:Id="id-ba05ffcc-9962-4b41-a1da-e813d9bc93d0" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <clic:getTestAgreementRequest>true</clic:getTestAgreementRequest>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I have generated by soap message using apache wss4j 1.6.8 and the output is as below
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clic="http://www.xxxx.com/xxx/schema/foundation/service/TestSchema">
   <SOAP-ENV:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsu:Timestamp wsu:Id="TS-3">
            <wsu:Created>2019-02-06T18:50:11.074Z</wsu:Created>
            <wsu:Expires>2019-02-06T19:06:51.074Z</wsu:Expires>
         </wsu:Timestamp>
         <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="6593263F499877B4A415494790109675">MIIDeDCCAuGgAwIBAgICAR4wDQYJKoZIhvcNAQEFBQAwgZUxCzAJBgNVBAYTAklOMRQwEgYDVQQIDAttYWhhcmFzaHRyYTEPMA0GA1UEBwwGbXVtYmFpMRQwEgYDVQQKDAszaS1pbmZvdGVjaDENMAsGA1UECwwEYWRtczENMAsGA1UEAwwEd3NjYTErMCkGCSqGSIb3DQEJARYcc3dhdGkuc2hpbmRlQDNpLWluZm90ZWNoLmNvbTAeFw0xODA4MzEwOTEyNTZaFw0xOTA4MzEwOTEyNTZaMGwxCzAJBgNVBAYTAmluMRQwEgYDVQQIEwttYWhhcmFzaHRyYTEPMA0GA1UEBxMGbXVtYmFpMRQwEgYDVQQKEwszaS1pbmZvdGVjaDENMAsGA1UECxMEYWRtczERMA8GA1UEAxMId3NzZXJ2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCGZAOvKwIffsVhKQ4sGasgUcgP1Vp+KZsNsuCjKCIkfZ5w0S7m5jUpzzIYjmWYa3b+aU3jCpvtfSFB5xQ6iHGcPJ6w3Dso+Clp4XuXgfS9ECblJjJ1gk6e91/uhywbt+e1zAE7dl7+S1dkxsw3H/1E3bVVWmeK31tqexwUVgVtyWJuX77w31yx0zJ2KI7CEfPq7OMEVRMq4jRkn9s0bHUjQ9PqMtOnglo9isg1lhm3TpWfy9wkB99pdDkAG5QqPlp/m+l5mBUTvoZIoOpVNHsI0r15bqC/Nzkm/g4p9qbG02rlv3P9JqDFCkgYWg/zIe5HUzTFaDFZwBKxO2Mexe7DAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBR2GHKfXofss3GtyDO9Y/CihdWrIDAfBgNVHSMEGDAWgBRGhczI58cP0v9DFA2z1jVz6w2ksDANBgkqhkiG9w0BAQUFAAOBgQAZSuRlgWHwoeUBKwI4c2vvfaSjntw2T73JcDL2L+ZsqRQz3TPWGs5T/UtnPiKP5SDrCR0syz1ejLXo0DgBlehlwBDYbizznyK2a8sG5URA5VGDCV69JInihZft0IbplDzaGr+RYdRlk6sL9Xn9/faKF6EJbG90WtqnRjBz+9Lvsg==</wsse:BinarySecurityToken>
         <xenc:EncryptedKey Id="EK-6593263F499877B4A415494790109674" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
            <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
            <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
               <wsse:SecurityTokenReference>
                  <wsse:Reference URI="#6593263F499877B4A415494790109675" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
               </wsse:SecurityTokenReference>
            </ds:KeyInfo>
            <xenc:CipherData>
               <xenc:CipherValue>ChwYvMF05oQtM1pCPwhsH2SUnb/D1ilvjff+1yPb8HPUyLv4AcbcQzROnujUdDBxdNNC5gWGP9YqSvEFTV1WF4+qXzVAOt6RdSERx0JGmh7FaeHiO0JDuVKmfJsb+sRgUh2u3LBgxEqs2mqB4PEW8rat3rY2V4d7pl3MiS4mJO7QTeo3OvoxXKeN4ya009DrKkr+Is7OUhWYqU6Ffw6sZSeZltbz0ZcrtLlZa/dIZo4gSgvFcePgBuW43Lm3KwtzCqOV1Zgul2bRpsQnfD3EVXp75i5zPYU/KvWJqBkpKM3h8c8h6nNA+aibvq9WCos1nZvs8XaKg6Ymd3dcwgePHQ==</xenc:CipherValue>
            </xenc:CipherData>
         </xenc:EncryptedKey>
         <xenc:ReferenceList xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"/>
         <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-6593263F499877B4A415494790103071">MIIDcjCCAtugAwIBAgICASAwDQYJKoZIhvcNAQEFBQAwgZUxCzAJBgNVBAYTAklOMRQwEgYDVQQIDAttYWhhcmFzaHRyYTEPMA0GA1UEBwwGbXVtYmFpMRQwEgYDVQQKDAszaS1pbmZvdGVjaDENMAsGA1UECwwEYWRtczENMAsGA1UEAwwEd3NjYTErMCkGCSqGSIb3DQEJARYcc3dhdGkuc2hpbmRlQDNpLWluZm90ZWNoLmNvbTAeFw0xODA5MjEwNzI1MTNaFw0xOTA5MjEwNzI1MTNaMGYxCzAJBgNVBAYTAmluMQswCQYDVQQIEwJtaDEPMA0GA1UEBxMGbXVtYmFpMRQwEgYDVQQKEwszaS1pbmZvdGVjaDENMAsGA1UECxMEYWRtczEUMBIGA1UEAxMLc2F0aWFjbGllbnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDHoAKC/vd19vb/OUlSjCmJc30RNiyvzorBjNAqyR9oBRALtwxMdnzLboCxawzTnjborgP1LBgmFD1c42LW83Yja/vmwNEGCNp7+S2moLbN4xe4lFB6ixNDcWgrbkFz4rGotvSGs8mxhLAdye69g5UUV14h/brzJY8pOmABG6Gz30bxogq+SWtZ1TlymAxNgx/Tw80gzgy1aOfUhJQaKIF6m+59O4HpxxFH00Z/f3ZXbyIfDfgRXDP+sxt1vOUKoLmgn3bypM9EqN2sGr721HKqJujMqtl1YNMs3fIGaT6lA4+obIg3/JYsz9xj7M6ym8IJm/OyDkRzRuB3BxVvW1GHAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBT0ZtrJGWC5jLIFvXHbSw/KV+M++DAfBgNVHSMEGDAWgBRGhczI58cP0v9DFA2z1jVz6w2ksDANBgkqhkiG9w0BAQUFAAOBgQC78s3HaYM1sqBXoPyUFitSZf9zyQipOWpvrrYdYwKMEmT84ZDJeJPLens/7URyyla9s/ygXbFpHbzre2nXZLEfXEC5ZSjt+/zDz0TTDPCoi/PBPAZP0f1gnAihSzi04YB2MKKKgRKCEPnc43WbiNWq9+e8rnKN3p82fgc03Mrc1w==</wsse:BinarySecurityToken>
         <ds:Signature Id="SIG-2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:SignedInfo>
               <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  <ec:InclusiveNamespaces PrefixList="wsa SOAP-ENV clic" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
               </ds:CanonicalizationMethod>
               <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
               <ds:Reference URI="#id-1">
                  <ds:Transforms>
                     <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces PrefixList="clic" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                     </ds:Transform>
                  </ds:Transforms>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                  <ds:DigestValue>xb52CEoxKdEcSo8q8eLMOURnTnI=</ds:DigestValue>
               </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>wQlP4hzCvKMVtolq6nnVnfH7Zz/0ktTrgHqb467RgoOB6W7jrDpNprofp7gMbdxjC2D4X7yj/APYD9ADmmGZf0EzMbF/o0G1RYPQzl2J/1tagWM5H3M3Ztnxbwj7cA7ToYTci9D6BASLef9Jl9I5diiBP/1eXsqjVkzeuocvozrRPVZLXhdLFIUT2Yk2V6s7RH0q6FNDZEk10Z6AWstneh/ixq7BkYUhObZmEu1P5/IO99lX68n+EGexbBOmTFBraszkjBeSSH+8/ShLDfhm24O52LlFktKXmyuMN8eQu8vmQW21vtW+7GxXD/TIdwTwtwjyH2awJtNCCRf8pLTJIQ==</ds:SignatureValue>
            <ds:KeyInfo Id="KI-6593263F499877B4A415494790103382">
               <wsse:SecurityTokenReference wsu:Id="STR-6593263F499877B4A415494790103413">
                  <wsse:Reference URI="#X509-6593263F499877B4A415494790103071" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
               </wsse:SecurityTokenReference>
            </ds:KeyInfo>
         </ds:Signature>
      </wsse:Security>
      <wsa:Action wsu:Id="id-1ea06b17-3ceb-4a69-8d2c-2ea8c9f88a9e" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">http://www.xxxx.com/xxx/definitions/service/RequestTestAgreement</wsa:Action>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body wsu:Id="id-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <clic:getTestAgreementRequest>true</clic:getTestAgreementRequest>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

When I call my webservice using my generated soap message on soap UI I get below response
<faultstring xml:lang="en">The signature or decryption was invalid; nested exception is org.apache.ws.security.WSSecurityException: The signature or decryption was invalid</faultstring>

What could be the problem with my soap message? I can see that CipherValue and SignatureValue in my soap message are longer than the one in the given sample soap message. Which encryption and signing algorithms do I need to use to make them have the same length of characters?

A: Either the signed Message was altered and then the signature doesn't know how to decrypt the signed message or you might have a problem with your keystore.
You can try generating a message using your keystore inside soapui https://www.soapui.org/soapui-projects/ws-security.html and then try to verify it once again, i had the same problem, that i managed to solve

A: ERROR:org.apache.ws.security.WSSecurityException: The signature or decryption was invalid
The reason for that error is that the WSS4J library needs XmlSec libraries starting from the version 1.5.6 but the SOAPUI is exported with the version 1.4.5
After replacing xmlsec-1.4.5 jar with xmlsec-1.5.6 jar under lib of C:\Program Files (x86)\SmartBear\SoapUI-5.5.0\lib the issue will be  resolved.
Try this approach.

A: I had faced the same problem like the SoapMessage signature invalid. Due to improper conversion of SoapMessage to String XML.
<soapenv:Fault>
  <faultcode>soapenv:Client</faultcode>
  <faultstring xml:lang="en">The signature or decryption was invalid; nested exception is org.apache.ws.security.WSSecurityException: The signature or decryption was invalid</faultstring>
</soapenv:Fault>

The problem that occurred is while delivery.

*

*Soap message Signing code is correct.

*while delivery SoapMessage is converted to XML is wrong due to this we have received an invalid response.

Exception Code: SoapMessage
public static String getSoapMessages(SOAPMessage soapMessage) throws Exception {
    SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
    Document ownerDocument = soapEnv.getOwnerDocument();
    String stringDocument = toStringDocument(ownerDocument);
    //System.out.println("SoapMessage: "+stringDocument);
    return stringDocument;
}
public static String toStringDocument(Document doc) throws TransformerException {
    StringWriter sw = new StringWriter();
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer = tf.newTransformer();
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
    transformer.setOutputProperty(OutputKeys.METHOD, "xml");
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");

    transformer.transform(new DOMSource(doc), new StreamResult(sw));
    return sw.toString();
}

Working code SoapMessage to XML String.
public static String getSoapMessageFromStream(SOAPMessage soapMessage) throws Exception {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    soapMessage.writeTo(outputStream);
    String codepage = "UTF-8";
    String stringDocument = new String( outputStream.toByteArray(), codepage );
    //System.out.println("SoapMessage form Stram: "+stringDocument);
    return stringDocument;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Error initializing plugins - GraphDB 8.7.2 I have tried updating my POM from v8.6.1 to v8.7.2 and in the process successfully re-created a sample repo with the new version's preload tool.
Although I have not altered my java code at all (which runs perfectly with v.8.6.1), now I get an error when trying to retrieve the repository from the manager with the following command:
repository = repositoryManager.getRepository(repositoryId);

The error is the following:
197822 [main] INFO  com.ontotext.plugin.magic-predicates  - Registering InverseMagicPredicate: http://jena.hpl.hp.com/ARQ/property#strSplit
197823 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'literals-index'
198002 [main] INFO  com.ontotext.plugin.literals-index  - Literals indices restored.
198003 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'geospatial'
198009 [main] INFO  com.ontotext.trree.plugin.geo.GeoSpatialPlugin  - Plugin:geospatial initialized
198010 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'sparql-mm'
198400 [main] INFO  com.ontotext.graphdb.sparqlmm.FunctionLoader  - Registered 48 functions from package com.github.tkurz.sparqlmm.function.
198400 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'dependencies-plugin'
198409 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'similarity'
198429 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'GeoSPARQL'
231881 [main] INFO  com.ontotext.trree.geosparql.FunctionLoader  - Registered 50 functions from package com.useekm.geosparql.
231882 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'lucene-connector'
231896 [main] ERROR com.ontotext.trree.sdk.impl.PluginManager  - Plugin 'lucene-connector' failed to initialize:org/json/simple/parser/ParseException
231897 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'rdfrank'
232224 [main] INFO  com.ontotext.trree.sdk.impl.PluginManager  - Initializing plugin 'notifications'
232237 [main] ERROR com.ontotext.trree.free.GraphDBFreeSchemaRepository  - Error initializing plugins:
java.lang.NullPointerException
    at com.ontotext.trree.plugin.externalsync.ExternalSyncPlugin.shutdown(ExternalSyncPlugin.java:803)
    at com.ontotext.trree.sdk.PluginBase.shutdown(PluginBase.java:100)
    at com.ontotext.trree.sdk.impl.PluginManager.disablePluginInt(PluginManager.java:986)
    at com.ontotext.trree.sdk.impl.PluginManager.removePlugin(PluginManager.java:361)
    at com.ontotext.trree.sdk.impl.PluginManager.initialize(PluginManager.java:128)
    at com.ontotext.trree.OwlimSchemaRepository.initPlugins(OwlimSchemaRepository.java:1979)
    at com.ontotext.trree.OwlimSchemaRepository.initializeInternal(OwlimSchemaRepository.java:242)
    at org.eclipse.rdf4j.sail.helpers.AbstractSail.initialize(AbstractSail.java:188)
    at org.eclipse.rdf4j.repository.sail.SailRepository.initializeInternal(SailRepository.java:151)
    at org.eclipse.rdf4j.repository.base.AbstractRepository.initialize(AbstractRepository.java:34)
    at org.eclipse.rdf4j.repository.manager.LocalRepositoryManager.createRepository(LocalRepositoryManager.java:270)
    at org.eclipse.rdf4j.repository.manager.RepositoryManager.getRepository(RepositoryManager.java:424)

I have specified the -Dregister-external-plugins=.... in the VM Options.
Any ideas what might be wrong? Should I go for a previous version and if so, which one?
Thanks

A: It looks like you have an incompatible Lucene connector configuration. I recommend deleting the Lucene connector directory and once the repository starts you can recreate the connector(s). The Lucene connector directory is located in the repository's data directory: <graphdb-data-dir>/repositories/<repository-id>/storage/lucene-connector. The easiest way to find <graphdb-data-dir> is looking at the startup messages of GraphDB where it will print something like:
GraphDB Data directory: /opt/test/graphdb-free-8.7.2/data
As Konstantin mentioned the problem might also have to do with register-external-plugins.


text:
Q: Flurry authorization key I can't find my Flurry authorization key for push credentials. How can I obtain a new one?
I see that this is not something available from the interface: "Receive the token code to access the API. Save the token, there is no interface available to recall the token. (Keep this token secure. This token cannot be retrieved from Flurry systems.)"

A: You will need to create a new programmatic user, which will then generate a new token for you to use with the API.
Log into y.flurry.com
Select the Admin icon from the left navigation bar
Select Users
Click on +Programmatic User


text:
Q: paillier image encryption in python I have tried to encrypt an image using paillier. But I can't decrypt it. Please help me to findout.
from phe import paillier
from PIL import Image
import cv2
import PIL
import numpy
openfilename = "greyscale.png"
img2 = cv2.imread(openfilename,0)
public_key, private_key = paillier.generate_paillier_keypair()
encrypted_number_list = [[public_key.encrypt(int(x)) for x in row] for row
in img2]
encrypted_number_array = numpy.array(encrypted_number_list)
print(encrypted_number_array)
decrypted_number_list =[private_key.decrypt(x) for x in
encrypted_number_array]
decrypted_number_array = numpy.array(decrypted_number_list)
print(decrypted_number_array)

Here is the image I am using:

A: Image encryption/decryption with pailer:
import cv2
from phe import paillier
from scipy.misc import toimage

img = cv2.imread('image.png', 0)
public_key, private_key = paillier.generate_paillier_keypair()
data_encrypted = [[public_key.encrypt(int(x)) for x in row] for row in img]

data_decrypted = [[private_key.decrypt(x) for x in row] for row in data_encrypted]
toimage(data_decrypted).save('result.png')


text:
Q: How to use \usepackage[parfill]{parskip} in memoir class? I would like to have a blank line between my paragraphs. In this way, I have decided to use :
\usepackage[parfill]{parskip}

However, it does not work with the memoir class.
\documentclass[a4paper,11pt]{memoir}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[parfill]{parskip}

\begin{document}
\section
lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae
ornare odio metus a mi.
\end{document}

Indeed, I get this error :/test.tex:6: LaTeX Error: Option clash for package parskip. []
Does anyone can help me please ?
Thanks

A: You don't use the parskip package in memoir: it's listed among the ones that the class emulates (page xxix of the manual).
In section 3.3.1 it is explained how to set a nonzero \parskip, but I'd like, first, to quote from the manual:

3.3.1 Paragraphs
  In traditional typography the first line of a paragraph, unless it comes immediately after a chapter or section heading, is indented. Also, there is no extra space between paragraphs. Font designers go to great pains to ensure that they look good when set with the normal leading. Sometimes, such as when trying to meet a University's requirements for the layout of your thesis, you may be forced to ignore the experience of centuries.
If you like the idea of eliminating paragraph indentation and using extra interparagraph space to indicate where paragraphs start and end, consider how confused your reader will be if the last paragraph on the page ends with a full line; how will the reader know that a new paragraph starts at the top of the following page?

You can use
\nonzeroparskip
\setlength{\parindent}{0pt}

in the preamble.
\documentclass{memoir}
\usepackage{lipsum} % just for the example

\nonzeroparskip
\setlength{\parindent}{0pt}

\begin{document}

\chapter{Title}

\lipsum[1-4]

\end{document}

If you're not satified by this setting, you can use
\abnormalparskip{12pt plus 2pt minus 2pt}

or any other length you want (don't forget the stretch and shrink parts) instead of \nonzeroparskip.


text:
Q: How can I use multiple shader in my renderer? I am trying to make my renderer able to use either default or custom shader.
class Renderer
{
public:
    void Create()
    {
        //Setup vao, vbo, ebo, quad indices, add data to ebo,
        //create default Shader
        //set camera projection
    }

    void Map()
    {
        vertexData = (VertexData*)glMapBufferRange(...);
    }

    void Draw(Rectangle destRect, Rectangle texCoordRect, Texture* texture)
    {
        //4 times for 4 different corners
        float textureSlot = FindTexture(texture);
        AddDataToMappedBuffer(position, texCoords, textureSlot, color);

        indexCount += 6;
    }

    void Unmap()
    {
        glUnmapBuffer(...);
    }

    void Render()
    {
        Unmap();

        shader.UniformMatrix4fv("projection", camera.getProjection());

        for(uint i = 0; i < texture.size(); ++i)
        {
            texture[i]->Bind(i);
        }

        BindVAO();
        DrawElements(TRIANGELS, indexCount, UNSIGNED_INT, nullptr);
        UnbindVAO();

        For(uint i = 0; i < texture.size(); ++i)
        {
            texture[i]->Unbind(i);
        }

        indexCount = 0;
        texture.clear();
    }

    float Renderer2D::FindTexture(Texture* t)
    {
        float result = 0.0f;
        bool found = false;
        for (uint i = 0; i < texture.size(); ++i) {
            if (texture[i] == t) {
                result = static_cast<float>(i + 1);
                found = true;
                break;
            }
        }

        if (!found) {
            if (texture.size() >= MAX_TEXTURES) {
                Render();
                Map();
            }
            texture.push_back(t);
            result = static_cast<float>(texture.size());
        }

        return result;
    }
private:
    std::vector<Texture*> texture;
    uint vao, vbo, ebo;
    VertexData* vertexData;
    float FindTexture(Texture*);
    Shader shader;
    Camera2D camera;
};

int main()
{
    Renderer renderer;
    renderer.Create();

    while(!quit)
    {
        //Clear color etc.

        renderer.Map();
        renderer.Draw(Rectangle(0.0f, 0.0f, 500.0f, 500.0f), Rectangle(0.0f, 0.0f, 1.0f, 1.0f), texture("sometexture.png"));
        renderer.Render();
    }
}

that is how it works right now.
I would like my renderer to be like this:

*

*in Draw method set shader

*check if this shader is in an array

*if it is, do not do another draw call - use shader which is already in an array

*if it is not, add this shader to an array, use it and do another draw call

I tried to do method which find shader - similar to texture - and go through all shaders and use them. It do not do exactly what I want.
std::vector<Shader*> shader;

void Renderer2D::FindShader(Shader* sh)
{
    bool found = false;
    for (uint i = 0; i < shader.size(); ++i) {
        if (shader[i] == sh) {
            found = true;
            return;
        }
    }

    if (!found) {
        shader.push_back(sh);
        Render();
        Map();
    }
}

void Render()
{
    Unmap();

    for(const auto& shader : shader)
    {
        shader->UseProgram();
        shader.UniformMatrix4fv("projection", camera.getProjection());
    }

    for(uint i = 0; i < texture.size(); ++i)
    {
        texture[i]->Bind(i);
    }

    BindVAO();
    DrawElements(TRIANGELS, indexCount, UNSIGNED_INT, nullptr);
    UnbindVAO();

    For(uint i = 0; i < texture.size(); ++i)
    {
        texture[i]->Unbind(i);
    }

    indexCount = 0;
    texture.clear();
}

void Draw(Rectangle destRect, Rectangle texCoordRect, Texture* texture, Shader* shader)
{
    FindShader(shader);
    float textureSlot = FindTexture(texture);
    AddDataToMappedBuffer(position, texCoords, textureSlot, color);

    indexCount += 6;
}

I have also tried to find shader without doing another draw call when shader is not found - only add it to an array - and in render method loop through all shaders and do draw call. It also did not work well.
How should I do it?


text:
Q: multiple class selector with ::-moz-progress-bar css I need to color progress bar with different colors based on their value.
I have this test snippet

    pbar tests

    <progress class="pbar-0" max="100" value="0"></progress>

    <progress class="pbar-10" max="100" value="10"></progress>

    <progress class="pbar-30" max="100" value="30"></progress>

    <progress class="pbar-60" max="100" value="60"></progress>

    <progress class="pbar-90" max="100" value="90"></progress>

    <progress class="pbar-100" max="100" value="100"></progress>

and the following css
*/*begin progress bar*/
progress,          /* All HTML5 progress enabled browsers */
progress[role]     /* polyfill */
{

    /* Turns off styling - not usually needed, but good to know. */
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;

    /* gets rid of default border in Firefox and Opera. */
    border: none;

    /* Needs to be in here for Safari polyfill so background images work as expected. */
    background-size: auto;

    /* Dimensions */
    width: 150px;
    height: 15px;
    border-radius: 3px;

}
/* Polyfill */
progress[role]:after {
    background-image: none; /* removes default background from polyfill */
}
/* Ensure fallback text doesn't appear in polyfill */
progress[role] strong {
    display: none;
}
progress,                          /* Firefox  */
progress[role][aria-valuenow] {    /* Polyfill */
    background: #f2f1f1 !important; /* !important is needed by the polyfill */
}
/* Chrome */
progress::-webkit-progress-bar {
    background: #f2f1f1;
}
/* IE10 */
progress {
    color: black;
}
/* Firefox */
progress::-moz-progress-bar {
    background: black;
}
/* Chrome */
progress::-webkit-progress-value {
    background: black;
}
/* Polyfill */
progress[aria-valuenow]:before  {
    background: black;
}
.pbar-0,.pbar-10,.pbar-30::-moz-progress-bar {
    background: red;
}

.pbar-60::-moz-progress-bar {
    background: yellow;
}

/*end progress bar*/*

I'm not able to match mulple classes with ::-moz-progress-bar selector:
.pbar-0,.pbar-10,.pbar-30::-moz-progress-bar {
    background: red;
}

Only pbar-30 is colored with red. What I'm doing wrong here?
Is is possible to write a multiple selector like this or I need to write them one by one?

A: You will need to repeat the pseudo-element across each of your class selectors.
Note that in this case, you can still group all three selectors into a single rule, since it's the exact same vendor-specific pseudo-element:
.pbar-0::-moz-progress-bar, .pbar-10::-moz-progress-bar, .pbar-30::-moz-progress-bar {
    background: red;
}

You only need to split a selector group into separate rules when each of the selectors has a different vendor prefix, like you have done with several of your other rules (e.g. progress::-moz-progress-bar and progress::-webkit-progress-value).


text:
Q: Removing specific values from columns in a pandas dataframe i need to remove specific rows containing specific column values in a pandas dataframe.
import numpy as np
import pandas as pd
import copy

### Choose the columns we will use
usecols = [str(x) for x in ["dered_r","u_g_color","g_r_color","r_i_color","i_z_color","diff_u",\
           "diff_g1","diff_i","diff_z","class"]]

### Load the data
dataset = pd.read_csv('STAR_data.csv',index_col=0, usecols=usecols)
dataset = dataset.append(pd.read_csv("GALAXY_data.csv",index_col=0, usecols=usecols))
dataset = dataset.append(pd.read_csv("QSO_data.csv",index_col=0, usecols=usecols))

### Fix the data
dataset = dataset[dataset["dered_r"] > -9999]
dataset = dataset[(dataset["g_r_color"] > -10)]
dataset = dataset[(dataset["g_r_color"] < 10)]

i want to remove any row which has a smaller value than -9999 under the dered_r column. For g_r_color i want only the rows which is between 10 and -10. The code i wrote gives the error :
Traceback (most recent call last):
 File "C:\Users\ABRA\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\indexes\base.py", line 2890, in get_loc
   return self._engine.get_loc(key)
 File "pandas\_libs\index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc
 File "pandas\_libs\index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc
 File "pandas\_libs\hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item
 File "pandas\_libs\hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'dered_r'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "data_extractor.py", line 19, in <module>
   dataset = dataset[dataset["dered_r"] > -9999]
 File "C:\Users\ABRA\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\frame.py", line 2975, in __getitem__
   indexer = self.columns.get_loc(key)
 File "C:\Users\ABRA\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\indexes\base.py", line 2892, in get_loc
   return self._engine.get_loc(self._maybe_cast_indexer(key))
 File "pandas\_libs\index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc
 File "pandas\_libs\index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc
 File "pandas\_libs\hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item
 File "pandas\_libs\hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'dered_r'


text:
Q: Insert an input into database I'm trying to insert in my database the input provided by the user, alongside the id . However i'm failing to do so. Maybe i'm way off maybe i'm close, but I just want to learn how to do it.Any help please?
$options = '';
    $filter=mysql_query("select id from employees WHERE Status='Employed '");
    while($row = mysql_fetch_array($filter)) {
        $options .="<option>" . $row['id'] . "</option>";
    }
    $menu="<form id='filter' name='filter' method='post' action=''>
    id : <select name='filter' id='filter' style='color:grey;'>" . $options . "</select>
    hours: <input type='text' name='Hours' style=' padding: 10px;border: solid 2px #c9c9c9; width:50px; height:2px;'>
    <input type='submit' name='submit' value='Submit' style='width:80px; height:30px; text-align:center; padding:0px;'>
    </form>
    <br>
    ";

if(isset($_POST['submit'])){

  $hours = $_POST['Hours'];
  $sql="INSERT INTO `editedworkhours` (`id`, `Note`, `WH`, `DeductedWH`) VALUES('$options',NULL,'$ahours',NULL)";
}
echo $menu;

A: There is mistake in your if condition
if(isset($_POST['submit'])){

        $addedhours = //fetched variable from the post data
        $options    = //fetched variable from the post data
             $sql="INSERT INTO `editedworkhours` (`AFNumber`, `Note`, `AddedWH`, `DeductedWH`) VALUES('$options',NULL,'$addedhours',NULL)";
             $getResult =mysql_query($sql);
             if(mysql_affected_rows() > 0)
             {
                   // do something
             }
             else{
                   // do something
             }
     }

If you wish to insert only in selected fields then you can remove the extra fields from your query. Like...
   $sql="INSERT INTO `editedworkhours` (`AFNumber`,`AddedWH`) VALUES('$options','$addedhours')";

And make sure all variables are not blank.. you can debug the query. Like...
   echo $sql;
   exit;

and copy that query, paste it into SQL area and check it. Whether it return any data or not.
Good Luck ['}

A: Apart from (among other problems) the fact that you really, really should not use mysql_* functions any more:
Near the end of your snippet you create a query. But you never execute it. That's why it's not working.


text:
Q: Add new latitude longitude on google map like real-time tracking I am trying to display real-time tracking of order on google maps.
On first API hit, I am getting all data of tracking and successfully plotted on google maps.
Now I want to call API periodically (10 sec) and get new data for lat-long and add the only newly received lat-long in google maps.
It's like every 10 sec map will update and show the latest status of location - like real-time tracking.
Here is my JavaScript Code :

Here is my HTML Code :

SO how can I call API in every 10 sec and plot update lat-long on google maps?

A: you can use SetInterval For this scenario
First Create Function for your action. then you can call this function at setinterval..
      setInterval(function() {
        $.ajax({
        url: 'http://api.xyz.com/api/Order/PostOrderDetails',
        dataType: "json",
        method: 'post',
        data: JSON.stringify({ order_id: orderID }),
        contentType: "application/json; charset=utf-8",
        success: function (data) {

            $(data.data.latLong).each(function (index, orderData) {
                var mylatlongs = new google.maps.LatLng(orderData.latitude, orderData.longitude);
                latlongs.push(mylatlongs);
            });

            newlatlongsLength = latlongs.length;
            oldlatlongsLength = latlongs.length;

            var mapProp = {
                zoom: 20,
                center: latlongs[latlongs.length - 1],
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById('google-map-div'), mapProp);

            var trackPath = new google.maps.Polyline({
                path: latlongs,
                icons: [{
                    icon: {
                        path: google.maps.SymbolPath.FORWARD_OPEN_ARROW
                    },
                    repeat: '175px'
                }],
                geodesic: true,
                strokeColor: '#FF0000',
                strokeOpacity: 1.0,
                strokeWeight: 2
            });
            trackPath.setMap(map);
        },
        error: function (err) {
            alert(err);
        }
    });   },10000);

A: Assuming your API will give you the full path on each call and that it won't mutate the previous points, you could grab the missing points and add them to the path via trackPath.getPath().push. Something like
var mapProp = {
    zoom: 20,
    center: latlongs[latlongs.length - 1],
    mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(
    document.getElementById('google-map-div'),
    mapProp
);

var trackPath = new google.maps.Polyline({
    icons: [{
        icon: {
            path: google.maps.SymbolPath.FORWARD_OPEN_ARROW
        },
        repeat: '175px'
    }],
    geodesic: true,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
});
trackPath.setMap(map);

function update() {
    $.ajax({
        url: 'http://api.xyz.com/api/Order/PostOrderDetails',
        dataType: "json",
        method: 'post',
        data: JSON.stringify({ order_id: orderID }),
        contentType: "application/json; charset=utf-8"
    }).then(function(data) {
        var path = trackPath.getPath(),
            coords = data.data.latLong;

        // restrict the coordinates to the new values
        coords = coords.slice(path.getLength());

        // add each point to the path
        coords.forEach(function (od) {
            var point = new google.maps.LatLng(od.latitude, od.longitude);
            path.push(point);
        });

        // sets a timer to update the points in 10 seconds
        setTimeout(update, 10000);
    });
}
update();

Note that the Polyline is created without any path and populated by the first call to update.
See https://developers.google.com/maps/documentation/javascript/examples/polyline-complex for an example of points added to a path.


text:
Q: Como corrigir o EntityValidationErrors Oi, preciso de uma ajuda. Após compilar o meu projeto estou recebendo um erro:

Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

Já descobri que esse erro é ocasionado na execução do método savechanges. Depurei o meu código e esta tudo certo até a execução do método. ao revisar o meu código encontrei algo como nas figuras abaixo:

Analisei o meu código mas não consegui encontrar o local exato de onde está o problema.
Gostaria de saber se  existe algum recurso no Visual Studio que possa me direcionar para o local exato onde está ocorrendo o erro? Ou há um local que indique onde está o erro?
Segue abaixo um trecho do código onde ocorre o erro.
public void inserirAcao(float cpf, string codigo, string empresa, string tipo, DateTime data, string hora, double abertura,
                             double maxima, double minima, double media, double fechamento, double fechamento_anterior,
                             int volume, int volume_financeiro, int negocio, double oferta_de_compra, double oferta_de_venda,
                             int quantidade_ofertada_compra, int quantidade_fertada_venda, double variação, string status, string fase)
    {
        try
        {
            validaInserirAcao(cpf, codigo, empresa, tipo, data, hora, abertura, maxima, minima, media, fechamento, fechamento_anterior,
                              volume, volume_financeiro, negocio, oferta_de_compra, oferta_de_venda, quantidade_ofertada_compra,
                              quantidade_fertada_venda, variação, status, fase);
            // instancia o banco
            bancotccEntities bco = new bancotccEntities();
          //  bco.Database.Connection.Open();
            // cria um objeto para receber os dados das ações
            acao obj = new acao();

            //popula o objeto
            obj.cpf = cpf;
            obj.codigo = codigo;
            obj.empresa = empresa;
            obj.tipo = tipo;
            obj.data = Convert.ToDateTime(data);
            obj.hora = hora;
            obj.abertura = abertura;
            obj.maxima = maxima;
            obj.minima = minima;
            obj.medio = media;
            obj.fechamento = fechamento;
            obj.f_anterior = fechamento_anterior;
            obj.volume = volume;
            obj.v_financeiro = volume_financeiro;
            obj.negocio = negocio;
            obj.ofcompra = oferta_de_compra;
            obj.ofvenda = oferta_de_venda;
            obj.qtd_of__compra = quantidade_ofertada_compra;
            obj.qtd_of_venda = quantidade_fertada_venda;
            obj.variacao = Convert.ToString(variação);
            obj.status = Convert.ToInt32(status);
            obj.fase = fase;

            // adiciona o objeto ao banco

           // bco.AddToacao(obj);
            bco.acao.Add(obj);
            // salva as informações o banco de dados
            bco.SaveChanges();
           // bco.Database.Connection.Close();
        }
        catch (Exception e)
        {

            throw new Exception(e.Message.ToString());
        }
    }

A: Crie no seu context o seguinte:
public class MeuProjetoContext : DbContext
{
    public override int SaveChanges()
    {
        try
        {
            return base.SaveChanges();
        }
        catch (DbEntityValidationException e)
        {
            foreach (var eve in e.EntityValidationErrors)
            {
                Console.WriteLine("Entidade do tipo \"{0}\" no estado \"{1}\" tem os seguintes erros de validação:",
                    eve.Entry.Entity.GetType().Name, eve.Entry.State);
                foreach (var ve in eve.ValidationErrors)
                {
                    Console.WriteLine("- Property: \"{0}\", Erro: \"{1}\"",
                        ve.PropertyName, ve.ErrorMessage);
                }
            }
            throw;
        }
    }

    ...
    // Coloque aqui as declarações de DbSets e outros.
}

Você poderá ver as mensagens de erro no console ou colocando um breakpoint dentro do catch.


text:
Q: p4 sync issue: Unable to sync all files after changing mapping and deleting folder I wanted to change the path of mapping in perforce client
For ex:
//depot/a/... /home/user/xyz/...

to
//depot/a/... /home/user/p4/xyz/...

After changing the path using p4 client, I have deleted folder xyz using rm -rf.
Then ran p4 sync but I think some files are not getting synced to new path p4/xyz/.

A: The server thinks that the workspace/client already has the #head revision of these files and does not need to sync them again.
You can try using -f option to force a refresh however that is taking a hammer to problem that just needs a pair of pliers.
I would try a p4 sync -k //depot/a/...#none to update the server 'have' list. Type [p4 help sync][1] for more information about the command.

A: Try using the force (-f) flag. See documentation.
There should also be a checkbox in the GUI, if you're using the visual client.

A: Same problem here and none of the solution worked. It turns out that file I was trying to sync was p4 opened. Once I reverted that back using p4 revert it synced back.

A: Below solution works for me.
p4 sync -f //depot/a/...

What I did is,synced the whole base directory,directory which contains all my files and folders.
-f is necessary because it will actually copy, which doesn't happen in normal sync situation(try doing ls on file for confirmation).
In case of a single file rm -rf situation you can do
p4 sync -f path/to/file


text:
Q: Join three table with dynamic columns and dynamic where clause This is my sqlfiddle.
Here, i need to find
No. of items (fetching item_name from 'item_list'),
ordered (fetching ordered_qty of 'order_detail'),
in each year (fetching ordered_date of 'orders').
Thus my output needs to be something like
year  red  blue yellow green
2010  20    20   20    10
2011  30    20   10    0
2012  20    10    0    0
2013  10    10    0    0
2014  20    10   10    10

where my column name will be list of items (if i add one more item to items_list that will be my 6th column but its values will be zero under it). I tried with subquery..


text:
Q: jQuery outputting string wrapped in quotes I have this application where I'm going to update a database using jQuery and the HTTP PUT method.
There's some code before this, and some more after it. I'm having issues with the part where it has id: {...
The id variable is equal to: 9j6bddjg7fd6ee0df09j0989
I need it to end up looking something like this: "9j6bddjg7fd6ee0df09j0989"
The rest (path, http, etc.) work because they don't have quotes around them.
Is there a way that I can have the id surrounded by quotes right before it is sent off to /api/routes?
    password = $('#password-' + i).val();
        id = $('#id-' + i).html();

        jQuery.ajax({
        url: "/api/routes",
        type: "PUT",
        data: {
            "routes": [
                {
                  id : {
                  "path" : path,
                  "httpMethod": http,
                  "ensureAuthenticated": password,
                  "route": route
                  }
                }

A: If you want the "id" key to be dynamic ( to have the value of your id variable ) you need to use a different notation:
var id = "9j6bddjg7fd6ee0df09j0989",
    newRoute = {},
    jsonData = {
        "routes": []
    };

newRoute[id] = {
    "path" : "path",
    "httpMethod": "http",
    "ensureAuthenticated": "passwd",
    "route": "route"
}

jsonData.routes.push(newRoute);

$.ajax({
  type: 'POST',
  dataType: 'json',
  url: '/echo/json/',
  data : { json: JSON.stringify( jsonData ) },
  success: function(data) {
      console.log("data > ", data);
  }
});

Check this fiddle for a working copy and check your js console for the output.


text:
Q: Calling Grandparent Class in magento class inheritance UPDATE:
This issue was finally tracked down as a class inheritance issue.
The original code in class becomes invalid, due to fact that the class inheritance has been updated, and the 'parent::parent' method is no longer a valid call.
Mystery solved. So simple, but somehow missed!
END UPDATE
This is more a PHP OOP related question, but I think falls within this community, since the question relates to magento and its class inheritance structure, and the way its core classes call parent methods to retain core functionality. If it is felt this does not belong here, I will happily remove this question.
I have of course googled this, and answers to this in stackexchange suggest changing the parent to place a flag to allow one to skip that class funcionality, but that woud mean having to rewrite the core classes, which is a no-go.
ref: https://stackoverflow.com/questions/8212048/parentparent-in-php
ref: https://stackoverflow.com/questions/1557608/how-do-i-get-a-php-class-constructor-to-call-its-parents-parents-constructor/1557663#1557663
As we all know magento has quite an inheritance scheme going, with inheritance running multiple classes deep.
Using the method _afterSave as an example, in the salesrule models:
CORE MODEL:
class Mage_SalesRule_Model_Rule extends Mage_Rule_Model_Abstract
{
   protected function _afterSave()
   {
       .....
       core code here (that what I want to change)
       .....
       .....
       parent::_afterSave(); (end by calling the parent class method)
       return $this;
   }
}

CORE ABSTRACT PARENT CLASS:
abstract class Mage_Core_Model_Abstract extends Varien_Object
{
    protected function _afterSave()
    {
        $this->cleanModelCache();
        Mage::dispatchEvent('model_save_after', array('object'=>$this));
        Mage::dispatchEvent($this->_eventPrefix.'_save_after', $this->_getEventData());
        return $this;
    }
}

Ok, so now I extend Mage_SalesRule_Model_Rule in my own module, and I change the functionality, (I do not want to extend Mage_Core_Model_Abstract, as i want to inherit from Mage_SalesRule_Model_Rule) (note I am not doing a rewrite, I am just extending the core class from my own module class)
Thus in my class, I cannot call parent::_afterSave(), as I do not want the core class code to run that exists in my class's parent Mage_SalesRule_Model_Rule, but I do want to call the grandparent _afterSave() method, as I do not want to copy that code into my class.
Pre PHP 5.4, the grandparent class method could be called 'statically', thus it was easy to just do Mage_Core_Model_Abstract::_afterSave() (ref : https://bugs.php.net/bug.php?id=42016 - it is not a bug!)
However, since I upgraded to PHP5.4, this causes a STRICT warning, and I do not want to disable strict warnings.
So, finally the question:
How do others overcome this issue in magento modules, if not using Mage_Core_Model_Abstract::_afterSave() ?

A: Unfortunatly there isn't a very clean solution, but the best one I've come across is the following:
call_user_func(array(get_parent_class(get_parent_class($this)), '_afterSave'));

A: it is should be possible to do it this way:
class Mage_SalesRule_Model_Rule extends Mage_Rule_Model_Abstract
{
   protected function _afterSave()
   {
       .....
       core code here (that what I want to change)
       .....
       .....
       //parent::_afterSave(); (end by calling the parent class method)
       Varien_Object::_afterSave(); // looks like static call but it will call a grandparent
       return $this;
   }
}


text:
Q: ¿Como hacer dinámico la agregación de clases a los td de una tabla? Tengo esta tabla, agrega la clase según el value, pero no me respeta el td, sino que del tr.
y como hacerlo dinámico si requiero n cantidad de registros?,mi código es este!

$( document ).ready(function() { validar(); });

  function validar(){
  var w =document.getElementById("uno").innerHTML;
  var s =document.getElementById("dos").innerHTML;
  if (s>5 && w>5){
   $('#dos').addClass('ale');
   $('#uno').addClass('ale');
  }else if(s>5 && w<=5){
   $('#dos').addClass('info');
   $('#uno').addClass('info');
  }else if(s<=5 && w>5 ){
   $('#dos').addClass('war');
   $('#uno').addClass('war');

  }else{
   $('#dos').addClass('sus');
   $('#uno').addClass('sus');
  }
  }
.ale{
 background-color: red;

}
.sus{
 background-color: green;

}
.info{
 background-color: blue;
}
.war{
 background-color: yellow;
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>

 3
 3
    texto sin color

 1
 3
    texto sin color

 1
 3
texto sin color

A: No estas utilizando todo el potencial de jQuery.  Intenta no mezclar vanilla javascript con jQuery.  Seria algo asi:

$( document ).ready(function() { validar(); });

  function validar(){
                  var trs = $(".table").find('tr');
                  trs.each(function(i,tr){
    var w =$(tr).find('td:first').text();
    var s =$(tr).find('td:eq(1)').text();
    if (s>5 && w>5){
   $(tr).find('.color').addClass('ale');
    }else if(s>5 && w<=5){
   $(tr).find('.color').addClass('info');
    }else if(s<=5 && w>5 ){
   $(tr).find('.color').addClass('war');
    }else{
   $(tr).find('.color').addClass('sus');
    }
                  });
  }
.ale{
 background-color: red;

}
.sus{
 background-color: green;

}
.info{
 background-color: blue;
}
.war{
 background-color: yellow;
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>

 3
 3
    texto sin color

 6
 6
    texto sin color

 1
 3
    texto sin color


text:
Q: Android: Google Vision API detect faces and landmarks every frame of the camera preview? Is Google Vision API capable of detecting faces and landmarks every frame of the camera preview when the preview is showing?
If yes, could you please point me to a code snippet on how to do this? I already have the camera2 interface set up. Thanks!

A: It depends.  The API detects faces and landmarks, but the amount of time required for each frame depends upon things like resolution and face size as well as hardware speed.  When tracking faces in a real time preview, the API may need to skip some frames in order to keep up.


text:
Q: Why did Mordo introduce this character this way? In Doctor Strange In The Multiverse of Madness, Mordo introduces a group of heroes to Doctor Strange. One of the heroes is

 Black Bolt

but instead of just saying his name, he says a garbled version of the name, similar to pig latin. Going off of memory, I believe the name he used was

 Bladagack Badagolt.

Doctor Strange responded in kind with a similarly garbled greeting. What was the significance of introducing the character this way? (Or is my memory completely mangled and I apparently had a mini-stroke?)

A: From the Disney+ subtitles, the dialogue is:

Mordo: Blackagar Boltagon. Keeper of the Terrigen Mists, the Inhuman king.
Strange: Blackagar Boltagard? Huh. Hidigy hidithere.

Mordo introduces him in this way, because it is his actual name. "Black Bolt" is his superhero name. This is shown at the top of his marvel.com character page.
Strange replies in that way, the first part because he misheard, the second part because he is an ass.

A: That is his name.
From the marvel cinematic wiki.

Blackagar Boltagon, also known as Black Bolt, is the leader of the Inhuman Royal Family and the King of the Inhumans of Attilan.

Mordo was just being polite by introducing Black Bolt by his real name, which is not a secret.


text:
Q: How remove duplicates from sql list? <property name="xxDescribtionNumbers" formula="(
                select nvl(listagg(A.NUMBER, ', ') within group (order by A.NUMBER),' ')
                from  ENTER E
                left outer join ADRESS A on A.ID = E.ADRESS_ID
                where E.BUILDING_ID = ID
                )" />

This will make a list of numbers but can contains duplicities, but I don't want any duplicities.

A: You can do this by removing the values in a subquery:
select coalesce(listagg(va.CISLO, ', ') within group (order by va.CISLO), ' ')
from (select distinct a.cislo
      from VCHOD V left join
           ADRESA A
           on A.ID = V.ADRESA_ID
      where V.BUDOVA_ID = ID
     ) va;


text:
Q: neo4j optimize read query performance I need help in optimizing a read query, it becomes very slow(around 3 secs) when the active users go around 250, with less load it takes only a few ms. Our graph size is 435 MB we are running it on a neo4j 3.5 cluster with 16 GB ram.
Query:
MATCH (lesson:Mlo)-[MLO_TO_CONTENT]->(Content)-[CONTENT_TO_SKILL]->(skill:Skill)<-[OUTCOME_TO_SKILL]-(outcome:Outcome)
WHERE lesson.mloUuid IN ["uuid-1", "uuid-2"]
AND outcome.boardId = lesson.boardId
AND outcome.gradeId = lesson.gradeId
AND outcome.subjectId = lesson.subjectId
AND exists(skill.name)
AND exists(skill.uuid)
AND exists(outcome.outcomeKey)
RETURN lesson.mloUuid as lessonUuid, skill.name as skillName, skill.uuid as skillUuid, collect(distinct outcome.outcomeKey) as outcomes

Configs:
Heap 6144 MB
Page Cache 5293 MB

:sysinfo
Page Cache
Faults    7348
Evictions    0
File Mappings    2544
Bytes Read    58851674
Flushes    9140
Eviction Exceptions    0
File Unmappings    2516
Bytes Written    280641246
Hit Ratio    100.00%
Usage Ratio    1.10%

Profile:

A: You can try profiling this:
MATCH (lesson:Mlo)-[MLO_TO_CONTENT]->(content)-[CONTENT_TO_SKILL]->(skill)<-[OUTCOME_TO_SKILL]-(outcome)
WHERE lesson.mloUuid IN ["uuid-1", "uuid-2"]
AND skill.name IS NOT NULL
AND skill.uuid IS NOT NULL
AND outcome.outcomeKey IS NOT NULL
AND outcome.boardId = lesson.boardId
AND outcome.gradeId = lesson.gradeId
AND outcome.subjectId = lesson.subjectId
RETURN lesson.mloUuid as lessonUuid, skill.name as skillName, skill.uuid as skillUuid, collect(distinct outcome.outcomeKey) as outcomes

In this query, we have removed label matches for skill and outcome nodes. They were taking around 50k DB hits, in the profile graph. However, if there is some mismatch in the response, you should re-add them back. Also, we have updated exists() check with IS NOT NULL, so that more indexes come into play. You can read more about it here.
Another potential option is to provide a JOIN hint in the query. These hints basically tell the query planner, how to traverse paths with respect to some particular nodes, so that the cost of traversal is minimized. Try the below query, we have provided the hint using the clause USING JOIN ON, any node can follow the clause, I have used skill nodes, but you can use lesson, content, or outcome as well, and compare the query response times.
PROFILE MATCH (lesson:Mlo)-[MLO_TO_CONTENT]->(content)-[CONTENT_TO_SKILL]->(skill:Skill)<-[OUTCOME_TO_SKILL]-(outcome:Outcome)
USING JOIN ON skill
WHERE lesson.mloUuid IN ["uuid-1", "uuid-2"]
AND outcome.boardId = lesson.boardId
AND outcome.gradeId = lesson.gradeId
AND outcome.subjectId = lesson.subjectId
AND skill.name IS NOT NULL
AND skill.uuid IS NOT NULL
AND outcome.outcomeKey IS NOT NULL
RETURN lesson.mloUuid as lessonUuid, skill.name as skillName, skill.uuid as skillUuid, collect(distinct outcome.outcomeKey) as outcomes

You can read more about the planner hint here.


text:
Q: How to parse a Java string into 2 double numbers and eliminate an invalid input? I am trying to parse a string which should contain a Complex Number into a ComplexNumber class that I wrote.
the string should be in the following format:
realNumber+imageNumberi, e.g : 14-3i.
I want to be able to:

*

*recognize if the string that was received is valid or not. If it has any characters in it which are not +, -, . or i or a digit, I want to be able to throw an exception error. e.g if the received string is 13a + 3i.

*Remove spaces (I did it using str.replaceAll), e.g : 13          +      i

*when I finally have the "fixed" string that looks like 12-3i for example, I want to  be able to split it into 2 double values of 12 and 3.

*I want to be able to also change i to 1 or '-1' if needed, e.g: -15+i.
I read about regex so I tried to use String.match, but had no luck with it.
I also succeeded to make a 50% working solution.
This is one way that I tried to do that.
run over the string, remove space, and go through each character to check if its valid or not. I had no luck because it writes: Condition '!Character.isDigit(ch) || ch != '+' || ch != '-'' is always 'true' .
String parsed = str.replaceAll("\\s++", "");

        for(int i = 0; i < parsed.length(); i++) {
            char ch = parsed.charAt(i);
            if (!Character.isDigit(ch) || ch != '+' || ch != '-')
            {
                System.out.println("invalid string.");

            }

I also wrote tried
if (!Character.isDigit(ch) || "+-".contains(ch))

and
if("~#@*+%{}<>[]|\"_^".contains(ch)){

but received:
Required type: CharSequence Provided: char
the following solution works but lacks of:

*

*check if the string is valid.

*change i with 1 if i received without a value before.

*determine if its + or - the image number.

code:
String[] splitString = str.split("[+|s+|i]"); // removing spaces, plus sign and "i" from the string

        Double[] complexNumberFields = new Double[2];
        complexNumberFields[0] = Double.parseDouble(splitString[0]);
            complexNumberFields[1] = Double.parseDouble(splitString[1]);
        }
        return new ComplexNumber(complexNumberFields[0], complexNumberFields[1]);

How should I implement this function in the best way without using a parser or matcher (becaue I did not read about them yet). I want it to be done with regex and string manipulations.
And without using any ComplexFormat methods of course because i'm implementing my own ComplexNumber class.

A: First of all I would recommend to implement this method inside Class (like Integer.valueOf() ex  ComplexNumber.valueOf("14-3i"))
Value of implementation:
I would do this with regExp in case you don't have any reason to avoid it (ex. performance) And also you can make my regExp more complex and flexible to cover more cases. I use Lombok here to decrease class construction noise (you can create constructors and get/set)
Also, please note that I set imageNumber as a string in case you need to parse only double just change parsing method or regular expression (regex variable) to   "^(\d{2})\-(\d)[a-zA-Z]{1}$";
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class ComplexNumber {

    private double realNumber;
    private String imageNumber;

    public static ComplexNumber valueOf(String inputValue) throws Exception {

        final String regex = "^(\\d{2})\\-(\\d[a-zA-Z]{1})$";

        final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
        final Matcher matcher = pattern.matcher(inputValue);

        if (matcher.matches()) {
            // constrict the object
            ComplexNumber obj = new ComplexNumber();
            obj.setRealNumber(Double.parseDouble(matcher.group(1)));
            obj.setImageNumber(matcher.group(2));
            return obj;
        } else {
            throw new Exception();
        }

    }

}


text:
Q: How to change the text of links in active-admin dashboard As the following image,
These links' text are generated by default.
For example.
I want to change the text 'Admin User' with 'Administrator' or '管理者'
How to do it ?

A: In your admin/admin_user.rb file
add this line for customize menu label:
menu :label => "Administrator"

So It will be look like this:
ActiveAdmin.register AdminUser do
    menu :label => "Administrator"
end

If you want to translate label as per your specific language then add locale and use it here.
ActiveAdmin.register Post do
    menu :label => proc{ I18n.t("administrator") }
end

You can check more here.


text:
Q: How to make usercontrol take whole space of the region its injected into I have a view which is injected into an region (Itemscontrol). The view only takes up space in the region depending on content size. I want that the view streches for whole height of the region. Here is code of my view:
    <UserControl x:Name="userControl" x:Class="DishPromo.Modules.Payments.SideCart.SideCartView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:infUIFramework="clr-namespace:DishPromo.Infrastructure.UIFramework;assembly=DishPromo.Infrastructure"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:Convert="clr-namespace:DishPromo.Modules.Payments.SideCart"
         mc:Ignorable="d"  >
<UserControl.Resources>
    <Convert:ObjectToStringConverter x:Key="ToString" />
    <Convert:BooleanToVisibilityConverter x:Key="ToVisibility" />
    <Convert:WOMsgVisibilityConverter x:Key="WOMsgVisibility" />
    <Convert:WorkOrderMsgConverter x:Key="WorkOrderMsg" />
    <Convert:RescheduleValueConverter x:Key="ValueConverter" />
    <Convert:PaymentAmountDueNow x:Key="PaymentAmountDueNow" />

    <Style TargetType="Button" x:Key="hotkeyStyle">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="Template">

            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="Transparent">
                        <Border Name="border"
                        Padding="4,2" CornerRadius="3"
                        BorderBrush="DarkGray"
                        />

                        <Rectangle x:Name="FVElement" Stretch="Fill" StrokeLineJoin="Miter" StrokeThickness="0.5" Opacity="0" RadiusX="2" RadiusY="2"
                               HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="{StaticResource {x:Static SystemColors.ControlLightLightBrushKey}}" Stroke="{StaticResource OEFlowButtonBorderStyle}"
                               >
                        </Rectangle>
                        <Rectangle x:Name="Background" StrokeLineJoin="Miter" StrokeThickness="0.5" Opacity="1" Margin="2" RadiusX="3" RadiusY="3">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                                    <GradientStop Color="{StaticResource {x:Static SystemColors.ControlColorKey}}" Offset="0.576" />
                                    <GradientStop Color="{StaticResource {x:Static SystemColors.ControlLightLightColorKey}}" Offset="0" />
                                    <GradientStop Color="{StaticResource {x:Static SystemColors.ControlColorKey}}" Offset="1" />
                                    <GradientStop Color="{StaticResource {x:Static SystemColors.ControlLightColorKey}}" Offset="0.262" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                            <Rectangle.Stroke>
                                <LinearGradientBrush EndPoint="0.5,-1.85" StartPoint="0.5,1.5">
                                    <GradientStop Color="Black" Offset="0"/>
                                    <GradientStop Color="Black" Offset="1"/>
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                        </Rectangle>
                        <Path x:Name="WhiteBand" Height="4.25" Stretch="Fill" StrokeLineJoin="Miter" Fill="{StaticResource OEFlowButtonWhiteBandFillStyle}"
                          Data="M4.2160064,2.75 C4.2160064,1.6454305 5.1114369,1.7153466 6.2160064,1.7153466 L22.679308,1.7153466 C23.783877,1.7153466 24.679308,1.6454305 24.679308,2.75 24.679308,2.75 4.2160064,2.75 4.2160064,2.75 z"
                          Margin="7,4,7,0" HorizontalAlignment="Center" VerticalAlignment="Top"/>

                        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontWeight="Light"
                               TextWrapping="WrapWithOverflow" Text="{TemplateBinding Content}" x:Name="btnName" >

                        </TextBlock>
                        <ContentPresenter />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="border" Property="BorderBrush" Value="#FF585151" />
                            <Setter Property="Cursor" Value="Hand" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" >
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                                        <GradientStop Color="#FF219921" Offset="0.35"/>
                                        <GradientStop Color="#FF216B99" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter  Property="RenderTransform" >
                                <Setter.Value>
                                    <TranslateTransform Y="0.5" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="border" Property="Opacity" Value="0.3" />
                            <Setter TargetName="Background" Property="Opacity"  Value="0.3" />
                            <Setter TargetName="FVElement" Property="Opacity" Value="0.3" />
                            <Setter TargetName="btnName" Property="Foreground" Value="Gray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</UserControl.Resources>
<DockPanel VerticalAlignment="Stretch" LastChildFill="True" >

    <DockPanel.InputBindings>
        <KeyBinding Command="{Binding MinPaymentOverride}" Gesture="SHIFT+CTRL+y"></KeyBinding>
        <KeyBinding Command="{Binding PIAMinPaymentOverride}" Gesture="SHIFT+CTRL+m"></KeyBinding>
        <KeyBinding Command="{Binding EFTOverride}" Gesture="SHIFT+CTRL+e"></KeyBinding>
        <KeyBinding Command="{Binding CCOverride}" Gesture="SHIFT+CTRL+c"></KeyBinding>
        <KeyBinding Command="{Binding OverrideCC}" Gesture="SHIFT+CTRL+c"></KeyBinding>
        <KeyBinding Command="{Binding OverrideSSN}"  Gesture="SHIFT+CTRL+s"></KeyBinding>
        <KeyBinding Command="{Binding OverrideCertificate}"  Gesture="SHIFT+CTRL+j"></KeyBinding>
        <KeyBinding Command="{Binding OverrideSellingAgent}"  Gesture="SHIFT+CTRL+d"></KeyBinding>
        <KeyBinding Command="{Binding OverrideRefCompany}"  Gesture="SHIFT+CTRL+i"></KeyBinding>
        <KeyBinding Command="{Binding OverrideSellingCompany}"  Gesture="SHIFT+CTRL+n"></KeyBinding>
    </DockPanel.InputBindings>

    <DockPanel.Style>
        <Style>
            <Style.Triggers>
                <DataTrigger Binding="{Binding ChangeFocus}" Value="True">
                    <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=SidecartRemove}"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </DockPanel.Style>

    <!--<Grid.RowDefinitions>
        <RowDefinition />

    </Grid.RowDefinitions>-->
    <DockPanel x:Name="dpNotificationArea"  Margin="0"  VerticalAlignment="Bottom" AllowDrop="True" LastChildFill="True" >

        <!--<Grid.RowDefinitions>
            <RowDefinition MinHeight="350" />
            <RowDefinition Height="29"/>
            <RowDefinition Height="58"/>
            <RowDefinition Height="27"/>
        </Grid.RowDefinitions>-->

        <Grid Grid.Row="3" VerticalAlignment="Bottom" DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="260"/>
            </Grid.ColumnDefinitions>

            <Label Grid.Column="0" Width="Auto" FontWeight="Bold" Foreground="Red">
                <MultiBinding Converter="{StaticResource PaymentAmountDueNow}">
                    <Binding Path="CustomerModel.AccountInfo.Pricer.PaymentRequired"/>
                    <Binding Path="CustomerModel.AccountInfo.AccountStatus"/>
                </MultiBinding>
            </Label>

            <StackPanel Grid.Column="1" x:Name="spPricerActionBar" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
                <Button Style="{StaticResource hotkeyStyle}" Width="80" x:Name="SidecartRemove" Command="{Binding RemoveCartItem}"
                    IsEnabled="{Binding CustomerModel.ControlStatus.RemoveIsEnabled}" GotFocus="SidecartRemove_GotFocus">
                    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontWeight="Light"><Run Text="Re"/><Underline><Run Text="m"/></Underline><Run Text="ove"/></TextBlock>
                </Button>

                <Button x:Name="btnFeeWaived" Width="80" Content="Fees Waived" IsEnabled="{Binding IsFeeWaivedEnabled}"
                    Command="{Binding ShowBattery}"  GotFocus="btnFeeWaived_GotFocus" />
                <Button Width="100" Content="Price It" HorizontalAlignment="Right" Visibility="{Binding PriceItVisibility}"  Command="{Binding GetPricing}" Background="#FF6633" Style="{StaticResource PriceItStyle}"/>
            </StackPanel>
        </Grid>

        <StackPanel x:Name="spWorkOrder" Grid.Row="2" VerticalAlignment="Bottom" DockPanel.Dock="Bottom">
            <Grid Margin="0,0,0,6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="75" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                </Grid.RowDefinitions>
                <StackPanel Grid.Column="1" VerticalAlignment="Bottom">
                    <Button Width="70" Height="25" x:Name="btnReschedule1" Content="Reschedule" HorizontalAlignment="Right" Command="{Binding GetInstallDates}" CommandParameter="1"
                        Visibility="{Binding CustomerModel.AccountInfo.ScheduleInfo, ConverterParameter=1, Converter={StaticResource ToVisibility}}" />
                    <Button Width="70" x:Name="btnReschedule0" Content="Reschedule" HorizontalAlignment="Right" Command="{Binding GetInstallDates}" CommandParameter="0"
                        Visibility="{Binding CustomerModel.AccountInfo.ScheduleInfo, ConverterParameter=0, Converter={StaticResource ToVisibility}}" />
                </StackPanel>
                <StackPanel Grid.Column="0" VerticalAlignment="Bottom">
                    <Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.WorkorderInfo.DisconnectDate, Converter={StaticResource WorkOrderMsg}}"
                        HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding CustomerModel.AccountInfo.WorkorderInfo.DisconnectDate, ConverterParameter=0, Converter={StaticResource WOMsgVisibility}}" VerticalAlignment="Center"/>
                    <Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.ScheduleInfo[1], Converter={StaticResource ValueConverter}}"
                        HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding Visibility, ElementName=btnReschedule1}" VerticalAlignment="Center"/>
                    <Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.ScheduleInfo[0], Converter={StaticResource ValueConverter}}"
                        HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding Visibility, ElementName=btnReschedule0}" VerticalAlignment="Center"/>
                </StackPanel>
            </Grid>
        </StackPanel>

        <StackPanel x:Name="NetworkQualification" Grid.Row="1" Margin="4,0,0,0" VerticalAlignment="Bottom" DockPanel.Dock="Bottom">
            <TextBlock x:Name="txtbNetQualStatus" Text="{Binding CustomerModel.ServiceAddress.NetQualResult}"  Foreground="Blue" FontWeight="Bold" />
            <TextBlock x:Name="txtDupAddress" Text="{Binding CustomerModel.ServiceAddress.NoAddressFound}" Foreground="Blue" FontWeight="Bold"/>
        </StackPanel>

        <ListView  Grid.Row="0"  Name="lstSideCart" ScrollViewer.HorizontalScrollBarVisibility="Auto" DockPanel.Dock="Top"
                   ScrollViewer.VerticalScrollBarVisibility="Auto" ItemsSource="{Binding CustomerModel.AccountInfo.Services}" SelectionMode="Extended"
                   SelectionChanged="lstSideCart_SelectionChanged" MaxHeight="781" VerticalContentAlignment="Stretch" >
        <ListView.ItemContainerStyle>
            <Style TargetType="ListViewItem">
                <Setter Property="Foreground" Value="{Binding Path=ForegroundColor}"/>
                <Setter Property="FontWeight" Value="{Binding Path=FontWeight}"/>
                <Setter Property="BorderBrush">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                            <GradientStop Color="DarkGray" Offset="0.0" />
                            <GradientStop Color="DarkGray" Offset="1.0" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="BorderThickness" Value="0,0,0,0.5"/>
            </Style>
        </ListView.ItemContainerStyle>
        <ListView.ContextMenu>
            <ContextMenu ItemsSource="{Binding ContextMenuList}">
                <ContextMenu.ItemTemplate>
                    <DataTemplate>
                        <MenuItem Header="{Binding Path=Header}" CommandParameter="{Binding}"
                                  Click="MenuItem_Click" Visibility="{Binding Path=IsVisible}" Height="16"/>
                    </DataTemplate>
                </ContextMenu.ItemTemplate>
            </ContextMenu>
        </ListView.ContextMenu>
        <ListView.View>
            <GridView>
                <GridViewColumn Width="175" Header="Service Code Name" DisplayMemberBinding="{Binding Description}" />
                <GridViewColumn Width="100" Header="Service Type" DisplayMemberBinding="{Binding ServiceCode.SecondaryServiceTypeSingle.ServiceTypeName}"/>
                <GridViewColumn Width="25" Header="#" DisplayMemberBinding="{Binding CurrentQuantity}"/>
                <GridViewColumn Width="68" Header="Added" DisplayMemberBinding="{Binding Path=DateAdded, StringFormat={}{0:MM/dd/yy}}"/>
            </GridView>
        </ListView.View>
    </ListView>

    </DockPanel>

</DockPanel>

A: What's the ItemsPanelTemplate of your ItemsControl?
The default is a StackPanel, which won't automatically stretch its child elements to the maximum allowed size.
You'll either have to set HorizontalAlignment to Stretch in the ItemsContainerStyle, or change the ItemsPanelTemplate to something that automatically stretches its children.
<!-- ItemContainerStyle -->
<ItemsControl.ItemContainerStyle>
    <Style>
        <Setter Property="HorizontalAlignment" Value="Stretch" />
    </Style>
</ItemsControl.ItemContainerStyle>

A: How about using a UniformGrid for your ItemsPanelTemplate like so
<ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
      <UniformGrid  />
    </ItemsPanelTemplate>
</ItemsControl.ItemsPanel>

Also, StackPanels by their definition only take up space according to the content which exists, so saying something like VerticalAlignment="Stretch" won't stretch the contents of the StackPanel throughout the parent container.

A: Try to use a Grid as the layoutroot of your usercontrol and dont set the width and height.


text:
Q: jQuery not defined in Google Chrome Extension I'm trying to run jQuery in my chrome extension, but I keep getting the error

Uncaught ReferenceError: $ is not defined

I'm trying to use jQuery in the content_script.js, but it seems that it is only loaded in the background.js
Is there some additional code that I need to add to my background.js, so that content_script.js can use jQuery?
My Code
manifest.json
{
"name": "Flip That Tab",

"description": "Flips a guitar tab on ultimate guitar",

"version": "1.0",

"author": "TyDyeTV",

"short_name": "Tab Flip",

"icons": {
    "16":"img/guitar16.png",
    "48":"img/guitar48.png",
    "128":"img/guitar128.png"
        },

"permissions": [
"activeTab"
],

"background": {
  "scripts": ["jquery-2.2.4.min.js", "background.js"],
  "persistent": false
            },

"browser_action": {
  "default_title": "Flip That Tab",
  "default_icon": "img/guitar.png"
                },

"manifest_version": 2

}

background.js
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {

chrome.tabs.executeScript(null, {file: "jquery-2.2.4.min"});
chrome.tabs.executeScript(null, {file: "content_script.js"});

});

content_script.js
// Code to flip tab

function isMusicLine(line)
{
    var numDash = 0;
    for (i=0; i < line.length; i++)
    {
        if(line[i] == '-')
        {
            numDash += 1;
        }
    }
    if (numDash > 10)
    {
        return true;
    }
    else
    {
        return false;
    }
}

function createMusic(line, myArray, tempArr)
{
    if(tempArr.length > 0)
    {
        for (i=0; i< tempArr.length; i++)
        {
            myArray.push(tempArr[i]);
        }
    }
    else
    {
        myArray.push(line);
    }

    return myArray
}

var element = document.getElementById("cont").innerHTML;
var element = $("cont").text(finalDoc)


text:
Q: how to move to correct definition in qtcreator with cmake projects I have cmake projects in QT Creator v4.5.0.
In build, I do "cmake build" and "cmake install".
What cmake install does is install header files and compiled libraries to a target directory.
Then, in QT Creator, I want to go to a definition of class clicking (Ctrl + left mouse button) as usual.
Where QT Creator brings me is the related header file, yes, but not the header file in source codes directory, but in target directory.
This is dangerous because if you edit the file in target directory and build it, you will lose your change, which makes the use of (Ctrl + left mouse button) impossible.
Here is the only thing that I found what QT tells about this:
moving to symbol definition/declaration
How can I use it as correct way?


text:
Q: How to create this gradient background in CSS3? I used the following image as the background throughout my site.

How can you use CSS3 and gradients to produce a similar visual element?

A: I can't really see that small image, but I advise you to try an online CSS3 generator, like this one:
CSS3 Gradient Generator

A: Here is the code that you are looking for CSS.
~~ HTML ~~

~~ CSS ~~
.mygradient{

    height:300px;
    width:100px;

    background: #7a0000; /* Old browsers */
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */
    background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzdhMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjYzJSIgc3RvcC1jb2xvcj0iIzkwMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9Ijk2JSIgc3RvcC1jb2xvcj0iIzk0MDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2NTAwMDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
    background: -moz-linear-gradient(top,  #7a0000 0%, #900000 63%, #940000 96%, #650000 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7a0000), color-stop(63%,#900000), color-stop(96%,#940000), color-stop(100%,#650000)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #7a0000 0%,#900000 63%,#940000 96%,#650000 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #7a0000 0%,#900000 63%,#940000 96%,#650000 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #7a0000 0%,#900000 63%,#940000 96%,#650000 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #7a0000 0%,#900000 63%,#940000 96%,#650000 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7a0000', endColorstr='#650000',GradientType=0 ); /* IE6-8 */

}

Add a "gradient" class to all your elements that have a gradient for IE9 support.
~~ HTML ~~

and also add the following override to your HTML to complete the IE9 support:
~~ HTML ~~ FOR IE9 FULL SUPPORT

A: CSS3 provides a more cross-browser way of doing it.
Example
.box_gradient {
  background-color: #fff;
  /* Chrome 10+, Saf5.1+ */
  background-image: -webkit-linear-gradient(top, #fff, #ddd);
  /* FF3.6 */
  background-image: -moz-linear-gradient(top, #fff, #ddd);
  /* Opera 11.10+ */
  background-image: -o-linear-gradient(top, #fff, #ddd);
  background-image: linear-gradient(top, #fff, #ddd);
  /* IE6–IE9 */
  filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#dddddd');
}

You will need to 100% height your html and body tags.