text:
Q: permission 403 error I switched from opensuse yesterday and i'm trying to configure the personal pc. In opensuse was pretty easy because i only needed to use the yast.
Now:
I've got 403 error
Forbidden

You dont have permission to access / on this server.

Apache/2.2.14 (Ubuntu) Server at ros Port 80

/etc/apache2/sites-available/ros
<VirtualHost 127.0.0.2:80>
        ServerAdmin admin@ros
        ServerName ros
    ServerAlias ros
        DocumentRoot /home/daniel/Public/ros
        <Directory /home/daniel/Public/ros/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

The /etc/hosts file
127.0.0.2    ros www.ros

Also in /var/log/apache2/error.log
[Thu Jun 24 11:32:20 2010] [crit] [client 127.0.0.2] (13)Permission denied: /home/daniel/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

I have chown the /home/daniel/Public/ros folder with the following command
chown -R daniel:www-data /home/daniel/Public/ros

also tried www-data:www-data in chown. But I don't see why it says permission denied /home/daniel/.htaccess/
Thank you !

A: Your home directory is probably 700. Apache just needs +x to get into the directory so we can just do this
chmod +x /home/daniel

As long as /home/daniel/Public/ros is 755 you should be good to go.


text:
Q: word order in the negative infinitive Is there any rule that regulates the word order in the negative infinitive form?
If the infinitive follows certain verbs in a sentence, it's clear that it should be 'not+to+inf'. For example, We decided not to go to Paris.
But in some dictionary explanations we can see a different word order: to + not+inf.
Are these patterns interchangeable?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to read a XML with XSLT I need read a CDATA and convert to array.
I have this XML and XSLT and I must validate the content of tag "name" showing the message "MosILOS." when message contains "20200713" in otherwise "otro mensaje".
I need to program XSLT version 1.0.
In the end I drop the expected result
I hope you can help me.
Thanks in advance

XML

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header xmlns:v1="http://192.127.0.1/U5g"/>
  <soap:Body xmlns:v1="http://192.127.0.1/U5g/v1">
    <ns2:QueryResponseMessage xmlns:ns2="http://192.127.0.1/5gNext/v1">
      <additionalFields>
        <additionalField>
          <byteValue>
            <![CDATA[<offerList>
  <offer>
    <balanceType>Adicional</balanceType>
    <balance>
      <offerId/>
      <typeCode>Palmera.net</typeCode>
      <total/>
      <endDateTime>2020-02-21T11:55:05</endDateTime>
      <name>TIKTOK POR DIA</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>Palmera.net</typeCode>
      <total/>
      <endDateTime>2020-03-02T11:55:05</endDateTime>
      <name>TIKTOK POR DIA + das a 20200713</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>CEFUR</typeCode>
      <total/>
      <endDateTime>2020-02-22T11:55:05</endDateTime>
      <name>TIKTOK POR DIA</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>C_VPN_STWR</typeCode>
      <total/>
      <endDateTime>2020-02-23T11:55:05</endDateTime>
      <name>TIKTOK POR DIA</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>C_VPN_STWR</typeCode>
      <total/>
      <endDateTime>2020-02-23T11:55:05</endDateTime>
      <name>TIKTOK POR DIA</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>MCV</typeCode>
      <total/>
      <endDateTime>2020-02-24T11:55:05</endDateTime>
      <name>TIKTOK POR DIA</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>MST</typeCode>
      <total/>
      <endDateTime>2020-02-25T11:55:05</endDateTime>
      <name>TIKTOK POR DIA</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>MYT</typeCode>
      <total/>
      <endDateTime>2020-03-01T11:55:05</endDateTime>
      <name>TIKTOK POR DIA</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
  </offer>
  <offer>
    <balanceType>Promocional</balanceType>
  </offer>
  <offer>
    <balanceType>Incluido</balanceType>
  </offer>
  <offer>
    <balanceType>Flex</balanceType>
  </offer>
</offerList>]]>
          </byteValue>
        </additionalField>
      </additionalFields>
      <stackMessages>
        <stackMessage>
          <id>0</id>
          <systemMessage>Successfully</systemMessage>
          <type/>
          <userMessage/>
        </stackMessage>
      </stackMessages>
    </ns2:QueryResponseMessage>
  </soap:Body>
</soap:Envelope>

XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="exel" version="1.0" xmlns:exel="http://common.org" xmlns:ns0="http://egnext/v6/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output encoding="UTF-8" method="xml" version="1.0">
    </xsl:output>
    <xsl:template match="/">
        <xsl:variable name="hala" select="//byteValue/text()"></xsl:variable>
        <xsl:variable name="balance" select="substring-before(substring-after($hala,'<balance>'),'</balance>')"/>
        <xsl:variable name="typeCode" select="substring-before(substring-after($balance,'<typeCode>'),'</typeCode>')"/>
        <xsl:variable name="name" select="substring-before(substring-after($balance,'<name>'),'</name>')"/>

        <umsprot version="1">
            <exec_rsp diagnostic="Successful consulta request" result="OK">
                <data name="id">
                    <xsl:value-of select="//id">
                    </xsl:value-of>
                </data>
                <xsl:choose>
                    <xsl:when test="//id = 0">
                      <xsl:text>Tu paquete incluye: </xsl:text>

                      <xsl:if test="$typeCode = 'Palmera.net'">

                        <xsl:choose>
                          <xsl:when test="contains($name,'20200713')">
                              <xsl:text>Minutos.</xsl:text>
                          </xsl:when>
                          <xsl:otherwise>
                              <xsl:text>otro mensaje</xsl:text>
                          </xsl:otherwise>
                        </xsl:choose>

                      </xsl:if>

                    </xsl:when>
                </xsl:choose>
            </exec_rsp>
        </umsprot>
    </xsl:template>
</xsl:stylesheet>

Result

<umsprot xmlns:ns0="http:/5gnext/t9" version="9">
   <exec_rsp diagnostic="Successful consulta request" result="OK">
      <data name="id">0</data>incluye:
otro mensaje</exec_rsp>
</umsprot>

The result that I want to get

<umsprot xmlns:ns0="http://5gnext/z8" version="9">
   <exec_rsp diagnostic="Successful consulta request" result="OK">
      <data name="id">0</data>
      <data name="message">
incluye_
otro mensaje. DROP POR DIA. Expira el 2020/02/21
minutos. DROP POR DIA + 20200713. Expira el 2020/03/02
DROP POR DIA. Expira el 2020/02/22
DROP POR DIA. Expira el 2020/03/01
      </data>

</exec_rsp>
</umsprot>

A: To do the same thing in one pass, you would need to use a recursive named template in order to process all instances of balance within the CDATA section:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns2="http://claro.com.ec/osb/message/Ussd/UssdMessage/v1"
exclude-result-prefixes="soap ns2">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/soap:Envelope">
    <umsprot xmlns:ns0="http://axis/EISApiOnlineWS.wsdl/types/" version="1">
        <exec_rsp diagnostic="Successful consultaBalanceSVA request" result="OK">
            <data name="id">
                <xsl:value-of select="soap:Body/ns2:QueryResponseMessage/stackMessages/stackMessage/id"/>
            </data>
            <data name="message">
                <xsl:text>
Tu paquete incluye:
</xsl:text>
                <xsl:call-template name="process-offerList">
                    <xsl:with-param name="cdata" select="soap:Body/ns2:QueryResponseMessage/additionalFields/additionalField/byteValue"/>
                </xsl:call-template>
            </data>
        </exec_rsp>
    </umsprot>
</xsl:template>

<xsl:template name="process-offerList">
    <xsl:param name="cdata"/>
    <xsl:variable name="balance" select="substring-before(substring-after($cdata, '<balance>'),'</balance>')"/>
    <xsl:variable name="typeCode" select="substring-before(substring-after($balance,'<typeCode>'),'</typeCode>')"/>
    <xsl:variable name="name" select="substring-before(substring-after($balance,'<name>'),'</name>')"/>
    <xsl:variable name="endDateTime" select="substring-before(substring-after($balance,'<endDateTime>'),'</endDateTime>')"/>
    <xsl:variable name="tail" select="substring-after($cdata, '</balance>')"/>
    <xsl:if test="$typeCode = 'C_Paquete_Voz_Onnet'">
        <xsl:choose>
            <xsl:when test="contains($name, '5claro')">minutos ILIMITADOS. </xsl:when>
            <xsl:otherwise>otro mensaje. </xsl:otherwise>
        </xsl:choose>
    </xsl:if>
    <xsl:value-of select="$name"/>
    <xsl:text>. Expira el </xsl:text>
    <xsl:value-of select="translate(substring($endDateTime, 1, 10), '-', '/')"/>
    <xsl:text>
</xsl:text>
    <!-- recursive call -->
    <xsl:if test="contains($tail, '<balance>')">
        <xsl:call-template name="process-offerList">
            <xsl:with-param name="cdata" select="$tail"/>
        </xsl:call-template>
    </xsl:if>
</xsl:template>

</xsl:stylesheet>

A: I would suggest you do this in two passes.
First, apply the following stylesheet to the input XML and save the result to a file:
XSLT 1.0 [1]
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns2="http://claro.com.ec/osb/message/Ussd/UssdMessage/v1"
exclude-result-prefixes="soap ns2">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/soap:Envelope">
    <root>
        <id>
            <xsl:value-of select="soap:Body/ns2:QueryResponseMessage/stackMessages/stackMessage/id"/>
        </id>
        <xsl:value-of select="soap:Body/ns2:QueryResponseMessage/additionalFields/additionalField/byteValue" disable-output-escaping="yes"/>
    </root>
</xsl:template>

</xsl:stylesheet>

In your example, this would produce:
Interim Result
<?xml version="1.0" encoding="UTF-8"?>
<root><id>0</id><offerList>
  <offer>
    <balanceType>Adicional</balanceType>
    <balance>
      <offerId/>
      <typeCode>C_Paquete_Voz_Onnet</typeCode>
      <total/>
      <endDateTime>2020-02-21T11:55:05</endDateTime>
      <name>FACEBOOK POR 1 DIA incluye Whatsapp GRATIS</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>C_Paquete_Voz_Onnet</typeCode>
      <total/>
      <endDateTime>2020-03-02T11:55:05</endDateTime>
      <name>FACEBOOK POR 1 DIA incluye Whatsapp GRATIS + llamadas ilimitadas a 5claro movil</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>FBMSN</typeCode>
      <total/>
      <endDateTime>2020-02-22T11:55:05</endDateTime>
      <name>FACEBOOK POR 1 DIA incluye Whatsapp GRATIS</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>C_GPRS_SOCIAL_TWITTER</typeCode>
      <total/>
      <endDateTime>2020-02-23T11:55:05</endDateTime>
      <name>FACEBOOK POR 1 DIA incluye Whatsapp GRATIS</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>C_GPRS_SOCIAL_FACEBOOK</typeCode>
      <total/>
      <endDateTime>2020-02-23T11:55:05</endDateTime>
      <name>FACEBOOK POR 1 DIA incluye Whatsapp GRATIS</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>MCV</typeCode>
      <total/>
      <endDateTime>2020-02-24T11:55:05</endDateTime>
      <name>FACEBOOK POR 1 DIA incluye Whatsapp GRATIS</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>MINST</typeCode>
      <total/>
      <endDateTime>2020-02-25T11:55:05</endDateTime>
      <name>FACEBOOK POR 1 DIA incluye Whatsapp GRATIS</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
    <balance>
      <offerId/>
      <typeCode>MYT</typeCode>
      <total/>
      <endDateTime>2020-03-01T11:55:05</endDateTime>
      <name>FACEBOOK POR 1 DIA incluye Whatsapp GRATIS</name>
      <shortName/>
      <useType>ilimitado</useType>
    </balance>
  </offer>
  <offer>
    <balanceType>Promocional</balanceType>
  </offer>
  <offer>
    <balanceType>Incluido</balanceType>
  </offer>
  <offer>
    <balanceType>Flex</balanceType>
  </offer>
</offerList></root>

Now you can apply a 2nd stylesheet to the resulting file and process it using standard XPath/XSLT methods. This could look something like:
XSLT 1.0 [2]
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/root">
    <umsprot xmlns:ns0="http://axis/EISApiOnlineWS.wsdl/types/" version="1">
        <exec_rsp diagnostic="Successful consultaBalanceSVA request" result="OK">
            <data name="id">
                <xsl:value-of select="id"/>
            </data>
            <data name="message">
                <xsl:text>
Tu paquete incluye:
</xsl:text>
                <xsl:for-each select="offerList/offer/balance">
                    <xsl:if test="typeCode = 'C_Paquete_Voz_Onnet'">
                        <xsl:choose>
                            <xsl:when test="contains(name, '5claro')">minutos ILIMITADOS. </xsl:when>
                            <xsl:otherwise>otro mensaje. </xsl:otherwise>
                        </xsl:choose>
                    </xsl:if>
                    <xsl:value-of select="name"/>
                    <xsl:text>. Expira el </xsl:text>
                    <xsl:value-of select="translate(substring(endDateTime, 1, 10), '-', '/')"/>
                    <xsl:text>
</xsl:text>
                </xsl:for-each>
            </data>
        </exec_rsp>
    </umsprot>
</xsl:template>

</xsl:stylesheet>

to produce:
Final Result
<?xml version="1.0" encoding="UTF-8"?>
<umsprot xmlns:ns0="http://axis/EISApiOnlineWS.wsdl/types/" version="1">
  <exec_rsp diagnostic="Successful consultaBalanceSVA request" result="OK">
    <data name="id">0</data>
    <data name="message">
Tu paquete incluye:
otro mensaje. FACEBOOK POR 1 DIA incluye Whatsapp GRATIS. Expira el 2020/02/21
minutos ILIMITADOS. FACEBOOK POR 1 DIA incluye Whatsapp GRATIS + llamadas ilimitadas a 5claro movil. Expira el 2020/03/02
FACEBOOK POR 1 DIA incluye Whatsapp GRATIS. Expira el 2020/02/22
FACEBOOK POR 1 DIA incluye Whatsapp GRATIS. Expira el 2020/02/23
FACEBOOK POR 1 DIA incluye Whatsapp GRATIS. Expira el 2020/02/23
FACEBOOK POR 1 DIA incluye Whatsapp GRATIS. Expira el 2020/02/24
FACEBOOK POR 1 DIA incluye Whatsapp GRATIS. Expira el 2020/02/25
FACEBOOK POR 1 DIA incluye Whatsapp GRATIS. Expira el 2020/03/01
</data>
  </exec_rsp>
</umsprot>


text:
Q: DynamicModule with intermediate expressions I am trying to generalize a Manipulate construct into a DynamicModule one to try and include smoother controls, but I seem to be running afoul of Dynamic's compartmentalization of my intermediate variables inside what used to be a Module.
More specifically, I used to have a construct of the form
Manipulate[
 Module[{y},
  y = f[x];
  {x, g[y]}
  ]
 , {x, 0, 1}]

including (a large number of) intermediate expressions like y=f[x], and which produced output like

I now want to move control of the variable x into the Module - essentially, into a LocatorPane command - but I don't know what the correct translation of the code above should be. My naive attempt is to so something like
DynamicModule[{x, y},
 y = f[x];
 {Slider[Dynamic[x]], Dynamic[x], Dynamic[g[y]]}
 ]

and this produces no errors but the output inside g fails to update:

What is the correct generalization of the Manipulate[Module[ ... ] ] combination? I have tried inserting Dynamic commands in all possible combinations but I cannot seem to get them right. I know the answer is probably fairly basic, but I'm also a bit lost in the maze of tutorials for these commands.
Obviously, simply doing {Slider[Dynamic[x]], Dynamic[x], Dynamic[f[g[y]]]} is not an option in my case. The intermediate calculations f[x] are quite a few and very verbose, and the 'displayable' function g[y] is actually several rather long and slow plotting commands. I need to do the central bit of the computation only once, and I do not want to repeat myself in giving it to the plotting commands.
What am I missing here? It feels very basic but I can't seem to get it right.

A: You should do something like:
DynamicModule[{x, y},
  {Slider[Dynamic[x]], Dynamic[x], Dynamic[g[y]]}
  ,
 Initialization :> (y = f[x];)]

for full control I would avoid using Manipulate. When you don't know what's going on, use Print for example. Let's focus on your Manipulate code:
Manipulate[Module[{y}, Print[1]; y = f[x];
  {x, g[y]}], {x, 0, 1}]

If you move the slider you are flooded by print. Now you know that your example works because definition of y is reevaluated at each update.

A: To mimic Manipulate, wrap the body in Dynamic:
DynamicModule[{x, y},
 Dynamic[
  y = f[x];
  {Slider[Dynamic[x]], Dynamic[x], Dynamic[g[y]]}]
 ]

(It's what Manipulate does.)
But putting the y code inside its own Dynamic is a little cleaner:
DynamicModule[{x, y},
 {Slider[Dynamic[x]],
  Dynamic[x],
  Dynamic[y = f[x]; Dynamic[g[y]]]}
 ]


text:
Q: Is a sendfile() like operation possible with linux-aio? I want to send data from one file descriptor to another via linux-aio without buffering and without transferring data to and from user space. Is such a sendfile64() funktion possible with linux-aio?
I looked at some linux-aio examples (in C/C++) and simple file-copy programs. All these examples do reading -> buffer -> writing.
regards,
philip

A: It's possible if you mmap the file, then you can make a aio sendfile. It's faster then sendfile via do_splice and should not sync at i_mutex.
Look at the lighttp linux_aio module.


text:
Q: :focus-withing not working for hover effect I've made this hover effect:
https://jsfiddle.net/fwgh7bca/
HTML & CSS

nav:hover ul li {
  opacity: 0.4;
}

nav ul li:hover {
  opacity: 1;
}

nav ul li {
  line-height: 1.5;
}

body {
  margin: 5rem;
}

Item Number 1

Item Number 2

Item Number 3

Item Number 4

And I want the effect to be applied when tabbing on the links. I tried adding this:
nav:focus-within ul li{
    opacity: 0.4;
}

nav ul li:focus{
    opacity: 1;
}

But it doesn't work, how can I make it work? Thanks in advance!

A: I think you should use :focus for the a elements

nav:hover ul li{
  opacity: 0.4;
}

nav ul li:hover{
  opacity: 1;
}

nav ul li{
  line-height: 1.5;
}

body{
  margin: 5rem;
}

nav:focus-within ul li a{
    opacity: 0.4;
    color: yellow;
}

nav ul li a:focus{
    opacity: 1;
    color: red;
}

Item Number 1

Item Number 2

Item Number 3

Item Number 4


text:
Q: What's the meaning of "to make a point"? Could you please tell me what the meaning of "to make a point" is in this case:

It's three in the morning, and we are making our way from southern to
  northern Utah, when the weather changes from the dry chill of the desert
  to the freezing gales of an alpine winter. Ice claims the road. Snowflakes
  flick against the windshield like tiny insects, a few at first, then so many
  the road disappears. We push forward into the heart of the storm. The van
  skids and jerks. The wind is furious, the view out the window pure white.
  Richard pulls over. He says we can't go any further.
  Dad takes the wheel, Richard moves to the passenger seat, and Mother
  lies next to me and Audrey on the mattress. Dad pulls onto the highway
  and accelerates, rapidly, as if to make a point, until he has doubled
  Richard's speed.

Extract from Educated by Tara Westover

A:
Dad pulls onto the highway and accelerates, rapidly, as if to make a point, until he has doubled Richard's speed.

"to make a point" usually refers to bringing forward a good argument (point) or an idea in a conversation.
Here, "Dad" accelerates rapidly as if he wanted to point out that this weather is not all that bad for a proficient driver.


text:
Q: springboot always read data from primary datasource My springboot app tries to read data from two datasources(emwbis and backupemwbis). I've followed the below link in configuring my springboot app to read data from two different datasources.
http://www.baeldung.com/spring-data-jpa-multiple-databases
The current problem with my app is it is always reading data from the primary datasource(emwbis). I've written below code.
Model classes for primary and backup datasources:
package com.jl.models.primary;
@Entity
@Table(name = "crsbis",schema="emwbis")
@Data
public class CrsBIS {

    @Id
    private String id;

    @NotNull
    private String email;

package com.jl.models.backup;

import lombok.Data;

@Entity
@Table(name = "crsbis",schema="backupemwbis")
@Data
public class CrsBIS {

    @Id
    private String id;

    @NotNull
    private String email;

Datasource config classes for primary and backup datasources:
@Configuration
@PropertySource("classpath:persistence-multiple-db.properties")
@EnableJpaRepositories(basePackages = "com.jl.dao.backup", entityManagerFactoryRef = "crsBISBackUpEntityManager", transactionManagerRef = "crsBISBackupTransactionManager")
public class BackupCrsBISDatabaseConfig {

@Configuration
@PropertySource("classpath:persistence-multiple-db.properties")
@EnableJpaRepositories(basePackages = "com.jl.dao.primary", entityManagerFactoryRef = "crsBISEntityManager", transactionManagerRef = "crsBISTransactionManager")
public class CrsBISDatabaseConfig {

Repository interfaces for primary and backup datasources:
@Transactional
public interface CrsBISRepository extends JpaRepository<CrsBIS, String> {
    public CrsBIS findById(String id);

}

@Transactional
public interface CrBisBackupRepository extends JpaRepository<CrsBIS, String>{
    public CrsBIS findById(String id);
}

Persistent db proeprties file :
jdbc.driverClassName=com.mysql.jdbc.Driver
crsbis.jdbc.url=jdbc:mysql://localhost:3306/emwbis
backupcrsbis.jdbc.url=jdbc:mysql://localhost:3306/backupemwbis
jdbc.user=root
jdbc.pass=Password1

Controller class to test both the datasources :
@Controller
public class CrsBISController {

    @Autowired
    private CrsBISRepository crsBISRepository;

    @Autowired
    private CrBisBackupRepository crsBackupRepository;

@RequestMapping("/get-by-id")
    @ResponseBody
    public String getById(String id){
        String email="";
        try{
            CrsBIS crsBIS = crsBISRepository.findById(id);
            email = String.valueOf(crsBIS.getEmail());
        }catch (Exception e) {
            e.printStackTrace();
            return "id not found!";
        }
        return "The email is : "+email;
    }

    @RequestMapping("/get-by-id-backup")
    @ResponseBody
    public String getByIdFromBackup(String id){
        String email="";
        try{
            com.jl.models.backup.CrsBIS crsBIS = crsBackupRepository.findById(id);
            email = String.valueOf(crsBIS.getEmail());
        }catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
            return "id not found!";
        }
        return "The email is : "+email;
    }

Although, I've separated the database schemas in the model classes and in the database config file, both the methods in the controller class hit the same database (emwbis). I want getByIdFromBackup method in controller class to read the data from secondary database (backupemwbis).
Can someone please let me know the mistake in my code? Or you can suggest/guide me to achieve my goal?

A: From the first configuration file you're creating a primary datasource bean definition with the name myDatasource and in the second emf you're injecting the same datasource reference.
The Bean causing the problem is this
@Bean
@Primary
public DataSource myDataSource()

Just change the second Bean datasource name and use it in the second EMF.
public class BackupCrsBISDatabaseConfig {

    ...
    @Bean
    public DataSource backupDS() {
    ....

    @Bean
    public LocalContainerEntityManagerFactoryBean crsBISBackUpEntityManager() {
      ....
      em.setDataSource(backupDS());
    }
}

Hope this fixes it.

A: You have to explicitly request a TransactionManager implementation in your @Transactional usage:
@Transactional("crsBISTransactionManager")
//..

@Transactional("crsBISBackupTransactionManager")
//..


text:
Q: react native passing data to other screen I am new to react native .what I want is that in my app there is many images in each menu .when I click on the image I want to view the image in the screen size .the thing is when I click on every image I want it to Direct to a single page and call the image from there ..how is it possible to pass image variable from different pages to a single page..the so far did image view single page render is like below:,when the image component is did so it only views the first image not the other .what is the solution?
render() {
 this.state.incident = this.props.navigation.getParam('incidents','hi!!');
    this.state.tenantattachedagreement = this.props.navigation.getParam('tenantattach','hi!!!')
    // this.state.residents = this.props.navigation.getParam('residents','');
    // this.state.tenantattachedagreement = this.props.navigation.getParam('attachedagreement','');
    // console.log("attached agreement",this.state.tenantattachedagreement);
    // incidents = this.props.navigation.getParam('incidents,'');
    // console.log("hello",attached);
    // console.log("l&f pic",this.state.lostfound);
    console.log("incidentpic",this.state.incident);
    console.log("tenantattach",this.state.tenantattachedagreement);

    // console.log("residents",this.state.residents);

    return (
       <View style={{flex:1}}>
             <StatusBar
       barStyle = "light-content"
       hidden = {false}
       backgroundColor = "#32ACFD"
       translucent = {false}
       networkActivityIndicatorVisible = {true}
       />
        <View style={{flexDirection:'row',height:50,width:'100%',justifyContent:'center',alignItems:'center',backgroundColor:'#32ACFD',elevation:5,borderBottomWidth:1,borderColor:'#5b9bd5'}}>
             <TouchableOpacity onPress={()=>{this.props.navigation.goBack()}} style={{height:'100%',width:'12%',justifyContent:'center',alignItems:'center'}}>
               <Icon name="angle-left" style={{fontSize:25,color:'white'}}/>
             </TouchableOpacity>
             <TouchableOpacity onPress={()=>{this.props.navigation.navigate('DashBoard')}} style={{width:'33%',height:'100%',justifyContent:'center'}}>
               <Text style={{color:'white',fontSize:18,textShadowColor: 'grey',paddingLeft:'5%',fontWeight:'500',fontStyle:'normal',textShadowRadius:5,textShadowOffset: {width: -1, height: 1}}}>Smart Vitae</Text>
             </TouchableOpacity>
             <View style={{width:'35%',height:'100%',justifyContent:'center',alignItems:'center'}}>
                <Text style={{color:'white'}}>Unit: {this.state.unitname}</Text>
             </View>
             <TouchableOpacity onPress={()=>{this.props.navigation.navigate('Notification')}} style={{width:'10%',height:'100%',justifyContent:'center',alignItems:'center'}}>
                <Icon name="bell-o" style={{color:'white',fontSize:22}}/>
             </TouchableOpacity>
             <TouchableOpacity onPress={()=>{this.props.navigation.navigate('Settings')}} style={{width:'10%',height:'100%',justifyContent:'center',alignItems:'center'}}>
                 <Icon name="cog" style={{color:'white',fontSize:24}}/>
             </TouchableOpacity>
          </View>
        <View>
                <View style={{height:'100%',width:'100%',justifyContent:'center',alignItems:'center',borderColor:'#2E4053'}}>

                              <Image source={{uri:this.state.residents}} style={{height:'100%',width:'100%'}}></Image>
                              <Image source={{uri:this.state.lostfound}} style={{height:'100%',width:'100%'}}></Image>
                              <Image source={{uri:this.state.tenantattachedagreement}} style={{height:'100%',width:'100%'}}></Image>
                              <Image source={{uri:this.state.incident}} style={{height:'100%',width:'100%'}}></Image>
                </View>
        </View>

       </View>
    );
  }
}

A: I believe this is a styling issue, you have multiple images all trying to fill 100%
<Image source={{uri:this.state.residents}} style={{height:'100%',width:'100%'}}></Image>

Try using flex or updating your height, like this:
<Image source={{uri:this.state.residents}} style={{height:'25%',width:'100%'}}></Image>


text:
Q: overview of algorithms for AI, navigation, mapping, pathfinding I want to begin with the topic of artificial intelligence and autonomous robots. What book (or webpage?) do you recommend to get an overview of nowadays approaches in this area? I'd like to get hold of algorithms being used, to know their pros cons etc.
I know there are many threads here covering this subject, but what I find in discussions are particular algorithms and some references to them. I'd like to have a source which gives an overview of approaches, so that I can better imagine whole area of activity.
Any suggestions? Thank you very much!

A: The Wikipedia article about AI is a good place to start. Remember to look at the "See also", "References", "Further reading" and "External links" sections at the end of each article. This will help you start with the broad topic of AI and will guide you to more detailed articles about specific algorithms and so on.

A: One of your topics:

Mark De Berg: Computational Geometry, Chapter 13: Robot Motion
  Planning


text:
Q: Formato de Fecha en @Html.DropDownList - ASP.NET MVC
System.NotSupportedException: 'LINQ to Entities does not recognize the
  method 'System.String ToString(System.String)' method, and this method
  cannot be translated into a store expression.'

Como puedo aplicarle un formato decha dentro de un DropList intente con un select pero sale sin los 0 [01/02/2020 => 1/02/2020]
ViewBag.evento_horario_id = new SelectList(db.tb_evento_horario_colaborador.Where(a=>a.evento_id==id)
                .Select(a => new { id = a.id, fecha = a.fecha }).ToList(), "id", "fecha");

si no uso select me muestra en un formato MM/dd/yyy y en 12H
ViewBag.evento_horario_id = new SelectList(db.tb_evento_horario_colaborador.Where(a=>a.evento_id==id)  , "id", "fecha");

Y por esto es que le pongo un format creando una nueva lista pero me arroja el error mostrado al inicio
ViewBag.evento_horario_id = new SelectList(db.tb_evento_horario_colaborador.Where(a=>a.evento_id==id)
                                                        .Select(a => new { id = a.id, fecha = a.fecha.ToString("dd/MM/yyyy HH:mm:ss") })
                                                        .ToList(), "id", "fecha");

A: Para poder utilizar el método ToString() de .NET, primero tienes que obtener los resultados desde la BD en un objeto en memoria, o sea, debes hacer el Tolist() antes del Select().
De esta manera, debería funcionar:
ViewBag.evento_horario_id = new SelectList(db.tb_evento_horario_colaborador
                            .Where(a => a.evento_id == id)
                            .ToList()
                            .Select(a => new { id = a.id, fecha = a.fecha.ToString("dd/MM/yyyy HH:mm:ss") })
                            .ToList()
                            , "id", "fecha");


text:
Q: Best practice on flowing functions in JavaScript I receive data from request, and before display it I want to process it, like add/format/generate/order the raw content just received.
Here the way I receive data, and how I send it to the processData function
this.httpService.get(`this/is/my/url`, body).then((data) => {
    this.processData(data).then((result) => {
        this.data = result;
    }, (error) => {
        this.error = error;
    });
}, (error) => {
    this.error = error;
});

Note the processData function may need to call promises functions.
I see two ways to write the processData function :
First way
function processData(data) {
    return new Promise((resolve, reject) => {
        step1();

        function step1() {
            this.myService.yolo(data).then({
                //...
                step2();
            }, (error) => {
                reject(error);
            });
        }

        function step2() {
            this.myService.foo(data).then({
                //...
                step3();
            }, (error) => {
                reject(error);
            });
        }

        function step3() {
            this.myService.bar(data).then({
                //...
                step4();
            }, (error) => {
                reject(error);
            });
        }

        function step4() {
            //...
            resolve(data);
        }
   });
}

Second way
function processData(data) {
    step1().then((result) => {
        step2().then((result) => {
            step3().then((result) => {
                step4();
                return data;
            }, (error) => {
                reject(error);
            });
        }, (error) => {
            reject(error);
        });
    }, (error) => {
        reject(error);
    });

    function step1() {
        //...
    }

    function step2() {
        //...
    }

    function step3() {
        //...
    }

    function step4() {
        //...
    }
}

The second way makes me feel more logical, because you don't need to see the step functions content to understand what's going on, but I find the notation so confusing !
With 10 steps, this is unreadable.
So I was wondering what would be the good way to do that !

A: The key thing missing from how you're using promises is you're not returning anything from your then callbacks, which is how you chain promises together in a useful way.
Your processData can look like this:
function processData(data) {
    step1().then(step2).then(step3).then(step4);

    function step1() {
        //...
    }

    // ...
}

...where the steps look like this:
function step1() {
    return this.myService.yolo(data).then(result => {
        return transformedResult;
    });
}

...which means, of course, that unless they're complex, you don't need to break them into their own functions:
function processData(data) {
    return this.myService.yolo(data)
        .then(result => {
            return /*...`result` transformed in some way...*/;
        })
        .then(result => anotherAsyncCall(result))
        .then(result => {
            return /*...`result` transformed again... */;
        })
        .then(result => anotherAsyncCall(result)) // If no transformation needed when passing it on
        .then(/*etc.*/);
}

This is because every call to then returns a promise. The promise is either resolved with the value you return from your then callback, or if you return a promise it's resolved/rejected based on the resolution/rejection of that promise.


text:
Q: Listen to a specific application using C# and FiddlerCore I'am trying to integrate C# Web Browser control and Fiddler Core. I wan't to do this by letting Fiddler Core to listen to the Web Browser control without affecting any internet explorer or other internet browsers.
The diagram below should show what I want to achieve:
Internet Explorer -> Internet
Chrome -> Internet
Other Browsers -> Internet
Web Browser Control (Custom C# App) -> Fiddler Core -> Internet

The four instance below should run parallel without fiddler core interfering with other browsers. So if I wan't to change the response HTML in my Custom App, this will not affect the other browsers.
I've been searching on Google for a while now but I cannot see any concrete example to get me started.
Thank you in advance guys, any help would be greatly appreciated.

A: FiddlerCore exposes the calling process information in each session's X-ProcessInfo flag.
By default, FiddlerCore will register as the system proxy and most applications will automatically route their traffic through it.
If you want to capture traffic from only a single application, the steps are:

*

*Don't register as the system proxy when calling .Startup.

*The target application's proxy settings must be pointed at FiddlerCore's port.

Now #1 is trivial, but #2 is harder, and depends entirely on what networking code the target application uses. You mentioned that the target application is a custom C# application hosting the .NET Web Browser control (which is just IE). If that's the case, and if the application is also hosting FiddlerCore, then you need only call
Fiddler.URLMonInterop.SetProxyInProcess("127.0.0.1:8889", String.Empty);
...inside of your application.


text:
Q: word-wrap in IE I really want to know why and how to fix this thing.

The first image is from IE8 while the second is from Chrome.
What I want is the second one. Any advice?

A: You probably need to use the css rule:
white-space:nowrap;

This prevents text from going onto the next line

A: This is most likely to do with font rendering. It's different between browsers and some will render ever so slightly larger that others. Ultimately you don't want to be trying to fit words into spaces exact to the pixel. If you want to do that make sure you're using fluid layouts with percentage width and auto height.


text:
Q: Effective way in LINQ of joining based on index I have written code that works, but I can't seem to find a better way to combine the lists together if they have the same index.
    class Apple {};
    class Carrot {};

    var apples = new list<Apple>();
    var carrot = new list<Carrot>();

    var combine = from a in apples
                  from c in carrots
                  where apples.IndexOf(a) == carrots.IndexOf(c)
                  select new {a, c};

(When I say combine, I don't mean append to the end of the list. {{a,b},{a,b}, .... { }}: Maybe I have the terminology wrong when trying to research.)

A: apples.Select((a,i)=> new { Apple = a, Carrot = carrots[i] });

That should work too.

A: You can use Enumerable.Zip:
var combine = apples.Zip(carrots, (a, c) => new { Apple = a, Carrot = c});


text:
Q: Compare dates within the same column I have the following query:
SELECT title, DATE(end) AS Regresso FROM raddb.AgendaSaidas WHERE title = '763';

Returns the following data:
# title, Regresso
'763', '2023-01-11'
'763', '2023-01-08'
'763', '2023-01-07'
'763', '2023-01-01'

If you notice, there are two dates with a difference of 1 day, this one 2023-01-07 and this one 2023-01-08.
I intend to compare these dates and in this situation only return the most recent date.
I want it to only return records where the date is different by at least 3 days.
I'm trying this but it doesn't work:
SELECT DISTINCT title, DATE(end) AS Regresso
FROM raddb.AgendaSaidas AS d1, raddb.AgendaSaidas AS d2
WHERE d1.title = '763' AND d2.title = '763' AND DATE(d1.end) >= (DATE(d2.end) + INTERVAL 3 DAY)

I'll put the data I want it to return as:
# title, Regresso
'763', '2023-01-11'
'763', '2023-01-08'
'763', '2023-01-01'

Example

A: WITH
cte1 AS (
    SELECT title,
           DATE(end) AS Regresso
    FROM raddb.AgendaSaidas
    WHERE title = '763'
),
cte2 AS (
    SELECT title,
           Regresso,
           DATEDIFF(LEAD(Regresso) OVER (ORDER BY Regresso), Regresso) delta
    FROM cte1
)
SELECT title, Regresso
FROM cte2
WHERE delta >= 3 OR delta IS NULL;


text:
Q: Issue correctly using CEREAL_REGISTER_DYNAMIC_INIT in C++ Cereal library I've moved to using a lib file and wanted to make use of CEREAL_REGISTER_DYNAMIC_INIT properly. I don't know if I need to use this, but I noticed an issue with one of my cerealization types not being picked up properly in a separate DLL and thought this might help.
in accountActions.h I have the following at the end of the file:
CEREAL_FORCE_DYNAMIC_INIT(mv_clientactions);

In accountActions.cpp I have the following near the top of the file:
#include "clientActions.h"

#include "cereal/cereal.hpp"
#include "cereal/types/base_class.hpp"
#include "cereal/types/polymorphic.hpp"
#include "cereal/archives/adapters.hpp"

#include "cereal/archives/portable_binary.hpp"
#include "cereal/archives/json.hpp"

CEREAL_REGISTER_TYPE(CreatePlayer);
CEREAL_REGISTER_TYPE(LoginRequest);
CEREAL_REGISTER_TYPE(FindMatchRequest);
CEREAL_REGISTER_TYPE(ExpectedPlayersNoted);
CEREAL_REGISTER_DYNAMIC_INIT(mv_accountactions);

Assume mv_accountactions is just a completely made up string. I don't have any library or dll named that, but figured it is used to link these two units together? Documentation is sparse and I may be using this incorrectly.
The error I'm getting is this:
1>  c:\git\bindstone\source\game\networklayer\accountactions.cpp(13): error C2084: function 'void cereal::detail::dynamic_init_dummy_mv_accountactions(void)' already has a body
1>  c:\git\bindstone\source\game\networklayer\accountactions.h(127): note: see previous definition of 'dynamic_init_dummy_mv_accountactions'
I've double checked and am not using mv_accountactions anywhere else... I don't know what might cause this or how to resolve it. I'm wondering if I even need the CEREAL_REGISTER_DYNAMIC_INIT, or if there's a safe way to use it in case I do move to a DLL and I'm just misusing it.
Advice would be greatly appreciated.
Issue Opened Here: https://github.com/USCiLab/cereal/issues/523

A: I seem to have been able to fix this by defining the CEREAL_FORCE_DYNAMIC_INIT with the previously missing CEREAL_DLL_EXPORT
Before (not working in VS 2017):
//! Forces dynamic initialization of polymorphic support in a
//! previously registered source file
/*! @sa CEREAL_REGISTER_DYNAMIC_INIT

    See CEREAL_REGISTER_DYNAMIC_INIT for detailed explanation
    of how this macro should be used.  The name used should
    match that for CEREAL_REGISTER_DYNAMIC_INIT. */
#define CEREAL_FORCE_DYNAMIC_INIT(LibName)              \
  namespace cereal {                                    \
  namespace detail {                                    \
    void dynamic_init_dummy_##LibName();                \
  } /* end detail */                                    \
  namespace {                                           \
    void dynamic_init_##LibName()                       \
    {                                                   \
      ::cereal::detail::dynamic_init_dummy_##LibName(); \
    }                                                   \
  } } /* end namespaces */

After (Fixed):
//! Forces dynamic initialization of polymorphic support in a
//! previously registered source file
/*! @sa CEREAL_REGISTER_DYNAMIC_INIT

    See CEREAL_REGISTER_DYNAMIC_INIT for detailed explanation
    of how this macro should be used.  The name used should
    match that for CEREAL_REGISTER_DYNAMIC_INIT. */
#define CEREAL_FORCE_DYNAMIC_INIT(LibName)              \
  namespace cereal {                                    \
  namespace detail {                                    \
    void CEREAL_DLL_EXPORT dynamic_init_dummy_##LibName();                \
  } /* end detail */                                    \
  namespace {                                           \
    void dynamic_init_##LibName()                       \
    {                                                   \
      ::cereal::detail::dynamic_init_dummy_##LibName(); \
    }                                                   \
  } } /* end namespaces */


text:
Q: Uniform integrability of the average of i.i.d.s So I'm being asked to show that for an i.i.d ${X_i}$, ${n^{-1}S_n}$  is uniformly integrable provided $X_i\in L_1$  My professor keeps insisting that $S_n$ is a number and not a random variable, which it seems like it should be a random variable to me.
In any case, I'm trying to prove $n^{-1}S_n$ converges in $L_p$ to $X_1$,  thus it is $u.i.$,  and it seems trivial to me, but my professor kept saying no, in an accent I can't make out.   It seems to me that $E(n^{-1}S_n)=n^{-1}E(\sum _{k=1}^nX_k)=n^{-1}\sum_{k=1}^{n}E(X_k)=n^{-1}nE(X_1)=E(X_1)$,  since they are i.id,  so of course they converge in expectation to $X_1$, which is the definition of $L_1$ convergence.  Is this wrong?

A: $n^{-1}S_n$ converges in $L^1$ and a.s. to $\mathbb{E} (X_1)$, by the Strong law of large numbers. Then notice the fact that
\begin{equation}
X_n \in L^1 \, \,\forall n \in \mathbb{N}, \, (X_n) \text{ converges to } X \text{ in } L^1 \Longleftrightarrow  (X_n) \text{ converges to } X \text{ in probability and } (X_n) \text{ is U.I. }
\end{equation}


text:
Q: Can't select object in list and delete it I've spent an hour or two collectively now trying to figure this problem out but I'm not getting any results. In my program when a defending animal is "killed" it should be deleted from it's registry, but no matter what I do I can't seem to get that to happen. In this instance if I were to initiate a hunter and a buffalo then attack() the buffalo with the hunter the buffalo should be killed and removed from it's classes registry but I can't get python to select that specific buffalo from the registry.
Any help is appreciated.
class IterRegistry(type):
    def __iter__(cls):
        return iter(cls._registry)

class Buffalo(object):
    __metaclass__ = IterRegistry
    _registry = []
    hp = 1
    price = 150
    attacks = 0
    regeneration = 2

    def __init__(self, name):
        self._registry.append(self)
        self.name = name

def createBuffalo():
    for i in range(len(Buffalo._registry),len(Buffalo._registry)+1):
        varname = ("b" + str(i))
        globals()[varname] = Buffalo("b" + str(i))

class Wolf:
    __metaclass__ = IterRegistry
    _registry = []
    hp = 1
    price = 0
    attacks = 2
    regeneration = 1.5

    def __init__(self, name):
        self._registry.append(self)
        self.name = name

def createWolf():
    for i in range(len(Wolf._registry),len(Wolf._registry)+1):
        varname = ("w" + str(i))
        globals()[varname] = Wolf("w" + str(i))

class Hunter:
    __metaclass__ = IterRegistry
    _registry = []
    hp = 2
    price = 0
    attacks = 1
    regeneration = 0
    balance = 0

    def __init__(self, name):
        self._registry.append(self)
        self.name = name

def createHunter():
    for i in range(len(Hunter._registry),len(Hunter._registry)+1):
        varname = ("h" + str(i))
        globals()[varname] = Hunter("h" + str(i))

def attack(attacker, target):
    if attacker.attacks >= 1:
        target.hp -= 1
        if target.hp == 0:
            if type(attacker) == Hunter:
                attacker.balance += 150
            print(target)
            if type(target) == Wolf:
                del Wolf._registry[[n for n in Wolf._registry if n == target]]
            if type(target) == Hunter:
                del Hunter._registry[[n for n in Hunter._registry if n == target]]
            if type(target) == Buffalo:
                del Buffalo._registry[[n for n in Hunter._registry if n == target]]

One more note, the reason I have double brackets is because it was incorrect syntax with single brackets but the syntax was fine with doubles.
If you need any more code, ask in a comment below (I have not included all of it but it should be enough).

A: The issue you're trying to solve is caused by trying to use a list as an index to be removed from your list
[n for n in Wolf._registry if n == target]

All you're trying to get out of this list comprehension is the target, so just use that.
Wolf._registry.remove(target)


text:
Q: My Android APK show google map On sony phone but don''t show on huawei phones I have a problem for showing google map on android apk.
I develop this on google API 2.1 and it's work on sony experia z but not work on huawei phone or lower sony phone...
on my phone( sony experia z) that's work exactly...
I user : google api2.1 ,
         (google_play_services_lib versionCode:3027110, versionName="3.0.27 (601249-10)")
Edited :
android manifest Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="BamSystem.UrbanMarkets.Activity"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="7" />

    <permission android:name="android.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
    <uses-permission android:name="android.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>
    <uses-library android:name="com.google.android.maps" />

    <application

        <meta-data
                android:name="com.google.android.gms.version"
                android:value="6" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="API_KEY"/>

    </application>

google map activity :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:orientation="vertical">

<TextView
    android:id="@+id/txtTitle"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#f05a00"
    android:gravity="center"
    android:height="48dp"
    android:text="title"
    android:textColor="#FFFFFF"
    android:textSize="30dp" />

<LinearLayout
    android:id="@+id/lnrMap"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:orientation="vertical"
    android:visibility="visible" >

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="fill_parent"
        android:layout_height="300dp"
        android:layout_weight="1" />
</LinearLayout>

A: Check whether you have Google Play Services app installed on your device.

A: On May 16, 2019, the US government placed Huawei on its Entity List. This government action prohibits all US companies, including Google, from collaborating with Huawei.
This means that Google is prohibited from working with Huawei on new device models or providing Google's apps including Gmail, Maps, YouTube, the Play Store and others for preload or download on these devices.
more info here
https://support.google.com/android/thread/29434011?hl=en


text:
Q: Is it possible to make a struct return a value directly? I wish to be able to return a value directly from a struct when it's called instead of accessing what I want through its member functions. Is this possible?
For example:
#include <iostream>

using namespace std;

enum FACE { NORTH, SOUTH, EAST, WEST };

struct Direction {
    FACE face;
};

int main(){
    Direction dir;
    dir.face = EAST;

    cout << dir;  // I want this to print EAST instead of having to do dir.face
}

A: You may add operator of conversion FACE:
struct Direction {
    // .. Previous code

    operator FACE () const { return face; }
};

Live example

A: You can define the << operator to do that.
std::ostream& operator<<(std::ostream& os, Direction const& dir)
{
    return os << dir.face;
}

Working example
Or if you want the string "EAST" instead of the int value in the enum
std::ostream& operator<<(std::ostream& os, Direction const& dir)
{
    std::string face = "";
    switch(dir.face)
    {
    case(NORTH):
        os << "NORTH";
        break;
    case(SOUTH):
        os << "SOUTH";
        break;
    case(EAST):
        os << "EAST";
        break;
    case(WEST):
        os << "WEST";
        break;
    }
    return os << face;
}

Working example


text:
Q: NetBeans cannot connect to repository at (gitlab repository) Yesterday I installed a new version of Netbeans (NetBeans IDE 8.2 (Build 201705191307)) and since then I can't connect to my gitlab repo (fails on trying to clone project). Credentials are fine, work on other computers and systems and I logged in over the browser(my first thought was that I tried a wrong password and banned my IP).
I use Windows 10, Java 1.8.0_31.
EDIT: Access to gitlab worked on an older version of NetBeans (not sure which one was it but above 8.0)
Updated JDK to 1.8.0_171 - still no success.
Also this was found in IDE log

INFO [org.netbeans.modules.git]: java.lang.InternalError: Should not get here
  java.lang.InternalError: Should not get here
      at sun.nio.fs.WindowsNativeDispatcher.CreateSymbolicLink0(Native Method)
      at sun.nio.fs.WindowsNativeDispatcher.CreateSymbolicLink(WindowsNativeDispatcher.java:901)
      at sun.nio.fs.WindowsFileSystemProvider.createSymbolicLink(WindowsFileSystemProvider.java:578)
      at java.nio.file.Files.createSymbolicLink(Files.java:1043)
      at org.eclipse.jgit.util.FileUtil.createSymLink(FileUtil.java:96)
      at org.eclipse.jgit.util.FS_Win32_Java7.detectSymlinkSupport(FS_Win32_Java7.java:80)
      at org.eclipse.jgit.util.FS_Win32_Java7.supportsSymlinks(FS_Win32_Java7.java:71)
      at org.eclipse.jgit.internal.storage.file.FileRepository.create(FileRepository.java:306)
      at org.eclipse.jgit.lib.Repository.create(Repository.java:169)
      at org.netbeans.libs.git.jgit.commands.InitRepositoryCommand.run(InitRepositoryCommand.java:89)
      at org.netbeans.libs.git.jgit.commands.GitCommand$1.run(GitCommand.java:80)
      at org.netbeans.libs.git.jgit.commands.GitCommand$1.run(GitCommand.java:77)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.netbeans.libs.git.jgit.commands.GitCommand.execute(GitCommand.java:77)
      at org.netbeans.libs.git.GitClient.init(GitClient.java:871)
      at org.netbeans.modules.git.client.GitClient$33.call(GitClient.java:574)
      at org.netbeans.modules.git.client.GitClient$33.call(GitClient.java:570)
      at org.netbeans.modules.git.client.GitClient$CommandInvoker$1$1.call(GitClient.java:956)
      at org.netbeans.modules.git.client.GitClient$CommandInvoker$1.call(GitClient.java:979)
      at org.netbeans.modules.git.FilesystemInterceptor.runWithoutExternalEvents(FilesystemInterceptor.java:496)
      at org.netbeans.modules.git.Git.runWithoutExternalEvents(Git.java:282)
      at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethodIntern(GitClient.java:989)
      at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:916)
  Caused: org.netbeans.libs.git.GitException
      at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:932)
      at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:898)
      at org.netbeans.modules.git.client.GitClient$CommandInvoker.access$400(GitClient.java:892)
      at org.netbeans.modules.git.client.GitClient.init(GitClient.java:570)
  [catch] at org.netbeans.modules.git.ui.clone.RepositoryStep$RepositoryStepProgressSupport.perform(RepositoryStep.java:323)
      at org.netbeans.modules.git.client.GitProgressSupport.performIntern(GitProgressSupport.java:115)
      at org.netbeans.modules.git.client.GitProgressSupport.run(GitProgressSupport.java:108)
      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
      at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
      at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)

A: The stack trace shows that the code failed when trying to create a symbolic link by calling Files.createSymbolicLink(). To do that on Windows 10 you must run with Administrator rights, or you need to have the right to create a symbolic link, so the true solution to your problem is to set appropriate User Account Control (UAC). This is the case even if you created the file or directory to which you want to add a symbolic link.
If you open a Command Prompt window, create a directory and then try to add a symbolic link it will fail with the error "You do not have sufficient privilege to perform this operation", but if you do the same thing when selecting Run as Administrator before opening a Command Prompt window it works fine:

The same principles apply when creating a symbolic link in a Java application on Windows 10, and again the proper solution is to set UAC appropriately. However, there is an easy workaround solution: just as you can open a Command Prompt window as an administrator, you can also run NetBeans as an administrator:

Once you do that the java.lang.InternalError should be gone.
You can run the trivial Java application below to confirm that admin rights are needed when creating a symbolic link under Windows 10. The application fails with a FileSystemException ("A required privilege is not held by the client.") when calling Files.createSymbolicLink() from NetBeans if it is started normally, but works fine when NetBeans is Run as administrator.
public class SymLink {

    public static void main(String... args) throws IOException {
        String originName = "c:\\ThisIsJunk";
        String targetName = originName + "SymLnk";
        Path origin = Files.createDirectories(Paths.get(originName));
        Path target = Paths.get(targetName);
        try {
            Files.delete(target);
        } catch (NoSuchFileException e) {
        }
        try {
            Path symLink = Files.createSymbolicLink(target, origin);
            System.out.println("Symbolic link created: " + symLink.toString());
        } catch (AccessDeniedException e) {
            e.printStackTrace();
        }
    }
}

A: After having the same issue mentioned above while running in Administrator Mode, I noticed I had Netbeans running in Windows 8 Compatibility mode. Unchecking compatibility mode, I was then able to connect to the Github repository.


text:
Q: How can I fix this issue, installing the Google Cloud SDK? I can't seem to find a way to install the Google cloud platform. I have tried to download from the Eclipse Marketplace, from the web page; and nothing.
After some work, I have reached the point where in the installation terminal, they ask me if I want to UPDATE %PATH% to include CLOUD SK Binaries?
I put yes and this happens:

even though my system variables are:

Please Help

A: I just tried it installing it in a new windows vm from here and the %PATH% the installation created is not the same as yours. In my case it was
C:\Users\<YOUR_USER>\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin

Are you sure Cloud SDK binaries are in C:\Program Files (x86)\Google\google-cloud-sdk\bin?


text:
Q: Delete table older than 10 days PROBLEM HAS BEEN SOLVED
ANSWER:
delete from `[table name]` where [row name] > AddTime( CurTime(), '14400 hour' )

This instantly deletes anything that is older than 10 days OLD.

A: first change string into DATETIME with help of  STR_TO_DATE

It takes a string str and a format string format. STR_TO_DATE() returns a DATETIME

SELECT STR_TO_DATE('Wed Nov 21 2012',  '%a %b %d %Y' )

// return 2012-11-21

then use DATEDIFF

DATEDIFF(expr1,expr2)
DATEDIFF() returns expr1 – expr2 expressed as a value in days from one date to the other.

SELECT DATEDIFF(CURRENT_TIMESTAMP(),STR_TO_DATE('Wed Nov 21 2012','%a %b %d %Y'))
//return 8

so complete query will be
$sql="DELETE FROM `journal`
      WHERE DATEDIFF(CURRENT_TIMESTAMP(),
                     STR_TO_DATE('journal_date','%a %b %d %Y')
                    ) > 5";

Note : in STR_TO_DATE function
use %d if you store day of month part with leading Zero ( 01..31 )
  OR use %e  if you store day of month part without leading zero (1..31)

A: MySQL date/time functions all work on MySQL DATE and DATETIME values of the format:
2012-11-28

2012-11-28 22:16:00

If you are actually storing your dates in the format you're specifying, MySQL cannot parse that.
For information on MySQL's date/time functions, see: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

A: You Can Use cron jobs to run specified script

A: Apparently the order of the dates matters. According to the MySQL reference for datediff() your dates are backwards, so you are probably only getting negative numbers (hence never more than 5, so no deletions).

A: Use abs() mathematical function to ignore negative date diffrence which is  causing the problem apparently.
$sql="delete from `journal` where
        abs(datediff(now(), STR_TO_DATE('journal_date',  '%a %b %d %Y'))) > 5"

A: delete from journal where journal_date < date_sub(curdate(),interval 5 day)
it can use index on column journal_date
but "datediff(now(), journal_date) > 5 " can't use index  on column journal_date


text:
Q: Readium js viewer config language How do i configure the language from readium js viewer to translate the buttons in the audio player.

This is my current configuration:
    config : {
    'readium_js_viewer/ModuleConfig' : {
        'fonts': fontsArray,
        'useSimpleLoader' : false,
        'epubLibraryPath': undefined,
        'canHandleUrl' : false,
        'canHandleDirectory' : false,
        'workerUrl': undefined,
        'epubReadingSystemUrl': undefined
    }
}

A: Just add
navigator.userLanguage = 'es' or the language that you want


text:
Q: Error Send Email : An invalid character was found in the mail header: ';' I am trying to create a sending email app and found some error. the email will be send to a certain recipient using checkbox inside gridview.
the condition are:

if email in coulmn 16 is not null then the email will be send directly. --> this is already work
if email in column 16 is null then the email will be send to the recipient in column 17. --> it's throw an error in this part.

here is my code for sending the mail:
Dim X As Integer
    For X = 0 To GridView1.Rows.Count - 1
        Dim chkBox As CheckBox = CType(GridView1.Rows(X).Cells(18).Controls(1), CheckBox)
        If chkBox.Checked = True Then
Dim email2 As String
            If GridView1.Rows(X).Cells(16).Text <> "" Then
                email2 = Trim(GridView1.Rows(X).Cells(16).Text)
            Else
                email2 = Trim(GridView1.Rows(X).Cells(17).Text)
            End If
            Try
                Dim EmailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage
                EmailMessage.From = New MailAddress("mailaddress.bla.com")
                EmailMessage.To.Add(email2)
                EmailMessage.Subject = "Attire Request"
                EmailMessage.IsBodyHtml = True
                Dim link As String = "some link"
                EmailMessage.Body = "Please login by Using this link <a href=""" & link & """>Click here </a>"

                Dim smtp As New SmtpClient(Server2)
                Dim basicAuthenticationInfo As New System.Net.NetworkCredential(Username2, Password2)
                smtp.Credentials = basicAuthenticationInfo
                smtp.Send(EmailMessage)

            Catch ex As Exception
                ' lblError.Text = lblError.Text & ex.Message & " " & ex.InnerException.ToString
                lblError.Text = ex.Message
                lblError.Visible = True
            End Try

it's throws an error : An invalid character was found in the mail header: ';'.
do you have any suggestion how to fix this.
edited : code for looping
Thanks in advances.

A: change your if-else statement as follows:
If GridView1.Rows(x).Cells(16).Value.ToString <> "" Then
email2 = Trim(GridView1.Rows(x).Cells(16).Value.ToString)
Else
email2 = Trim(GridView1.Rows(x).Cells(17).Value.ToString)
End If

Note:- the Row is selected on the basics of the value of X; loop can be used to select multiple rows in single click


text:
Q: Improve multiple merges of dataframes I have the following dataframes:
print(inventory_df)

dt_op        Prod_1  Prod_2 ... Prod_n
10/09/18       0        0         0
11/09/18       0        0         0
12/09/18       0        0         0

...

print(final_inspect)

    dt_op        Prod_1
    10/09/18       10
    11/09/18       2
    12/09/18       5

print(updated_df)
    dt_op        Prod_1  Prod_2 ... Prod_n
    10/09/18      10        0         0
    11/09/18       2        0         0
    12/09/18       5        0         0

    ...

I am trying to update the dataframe "inventory_df", with the values contained in "final_inspect", in order to get "updated_df" with:
final_inspect = pd.DataFrame(data = {'dt_op': inspect["dt_op"] , j: inventory})
final_inspect_1 = pd.DataFrame(data = {'dt_op':inventory_df.dt_op })

final_inspect_1 = final_inspect_1.merge(final_inspect, on = "dt_op", how = "left").fillna(0)
inventory_df = inventory_df.merge(final_inspect_1, on = ["dt_op", j], how = "outer").fillna(0)

inventory_df = inventory_df.drop_duplicates(subset=None, keep='first', inplace=False)

The solution is cumbersome, but the update function from pandas does not seem to work ( inventory_df.update(final_inspect) ).
How can I improve this solution, in order to run it on several (3000) items?
N.B. The size of updated_df has to be the same as inventory_df, and nrows of final_inspect are less than nrows of inventory_df.


text:
Q: Wrapping add.period I am trying to adapt the BibTeX style file supplied with the LNI LaTeX template to actually match the style defined in the guidelines from the same page (sorry, as opposed to the guidelines document, the page with the links is only available in German). I had never looked into the BST language before and thus was happy to easily being able to modify the number of displayed names and the format of names, but the separator after the list of authors is still an open issue:
The style file insists on adding a fullstop by using the add.period command after each segment of a bibliography item. The guidelines, however, require that a colon be added after the author names.
I have tentatively inserted a colon in the various template functions, which are generally structured like this:
format.authors "author" output.check
new.block
format.title "title" output.check

new.block and output.check being generic functions defined in the same BST file. Somewhere in there, add.period is invoked.
Unfortunately, if I add a colon either before or after new.block, another period is added after the colon, making the references look like this:

Sample, S.; Example, E.:. An Example Paper For Your Bibliography.

Apparently, add.period ignores colons (well, the documentation implicitly states just that). Therefore, my idea was wrapping the add.period function (which is called only three times in the BST file, so replacing all calls with calls to the wrapper function should be feasible) that checks whether the last character is a colon, and if so, nothing is done, otherwise add.period is invoked.
This is my wrapper function:
FUNCTION {safe.add.period}
{ 's :=
  s s text.length$
  #1 substring$
  ":" =
    'skip$
    { s add.period$ 's := }
  if$
  s
}

It should work like this:

*

*take the topmost string from the stack and store it as s

*put that string and its length onto the stack

*replace those two with the last character of the string

*compare that character with a colon

*if the comparison returned true, do nothing, else invoke add.period on s and assign the result back to s

*put s back onto the stack, as the pure add.period would

I have replaced all three invocations of add.period with safe.add.period, however all periods are missing now. It seems like add.period never gets called. What am I doing incorrectly?


text:
Q: Perforce: Additional edits after resolve I've performed integration (p4 integrate) and then resolved conflicts in all files (p4 resolve ...). After that I noticed that one conflict could be resolved better by providing additional edits.
I want Perforce to think that the additional edits (after p4 edit file/in/question and vim file/in/question) are part of resolution, not an separate edit.
How can achieve this using p4 command line tool?

A: If you do p4 edit and make the edits, they will be part of the same atomic changelist and the same revision.
(It is possible to make the edits in such a way as to have them not get propagated back to the source on a reverse integrate, by "hiding" them in the merge, but you probably don't want to do this because it likely means you'll end up re-resolving the conflict later.)


text:
Q: How to prevent dropdown from executing when source list is changed programmatically I have an activeX dropdown form on my spreadsheet which executes code on _Change. My code modifies the dropdowns list source (adding or deleting items). Whenever this happens, the _Change is called again.
I have various workarounds, all of which were some version of changing the list source, but with no success. The reason none of this has worked is because clearing or altering the .ListFillRange actually triggers the _Change event again.
How do I prevent the _Changeevent from getting called if I want to add or delete items in the .ListFillRange
UPDATE w EnableEvents set to false:
Public Sub SetRangeForDropdown()
On Error Resume Next

    Application.EnableEvents = False

    'Get new List of employees from Employee sheet
    Dim rng1 As Range
    With wsDB_employee
        Set rng1 = .Range("A2:B" & .Range("A10000").End(xlUp).Row)
    End With
    With wsStage
        .Cells.Clear
        rng1.Copy .Range(.Cells(1, 1), .Cells(rng1.Rows.Count, 2))
    End With

    'Set range for dropdown on employee sheet
    Dim rng2 As Range
    Set rng2 = wsStage.Range("A1:B" & wsStage.Range("A10000").End(xlUp).Row)

    'Update employee list named formula
    ActiveWorkbook.Names.Add Name:="nfEmployeeList", RefersTo:=rng2
    Dim str As String
    str = rng2.Parent.Name & "!" & rng2.Address 'Source path for list fill range
    wsMA.cmbEmployeeSelection.ListFillRange = str

    Application.EnableEvents = True

End Sub

Apperantly EnableEvents does not work for ActiveX controls.
Thank you Microsoft for making life just a little bit more complicated!
Just found this: "Application.EnableEvents=False/True ONLY applies to Sheet and Workbook Events, not ActiveX Control Events" from here enter link description here

A: You can disable the events in the SetRangeForDropdown and then enable them back.
So, write the following at the start:
Application.EnableEvents = False

And the following at the end:
Application.EnableEvents = true

A: it's always a good habit to make (nearly) sure that events handling is always brought back, like follows:
Public Sub SetRangeForDropdown()

'...your code

    On Error GoTo ExitSub
    Application.EnableEvents = False
    wsMA.cmbEmployeeSelection.ListFillRange = rng2

    'Update employee list named formula
    ActiveWorkbook.Names.Add name:="nfEmployeeList", RefersTo:=rng2

ExitSub:
    Application.EnableEvents = True

End Sub

Furthermore, avoid On Error Resume Next unless you really need it

A: I have solved the problem by adding a global variable that prevents the _Change event from firing. Here is that code:
Private Sub cmbEmployeeSelection_Change()

If bNOTRUN = False Then 'Check if ActiveX event should fire or not

    modEmployeeDB.SaveEmployeeData 'Save currently selected employee data
    modEmployeeDB.DBSoll_To_WorkerInfo 'Get called employee data

End If

End Sub

And this is the module as modified... note the simple Boolean variable that I added:
Public Sub SetRangeForDropdown()

On Error GoTo SetRangeForDropdown_Error

    bNOTRUN = True 'Global Variable that when True prevents Active X from firing

    'Get new List of employees from Employee sheet
    Dim rng1 As Range
    With wsDB_employee
        Set rng1 = .Range("A2:B" & .Range("A10000").End(xlUp).Row)
    End With
    With wsStage

        .Cells.Clear
        rng1.Copy .Range(.Cells(1, 1), .Cells(rng1.Rows.Count, 2))

    End With

    'Set range for dropdown on employee sheet
    Dim rng2 As Range
    Set rng2 = wsStage.Range("A1:B" & wsStage.Range("A10000").End(xlUp).Row)

    'Update employee list named formula
    ActiveWorkbook.Names.Add Name:="nfEmployeeList", RefersTo:=rng2
    Dim str As String
    str = rng2.Parent.Name & "!" & rng2.Address 'Source path for list fill range
    wsMA.cmbEmployeeSelection.ListFillRange = str

    bNOTRUN = False

    On Error GoTo 0
    Exit Sub

SetRangeForDropdown_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure SetRangeForDropdown of Sub modEmployeeDB"
    bNOTRUN = False

End Sub


text:
Q: Pulling metafields for variants in Shopify I am trying to pull metafields for variants and/or single products.
Effectively i have a catalog of products, some are simple products some have variants. For instance, some products are beds with variants of different sizes. therefore the metafield dimensions are different for these products.
I am unaware if there is a liquid command to pull full array of metafields of a product.
What i am looking to implement is.
Define if product has variants.
if yes -> Pull array/list of  variant metafields for selected variant.
if no -> pull list of array/list of product metafields.
i am capable of showing product metafield values or variant values such as below, however this does not feel efficient and i am unable to determine if the product is a variant or single product.
                {%- if product.metafields.global.length_cm.value != blank -%}

                    Seat Width (cm)
                    {{ product.metafields.global.seat_width_cm.value }}

                {%- endif -%}
                {%- if product.metafields.global.width_cm.value != blank -%}

                    Seat Depth (cm)
                    {{ product.metafields.global.seat_depth_cm.value }}

                {%- endif -%}

is there a way also to inject code into a liquid command.
such as something along the lines of this?
{% assign main_dimensions = "width_cm, height_cm, depth_cm, length_cm" | split: ','%}
{% assign main_dimensions_title = "Width (cm), Height (cm), Depth (cm), Length(cm)" | split: ','%}

{{ main_dimensions_title[1]}} - {{ product.metafields.global.main_dimensions[1].value }}


text:
Q: How do I convert Excel OpenXML shared strings to inline strings? I have a large spreadsheet in Excel 2007 OpenXML format that I want to manipulate in xml programmatically. Excel saves it using the shared strings method which, while more efficient, complicates the process. Does anyone know if there is an option buried in Excel to save using inline strings, or maybe a utility already build to place all the strings back inline within the sheet.xml again? Haven't had much luck googling and I'd rather use an existing solution rather than building my own converter if possible. Thanks.

A: It should be pretty easy to do so (just iterate through though each page/row/shared string cell looking up its value in the table and then changing its value and type), but why would you want to (unless you were doing some XSLT or something)?  By inlining everything, you probably increase file size.   Just make sure any cell you modify you change to inline string.

A: See a tutorial: Reading and writing to Excel 2007 or Excel 2010 from C#


text:
Q: How to change UINavigationBar depending on the UIViewController shown in UINavigationController As the question says, I need to be able to change the contents of the UINavigationBar when different UIViewControllers are displayed by the UINavigationController. This is easily achievable for titles since the navigation controller just uses the view controller's title property. What I am struggling with is changing the left and right bar button items depending on the view controller.
The code that I would use to change them has already been addressed in multiple other questions and isn't really the issue, although for reference I will be using the following:
UIBarButtonItem *newItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
    UIBarButtonSystemItemAdd target:self action:nil];
newItem.tintColor = [UIColor whiteColor];
self.navigationItem.rightBarButtonItem = newItem;

I think what I am looking for is a method which is called every time that a new UIViewController is shown by the navigation controller in order to set up the navigation controller layout. In the documentation of the UINavigationController is the following method:
// Called when the navigation controller shows a new top view controller via a push, pop or setting of the view controller stack.
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;

However, this method is seemingly not called at any point when I run the app. So, is there a method which is called when a new view controller is shown by the navigation controller? Or am I going completely wrong here and there is already an accepted way of having the navigation bar change with the view being displayed beneath it which I have so far missed?

A: The typical solution is to put code in each view controller's viewDidLoad method that sets up the desired buttons.
The first bit of code in your question would be a perfect example of a view controller setting up a desired button to be shown on the right side of the nav bar when it (the view controller) is displayed.
There is nothing you need to do with navigation controller delegates or the navigation controller itself.


text:
Q: ASP Core: How to set httpContext.User? I writing middleware for authentication with tokens. (don't ask me: "why?").
...
private UserManager<ApplicationUser> userManager;
private RequestDelegate next;
private WareHouseDbContext context;
...
public async Task Invoke(HttpContext httpContext)
{
    var header = httpContext.Request.Headers.Where(x => x.Key == "Authorization");
    if (header.Count() == 1)
    {
        var token = header.First().Value.First();
        if (token.Contains("Bearer"))
        {
            var name = TokenEncryptor.Decrypt(token.Replace("Bearer ", ""));
            var user = context.Users.FirstOrDefault(x => x.UserName == name);

            if (user != null)
            {
                httpContext.User = user; // ???? how do this  ???/
            }
        }
    }
    await next.Invoke(httpContext);
}

Please answer me how to set httpContext.User?

A: you must create IPrincipal object like this
var user = new GenericPrincipal(new ClaimsIdentity(userData.Username), userData.Roles);
httpContext.User = user;


text:
Q: Making a Session service available to my SessionsController in AngularJS This is probably a matter of me not handling dependency injection proper, but I'm trying to make a 'Session' service available to my SessionsController. Here's my SessionsController:
angular.module('App.controllers').controller('SessionsController', ['$scope', '$location', '$cookieStore', 'Session', function($scope, $location, $cookieStore, Session) {

  $scope.foo = function() {
    console.log("clicked foo..");
  }

  $scope.session = Session.userSession;

  $scope.create = function() {

    if ( Session.signedOut ) {
      $scope.session.$save()
      .success(function(data, status, headers, config) {
        $cookieStore.put('_app_user', data);
      });
    }

  };

  $scope.destroy = function() {
    $scope.session.$destroy();
  };

}]);

Here's the actual Session service definition:
angular.module('App.services').service('Session',[ '$cookieStore', 'UserSession', 'UserRegistration', function($cookieStore, UserSession, UserRegistration) {
  this.currentUser = $cookieStore.get('_app_user');
  this.signedIn = !!$cookieStore.get('_app_user');
  this.signedOut = !this.signedIn;
  this.userSession = new UserSession( { email:"foo@bar.com", password:"example", remember_me:true } );
  //this.userRegistration = new UserRegistration( { email:"foo-" + Math.floor((Math.random()*10000)+1) + "@bar.com", password:"example", password_confirmation:"example" } );

  $rootScope.$on('$routeChangeStart', function (current, next) {
    if (this.signedOut && next !== '/login') {
     console.log("relocating user..");
        //$location('/login');
    }});

}]);

And here's how I strung it together:
angular.module('App.resources', ['ngResource']);
angular.module('App.services', ['ngResource']);
angular.module('App.directives', []);
angular.module('App.filters', []);
angular.module('App.controllers', ['ngCookies', 'Session']);

var App = angular.module("App", ['App.resources', 'App.services', 'App.directives', 'App.filters', 'App.controllers', 'ui.compat', '$strap.directives', 'templates']);

Clearly missing something to string everything together as Firebug is complaining that there is no module named: Session.

A: Firebug is right, you have no module named session. You have a service named Session in the App.services module.
Just remove the Session module injection, and you are good to go.
angular.module('App.controllers', ['ngCookies']);


text:
Q: Setting up two screens in Xorg I'be got two Nvidia cards, but Xorg activates only one of them. The following config is based on the nvidia configurator output:
Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" LeftOf "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "keyboard"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "HP LE2201w"
    HorizSync       24.0 - 83.0
    VertRefresh     50.0 - 76.0
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "Acer AL2017"
    HorizSync       30.0 - 82.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier  "Card0"
    Driver      "nvidia"
    VendorName  "nVidia Corporation"
    BoardName   "GeForce 6100 nForce 405"
    BusID       "PCI:0:13:0"
EndSection
Section "Device"
    Identifier  "Card1"
    Driver      "nvidia"
    VendorName  "nVidia Corporation"
    BoardName   "GeForce 8400 GS"
    BusID       "PCI:2:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

What I see in the log file is:
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Mar 19 11:08:08 2010
(==) Using config file: "/etc/X11/xorg.conf"
(==) ServerLayout "Layout0"
(**) |-->Screen "Screen0" (0)
(**) |   |-->Monitor "Monitor0"
(==) No device specified for screen "Screen0".
        Using the first device section listed.
(**) |   |-->Device "Card0"
(**) |-->Screen "Screen1" (1)
(**) |   |-->Monitor "Monitor1"
(==) No device specified for screen "Screen1".
        Using the first device section listed.
(**) |   |-->Device "Card0"
(**) |-->Input Device "Keyboard0"
(**) |-->Input Device "Mouse0"
(**) Option "Xinerama" "0"
(==) Automatically adding devices
(==) Automatically enabling devices

even though later on both cards are detected:
(--) PCI:*(0:0:13:0) 10de:03d1:1019:2601 nVidia Corporation C61 [GeForce 6100 nForce 405] rev 162, Mem @ 0xfb000000/16777216, 0xd0000000/268435456, 0xfc000000/16777216, BIOS @ 0x????????/131072
(--) PCI: (0:2:0:0) 10de:0422:0000:0000 nVidia Corporation G86 [GeForce 8400 GS] rev 161, Mem @ 0xf8000000/16777216, 0xe0000000/268435456, 0xf6000000/33554432, I/O @ 0x0000bc00/128, BIOS @ 0x????????/131072
[ --- some more logs --- ]
(II) Mar 19 11:08:10 NVIDIA(0): NVIDIA GPU GeForce 6100 nForce 405 (C61) at PCI:0:13:0
(II) Mar 19 11:08:10 NVIDIA(0):     (GPU-0)
[ --- some more logs --- ]
(II) Mar 19 11:08:12 NVIDIA(GPU-1): NVIDIA GPU GeForce 8400 GS (G86) at PCI:2:0:0 (GPU-1)

Unfortunately later on only one card is initialised and one screen is active. Xrandr shows only one screen too.
Any ideas on how to fix it?

A: Your Screen sections are not matching the Device sections you've defined.  In the first Screen section (Screen0), the Device option points to "Device0" -- when in the first Device section, you set the Identifier option to "Card0".  The Screen sections need to use the correct identifier.
What you want to have here is:
Section "Device"
    Identifier  "Card0"
    ^^^^^^^^^^^^^^^^^^^  this line names this device "Card0"
    [...]
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Card0"
    ^^^^^^^^^^^^^^^^^^^^^^  this line needs to match a device's Identifier
    [...]
EndSection


text:
Q: Create a view with sum total across two tables grouped by date (SQL Server 2008) I currently have a view like this:
CREATE VIEW dbo.audit
WITH schemabinding
AS
    SELECT
       CONVERT(date, DateAdded) AS dt,
       COUNT_BIG(*) AS cnt
    FROM
       dbo.Table1
    GROUP BY
       CONVERT(date, DateAdded)

Which returns:
dt          cnt
-----------------
3/13/2015   5000
3/12/2015   1324

I'm trying to get a sum total count from both tables grouped by date into a single view. Is this possible?
i.e.
    Table 1                  Table 2
dt          cnt     |     dt          cnt
3/13/2015   5000    |     3/13/2015   1000
3/12/2015   1324    |     3/12/2015   1

To:

    View 1
dt          cnt
3/13/2015   6000
3/12/2015   1325

It would be nice to keep this in a single view. As it's just a running total of how many new items got added. Any ideas?

A: Assuming your data is such that there can be days missing from the tables it's easier to handle the dates by creating a table of dates (one row per day) so that you can join the tables using it, like this:
CREATE VIEW dbo.audit WITH schemabinding AS
select
  Dates.Date as dt,
  count_big(Table1.date) as ct_1,
  count_big(Table2.date) as ct_2
from
  Dates
  left outer join Table1 on convert(date, Table1.Date) = Dates.Date
  left outer join Table2 on convert(date, Table2.Date) = Dates.Date
group by
  Dates.Date

SQL Fiddle: http://sqlfiddle.com/#!6/bf116/3
If the tables are huge there might be some problems with performance because SQL Server isn't going to use index for the dates because there is a conversion to date -- and this is in case you have a where clause on the view. If you need something like that an inline table value function might work better because then you can have variables for the date ranges.

A: Assuming that there are two views and depending on relationship between these two views (based on values from dt columns: View1.dt and View2.dt) you could use a INNER/LEFT/RIGHT or FULL JOIN thus:
SELECT  ISNULL(v1.dt, v2.dt) AS dt, ISNULL(v1.cnt, 0) + ISNULL(v2.cnt, 0) AS cnt
FROM    dbo.View1 v1 /*INNER/LEFT/RIGHT*/ FULL JOIN dbo.View2 v2 ON v1.dt = v2.dt

I've used FULL JOIN because I assumed that there are values in View1.dt column that doesn't exist in View2.dt column and also there are values in View2.dt column that doesn't exist in View1.dt. More, some dt values could exist in both columns(views).
Note: I assume that second view has the same definition but it uses Table2 as data source: FROM dbo.Table2.

A: If I understand your question correctly, try something like this:
CREATE VIEW dbo.audit WITH schemabinding AS
SELECT CONVERT(Table1.date,DateAdded) AS Table1_dt,
       COUNT_BIG(Table1.*) AS Table1_cnt,
       CONVERT(Table1.date,DateAdded) AS Table2_dt,
       COUNT_BIG(Table2.*) AS Table2_cnt
FROM dbo.Table1 INNER JOIN dbo.Table2 ON(Table1.date = Table2.Date)
GROUP BY CONVERT(Table1,DateAdded)

This solution assumes the same column names in both tables and also the same dates to be selected.


text:
Q: Using std::thread in Node.js Addon Imagine that I use a synchronous function, from my Node.js addon:
var check_ok = addon.my_function(parameters);
var final_results = addon.final_function(parameters);

But in the method code I have:
std::thread t[10]; //Global
//...
void my_function(const FunctionCallbackInfo<v8::Value>& args) {
//....
t[0] = thread(random_void_function, [parameters])
t[1] = thread(random_void_function_2, [parameters])
//...
}
//...
void final_results(const FunctionCallbackInfo<v8::Value>& args) {
//...
t[0].join();
t[1].join();
//...Give results.. etc
}

So I have 2 synchronous calls of addon, but in this addon two threads are used. One function will start the threads and the other will join them. The questions are: random_void_function and random_void_function_2 will run in parallel? Since my_function and final_function are synchronous, the random_void_function and random_void_function_2 will block the event loop? From what I see, they not block.

A:
The questions are: random_void_function and random_void_function_2 will run in parallel?

Yes, provided they live long enough.  If they are short-lived, an equally plausible outcome is that the first starts and exits prior to the second starting and exiting (or visa versa).

Since my_function and final_function are synchronous, the random_void_function and random_void_function_2 will block the event loop? From what I see, they not block.

No and maybe.  addon.my_function will not block the event loop.  addon.final_results (which I assume you meant to call above instead of addon.final_function) will only block if the random_void_functions are long- lived.  If they are short lived and have already exited, addon.final_results will exit immediately.
Since you are not seeing any blocking, I suspect the random_void_functions are short-lived.


text:
Q: Can a method in a generic abstract base class "know" the most-derived class of its instance? I'm trying to figure out if this is possible:
public abstract class A<T>
{
    public void MyFunc() { ... }
}

public MyClass : A<string>
{
}

Is there a way for MyFunc to know that it has been instanced in a clas  of type MyClass ?

I think I need to clarify the question some more:
I have a generic abstract class that contains some core functionality accessed through a singleton.
The user is building a derived class to extend functionalities but the class is not instantiated through a new, but rather by the singleton, contained in the A class once it is accessed.
So, you could see the flow as such:
In the beginning, there is the abstract A<T>
The user creates MyClass : A<string>
The user now accesses: MyClass.MyFunc()
The singleton in MyFunc is then creating the instance

The singleton code is as follows:
public abstract class Singleton<T> where T : class
{
    private static readonly Lazy<T> _Instance = new Lazy<T>(CreateInstanceOfT);
    protected static T Instance => _Instance.Value;
    private static T CreateInstanceOfT()
    {
        return Activator.CreateInstance(typeof(T), true) as T;
    }
}

so:
class A<T>

is really:
class A<T> : Singleton<A>

but what I really need is to, somehow, make it like
Singleton<MyClass>

or whatever class is deriving from
A<T>

I hope this clarifies the question.

A: Yes, you could do something like:
public abstract class A<T>
{
    public void MyFunc()
    {
        if(this.GetType() == typeof(MyClass))
        {
            // do your magic
        }
    }
}

public class MyClass : A<string>
{
}

but why?

A: Seems to me, if I read your question right, that if the instance of A needs to have MyFunc act differently when it is a MyClass, then MyFunc should be virtual, and overridden in MyClass.
public abstract class A<T>
{
    public virtual void MyFunc() { ... }
}

public MyClass : A<string>
{
    public override void MyFunc() { ... }
}


text:
Q: Unique IDs with mongodb If I were building a blog I could use the blog title as the unique identifier and parse it through the URL. However, what if I wanted to use numbers. You know how twitter has www.twitter.com/username/statuses/9834542? Has anyone figured out a nice way of making this work? using "_id" is out of the question since it's way too long.

A: If you want to add a uniqueness constraint to your own field in MongoDB, use an index.  Then you can use any hashing algorithm you want to generate the number and test it for uniqueness.  The example in the MongoDB documentation is
db.things.ensureIndex({firstname: 1, lastname: 1}, {unique: true});

which will prevent you from inserting documents with the same firstname AND lastname as another document.
More information is available in the documentation.

A: I have solved this problem by creating collection 'sequence' with data:

*

*name

*currurt value

I'm using Morhpia, so have DAO for it. But you can do it without Morhpia too.
Idea is to use $atomic (probably it can be omitted due updateing 1 instance only) and $inc modifier operator.
Sequence
@Entity(value = "sys_sequence", noClassnameStored = true)
public class SequenceM {

    /**
     * Names of entity
     */
    public static enum Entity {
        USER,
        CAPABILITY_HISTORY;

        public String getEntityName() {
            return this.name().toLowerCase();
        }
    }

    @Id
    private ObjectId uid;

    @Property
    @Indexed(unique = true)
    private String name;

    @Property
    private Long value;

 //..getters/setters/etc
 }

Method on SequenceDAO:
@NotNull
public Long nextValue(final @NotNull SequenceM.Entity entity) {
    final DB db = this.ds.getDB();
    final WriteConcern writeConcern = getWriteConcern();

    //optimization for JVM instance
    synchronized(entity) {
        do {
            SequenceM sequence = findOne("name", entity.getEntityName());

            final DBObject q = BasicDBObjectBuilder.start().add("name", entity.getEntityName()).add("value", sequence.getValue()).add("$atomic", 1).get();
            final DBObject o = BasicDBObjectBuilder.start().add("$inc", BasicDBObjectBuilder.start().add("value", 1).get()).get();

            WriteResult writeResult = db.getCollection("sys_sequence").update(q, o, false, true, writeConcern);

            if(writeResult.getN() == 1) {
                return sequence.getValue() + 1;
            }
        } while(true);
    }
}

/**
 * Determining writing concern basing on configuration
 */
private WriteConcern getWriteConcern() {
    return isOneNodeOnly ? WriteConcern.SAFE : REPLICATION_SAFE;
}

Depending on MongoDB configuration (one node only or master/slave or replica set) you have to use correct WriteConcern. Using REPLICATION_SAFE in one environment with one instance only causes infinite loop.

A: As long as you can guarantee uniqueness, you're not constrained to using the default "_id" MongoDB supplies.
Therefore, it's down to you how you generate this number.  If you'd like to store this number inside MongoDB, then you could store it in a separate collection and increment it for every new URL required.
Incrementing a field is achieved by using the $inc verb, or you may want to take a look at how MongoDB can atomically update or increment a value.

A: It can be done by using the findandmodify command.
Let's consider we have a special collection named sequences and we want to have a sequence for post numbers (named postid), you could use code similar to this:

> db.runCommand( { "findandmodify" : "sequences",
                   "query" : { "name" : "postid"},
                   "update" : { $inc : { "id" : 1 }},
                   "new" : true } );

This command will return atomically the updated (new) document together with status. The value field contains the returned document if the command completed successfully.

A: Technically, the ID number is too large to shorten it. However, a tactic can be filled. That is passing from Hex to alphanumeric, thus reducing the number of characters to tulizar and looks more beautiful in the Url. I really served very well ... here is
function encode(hex) {
    return new Buffer(hex, 'hex').toString('base64').replace('+', '-').replace('/', '_');
};

function decode(NoHex) {
    return new Buffer( NoHex.replace('-','+').replace('_','/'), 'base64').toString('hex');
};

IdString= MyDoc._id.toString();
Idencode = encode( IdString ) // 16 Caracters a-Z and 0-9
console.log( IdEncode ); //You see That 'aqswedasdfdsadsf'
IdDecode = decode( IdEncode );
IdDecode === IdString // Is true!!!

Of course this technique uses the same id, mongo.