text:
Q: Declare variable inside if, and use it inside the next if I have met a problem at my work, I am currently developing on an already built website (that i havn't developed myself), and I'm not really familiar with Umbraco and xslt..
This is the code im working on:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:msxml="urn:schemas-microsoft-com:xslt"
   xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
   exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

   <xsl:output method="xml" omit-xml-declaration="yes"/>

   <xsl:template match="/">

   <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
   <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>

   <xsl:variable name="loc" select="umbraco.library:GetXmlDocument('/media/31087/data.xml', 1)"/>
   <xsl:for-each select="$loc/rdsppGenData/generatorData">
     <xsl:variable name="tags">
       <xsl:if test="(OA23) and (not(OA23 = '-'))">cat_1223 </xsl:if>
       <xsl:if test="(OA30) and (not(OA30 = '-'))">cat_1868 </xsl:if>
       <xsl:if test="(OA36) and (not(OA36 = '-'))">cat_1227 </xsl:if>
       <xsl:if test="(OA60) and (not(OA60 = '-'))">cat_1881 </xsl:if>
       <xsl:if test="(F0) and (F0 = 'Z01')">cat_1229 </xsl:if>
       <xsl:if test="(F0) and (F0 = 'X01')">cat_1802 </xsl:if>
     </xsl:variable>
     <xsl:variable name="system">
       <xsl:choose>
         <xsl:when test="F0">
           <xsl:value-of select="F1"/>
         </xsl:when>
         <xsl:when test="(OA23) or (OA30) or (OA36) or (OA60)">
           <xsl:value-of select="system"/>
         </xsl:when>
       </xsl:choose>
     </xsl:variable>
     <xsl:variable name="TE">
       <xsl:choose>
         <xsl:when test="F0">
           <xsl:value-of select="F2"/>
         </xsl:when>
         <xsl:when test="(OA23) or (OA30) or (OA36) or (OA60)">
           <xsl:value-of select="TE"/>
         </xsl:when>
       </xsl:choose>
     </xsl:variable>
     <xsl:variable name="P1">
       <xsl:choose>
         <xsl:when test="F0">
           <xsl:value-of select="P1s"/>
         </xsl:when>
         <xsl:when test="(OA23) or (OA30) or (OA36) or (OA60)">
           <xsl:value-of select="P1"/>
         </xsl:when>
       </xsl:choose>
     </xsl:variable>
     <xsl:variable name="P2">
       <xsl:choose>
         <xsl:when test="F0">
           <xsl:value-of select="P2s"/>
         </xsl:when>
         <xsl:when test="(OA23) or (OA30) or (OA36) or (OA60)">
           <xsl:value-of select="P2"/>
         </xsl:when>
       </xsl:choose>
     </xsl:variable>
     <xsl:variable name="description">
       <xsl:choose>
         <xsl:when test="F0">
           <xsl:value-of select="Sdescription"/>
         </xsl:when>
         <xsl:when test="(OA23) or (OA30) or (OA36) or (OA60)">
           <xsl:value-of select="description"/>
         </xsl:when>
       </xsl:choose>
     </xsl:variable>

     <xsl:if test="not(contains($system,'_'))">
       <xsl:if test="3 = string-length($system)">

                <xsl:value-of select="$system"/>

          <xsl:variable name="systemname" select="translate($system,$ucletters,$lcletters)" />

              <xsl:if test="(OA23) and (not(OA23 = '-'))">

              </xsl:if>
              <xsl:if test="(OA30) and (not(OA30 = '-'))">

              </xsl:if>
              <xsl:if test="(OA36) and (not(OA36 = '-'))">

              </xsl:if>
              <xsl:if test="(OA60) and (not(OA60 = '-'))">

              </xsl:if>
              <xsl:if test="(F0) and (F0 = 'Z01')">

              </xsl:if>
              <xsl:if test="(F0) and (F0 = 'X01')">

              </xsl:if>

                <xsl:value-of select="$description"/>

      </xsl:if>

      <xsl:if test="5 = string-length($system)">
        <xsl:if test="(3 > string-length($TE)) or (not($TE))">

          <xsl:variable name="tags2">
            <xsl:if test="(OA23) and (not(OA23 = '-'))">cat_1223 </xsl:if>
            <xsl:if test="(OA30) and (not(OA30 = '-'))">cat_1868 </xsl:if>
            <xsl:if test="(OA36) and (not(OA36 = '-'))">cat_1227 </xsl:if>
            <xsl:if test="(OA60) and (not(OA60 = '-'))">cat_1881 </xsl:if>
            <xsl:if test="(F0) and (F0 = 'Z01')">cat_1229 </xsl:if>
            <xsl:if test="(F0) and (F0 = 'X01')">cat_1802 </xsl:if>
          </xsl:variable>
          <xsl:variable name="second_level_id" select="generate-id(msxml:node-set($system))" />

                  <xsl:value-of select="$system"/>

                <xsl:value-of select="$description"/>

        </xsl:if>
      </xsl:if>
      <xsl:if test="($TE) and (not($TE = '-')) and (not($TE = ''))">
        <xsl:variable name="tags3">
          <xsl:if test="(OA23) and (not(OA23 = '-'))">cat_1223 </xsl:if>
          <xsl:if test="(OA30) and (not(OA30 = '-'))">cat_1868 </xsl:if>
          <xsl:if test="(OA36) and (not(OA36 = '-'))">cat_1227 </xsl:if>
          <xsl:if test="(OA60) and (not(OA60 = '-'))">cat_1881 </xsl:if>
          <xsl:if test="(F0) and (F0 = 'Z01')">cat_1229 </xsl:if>
          <xsl:if test="(F0) and (F0 = 'X01')">cat_1802 </xsl:if>
        </xsl:variable>
        <xsl:variable name="third_level_id" select="generate-id(msxml:node-set($TE))" />

                <xsl:value-of select="$TE"/>

              <xsl:value-of select="$description"/>

      </xsl:if>
      <xsl:if test="($P1) and (not($P1 = '-')) and (not($P1 = ''))">
        <xsl:variable name="tags4">
          <xsl:if test="(OA23) and (not(OA23 = '-'))">cat_1223 </xsl:if>
          <xsl:if test="(OA30) and (not(OA30 = '-'))">cat_1868 </xsl:if>
          <xsl:if test="(OA36) and (not(OA36 = '-'))">cat_1227 </xsl:if>
          <xsl:if test="(OA60) and (not(OA60 = '-'))">cat_1881 </xsl:if>
          <xsl:if test="(F0) and (F0 = 'Z01')">cat_1229 </xsl:if>
          <xsl:if test="(F0) and (F0 = 'X01')">cat_1802 </xsl:if>
        </xsl:variable>
        <xsl:variable name="fourth_level_id" select="generate-id(msxml:node-set($P1))" />

                <xsl:value-of select="$P1"/>

              <xsl:value-of select="$description"/>

      </xsl:if>
      <xsl:if test="($P2) and (not($P2 = '-')) and (not($P2 = ''))">
        <xsl:variable name="tags5">
          <xsl:if test="(OA23) and (not(OA23 = '-'))">cat_1223 </xsl:if>
          <xsl:if test="(OA30) and (not(OA30 = '-'))">cat_1868 </xsl:if>
          <xsl:if test="(OA36) and (not(OA36 = '-'))">cat_1227 </xsl:if>
          <xsl:if test="(OA60) and (not(OA60 = '-'))">cat_1881 </xsl:if>
          <xsl:if test="(F0) and (F0 = 'Z01')">cat_1229 </xsl:if>
          <xsl:if test="(F0) and (F0 = 'X01')">cat_1802 </xsl:if>
        </xsl:variable>

                <xsl:value-of select="$P2"/>

              <xsl:value-of select="$description"/>

      </xsl:if>
    </xsl:if>
  </xsl:for-each>

 </xsl:template>
 </xsl:stylesheet>

And i am trying to get the unique ID from the prev. tr and use it in the current row..
I want to use the variable:
<xsl:variable name="second_level_id" select="generate-id(msxml:node-set($system))" />

in this line:

And so on.
If there is ANY better way of doing all of this, where i would get the exact same output, but with the desired variable thingy from above, i would love to hear about it.

*

*Mathias

A: Here is a way you should be able to accomplish this:
Replace this:
<xsl:for-each select="$loc/rdsppGenData/generatorData">

with:
<xsl:variable name="locItems" select="$loc/rdsppGenData/generatorData" />
<xsl:apply-templates select="$locItems[1]">
  <xsl:with-param name="remainder" select="$locItems[position() > 1" />
</xsl:apply-templates>

Add this to your XSLT:
<xsl:template match="generatorData">
  <xsl:param name="remainder" />
  <xsl:param name="last_second_level_id" />
  <xsl:param name="last_third_level_id" />

  <xsl:apply-templates select="$remainder[1]">
    <xsl:with-param name="remainder" select="$remainder[position() > 1]" />
    <xsl:with-param name="last_second_level_id" select="$second_level_id" />
    <xsl:with-param name="last_thirdlevel_id" select="$second_level_id" />
  </xsl:apply-templates>
</xsl:template>


text:
Q: Logic & Reasoning Question At a track meet, every group of $n$ participants shares exactly one common friend.
Suppose runner $P$ has the largest number of friends. Determine how many friends $P$ has.
Assume for this question:

*

*$n \in N$ such that $n ≥ 3$

*Friends are mutual, EX: if $X$ is friends with $Y$, then $Y$ is friends with $X$

*No one is friends with themselves

*a group of runners has a "common friend" $a$ iff each runner in the group is friends with $a$

Prove the answer.
Update for Clarification

*

*$n$ is the size of the group, not the total number of attendees.

*There are an arbitrary number of groups

*The answer should be expressed in terms of $n$

*If $X$ is friends with $Y$ then both $X$ and $Y$ are at the trackmeet

*Assume there are at least $n + 1$ attendees.

Thank you very much for your effort so far @fleablood

A: P can't like as many as n people.
Label n of P's friends as $a_1,... a_n$.
$(P, a_1, ...., a_{n-1})$ have P as the mutual friend.  So $(a_1,..., a_{n-1})$ have no mutual friend.  So $(a_1, ..., a_n)$ have $a_n$ as a mutual friend.  So $(P, a_2, ...., a_n)$ have both P and $a_n$ as mutual friends.  Impossible.
So P has n-1 friends or fewer.
But as any group of n people have 1 mutual friend, that mutual friend has at least n-1 friends.  So P has at least n-1 friends.
So P has n-1 friends.

redpajama_set_name: RedPajamaStackExchange


text:
Q: The request signature we calculated does not match the signature you provided I am using SES for sending email here is my code can you anybody tell me what is the problem ?
Is there anyone facing the same problem??
I have also check my credentials they are also correct.
  $client = SesClient::factory(array(
      'version'=> 'latest',
      'region' => REGION,
     'credentials' => array(
    'key'    => "AKIA***********",
    'secret' => "AoIM6Z/clu********************",
),
  ));

  try {
       $result = $client->sendEmail([
      'Destination' => [
          'ToAddresses' => [
              RECIPIENT,
          ],
      ],
      'Message' => [
          'Body' => [
              'Html' => [
                  'Charset' => CHARSET,
                  'Data' => HTMLBODY,
              ],
        'Text' => [
                  'Charset' => CHARSET,
                  'Data' => TEXTBODY,
              ],
          ],
          'Subject' => [
              'Charset' => CHARSET,
              'Data' => SUBJECT,
          ],
      ],
      'Source' => SENDER,
      // If you are not using a configuration set, comment or delete the
      // following line
      'ConfigurationSetName' => CONFIGSET,
  ]);
       $messageId = $result->get('MessageId');
       echo("Email sent! Message ID: $messageId"."\n");

    } catch (SesException $error) {
        echo("The email was not sent. Error message: ".$error-
    >getAwsErrorMessage()."\n");
   }

     }

A: After so much googling I found out that my credentials are wrong. Just regenerate the credentials, try it again and it should work. Another thing is that the when key includes '/', it will not work, so if your key contains '/', regenerate it.


text:
Q: Verifying RSA signature from Google Licencing with PyCrypto I am build a Python implementation of the verification of the Google License signature.
I am having problem importing the public RSA key into the python module.
The key is a 2048-bit RSA and the public part of this key you get from the developer console on Google Play. It is "base64 encoded".
When I try to load it with the following Python code
from Crypto.PublicKey import RSA
BASE64_PUBLIC_KEY = "MIIBIjANBgkqhkiG.."
pubkey = RSA.importKey(BASE64_PUBLIC_KEY)

I get the error ValueError: RSA key format is not supported
I get the same error when I add base64 decoding.
from Crypto.PublicKey import RSA
import base64
BASE64_PUBLIC_KEY = "MIIBIjANBgkqhkiG.."
pubkey = RSA.importKey(base64.b64decode(BASE64_PUBLIC_KEY))

Checking the standard implementation of how the key is loaded in Android it is base64 decoded and then sent to a class called X509EncodedKeySpec. The constructor to this class takes one argument
encodedKey - the key, which is assumed to be encoded according to the X.509 standard. The contents of the array are copied to protect against subsequent modification.

Thus my guess is that the key is X.509 encoded and then base64 endoded. However, the importKey function in the RSA module claims to support this encoding
X.509 subjectPublicKeyInfo DER SEQUENCE (binary or PEM encoding)

A: Your symptom that base 64 encoded values being supported out of the box by the x509 code you provided is probably not true.
X.509 subjectPublicKeyInfo DER SEQUENCE (binary or PEM encoding)
Directly stated binary or pem encoding.  You actually have to decode the base 64 encoded string, and then figure out what to do from their ( I'm not sure what output the decoding will produce in relation to X509 code)

A: My key was corrupted and the above approach worked just fine, as noted by @GregS.


text:
Q: Declare Code as JQuery I have mootools and jquery installed (Joomla) for various reasons, and I think my jquery code is trying to run through mootools because I keep getting a bunch of garbage errors with $.getJSON. Is there something I can wrap around my Jquery code that I don't have this kind of cross-framework conflict?

A:   var jQuery = jQuery.noConflict();

then try replace the $ with jQuery
or alternatively just jQuery.noConflict(); and keep using $
Check this

A: You need to use noConflict():
http://api.jquery.com/jQuery.noConflict/
You can replace $ with any variable you want:
var $jq = jQuery.noConflict();

If you read the doc, you can use noConflict and still use $ within a $.ready() call, and use $ for mootools outside of the ready call.


text:
Q: How can I improve this sentence about the German "Kleinunternehmer"? I'm looking for the correct translation of the German word "Kleinunternehmer". The translations I found are individual businesses, small entrepreneurs, small businesses, etc., but I'm not sure which of them to use.
The text I'm trying to translate is a note for an order form which gives the users the information that the business owner is, based on a certain legal regulation, exempted from the value added tax (VAT).

"Gemäß § 19 UStG sind wir als Kleinunternehmer von der MwSt.
      freigestellt."

Unfortunately I wasn't able to come up with something which seemed correct to me. This is what I've got so far:

"As entrepreneurs we are according to § 19 UStG exempt from VAT."

Is there a chance to improve this?

A: StoneyB recommends translating "Kleinunternehmer" as "small business owners".

Small BusinessSmall businesses are normally privately owned corporations, partnerships, or sole proprietorships. What constitutes "small" in terms of government support and tax policy varies depending on the country and industry.Source: Wikipedia entry – Small business

There is some flexibility to how you order things in this sentence, but the most natural way is probably:

As small business owners, we are exempt from VAT under § 19 UStG.

If you wanted to stay closer to the order in the original statement, you could write:

According to § 19 UStG, we small businesses are exempt from VAT.

A: According to this website https://leitsch.org/blog/ein-kleinunternehmen-gruenden-und-alles-was-dazu-gehoert "Kleinunternehmen" in the legal sense in Germany is a single person trading with an annual revenue of at most €17,500. I would suggest that for a UK audience, "sole trader" is most likely a much better translation. A "small business" is very unlikely to be VAT exempt (according to German rules), a "sole trader" quite possibly is.


text:
Q: Jenkins UserContent does not execute JS and form HTML On my project, I need to have an HTML file on jenkins in the directory "userContent" to run a form and send some data to another server :
<form id="recievefile" action="http://127.0.0.1:8844/process" method="post" enctype="multipart/form-data">

Worker

        <select name="workerName">
            <option value="Worker1" selected="selected">Worker1</option>
        </select>

Input

        File: <input id="fileInput" type="file" name="filerecievefile" />

Options

        Process type

            <select name="processType">
                <option value="signDocument" selected="selected">Sign document</option>
            </select>

    <input type="text" name="callback" value="?"/>

Submit

    <input id="submitButton" type="submit" name="buttonrecievefile" value="Submit" class="buttonFeatured" />
</form>

This form is well executed locally, but when I put it in the userContent directory, the form is not executed. Do you know  why ?
Is there any security I can disable to allow form and JavaScript execution on this directory ?
Thx.

A: So, i've found the reason why, it's the CSP (Content Security Policy).
You can disable it in a jenkins configuration file :

vim /etc/sysconfig/jenkins

Find the line with JENKINS_JAVA_OPTIONS and add the CSP policy like this:

JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true
-Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src data:;""


text:
Q: Configuring wildcard record on AWS route 53 I have a domain registered with Google Domains and using AWS Route 53 as NS.
This domain has several sub domains (some for our applications, and some for our public site)
*.dev.mydomain.com ('A' record pointing to a cloudfront for our development application) works great,
*.app.mydomain.com ('A' record pointing to a cloudfront for our live application) works great
www.mydomain.com ('A' record pointing to an IP address on Bluehost which hosts our Wordpress website) works great
The one I can't figure out is how to get mydomain.com (without any subdomain) to point to the same Bluehost wordpress site as www.
I configured:
*.mydomain.com ('A' record pointing to the same bluehost IP)
But what I get is:

This site can't be reached
mydomain.com's server IP address could not
be found. DNS_PROBE_FINISHED_NXDOMAIN

A: Assuming that your public hosted zone is for mydomain.com you simply create the record without the subdomain part.
By using *.mydomain.com it will simply resolve any single level subdomain that does not have an explicit record to resolve to the bluehost IP.
If you're using the console and if you do not enter any value in the domain entry box you will default to creating a record for the apex/root domain record.
Steps
Click create record, you will then be presented with some options. Click "Define Simple Record", then fill in the details similar to the ones below. You should notice nothing filled in for the domain.

Click "Define Simple Record", then click "Create Records". You should now have your root domain records created.


text:
Q: Nested span in bootstrap I need to work with HTMLs having span inside another span in bootstrap for doing vertical alignment. I have so far used span for only making horizontal layout like putting "span4" thrice for creating a 3 column layout ..
but, Following lines create a vertical layout instead .. can some one point on how to use  nesting of span in bootstrap ..

Related

Related-1

Related-2

A: You're spanning 6 grid columns inside an element that spans only 4, which will necessarily cause wrapping. You always need to have child rows that total the same or fewer columns than parent rows if you don't want a vertical stack.
I suggest a closer look at the grid docs: http://twitter.github.com/bootstrap/scaffolding.html#gridSystem


text:
Q: How can I add information to tooltips in shiny/leaflet using tm_fill? I've created an interactive map using shiny and leaflet: https://iseak.shinyapps.io/Mapa/
Currently, when you hover over the map the tooltip shows the name of the area. I can change it so that instead of the name of the area, another variable (e.g. the numeric value that colors the map) is shown, but I haven't been able to show both at the same time. I can only seem to do that when you click on the map and a popup shows up.
I'd like to be able to display both the area name & numeric value that colors the map when you hover over the area, not just upon clicking. Is there an easy way to do that?
The portion of my code that creates the map is pretty simple:
output$map = renderLeaflet({

      tm <- tm_shape(subsetData()) +
            tm_fill(selvar(),
                    palette=colores(),
                    alpha=0.95,
                    breaks=breaks(),
                    id="Zona", #Mouseover
                    popup.vars=c(" "=selvar()), #Popups on click
                    popup.format=list(digits=2),
                    legend.show = F,
                    labels=c(" "=selvar())
             ) +
            tm_borders()
            tmap_options(basemaps = "CartoDB.Positron")

Thanks in advance for any tips!


text:
Q: boost asio multiple async_send on udp socket Is it safe to have fire and forget approach to udp socket in boost::asio?
so e.g if i have such code
 socket.async_send(buffer(somedata1),write_handler);
 socket.async_send(buffer(somedata2),write_handler);
 socket.async_send(buffer(somedata3),write_handler);
 socket.async_send(buffer(somedata4),write_handler);

am i guaranteed that this will not fail - that means that at the receiving endpoint i will get 4 packets containing somedata1,somedata2,somedata3,somedata4 ?

A: No, it most certainly isn't safe, none of the asio async_* functions are documented to be "fire and forget".
The boost asio reference for the basic_datagram_socket::async_send buffers states: "Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called."
If you need a "fire and forget" approach, then you'll need to a class to manage your connection and buffer the packets for you. Here's an example using a deque to buffer the packets:
class Connection : public boost::enable_shared_from_this<Connection>
{
  boost::asio::ip::udp::socket socket_;
  std::deque<std::vector<char> > tx_queue_;

  /// transmit the packet at the head of the queue
  void transmit()
  {
    socket_.async_send(
      boost::asio::buffer(&tx_queue_.front()[0], tx_queue_.front().size()),
      boost::bind(&Connection::write_callback,
                  boost::weak_ptr<Connection>(shared_from_this()),
                  boost::asio::placeholders::error,
                  boost::asio::placeholders::bytes_transferred));
  }

  /// The function called whenever a write event is received.
  void write_handler(boost::system::error_code const& error,
                     size_t /* bytes_transferred */)
  {
    tx_queue_.pop_front();
    if (error)
      ; // handle the error, it may be a disconnect.
    else
      if (!tx_queue_.empty())
        transmit();
  }

  /// Static callback function.
  /// It ensures that the object still exists and the event is valid
  /// before calling the write handler.
  static void write_callback(boost::weak_ptr<Connection> ptr,
                             boost::system::error_code const& error,
                             size_t bytes_transferred)
  {
    boost::shared_ptr<Connection> pointer(ptr.lock());
    if (pointer && (boost::asio::error::operation_aborted != error))
      pointer->write_handler(error, bytes_transferred);
  }

  /// Private constructor to enusure the class is created as a shared_ptr.
  explicit Connection(boost::asio::io_service& io_service) :
    socket_(io_service),
    tx_queue_()
  {}

public:

  /// Factory method to create an instance of this class.
  static boost::shared_ptr<Connection> create(boost::asio::io_service& io_service)
  { return boost::shared_ptr<Connection>(new Connection(io_service)); }

  /// Destructor, closes the socket to cancel the write callback
  /// (by calling it with error = boost::asio::error::operation_aborted)
  /// and free the weak_ptr held by the call to bind in the transmit function.
  ~Connection()
  { socket_.close(); }

  /// add the packet to the end of the queue and send it ASAP.
#if defined(BOOST_ASIO_HAS_MOVE)
  void send(std::vector<char>&& packet)
#else
  void send(const std::vector<char>& packet)
#endif
  {
    bool queue_empty(tx_queue_.empty());
    tx_queue_.push_back(packet);
    if (queue_empty)
      transmit();
  }
};

A: There is no guarantee simply because the underlying protocol makes no guarantee.
As long as the underlying memory provided to buffer during socket.async_send() remains valid until the handler is called, and no other thread is making concurrent calls to socket, then the criteria for socket.async_send() has been satisfied and it should be safe.

For implementation details, the basic_datagram_socket::async_send() will have its service create a single non-composed operation (reactive_socket_send_op or win_iocp_socket_send_op).  The service will then have its reactor start the operation.  Some reactor implementations may attempt to run the operation immediately; otherwise, the operation is added to a queue specific to the socket file descriptor based on the operation type (read or write).  The operation queues allow for multiple read or write operations to be outstanding for a given file descriptor.


text:
Q: cookiechoices on appspot not working I'm trying to run cookieChoices.js from cookieChoices.org on appspot but I'm getting the following error when I inspect the elements
Failed to load resource: the server responded with a status of 404 (Not Found) http://whatsonpontyclun.appspot.com/cookiechoices.js Uncaught ReferenceError: cookieChoices is not defined whatsonpontyclun.appspot.com/:36
I've loaded cookieChoices into the root directory as I understand the instructions but I've also tried loading the file into /static/js which is where I keep my other javascript files.  I get the same errors.
What gives?

A: You also need to include code in landing page:

<HTML>
<HEAD>
</HEAD>
<BODY>
<script src="/cookiechoices.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', function(event) {
    cookieChoices.showCookieConsentBar('This site uses cookies to improve your reading experience. ',
      'Click here to accept cookies', 'Click here to refuse cookies', 'http://www.islandpublishers.co.uk/cookietest/cookieask.html');
  });
</script>

I am having a problem allowing the user to refuse the cookies.


text:
Q: How i can get context for testing a VideoViewModel (Xamarin,NUnitLite) I want to test a concrete implementation of abstract VideoViewModel on android. I use VS 2013 with NUnitLite.
For create the VideoViewModel instance i need Activity Context
Here is the constructor vor VideoViewModel:
    public VideoViewModelAndroid(Context context, IFileSystem fileSystem)
        : base(fileSystem)
    {
        bool contextIsActivity = context is Activity;
        ExceptionUtil.ThrowIf.IsFalse(() => contextIsActivity);

        this.context = context;
        this.videoView = (context as Activity).FindViewById<VideoView>(Resource.Id.videoView1); // Returns null for the videoView
        this.videoView.Touch += videoView_Touch;

}
Here is what i do to create this videoView
        context = MainActivity.con;
        var view = new VideoViewModelAndroid(context, fileSystem);

The context comes from here:
[Activity(Label = "IDS.Droid.Tests", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : TestSuiteActivity
{
    public static Context con;
    protected override void OnCreate(Bundle bundle)
    {
        // tests can be inside the main assembly
        AddTest(Assembly.GetExecutingAssembly());
        // or in any reference assemblies
        // AddTest (typeof (Your.Library.TestClass).Assembly);

        // Once you called base.OnCreate(), you cannot add more assemblies.
        base.OnCreate(bundle);
        //SetContentView(Resource.Layout.MainLayout);
        con = this;
    }

}

I linked the layout from the application and the id is represented in Resource.Designer.cs.
But it retuns no view after it call
this.videoView = (context as Activity).FindViewById<VideoView>(Resource.Id.videoView1);

Any idea to resolve this problem???

A: Do you really need the context or maybe you could mock it? If you can mock it then use this package(available through nuget):
github:
https://github.com/Moq/moq4
nuget:
https://www.nuget.org/packages/Moq/
but as others stated in comment, using context in viewModel isn't good practice. The reason for this is that ViewModel has to be platform independent. If you wanted to reuse viewModel for iOS and WinPhone you would have problem with context not existing on these platforms.


text:
Q: Reinstall R to include X11 support I need X11 support for some R code. R was unfortunately explicitly configured with "--with-x=no" option. I was wondering if it is safe to re-configure, re-compile and re-install R (Centos 7) or it would trigger some errors in R-Studio or have an impact on the R-packages installed so far. I would of course use the same R version to re-install R.
Here is the output "print(capabilities())":
       jpeg         png        tiff       tcltk         X11        aqua    http/ftp     sockets      libxml        fifo      cledit       iconv         NLS     profmem       cairo         ICU long.double     libcurl
       TRUE        TRUE       FALSE        TRUE       FALSE       FALSE        TRUE        TRUE        TRUE        TRUE       FALSE        TRUE        TRUE       FALSE        TRUE        TRUE        TRUE        TRUE


text:
Q: Delphi Component Property Declaration Recently, I came across the following property declaration in the component TDBNavigator:
property Enabled;
[Default(False)]     <--------------------
property Flat: Boolean read FFlat write SetFlat default False;

What does the directive [Default(False)] mean? What is its main purpose?

A: The [Default(True|False)] Attribute does the same thing as the default True|False clause on the property itself.  DFM streaming supports both forms, and with each new IDE release, more and more properties are being moved to this Attribute model.  Why Embarcadero feels this is needed, I have no idea.  However, Attributes were added in XE3 and are accessible via Extended RTTI (the System.Rtti unit), and thus can be applied to things that old-style RTTI (the System.TypInfo unit) simply doesn't work for.  So, this may have been added to aid with other kinds of streaming frameworks, and they decided to apply it to DFMs, too.  Who knows.


text:
Q: Mongoose - access populated object's virtual attributes I understand that I can create virtual attributes on a model (ex - an author has a virtual that allows it to access all their associated documents in a publications model).
I have the following models (note the virtual name attribute in the author model)
// book.js
var mongoose = require("mongoose");
var debug = require('debug')('local-library:server');

const Schema = mongoose.Schema;

const BookSchema = new Schema({
  title: { type: String, required: true },
  author: { type: Schema.Types.ObjectId, ref: 'Author', required: true },
  // summary: { type: String, minlength: 150, maxlength: 500, required: true },
  summary: { type: String, required: true },
  isbn: { type: String, required: true, validate: {
    validator: (toValidate) => {
      // some kind of REGEX can go here
      return true;
    }
  }},
  genre: { type: Schema.Types.ObjectId, ref: 'Genre' },
})

BookSchema
.virtual('url')
.get(function() {  // can not use arrow functions here b/c they lack binding
  return `/catalog/books/${this._id}`
})

module.exports = mongoose.model('Book', BookSchema)

// author.js
var mongoose = require("mongoose");

const Schema = mongoose.Schema;

const AuthorSchema = new Schema({
  first_name: { type: String, required: true, maxLength: 100 },
  family_name: { type: String, required: true, maxLength: 100 },
  date_of_birth: { type: Date },
  date_of_death: { type: Date }
});

// Virtual attribute for author's full name
// I think this is not dissimilar to making an instance method
// on a Rails model class like def fullName; return self.first_name + self.last_name; end
AuthorSchema
.virtual('name')
.get(() => {
  let fullName = '';

  if (this.first_name && this.family_name) {
    fullName = `${this.family_name}, ${this.first_name}`
  }

  return fullName;
});

// Virtual attribute for author's lifespan (year range of author's life)
AuthorSchema
.virtual('lifespan')
.get(() => {
  return `${this.date_of_birth.getYear().toString()} - ${this.date_of_death ? (this.date_of_death.getYear().toString()) : 'present'}`
})

// Virtual attribute for author's url
// (so you don't have to have this type of parsing logic all over the place whenever you need to access data about this author)
AuthorSchema
.virtual('url')
.get(function() {
  return `/catalog/authors/${this._id}`
})

module.exports = mongoose.model('Author', AuthorSchema)
// export default mongoose.model('Author', AuthorSchema)

In my books controller, I have the following:
// show
exports.books_show = (req, res, next) => {
  Book
    .findById(req.params.bookId, 'title author')
    .populate('author')
    .exec((err, book) => {
      if (err) {
        return next(err)
      } else {
        res.render('./catalog/books/books_show.pug', { title: "Book Show", book: book, id: req.params.bookId })
      }
    })
}

I am having a hard time accessing the populated object's (i.e., the author's) virtual attribute of name
Docs describe something like adding a virtual books attribute to the author model, so that you can populate() an author with their books, which doesn't really seep appropriate here since I'm going in the other direction / want to access a virtual property of the populated model that doesn't really have anything to do with books, I just want to access the functionality of the author's virtual attribute.
Is there a best way to do this?

A: Turns out the issue stemmed from using arrow functions when I defined the virtual attributes for the populated model's schema, which caused the virtual attribute's logic to not function as expected.


text:
Q: On dataProvider change labels changes chart doesn't I have a flex application, which consists of several tabs. One tab contains a columnchart and a datagrid, which contains collection of results (after selecting another datagrid result, another line in the chart shows up). This stops, however, after I go to another tab and come back. At this point, after datagrid line is selected, chart's dataProvider changes, which causes labels to change, but chart remains the same.
Tab navigation is implemented through states, like this:
<s:states>
 <s:State name="tabWithChart"/>
 <s:State name="anotherTab"/>
 <s:State name="yetAnotherTab"/>
</s:states>

...................
<s:Group>
 <chartTab:ChartTab includeIn = "tabWithChart"/>
 <tab1:Tab1 includeIn = "anotherTab"/>
 <tab2:Tab2 includeIn = "yetAnotherTab"/>
</s:Group>

Clicking navigation button causes state to change. What may be causing the problem?


text:
Q: How to receive a notification from webview in Angular & Electron app I am using this package to try integrating Angular 7 with Electron.
In app.html I use  tag to view a web page push notification using HTML5 Notification.
<webview partition="somepartition" id="webview1" src="src"></webview>

And I have another webview to show another web page
In component ts file, I want to listen to notifications from every webview and show them as a native descktop notifications.
How can I implement this in app.component.ts

A: You can use ipc communication to send messages from webview to main process. https://electronjs.org/docs/api/notification to implement notification.
Use ipcRenderer.send('notification',{data}) from every webview application. To do this, create a preload script that contains the following which injects ipcRenderer.
window.ipcRenderer = require('electron').ipcRenderer;

Use the following script from webview application
window.ipcRenderer.send('notification',{title:"sample title",body:"sample body" });

Note that we are using preload script to avoid nodeIntegration inside webview.
And in the main process, catch the message using
const { Notification , ipcMain } = require('electron');
ipcMain.on('notification',(event,channel,args)=>{
//Write code to show notification notification module
   let notification =  new Notification({ title : args.title , body: args.body });
notification.show();

})


text:
Q: Parcelable Model ArrayList pass activity A to activity B and get sub model ArrayList size it's return NullPointerException This is my Parcelable Model class
public class BVCCategoryTemplateModel implements Parcelable {
    @Expose
    @SerializedName("dir")
    private List<DirCategory> dir;
    @Expose
    @SerializedName("url")
    private String url;
    @Expose
    @SerializedName("name")
    private String name;

    protected BVCCategoryTemplateModel(Parcel in) {
        url = in.readString();
        name = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(url);
        dest.writeString(name);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<BVCCategoryTemplateModel> CREATOR = new Creator<BVCCategoryTemplateModel>() {
        @Override
        public BVCCategoryTemplateModel createFromParcel(Parcel in) {
            return new BVCCategoryTemplateModel(in);
        }

        @Override
        public BVCCategoryTemplateModel[] newArray(int size) {
            return new BVCCategoryTemplateModel[size];
        }
    };

    public List<DirCategory> getDir() {
        return dir;
    }

    public void setDir(List<DirCategory> dir) {
        this.dir = dir;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Keep
    public static class DirCategory implements Parcelable{
        @Expose
        @SerializedName("dir")
        private List<DirCategoryData> dir;
        @Expose
        @SerializedName("url")
        private String url;
        @Expose
        @SerializedName("name")
        private String name;

        protected DirCategory(Parcel in) {
            url = in.readString();
            name = in.readString();
        }

        public static final Creator<DirCategory> CREATOR = new Creator<DirCategory>() {
            @Override
            public DirCategory createFromParcel(Parcel in) {
                return new DirCategory(in);
            }

            @Override
            public DirCategory[] newArray(int size) {
                return new DirCategory[size];
            }
        };

        public List<DirCategoryData> getDir() {
            return dir;
        }

        public void setDir(List<DirCategoryData> dir) {
            this.dir = dir;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(url);
            parcel.writeString(name);
        }
    }
}

pass mode to another activity like this
Intent intent = new Intent(context, BVCTemplatePreviewBeforeEditActivity.class);
                intent.putParcelableArrayListExtra("category_data", new ArrayList<>(festivalCategoryTemplateModelsList));
                startActivity(intent);

another activity get a list like this
ArrayList<BVCCategoryTemplateModel> templateSubcategoryDataList = getIntent.getParcelableArrayListExtra("category_data");

get sub model class list templateSubcategoryDataList.get(0).getDir().size()
return NullPointerException
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
        at dfgdfg.sfgfdgd.dfgdfg.activity.BVCTemplatePreviewBeforeEditActivity.onCreate(EditActivity.java:103)
        at android.app.Activity.performCreate(Activity.java:7963)
        at android.app.Activity.performCreate(Activity.java:7952)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3505)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3689)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:100)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2239)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:227)
        at android.app.ActivityThread.main(ActivityThread.java:7822)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)

A: after a long time search, I found the issue
Change
protected BVCCategoryTemplateModel(Parcel in) {
        url = in.readString();
        name = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(url);
        dest.writeString(name);
    }

To
protected BVCCategoryTemplateModel(Parcel in) {
        url = in.readString();
        name = in.readString();
        dir = new ArrayList<DirCategory>();
        in.readList(dir, DirCategory.class.getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(url);
        dest.writeString(name);
        dest.writeList(dir);
    }

I forgot to write my List<DirCategory> sub-model class to writeToParcel() method and read the list in Constructor, after editing the above code NullPointerException remove, and the code working file


text:
Q: JSX element does not have construct or call signatures for react-timekeeper I have the following component:
import * as React from 'react';
import TimeKeeper from 'react-timekeeper';

export class Modal extends React.Component<any, any>{
constructor(props: any) {
    super(props)
    this.state = {
        time: '',
        displayTimepicker: false
    }
    this.handleTimeChange = this.handleTimeChange.bind(this)
}

handleTimeChange(newTime: any) {
    this.setState({ time: newTime.formatted })
}
toggleTimekeeper(val: any) {
    this.setState({ displayTimepicker: val })
}

public render() {
    return (

                     this.toggleTimekeeper(true)}>{
                        (this.state.time == '')
                            ?
                            "Select Time"
                            :
                            this.state.time
                    }

                    {
                        this.state.displayTimepicker ?
                            <TimeKeeper
                                time={this.state.time}
                                onChange={this.handleTimeChange}
                                onDoneClick={() => {
                                    this.toggleTimekeeper(false)
                                }}
                                switchToMinuteOnHourSelect={true}
                                closeOnMinuteSelect={true}
                            />
                            :
                            false
                    }

    )
}

}
In this configuration I have the following error:

Could not find declaration file for module 'react-timekeeper'. Try 'npm install @types/react-timekeeper' if it exists or add a new declaration (.d.ts) file containing 'declare module 'react-timekeeper';'

There is no @types install for react-timekeeper. So I tried switching

import Timekeeper from 'react-timekeeper';

to

const TimeKeeper = require('react-timekeeper');

But now I get the following error:

JSX element TimeKeeper does not have any constructs or call signatures.

I looked at similar threads but the solutions seemed to be component specific. Any general way to fix these errors?
EDIT:
Tried the following:
    public render() {
        var gettimekeeper = (TimeKeeper: new () => React.Component<any, any>) => {
        return <TimeKeeper
            time={this.state.time}
            onChange={this.handleTimeChange}
            onDoneClick={() => {
                this.toggleTimekeeper(false)
            }}
            switchToMinuteOnHourSelect={true}
            closeOnMinuteSelect={true}
        />
    };
    return (

                          {gettimekeeper}

                     this.toggleTimekeeper(true)}>{
                        (this.state.time == '')
                            ?
                            "Select Time"
                            :
                            this.state.time
                    }

    )

It does not work.


text:
Q: URL Rewriting to subfolders based on the parameters Is it possible to Rewrite the URL to different sub folders based on the parameters passed in URL? i found the Question1 and Qestion2 but they are not applicable on my example. Consider the following situation
www.mywebsite.com/about/overview

rewrites to
www.mywebsite.com/about/index.php?a=overview

Similarly
www.mywebsite.com/contact-us/office

rewrites to
www.mywebsite.com/contact-us/index.php?a=office

or
www.mywebsite.com/contact-us/home

rewrites to
www.mywebsite.com/contact-us/index.php?a=home

A: You can use this code in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteBase /

RewriteRule ^([\w-]+)/([\w-]+)/?$ $1/index.php?a=$2 [L,QSA]


text:
Q: How do row operations affect the column space? I've been curious about this: Row operations do not affect the row space, but they affect the column space.
Is there any way to 'systematically' perform row operations to make the column space the way we want?
Let $C$ be the left matrix below, and $A$ be the right.
I'd like to find $C$ to make a column of $AC$ to be a constant multiplication of another column. Given $A$ has no pair of two column vectors that is linearly dependent. Since row operations, $C$ can change the column space of $A$, I wonder if there's any systematic way of making the dependencies of the column vectors the way I want.
$ \left( \begin{array}{l} c_1 & c_2 \\ c_3 & c_4 \end{array} \right) $$ \left( \begin{array}{l} 1 & 3 & 2 \\ 3 & 1 & 2\end{array} \right) $
Thanks.

A: If $c^1,\ldots, c^n$ are the columns of a matrix and $d^1,\ldots, d^n$ the columns of a transformed matrix after some row operations, then $d^i$ is the expression of $c^i$ in a different basis. The transition matrix to this new basis is formed by the columns of $R^{-1}$ where $D=RC$ is the relation between $D=(d^1,\ldots, d^n)$ and $C=(c^1,\ldots, c^n)$.
(It follows from this that, if $c^1$ and $c^2$ are independent -- for example -- then $d^1$ and $d^2$ will be also independent, etc.)


text:
Q: How do I copy files from from the current docker build stage from one directory to another? How is one meant to copy files that are part of the base image of the current stage in a multistage docker build?
E.g. if I want to start with a base image of alpine 3.7 how would I copy the file /etc/resolv.conf to somewhere I wanted it?

First version of my Dockerfile:
# Dockerfile
FROM alpine:3.7 as dev
WORKDIR /test
COPY /etc/resolv.conf /test

$ docker build -t foo:bar .
Sending build context to Docker daemon  14.85kB
Step 1/3 : FROM alpine:3.7 as dev
 ---> 6d1ef012b567
Step 2/3 : WORKDIR /test
 ---> Using cache
 ---> a82a71a856b0
Step 3/3 : COPY /etc/resolv.conf /test
COPY failed: stat /var/lib/docker/tmp/docker-builder820934750/etc/resolv.conf: no such file or directory

Second version of my Dockerfile:
# Dockerfile
FROM alpine:3.7 as dev
WORKDIR /test
COPY --from=dev /etc/resolv.conf /test

$ docker build -t foo:bar .
Sending build context to Docker daemon  14.85kB
Step 1/3 : FROM alpine:3.7 as dev
 ---> 6d1ef012b567
Step 2/3 : WORKDIR /test
 ---> Using cache
 ---> a82a71a856b0
Step 3/3 : COPY --from=dev /etc/resolv.conf /test
invalid from flag value dev: pull access denied for dev, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

A: Creating a multi-stage build can be tricky to get right, but the basics look like this:
FROM alpine:3.7 as dev
WORKDIR /test

# ... Do additional stuff in the "dev" stage

# Define a new stage called whatever you want, here called "final"
FROM alpine:3.7 as final

# Copy from an earlier stage
COPY --from=dev /etc/resolv.conf /test

Doing --from only makes sense if you are referencing a previous stage. It doesn't do anything useful if you have only one stage. It cannot reference other Dockerfile stages directly, you must have a corresponding FROM ... AS ... directive.


text:
Q: What is Kestrel (vs IIS / Express) What is the kestrel web server and how does it relate to IIS / IIS Express?
I come from developing apps on IIS Express and hosting them on an IIS web server. With ASP.NET Core I have a dependency on Microsoft.AspNetCore.Server.Kestrel and my startup has .UseServer("Microsoft.AspNetCore.Server.Kestrel"). But when I run my website, I still get the IIS Express icon in the system tray. Someone asked me if I was using IIS Express or Kestrel and I didn't know what to say!
I don't have any cross-platform requirements as I develop on a PC and host in Azure, so I'm confused if I even need Kestrel, but it doesn't seem like there's an alternative - even the simplest samples use Kestrel.

A: *

*Multiple apps on the same port is not supported in Kestrel.

*Windows Authentication does not exist on Kestrel.

*Request Filtering is much more fully featured in IIS.

*Mime Type Mapping is much better in IIS.

*HTTP access logs aren't collected in Kestrel.

A: I'd like to offer an alternative answer, with some history, so that you might understand why Kestrel comes, even if you only use Windows and IIS.
At the very beginning of ASP.NET development before year 2000, clearly Microsoft created two pieces to host ASP.NET WebForms apps,

*

*Cassini, later became ASP.NET Development Server in Visual Studio. It is a fully managed web server written in C# based on HttpListener. Of course, since it was for development only, many features were never implemented. As Microsoft made the source code of Cassini available for the public, there are third parties who forked the code base and added more features, which started the Cassini family.

*ASP.NET support on IIS (revision 1). Because IIS was 4.0 and 5.0/5.1 at that time, which has nothing like application pools, ASP.NET even has its own worker process (aspnet_wp.exe).

So to develop a web app, you use Cassini, and to deploy you use IIS.

*

*The introduction of application pools in IIS 6 required some changes on ASP.NET side, so aspnet_wp.exe became obsolete and replaced by aspnet_isapi.dll. That can be seen as ASP.NET support on IIS revision 2. So ASP.NET apps are being hosted in IIS worker processes w3wp.exe.

*The introduction of integrated pipeline in IIS 7 and above required further changes, which replaced aspnet_isapi.dll with webengine4.dll. That can be seen as ASP.NET support on IIS revision 3. ASP.NET and IIS pipelines are unified.
You can see ASP.NET has become much more complex and tightly integrated with IIS, so Cassini started to show its age, and gradually was replaced by IIS Express (a user mode lite IIS).
Thus, in many cases, when people blame that IIS is slow, they should blame ASP.NET in fact. IIS itself without ASP.NET is pretty fast and stable, while ASP.NET was not developed with enough performance metrics in mind (as WebForms focuses quite a lot of productivities and RAD).
Then in November 2014, ASP.NET 5 (later renamed to ASP.NET Core) was announced and became a cross platform technology. Obviously Microsoft needed a new design to support Windows, macOS, and Linux, where all major web servers, nginx/Apache (or other web servers) should be considered besides IIS.
I think many would agree that Microsoft learned quite a lot from NodeJS, and then designed and developed Kestrel (based on libuv initially but might move to other technology soon). It is a light-weight web server like Cassini initially, but later more features are being added (like another answer commented, much more features so can be treated as a full web server). Though fully managed (some native dependencies exist), it is no longer a toy web server like Cassini.
Then why cannot you just use Kestrel? Why IIS Express and potentially IIS, nginx, or Apache are still needed? That primarily is a result of today's internet practice. Most web sites use reverse proxies to take requests from your web browsers and then forward to the application servers in the background.

*

*IIS Express/IIS/nginx/Apache are the reverse proxy servers

*Kestrel/NodeJS/Tomcat and so on are the application servers

Another answer already showed a link to Microsoft documentation, so you can take a look.
Microsoft developed HttpPlatformHandler initially to make IIS a good enough reverse proxy for Java/Python and so on, so planned to use it for ASP.NET Core. Issues started to appear during development, so later Microsoft made ASP.NET Core Module specifically for ASP.NET Core. That's ASP.NET support on IIS revision 4.
Starting from ASP.NET Core 2.2, ASP.NET Core Module for IIS (version 2) can host .NET Core environment inside IIS worker process (w3wp.exe), quite similar to ASP.NET 2.x/4.x. This mode is called "IIS in-process hosting". It can be considered as ASP.NET support on IIS revision 5.
Well, quite lengthy, but I hope I put all necessary pieces together and you enjoy reading it.
One recent update (Jan 2023) is that ASP.NET Core/Kestrel can be used to host reverse proxy functionalities itself, as the open source YARP project revealed.
Kestrel/YARP is now widely used inside Microsoft Azure to replace IIS ARR in many scenarios as reported, so literally now you can host your own production web apps with Kestrel/YARP without any other web server (IIS/nginx/Apache) in front as well.

A: From ms docs at:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?tabs=aspnetcore2x

Kestrel is a cross-platform web server for ASP.NET Core based on
libuv, a cross-platform asynchronous I/O library. Kestrel is the web
server that is included by default in ASP.NET Core project templates.
You can use Kestrel by itself or with a reverse proxy server, such as
IIS, Nginx, or Apache. A reverse proxy server receives HTTP requests
from the Internet and forwards them to Kestrel after some preliminary
handling.

UPDATE: .net core 2.1, Kestrel uses managed sockets instead of libuv
From asp.net core 2.1 docs at: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.1#transport-configuration

With the release of ASP.NET Core 2.1, Kestrel's default transport is
no longer based on Libuv but instead based on managed sockets.

A:
What is Kestrel

It's a full blown web server. You can run your ASP.NET Core application using just Kestrel.

But when I run my website, I still get the IIS Express icon in the system tray

In your ASP.NET application, probably in the wwwroot directory, you'll see a web.config that contains this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
    <handlers>
    <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
</system.webServer>
</configuration>

This is the HttpPlatformHandler. Essentially, what this does is forward all requests to Kestrel. IIS Express (and IIS for that matter) will not run ASP.NET themselves anymore. Instead, they will act as proxies that simply pass requests and responses back and forth from Kestrel. There is still advantages of using IIS, specifically it gives you security configuration, kernel-level caching, etc.


text:
Q: Compare if cells in a column are equal and perform formula Im working with a data sheet and I have a column with multiple customers, every customer might appear more than once. Is there a way for excel to check the column, find the cells that match, and then execute a formula?
My Column could look like this:
Apple
Apple
Intel
Windows
Intel

I want excel to check the column for duplicates and calculate an average for each customer. Like an average for both apple lines, then a new for both Intel, and a new for Windows.

A: This can be handled using the formula =COUNTIF(A$2:A2,A2), as in following example:

As you see, every item if counted from the beginning (A$2) up to itself (for cell "B6", the formula has become =COUNTIF(A$2:A6,A6)).
Explanation:

*

*Go in every cell from "A$2" to "A6".

*Count the amount of times you find the value of "A6".

*The usage of absolute cell references (with the dollarsign) and relative cell references (without the dollarsign) becomes clear once you drag the formula down for new cell entries.

You can use this as a start for an =IF()-based formula.


text:
Q: How to call procedure in oracle for input parameter as types? Code segment for oracle to call proc where we are using type variables as a input parameter.
1- By this approach we could call proc of input type parameter.
CREATE OR REPLACE TYPE callbck AS TABLE OF callback_t;
CREATE OR REPLACE TYPE CALLBACK_T AS OBJECT
(
   p_grading_id NUMBER,
   p_name VARCHAR2 (500),
   p_value VARCHAR2 (500)
);
CREATE TABLE CALLBACK_T_temp
(
   p_grading_id   NUMBER,
   p_name         VARCHAR2 (500),
   p_value        VARCHAR2 (500)
);
CREATE OR REPLACE PROCEDURE log_errors (p_error_message IN callbck)
AS
BEGIN
   INSERT INTO CALLBACK_T_temp
      SELECT *
        FROM TABLE (p_error_message) COMMIT;
END;
/
SELECT * FROM CALLBACK_T_temp;
COMMIT;
DECLARE
   P_ERROR_MESSAGE   callbck;
BEGIN
   P_ERROR_MESSAGE :=
      callbck (CALLBACK_T (1, 'name1', 'value1'),
               CALLBACK_T (1, 'name2', 'value2'),
               CALLBACK_T (1, 'name3', 'value3'));
   CRADLE_DEV_ENV11_O.LOG_ERRORS (P_ERROR_MESSAGE);
   COMMIT;
END;
SELECT * FROM CALLBACK_T_temp;
TRUNCATE TABLE CALLBACK_T_temp;

2- this is another approach by which  we could call proc of input type parameter.
CREATE TABLE temp
(
   p_grading_id   NUMBER,
   p_name         VARCHAR2 (500),
   p_value        VARCHAR2 (500)
);
INSERT INTO temp
     VALUES (1, 'name1', 'value1');
INSERT INTO temp
     VALUES (1, 'name2', 'value2');
INSERT INTO temp
     VALUES (1, 'name3', 'value3');
COMMIT;
SELECT * FROM temp;
DECLARE
   P_ERROR_MESSAGE   callbck;
BEGIN
   SELECT CALLBACK_T (e.p_grading_id, e.p_name, e.p_value)
     BULK COLLECT INTO P_ERROR_MESSAGE
     FROM temp e;
   CRADLE_DEV_ENV11_O.LOG_ERRORS (P_ERROR_MESSAGE);
END;
/
SELECT * FROM CALLBACK_T_temp;
TRUNCATE TABLE CALLBACK_T_temp;

3- By this approach we could call proc of input type parameter but object type inside object type.
CALLING OBJECT INSIDE OBJECT
**DECLARE
   P_VALUES   P_OBJECT;
BEGIN
   P_VALUES :=
      P_OBJECT (
         1000,
         name_value_table (name_value_object ('NAME1', 'VALUE1'),
                           name_value_object ('NAME2', 'VALUE2'),
                           name_value_object ('NAME3', 'VALUE3')));
   PKG.PROC (P_VALUES);
   COMMIT;
END**;

So is there any other way by which we could call procedure of input parameter as type.


text:
Q: Why aren't my data-bound user settings saving? I have the following:
MainWindow:
<Window x:Class="TestApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:TestApp"
        xmlns:settings="clr-namespace:TestApp.Settings"
        mc:Ignorable="d" Title="MainWindow" Height="350" Width="525">
    <Grid>
        <ItemsControl>
            <ItemsControl.ItemsSource>
                <Binding>
                    <Binding.Source>
                        <CollectionViewSource Source="{Binding Source={x:Static settings:CustomSettings.Default}, Path=coll}" />
                    </Binding.Source>
                </Binding>
            </ItemsControl.ItemsSource>

            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100" />
                            <ColumnDefinition Width="100" />
                        </Grid.ColumnDefinitions>

                        <TextBox Text="{Binding Name}" />
                        <Button Grid.Column="1" Click="Button_Click" />
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</Window>

Code-Behind:
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;

namespace TestApp
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            if (Settings.CustomSettings.Default.coll == null)
            {
                Settings.CustomSettings.Default.coll = new ObservableCollection<BasicClass>();
                Settings.CustomSettings.Default.coll.Add(new BasicClass("String1"));
                Settings.CustomSettings.Default.coll.Add(new BasicClass("String2"));
                Settings.CustomSettings.Default.coll.Add(new BasicClass("String3"));
            }

            Settings.CustomSettings.Default.Save();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Settings.CustomSettings.Default.Save();

            foreach (BasicClass item in Settings.CustomSettings.Default.coll)
            {
                MessageBox.Show(item.Name);
            }
        }
    }

    public class BasicClass : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private string name;
        public string Name
        {
            get { return name; }
            set
            {
                if (value != name)
                {
                    name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }

        public BasicClass() { }

        public BasicClass(string Name)
        {
            this.Name = Name;
        }
    }
}

Settings:
using System.Collections.ObjectModel;
using System.Configuration;
using System.Diagnostics;

namespace TestApp.Settings
{
    internal sealed partial class CustomSettings : ApplicationSettingsBase
    {
        private static CustomSettings defaultInstance = ((CustomSettings)(Synchronized(new CustomSettings())));

        public static CustomSettings Default
        {
            get
            {
                return defaultInstance;
            }
        }

        [UserScopedSetting()]
        [DebuggerNonUserCode()]
        public ObservableCollection<BasicClass> coll
        {
            get
            {
                return ((ObservableCollection<BasicClass>)(this["coll"]));
            }
            set
            {
                this["coll"] = value;
            }
        }
    }
}

How it works:
The app present three controls consisting of a TextBox and a Button. These are part of an ItemsControl whose source is bound to a user setting 'coll', of type ObservableCollection<BasicClass>. BasicClass has one property, 'Name', which appears in the TextBox via data-binding.
Expected behaviour:
I change the text in a TextBox, then click the corresponding Button. This would then save the new value in 'coll', and then present a MessageBox sequence demonstrating that this has indeed been changed. I restart the app, and my value is showing the newly saved value.
Actual behaviour:
I change the text, I click the Button, the MessageBox sequence shows me that the value is now stored in the user settings (and should therefore have been saved). However, when I restart the app, I see the original value, not the saved one.
An anomaly(?):
If I click the button twice instead of once (going through the MessageBox sequence twice), when I restart the value has now been successfully saved.

A: EDIT (original answer below):
While I suspect implementing IBindableComponent on a subclass of ObservableCollection might work, I don't recommend it. If you're just storing strings, System.Collections.Specialized.StringCollection might help you.
But in general, I don't think it makes much sense to update your application settings each time something changes. Instead, load them during application startup into your view model (e.g. an ObservableCollection) and move them back to the application settings when closing. This way, the values only need to be deserialized and serialized once.
The effect you mention in your comment about setting the value to itself works (it seems) because the list is re-serialized when you set it. It appears, ApplicationSettingsBase is storing a serialized copy of every value you provide, and therefore can't react to changes in your original object. When you provide the value again, it overwrites its copy with a serialized version of the new state of your object. However, if you serialize the list every time a user makes a change, it will impact your app's performance, once the list gets longer.
This might be interesting to you as well:
How to store int[] array in application Settings
And it seems unnecessary to subclass ApplicationSettingsBase yourself, see https://social.msdn.microsoft.com/Forums/en-US/4e299ed8-8e3a-408e-b900-eb6738fe0775/persist-and-restore-application-state?forum=wpf
ORIGINAL:
I'm not familiar with the ApplicationSettingsBase, but perhaps this helps https://msdn.microsoft.com/en-in/library/8eyb2ct1(en-us).aspx:

You can only bind an application setting to a component that supports the IBindableComponent interface. Also, the component must implement a change event for a specific bound property, or notify application settings that the property has changed through the INotifyPropertyChanged interface. If the component does not implement IBindableComponent and you are binding through Visual Studio, the bound properties will be set the first time, but will not update. If the component implements IBindableComponent but does not support property change notifications, the binding will not update in the settings file when the property is changed.

It seems like it has to do with the fact that only serialized versions of your settings are stored and therefore changes within the list are not recognized (because the reference itself does not change). Note that when you replace the list entirely upon clicking a button, the new list's values are stored.


text:
Q: What is the network protocol of SqlConnection When using .net SqlConnection to connect to the DB, what network protocol does it use to connect the application to the database? I tried googling it and reading the docs but couldn't find anything. Is it HTTP or something else?

A: The network protocol for SQL Server is the Tabular Data Stream Protocol or TDS, and it runs over TCP/IP, Named Pipes, or (for local connections) Shared Memory.


text:
Q: How to make a compile time error if an enum variant is passed to a function Suppose I have an enum:
enum Foobar {
    Foo(i32),
    Bar(f64)
}

I also have a function that takes a Foobar as an argument:
fn foo(x: &mut Foobar) {
    match x {
        Foobar::Foo(i32) => { /* do something */ },
        Foobar::Bar(f64) => { /* panic */ }
    }
}

Is it possible to throw a compile time error if the caller of the function passes the Bar variant to the function, without using a compiler plugin?

A: No.
Even a compiler plugin (by which I assume you mean a "lint") can't possibly cover all cases.
If you want to make it statically impossible to pass a particular piece of data to the function, then change the types so that it's actually not valid: define a sibling of Foobar that doesn't have the Bar variant, along with some conversions between the two.
There is no simple or automatic way to do this in Rust; you'll just have to do the hard yakka.  Or wait for refinement types, but I wouldn't recommend doing that.


text:
Q: Could we characterize injective objects in the category of $G$-equivariant sheaves? Let $k$ be a field and $X$ be a topological space. We consider Sh$(X)$, the category of sheaves of $k$-vector spaces on $X$.
Let $G$ be a topological group which act on $X$ continuously from the left. Consider the simplicial space $[G\backslash X]_{\cdot}$ where
$$
[G\backslash X]_n=\underbrace{G\times \ldots \times G}_{n\text{ copies of }G\text{'s}}\times X
$$
with structural maps
$$
d_0(g_1,\ldots, g_n,x)=(g_2,\ldots,g_n,g_1^{-1}x);
$$
$$
d_i(g_1,\ldots, g_n,x)=(g_1,\ldots, g_ig_{i+1},\ldots, g_n,x), ~1\leq i\leq n-1;
$$
$$
d_n(g_1,\ldots, g_n,x)=(g_1,\ldots, g_{n-1},x);
$$
and
$$
s_0(g_1,\ldots, g_n,x)=(e,g_1,\ldots, g_n,x);
$$
$$
s_i(g_1,\ldots, g_n,x)=(g_1,\ldots, g_i,e , g_{i+1},\ldots, g_nx),~1\leq i\leq n-1;
$$
$$
s_n(g_1,\ldots, g_n,x)=(g_1,\ldots, g_n,e,x).
$$
A $G$-equivariant sheaf on $X$ is a pair $(\mathcal{F},\theta)$, where $\mathcal{F}\in \text{Sh}(X)$ and $\theta$ is an isomorphism
$$
\theta: d_0^*\mathcal{F}\overset{\sim}{\to} d_1^*\mathcal{F},
$$
satisfying the cocycle condition
$$
d_2^*\theta\circ d_0^*\theta=d_1^*\theta, \text{ and } s_0^*\theta=\text{id}_{\mathcal{F}}.
$$
We denote the category of $G$-equivariant sheaves on $X$ by $\text{Sh}_G(X)$. It is clear that $\text{Sh}_G(X)$ is an abelian category and the forgetful functor
For$: \text{Sh}_G(X)\to \text{Sh}(X)$ is exact.
I am interested in the injective objects in $\text{Sh}_G(X)$. We know that in general, $\text{For}: \text{Sh}_G(X)\to \text{Sh}(X)$ does not preserve injective objects, unless $G$ is discrete.
Here are my questions

In the case that $G$ is discrete, $\mathcal{F}$ is injective as a sheaf is a necessary but not sufficient condition that $(\mathcal{F},\theta)$ is an injective object in $\text{Sh}_G(X)$. Then what are additional requirements to make sure that $(\mathcal{F},\theta)$ is injective?
In then general case that $G$ is not discrete, what are injective objects in $\text{Sh}_G(X)$?


text:
Q: Mathematica: Constraints not valid Nmaximize I am trying to use NMaximize in Mathematica
This is how I proceeded:
1) define a list of parameters: Par = {a->1, b->3, etc};
2) define two functions: f1: v1=express./Par  f2: v2=express./Par
After this the expression are numerical except for the variables:
V1=f(e1,x) and V2=f(e2,x)

The objective function to be maximized is V1/(e1+e2)
I defined the constraint as constr=V1-V2;
then I used the NMaximize:
 NMaximize[{objopt > 0, constr == 0}, {e1, e2, x}, Method -> NelderMead]

I obtained the following error:

NMaximize::bcons: "The following constraints are not valid:
  "expression". Constraints should be equalities, inequalities, or
  domain specifications involving the variables"

I checked that only those variables are present in the constraint and objective function (other are numerical parameters).
I do not understand why this error appears.


text:
Q: Count/identify INCORRECT selection in reCaptcha v3 I want to use the 'reCaptcha v3 invisible option' where you don't have to do any particular action like clicking on 'I am not a robot'.

I want to know how many API calls are made in each of the following scenarios

*

*Form is submitted and no prompt is shown by reCaptcha because it considers as a human. not a bot.

*Form is submitted and ReCaptcha shows the puzzle to solve because it considers probably spam, the user makes the correct selection.

*In the above scenario (2), the user makes an incorrect selection.

Question: How to track/detect/identify the no 3 above?
What I have done so far
I studied the following answer. (It was better than the official Google documentation)
https://stackoverflow.com/a/57202461/18752911
I went through the official reCaptcha v3 documentation too.
https://developers.google.com/recaptcha/docs/v3
https://developers.google.com/recaptcha/docs/verify

A: You can visit the reCaptcha admin console and view/download the statistics. See the below image of the downloaded CSV. (No.3 - Unsuccessful attempts are included too.)
Image of CSV with reCaptcha analytics
More information about analytics: https://developers.google.com/recaptcha/docs/analytics#recaptcha_v3


text:
Q: Parse error: syntax error, unexpected '?' I have been trying to follow a guide for making a PHP server app and I am getting a few syntax errors.
Error message:
Parse error: syntax error, unexpected '?' in
D:\inetpub\wwwroot\cmpswoo1\CMPPROJ_Web\ServerApp\api2\db_functions2.php on line 134

So I know were the error is, I just don't know how to fix it
<?php
class db_functions2 {
private $db;
//put your code here
// constructor
function __construct() {
    require_once 'db_connect2.php';
    // connecting to database
    $this->db = new db_connect2();
    $this->db->connect();
}
// destructor
function __destruct() {
}
/**
 * Random string which is sent by mail to reset password
 */
public function random_string()
{
$character_set_array = array();
$character_set_array[] = array('count' => 7, 'characters' => 'abcdefghijklmnopqrstuvwxyz');
$character_set_array[] = array('count' => 1, 'characters' => '0123456789');
$temp_array = array();
foreach ($character_set_array as $character_set) {
    for ($i = 0; $i < $character_set['count']; $i++) {
        $temp_array[] = $character_set['characters'][rand(0,  strlen($character_set['characters']) - 1)];
    }
 }
 shuffle($temp_array);
 return implode('', $temp_array);
 }
 public function forgotPassword($forgotpassword, $newpassword, $salt){
 $result = mysql_query("UPDATE `Users` SET `encryptedPassword` = '$newpassword',`salt` = '$salt'
          WHERE `email` = '$forgotpassword'");
 if ($result) {
 return true;
 }
 else
 {
 return false;
 }
 }
 /**
 * Adding new user to mysql database
 * returns user details
 */
 public function storeUser($FirstName, $LastName, $DOB, $email, $Username, $Password) {
    $uuid = uniqid('', true);
    $hash = $this->hashSSHA($Password);
    $encrypted_password = $hash["encrypted"]; // encrypted password
    $salt = $hash["salt"]; // salt
    $result = mysql_query("INSERT INTO Users(unique_id, FirstName, LastName, email, DOB, Username, encryptedPassword, salt, created_at) VALUES('$uuid', '$FirstName', '$LastName', '$email', '$DOB', '$Username', '$encryptedPassword', '$salt', NOW())");
    // check for successful store
    if ($result) {
        // get user details
        $uid = mysql_insert_id(); // last inserted id
        $result = mysql_query("SELECT * FROM Users WHERE uid = $id");
        // return user details
        return mysql_fetch_array($result);
    } else {
        return false;
    }
}
 /**
 * Verifies user by username and password
 */
 public function getUserByUsernameAndPassword($Username, $Password) {
    $result = mysql_query("SELECT * FROM Users WHERE usernameE = '$Username'") or die(mysql_error());
    // check for result
    $no_of_rows = mysql_num_rows($result);
    if ($no_of_rows > 0) {
        $result = mysql_fetch_array($result);
        $salt = $result['salt'];
        $encrypted_password = $result['encryptedPassword'];
        $hash = $this->checkhashSSHA($salt, $Password);
        // check for password equality
        if ($encryptedPassword == $hash) {
            // user authentication details are correct
            return $result;
        }
    } else {
        // user not found
        return false;
    }
 }
 /**
 * Checks whether the username is valid or fake
 */
 public function validUsername($Username)
 {
 $isValid = true;
 $atIndex = strrpos($Username, "@");
 if (is_bool($atIndex) && !$atIndex)
 {
  $isValid = false;
 }
 else
 {
  $domain = substr($Username, $atIndex+1);
  $local = substr($Username, 0, $atIndex);
  $localLen = strlen($local);
  $domainLen = strlen($domain);
  if ($localLen < 1 || $localLen > 64)
  {
     // local part length exceeded
     $isValid = false;
  }
  else if ($domainLen < 1 || $domainLen > 255)
  {
     // domain part length exceeded
     $isValid = false;
  }
  else if ($local[0] == '.' || $local[$localLen-1] == '.')
  {
     // local part starts or ends with '.'
     $isValid = false;
  }
  else if (preg_match('/\.\./', $local))
  {
     // local part has two consecutive dots
     $isValid = false;
  }
  else if (!preg_match('/^[A-Za-z0-9\-\.]+$/', $domain))
  {
     // character not valid in domain part
     $isValid = false;
  }
  else if (preg_match('/\.\./', $domain))
  {
     // domain part has two consecutive dots
     $isValid = false;
  }
   else if
     (!preg_match('/^(\\.|[A-Za-z0-9!#%&`_=\/$'*+?^{}|~.-])+$/',str_replace("\\","",$local)))
  {
     // character not valid in local part unless
     // local part is quoted
     if (!preg_match('/^"(\\"|[^"])+"$/',
         str_replace("\\","",$local)))
     {
        $isValid = false;
     }
  }
  if ($isValid && !(checkdnsrr($domain,"MX") ||checkdnsrr($domain,"A")))
  {
     // domain not found in DNS
     $isValid = false;
  }
 }
 return $isValid;
 }
 /**
 * Check user is existed or not
 */
 public function isUserExisted($Username) {
    $result = mysql_query("SELECT Username from Users WHERE Username = '$Username'");
    $no_of_rows = mysql_num_rows($result);
    if ($no_of_rows > 0) {
        // user existed
        return true;
    } else {
        // user not existed
        return false;
    }
 }
 /**
 * Encrypting password
 * returns salt and encrypted password
 */
 public function hashSSHA($Password) {
    $salt = sha1(rand());
    $salt = substr($salt, 0, 10);
    $encrypted = base64_encode(sha1($Password . $salt, true) . $salt);
    $hash = array("salt" => $salt, "encrypted" => $encrypted);
    return $hash;
 }
 /**
 * Decrypting password
 * returns hash string
 */
 public function checkhashSSHA($salt, $Password) {
    $hash = base64_encode(sha1($Password . $salt, true) . $salt);
    return $hash;
 }
 }

 ?>

A: Here single quote is causing problem:
So, change
(!preg_match('/^(\\.|[A-Za-z0-9!#%&`_=\/$'*+?^{}|~.-])+$/',str_replace("\\","",$local)))

To:
(!preg_match('/^(\\.|[A-Za-z0-9!#%&`_=\/$\'*+?^{}|~.-])+$/',str_replace("\\","",$local)))

A: The regular expression string is opened with ', but also contains a '. Escape it with \. The error should be gone.
 (!preg_match('/^(\\.|[A-Za-z0-9!#%&`_=\/$'*+?^{}|~.-])+$/',str_replace("\\","",$local)))

Should be
 (!preg_match('/^(\\.|[A-Za-z0-9!#%&`_=\/$\'*+?^{}|~.-])+$/',str_replace("\\","",$local)))


text:
Q: How does the Casorati-Weierstrass Theorem not contradict Picard's Theorem? I was looking at a proof regarding the Casorati-Weierstrass Theorem here and it got me thinking, using this set up can't one get a contradiction with Picard's Theorem?
For example, if we let  $f(z)=e^\frac{1}{z}$ in the above proof and we consider $\lambda = 0$ don't we get that there must be some $z_0$ such that $f(z_0)=0$ which would be a contradiction as it is often given that an example case of Picard's Theorem is that $0$ does not appear for $f(z)$?
Thank you in advance for the help. If the question is clear to understand please let me know.

A: The assumption which leads to a contradition is that there is a whole disk of values around $\lambda$ which are not attained, and the conclusion is then that $f$ must assume values arbitrarily close to $\lambda$.
If the assumption were that the single value $\lambda$ is not attained, then a contradiction would indeed imply that $\lambda$ is attained. However, it's impossible to derive such a contradiction (as shown by your counterexample), and the place where the current argument would break down is when it's claimed that $1/(f(z)-\lambda)$ is bounded.


text:
Q: Multivariate, nonlinear regression in R I am trying to make a chemical concentration curve, but it has been so long since I have had to use any type of math I'm having trouble getting going through iterations to find the best fit.
The data has one dependent variable, $y$, and two independent variables $x_1$ and $x_2$. However $x_1$ and $x_2$ do interact with each other. One concentration, $y$, is represented by a nonlinear curve made up by $x_1$ and $x_2$.

Each curve in the image shown represents a different concentration. The goal is to be able to gather $x_1$ and $x_2$ and determine what concentration, $y$ the solution is.
What methods should I start with? Should I just stick with polynomial or try PLS or PCA? I'm worried about over-fitting the data since in the real life application there will be some day to day testing variability that the regression needs to account for.
Any help is appreciated.


text:
Q: No consigo insertar la imagen después del input con JS El HTML (creo los inputs):
<input type="text" placeholder="Escribe tu nombre" required>
<input type="email" placeholder="Escribe tu Email" required/>
<textarea placeholder="Escribe aquí el contenido de tu mensaje"></textarea>

Y el JavaScript para el input email (con resolver este ya hago los otros):
var email = document.querySelector("input[type='email']")

function removeElement(element) {
  for (var i = 0; i < element.length; i++) {
    element[i].parentNode.removeChild(element[i]);
  }
}

function borrarEmail() {
  var parArea = document.getElementsByClassName("remove5");
  var parArea2 = document.getElementsByClassName("remove6");

  if (parArea.length > 0 && parArea2 > 0) {
    removeElement(parArea);
    removeElement(parArea2);
  }
}

email.addEventListener("blur", function() {
  if (this.value == "" || this.value.indexOf("@") == -1 || this.value.indexOf(".") == -1) {
    borrarEmail();
    email.setAttribute("style", "background: pink; border-color: red");
    var parrafo5 = document.createElement("p");
    parrafo5.classList.add("remove5");
    parrafo5.innerHTML = "Bad Email";
    var emailConf = email.parentNode;
    emailConf.insertBefore(parrafo5, email);
    parrafo5.setAttribute("style", "color: red");
  } else {
    borrarEmail();
    email.setAttribute("style", "background: #C8FDD4; border-color: #52FD8B");
    var parrafo6 = document.createElement("img");
    parrafo6.classList.add("remove6");
    var emailCheck = document.getElementsByClassName("remove6");
    emailCheck.src = "./img/check.png";
    var emailConf1 = email.parentNode;
    emailConf1.insertChildAfter(parrafo6, email);
  }
});

Lo que hago es checkar que si el campo esta vacio añadirle estilo al input y un texto, (eso funciona), pero al añadirle una imagen despues, no consigo que funcione.

A: Para insertar un elemento inmediatamente después de otro utiliza:
elemento.parentNode.insertBefore(nuevo_elemento, elemento.nextSibling);

Esto quiere decir, insertar justo antes del elemento siguiente. No es muy elegante pero a falta de un metodo insertAfter (no existe) funciona bien.
Aquí te dejo el código corregido, hice otros cambios ya que la eliminación del mensaje de error (o el checkmark) no funcionaban bien.

var email = document.querySelector("input[type='email']")

function removeElement(element) {
  if (element.length) {
    for (var i = 0; i < element.length; i++) {
      element[i].parentNode.removeChild(element[i]);
     }
  }
}

function borrarIndicadores() {
  var parArea = document.getElementsByClassName("con_error");
  var parArea2 = document.getElementsByClassName("sin_error");
  removeElement(parArea);
  removeElement(parArea2);
}

email.addEventListener("blur", function() {
  if (this.value == "" || this.value.indexOf("@") == -1 || this.value.indexOf(".") == -1) {
    borrarIndicadores();
    email.setAttribute("style", "background: pink; border-color: red");
    var parrafo5 = document.createElement("p");
    parrafo5.classList.add("con_error");
    parrafo5.innerHTML = "Bad Email";
    var emailConf = email.parentNode;
    emailConf.insertBefore(parrafo5, email);
    parrafo5.setAttribute("style", "color: red");
  } else {
    borrarIndicadores();
    email.setAttribute("style", "background: #C8FDD4; border-color: #52FD8B");
    var image = document.createElement("img");
    image.classList.add("sin_error");
    image.style.width = "20px";
    image.style.height = "20px";
    image.src = "http://www.iconsdb.com/icons/download/moth-green/check-mark-3-512.gif";
    email.parentNode.insertBefore(image, email.nextSibling);
  }
});
<input type="text" placeholder="Escribe tu nombre" required>
<input type="email" placeholder="Escribe tu Email" required>
<textarea placeholder="Escribe aquí el contenido de tu mensaje"></textarea>

Aquí te dejo una version revisada que incluye todos lo campos, hice algunas mejoras (refactorize los metodos repetidos) y corregi otros bugs menores.
https://jsfiddle.net/efgqkn1k/2/


text:
Q: Get value from JSON and put it in String it's my first question here, i've try to be the more explicit :)
I want get value from a JSON page : https://api.dailymotion.com/video/x3p6d9r?fields=onair.
I have follow a tutorial about json object.
But i want get the value "onair" and put this in a String for use a IF STRING == "XX".
This is my code :
public class notification extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_notification);

        detectonline();

    }

    public void detectonline(){
        /*
        if (xx == "false") {
             Do something is live is off
        }
        else{
           Do something is live is on
        }

         */

    }

    public static boolean checkIfOnline(String channel) throws IOException {
        String channerUrl = "https://api.dailymotion.com/video/x3p6d9r?fields=onair";

        String jsonText = readFromUrl(channerUrl);// reads text from URL

        JsonParser parser = new JsonParser();
        JsonObject json = parser.parse(jsonText).getAsJsonObject();

        return !json.get("onair").isJsonNull();
    }

    private static String readFromUrl(String url) throws IOException {
        URL page = new URL(url);
        StringBuilder sb = new StringBuilder();
        Scanner scanner = null;
        try{
            //scanner = new Scanner(page.openStream(), StandardCharsets.UTF_8.name());
            scanner = new Scanner(page.openStream());
            while (scanner.hasNextLine()){
                sb.append(scanner.nextLine());
            }
        }finally{
            if (scanner!=null)
                scanner.close();
        }
        return sb.toString();
    }
}

A: I remake your method according what you are looking for it's one of several way to parse json data :
 public static boolean checkIfOnline(String channel) throws JSONException, IOException {
    String channerUrl = "https://api.dailymotion.com/video/x3p6d9r?fields=onair";

    String jsonText = readFromUrl(channerUrl);// reads text from URL

    JSONObject json = new JSONObject(jsonText); // You create a json object from your string jsonText
    if(json.has("onair")) { // just a simple test to check the node that you need existe
        boolean value = json.getBoolean("onair"); // In the url that you gave onair value is boolean type
        return value;
    }
    return false;
}

A: I will create methode using your way  !
public static boolean checkIfOnline(String channel) throws IOException {
        String channerUrl = "https://api.dailymotion.com/video/x3p6d9r?fields=onair";

        String jsonText = readFromUrl(channerUrl);// reads text from URL

        JsonParser parser = new JsonParser();

      String myString =json.get("onair");
 return mystring;}


text:
Q: Repeating  tag in the TeX4HT; how to suppress the repeated tag in the tex4ht? I am new to TeX4HT, I tried to write a .cfg for quote environment, i have used the below tex coding
\documentclass{book}
\begin{document}
\begin{quote}
Sample para 1

Sample para 2
\end{quote}
\end{document}

and the cfg coding is
\ConfigureEnv{quote}
             {\ifvmode \IgnorePar\fi \EndP\HCode{
}}
             {\ifvmode \IgnorePar\fi \EndP\HCode{
}}
             {}
             {}

I am getting the output like below

Sample para 1

Sample para 2

In the output html file '
' tag is opened for two times
"
" - this is I defined in the cfg file
"
"  - this one is coming from the html4.4ht

also i am getting  and  in the each and every para starting in the output html file
I compile the file with the following arguments
htlatex sample "sample.cfg,xhtml"
Please suggest How to suppress the repeating
 tag and the comment Instructions  ?

A: The original configuration for quote environment is:
\ConfigureEnv{quote}
    {}{}
    {\IgnorePar\EndP
 \HCode{
}\afterGetClass{quote}}
    {\IgnorePar\EndP\HCode{
}\ShowPar\ShowIndent}
 \Css{.quote  {margin-bottom:0.25em; margin-top:0.25em;
               margin-left:1em; margin-right:1em; text-align:justify;}}
 \NewConfigure{quoteClass}{2}
 \Configure{quoteClass}{quote}{}

quote environment is based on \list, so it is a little bit special. You can see that tags are inserted in fourth and fifth argument of \ConfigureEnv instead of the second and third. When you provide your own configuration, you leave these arguments empty, but in that case the original configuration is used, and this results in double tag insertion.
You can either change your configuration to replace the original insertions:
\ConfigureEnv{quote}
         {}
         {}
         {\ifvmode \IgnorePar\fi \EndP\HCode{
}}
         {\ifvmode \IgnorePar\fi \EndP\HCode{
}}

or you can use the fact that quote has configurable class name, using \Configure{quoteClass}{quote class name}{code to be inserted aftertag}:
\Configure{quoteClass}{disp-quote}{}

The line numbers are inserted by the paragraph configuration, you can get rid of it using this configuration:
\Configure{HtmlPar}
 {\EndP\HCode{
}}
 {\EndP\HCode{
}}
 {\HCode{
}}
 {\HCode{
}}

We have different configurations for paragraphs with and without indent, the \ifdim\parindent=0pt no\fi part is for inserting noindent class if the paragraph is marked as indented, but \parindent is zero, because it is the situation inside the quote environment.
The meaning of some of the paragraph handling commands is following:
\IgnorePar     Asks to ignore the next paragraph
\ShowPar       Asks to take into account the following paragraphs

\IgnoreIndent  asks to ignore indentation in the next paragraph
\ShowIndent    asks to check indentation in the following paragraphs

\SaveEndP      Saves the content of \EndP, and sets it to empty content
\RecallEndP

This results in the following code:

Sample para 1

Sample para 2


text:
Q: Difference between map only and map-reduce application I am trying to develop a set of simple mapreduce application where I process some complex data from file using map-only and map-reduce application. I am seeing some failure in my serialization code when I try to run map-reduce application. It is happening when the system tries to write intermediate data after map step. Due to this, one of the mapper is failing. But the same mapper is successful when there is no reducer.
Is there any difference in mapper output step for map-only or map-reduce step in terms of writing results to the filesystem?


text:
Q: Filtering set by classes information Suppose I want to get all fields from some OFG g while ignoring fields like  |java+field:///java/lang/System/err|. How do I check whether the resulting field actually refers to some class from the imported project?
My attempt is this. Here the compiler lights up at <- classes. So it doesn't allow from.path. Which I think should be possible.
g = buildGraph(createOFG(|project://eLib|));
m = createM3FromEclipseProject(|project://eLib|);
set[str] classes = { cl.path | cl <- classes(m) };
set[loc] fields = { from | <from,_> <- g,
                       from.scheme == "java+field", from.path <- classes };

How could I make this work?

A: Simple answer: from.path is not a pattern syntax, so you can use a variable instead:
 set[loc] fields = { from | <from,_> <- g,
                   from.scheme == "java+field", x <- classes, x == from.path };

or
 set[loc] fields = { from | <from,_> <- g,
                   from.scheme == "java+field", x := from.path, x <- classes };

A nice solution to the problem could be to use the containment relation m@containment, if you transitively close it m@containment* and query from the top you know if something is in the project, like myField in m@containment*[ |java+package:///elib|].
It's good to keep the m@containment*[ |java+package:///elib|] around in a variable since it is an expensive computation.
You can find out what the top of the containment relation is like so:
rascal> import analysis::graphs::Graph; // or import Graphs; in older versions
ok
rascal> top(m@containment)
set[loc]: {
   |java+package:///org|,
   |java+package:///vinju|
}


text:
Q: Angular 5 route issue I have following routes in my application.
const flowRoutes: Routes  = [
{ path: '', redirectTo: 'landingpage', pathMatch: 'full' },
{ path: 'landingpage', component: LandingPageComponent },
{ path: 'limitexcession/dashboard?Primary=true', component: LimitExcessionDashboardComponent },
{ path: 'limitexcession/:excessionID', component: LimitExcessionComponent },

];
limitexcession/dashboard?Primary=true and limitexcession/:excessionID are different routes. But both components are getting initialized if I route to limitexcession/dashboard?Primary=true.
But if I removed primary=true from the route it's not getting initialised.
Can any one help ?

A: Problem is following query  parameter ?Primary=true.
Pls reference below url: https://angular-xbj5n8.stackblitz.io
It is working fine if we remove hard-coded queryparam


text:
Q: Implementing partition refinement algorithm I have some nodes and edges
nodes = [
  { id: 'n1', propositions: ['p'] },
  { id: 'n2', propositions: ['p'] },
  { id: 'n3', propositions: ['p'] }
];
edges = [
  { source: 'n1', target: 'n2' },
  { source: 'n2', target: 'n1' },
  { source: 'n1', target: 'n3' },
  { source: 'n2', target: 'n3' }
];

As seen in the data, the two nodes n1 and n2 are pointing against each other, and both n1 and n2 are each pointing at n3.
I am trying to implement the algorithm on http://homepages.cwi.nl/~jve/courses/lai0506/LAI11.pdf#page=25 in JavaScript.
From what I understand, the initial partition will have only one block that contains all three nodes n1, n2, and n3. The second partition will have n1 and n2 in one subblock and n3 in another subblock. The third partition will be the same as the second partition, so the iteration will halt. And as I have understood, all nodes in a subblock are redundant except of one, so I can just remove them and keep only one.
I have first created an initial partition Pi_0 by grouping the nodes with the same propositions. Then I move onto iterating until no changes are made since the last partition.
What I have come up with so far is
/**
 * Initial partition
 **/

// blocks in initial partition
const partition = {};

// group nodes into blocks based on propositions
nodes.forEach(function (node) {
  // use propositions as key
  const key = node.propositions.sort().join();

  // create block if it does not already exists
  if (!partition[key]) {
    partition[key] = [];
  }

  // add node to block
  partition[key].push(node);
});

/**
 * Iterate until P_{i} = P_{i - 1}
 **/

// repeat until Pi_{i} = Pi_{i-1}
while (true) {
  // get ready to partition each block in the partition into subblocks
  const newPartition = {};

  // go through each block in partition
  Object.keys(partition).forEach(function (blockName) {
    // get block by blockName
    const nodesInBlock = partition[blockName];

    // go through each node in the block
    nodesInBlock.forEach(function (sourceNode) {
        // ...
        // ...

        // create subblock if it doesn't already exists
        if (!newPartition[key]) {
          newPartition[key] = [];
        }

        // add node to subblock
        newPartition[key].push(sourceNode);
      });
    }
  });

  // if nothing changed
  if (Object.keys(partition).length === Object.keys(newPartition).length) {
    break;
  } else {
    partition = newPartition;
  }
}
}

But I don't know what to do instead of the snippet where I wrote ....
I guess I should get the name of the block to which the node points (i.e. the target node's block name), and then create a key from the source node's block name and the target node's block name. I just don't know how. From page 27, the implementation is described in Haskell, but I don't understand Haskell, so it won't help me.
Edit
I guess the partitions should look like this
// data:
nodes = [
  { id: 'n1', propositions: ['p'] },
  { id: 'n2', propositions: ['p'] },
  { id: 'n3', propositions: ['p'] }
];
edges = [
  { source: 'n1', target: 'n2' },
  { source: 'n2', target: 'n1' },
  { source: 'n1', target: 'n3' },
  { source: 'n2', target: 'n3' }
];

// initial partition
initialPartition = [
  { id: 'n1', propositions: ['p'] },
  { id: 'n2', propositions: ['p'] },
  { id: 'n3', propositions: ['p'] }
];

// second partition
secondPartition = [
  [
    { id: 'n1', propositions: ['p'] },
    { id: 'n2', propositions: ['p'] }
  ],
  { id: 'n3', propositions: ['p'] }
];

// third partition
thirdPartition = [
  [
    { id: 'n1', propositions: ['p'] },
    { id: 'n2', propositions: ['p'] }
  ],
  { id: 'n3', propositions: ['p'] }
];

So because the second and third are equal, the iteration process halts.