text:
Q: How to render HTML tags for chatbot using JS or JQuery? I'm trying to customize an old chatbot project I found online, which I'm using as a simple "command bot" that returns specific response based on the user input.
However, it's almost full text-based only and I can't render HTML tags. I would like it to be able to return HTML elements such as buttons, lists, images, bold and all emphasis, etc...
I have no idea anymore how I'd do it. So far it seems to render anchor tags fine..
Also, I'd like it to interpret \n as line break or \s as space.
How do I go about doing any of this? Here's my code so far:

let search = `<a href='http://google.com' target="_blank">Google.com</a>`;

function chatBot() {

    this.input;

    this.respondTo = function (input) {

        this.input = input.toLowerCase();

        if (this.match('(/help|!help|help)(\\s|!|\\.|$)'))
            return `Available commands: /userguides`;

        if (this.match('google'))
            return `Try this: <a href='http://google.com' target="_blank">Google.com</a>`;

        if (this.match('bracketed matter') && this.match('under this title'))
            return `here's the solution`;

        if (this.match('(search)'))
            return search;

        if (this.input == 'noop')
            return;

        return [`Sorry, the command you entered doesn't exist.`, `Type /help to see all available commands.`];
    }

    this.match = function (regex) {

        return new RegExp(regex).test(this.input);
    }
}

/******************************************************************************************************************* */

$(function () {

    var you = 'You';
    var system = 'System';

    var delayStart = 300;
    var delayEnd = 700;

    // initialize
    var bot = new chatBot();
    var chat = $('.chat');
    var waiting = 0;
    $('.status').text(system + ' is typing...');

    // submit user input and get chat-bot's reply
    var submitChat = function () {

        var input = $('.input input').val();
        if (input == '') return;

        $('.input input').val('');
        updateChat(you, input);

        var reply = bot.respondTo(input);
        if (reply == null) return;

        var latency = Math.floor((Math.random() * (delayEnd - delayStart)) + delayStart);
        $('.status').css('display', 'block');
        waiting++;
        setTimeout(function () {
            if (typeof reply === 'string') {
                updateChat(system, reply);
            } else {
                for (var r in reply) {
                    updateChat(system, reply[r]);
                }
            }
            if (--waiting == 0) $('.status').css('display', 'none');
        }, latency);
    }

    // add a new line to the chat
    var updateChat = function (party, text) {

        var style = 'you';
        if (party != you) {
            style = 'other';
        }

        var line = $('

');
        line.find('.party').addClass(style).text(party + ':');
        line.find('.text').html(text);

        chat.append(line);

        chat.stop().animate({ scrollTop: chat.prop("scrollHeight") });

    }

    // event binding
    $('.input').bind('keydown', function (e) {
        if (e.keyCode == 13) {
            submitChat();
        }
    });
    $('.input a').bind('click', submitChat);

    // initial chat state
    updateChat(system, `Hi there. Type /help to see all available commands.`);

});
/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}

body {
    line-height: 1;
}

/*****************************************************/

* {
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
}

body {
    font-family: "Roboto", sans-serif;
    font-size: 15px;
    background-color: #fafafa;
}

.container {
    width: 600px;
    margin: 50px auto 20px;
}

.title {
    font-size: 30px;
    font-weight: bold;
    font-family: "Roboto", sans-serif;
    text-shadow: #ccc 2px 2px 1px;
    padding-bottom: 5px;
}

.chat {
    border: 1px solid #ccc;
    min-height: 20vh;
    overflow-y: scroll;
    background-color: white;
    border-radius: 0;
    resize: vertical;
}

.chat div {
    margin: 10px 12px 15px;
    line-height: 15px;
}

.chat .party {
    font-weight: bold;
}

/* .chat .text {
    background-color: #ff7f50;
    padding: 5px;
    border-radius: 10px;
} */

.chat .you {
    color: #1976d2;
}

.chat .other {
    color: #43a047;
}

.status {
    position: absolute;
    padding: 3px 0;
    color: #666;
    display: none;
    font-size: 11px;
}

.input {
    margin-top: 20px;
}

.input input {
    vertical-align: top;
    float: left;
    border: 1px solid #ccc;
    padding: 5px;
    width: 480px;
    margin: 0;
    border-radius: 5px;
}

.input a {
    vertical-align: top;
    float: right;
    font-weight: bold;
    border: 1px solid #ccc;
    background-color: #efefef;
    padding: 7px 35px;
    color: black;
    text-decoration: none;
    border-radius: 5px;
}

.input a:hover {
    background-color: #ddd;
    cursor: pointer;
}

h9 {
    padding-left: 20px;
}
<!DOCTYPE html>

    <title>Chat Bot</title>

Chat Bot

            <input type="text" placeholder="Type something..." />
            Send

I'm still learning JS and this is a project I'm using to do so, but I'm really stuck. I'd appreciate any help. Thank you!

A: First, I think you should read source code carefully, then research.
line.find('.text').html(text);

*

*.find, .html with keyword Jquery

*render HTML tags: search with keyword like: insert html in div Jquery


text:
Q: android - dynamic first radio button to be in true state in my android app i am tried to create a dynamic radio button, according to an arraylist size, inside a radio group using the following code
for (int aa = 0; aa < itemname.length(); aa++)
{
    String iname = itemname.getJSONObject(aa).getString("item");

    final RadioButton[] radioButton = new RadioButton[itemname.length()];
    radioButton[aa] = new RadioButton(this);
    radioGroup.addView(radioButton[aa]);
    radioButton[aa].setTextColor(R.color.black);
    radioButton[aa].setText(iname);
    radioButton[aa].setButtonDrawable(R.drawable.about_us_tab);

    radioButton[aa].setId(h_count);
    radioGroup.setOnCheckedChangeListener(new     android.widget.RadioGroup.OnCheckedChangeListener()
     {
         public void onCheckedChanged(RadioGroup group, int checkedId)
         {
             int selectedBtn = radioGroup.getCheckedRadioButtonId();
          }
       });
       h_count++;
      }
  }

I am getting all the data in right order, and the onclick action of radio group is also working correctly.
But i want the the first radio button to be in selected mode. For this i tried using an if condition as follows
if(aa == 0)
    {
        radioButton[aa].setChecked(true);
        radioButton[aa].setId(h_count);
    }

But here the problem is, the first one is getting selected and in onclick action of radio group the first one is not getting deseleced, all others are working fine.
how to make the first one also deselected in onclick action of radio group

A: try in this way and its working
for (int aa = 0; aa < itemname.length(); aa++)
{
    String iname = itemname.getJSONObject(aa).getString("item");

    final RadioButton radioButton = new RadioButton(this);
    radioGroup.addView(radioButton;
    radioButton.setTextColor(R.color.black);
    radioButton.setText(iname);
    radioButton.setButtonDrawable(R.drawable.about_us_tab);

    if(aa == 0)
    {
        radioButton.setChecked(true);
    }

    radioButton.setId(h_count);
    radioGroup.setOnCheckedChangeListener(new     android.widget.RadioGroup.OnCheckedChangeListener()
    {
         public void onCheckedChanged(RadioGroup group, int checkedId)
         {
             int selectedBtn = radioGroup.getCheckedRadioButtonId();
         }
    });
    h_count++;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Restored my mac, lost a gesture I used to have a gesture where I could place 2 fingers on the top bar of an application/a file  and use a third finger to drag it around. What gesture is this?

A: Found it. It's not a gesture but an Accessibility feature. Navigate to the screenshot shown below (System Preferences > Accessibility > Mouse & Trackpad > Trackpad Options...) and you can enable dragging from there.

Switch it to three finger drag and your lost functionality will be restored.


text:
Q: Local Storage giving me undefined I have been creating a form where after I have input my values and submit, I want to show the data on another page
Here is my form:
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/checkout.css">

Checkout page

      {{!-- When fom submitted, transport to here --}}
      <form id="form" action="receipt" style="checkout.css">

Billing Address

            {{!-- Name --}}
             Full Name*
            <input class="form-control" type="text" placeholder="Example: Chia Kai Jun" id="name" required />

             Email*
            <input class="form-control" type="email" id="email" placeholder="Example: john@example.com" required />

             Address (Street, Block, Unit Number)*
            <input class="form-control" type="text" id="adr" name="address" placeholder="Example: Ang Mo Kio Street 69, Blk106P, #07-212" required />

                Zip*
                <input class="form-control"
                oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
                {{!-- Javascript code needed here to prevent using text --}}
                pattern="\d*" maxlength="6" type="number" id="zip" name="zip" placeholder="Example: 123456" required />

Payment

            {{!-- Available credit cards to use with image --}}
            Accepted Cards

            Name on Card*
            <input class="form-control" type="text" id="cname" name="cardname" required />

            Credit card number*
            <input class="form-control" type="text" maxlength="19" id="ccnum" name="cardnumber" placeholder="Example: 1111-2222-3333-4444"required />

                Exp Month and Year*
                <input class="form-control" type="month" id="expyear" name="expyear" required />

                CVV*
                <input class="form-control" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
                type="password" id="cvv" name="cvv" pattern="\d*" minlength="3" maxlength="3" required />

        {{!-- Will link to thank you for purchase, but now link to base for testing --}}
        <button type="submit" class="btn btn-primary" onclick="submitForm()">Submit</button>* - Must be filled in

Cart

      {{!-- Will be currently empty if nothing and have items if something there --}}

Thinkpad Laptop - $100

Total: $100

      {{!-- Will display nothing if there are no items and will compute total cost if there are items --}}

</form>

Here is where I show the data input:
    .yeet{
        font-size: 25px;
        line-height: 200%;
        padding: 40px;
    }
    .intro{
        text-align: center;
    }
</style>

Thank you for your purchase!

Please check that your checkout details are correct

Name:

Email:

Address:

Zip:

Item:

The values I want to show after the input is currently Name, Email, Address, ZIP and CVV. My CVV is giving me undefined when my other values are correct. I am not sure why

A: To set and get data from localStorage -
localStorage.setItem('variable_name', 'value');
localStorage.getItem('variable_name');

A: Please try to do this code.

why we are checking this condition, some browser does not support Web Storage
   if(typeof(Storage) !== "undefined")

A: I found out my problem, my </form was placed wrongly. Sorry and thanks to everyone that helped!


text:
Q: How are the Tate-Shafarevich group and class group supposed to be cognates?
How can one consider the Tate-Shafarevich group and class group of a field to be analogues?

I have heard many authors and even many expository papers saying so, class group as far as I know is the measure of failure of unique factorization of elements (in some sense) in a ring.
 On the other hand the TS-group is $Ш(E/K)=\mathrm{Ker}(H^1(K,E)\mapsto \prod_{v}H^1(K_v,E))$ for a number field K. How can one compare them? I mean, how can one proceed comparing the failure of unique factorization to failure of Hasse-principle?
Any help regarding good articles about the Hasse-principle and BSD conjectures is also appreciated.

A: Just as a small addition of an example where the Tate-Shafarevich group and the ideal class group are related. Developing the arithmetic of Pell conics (which are affine curves of genus 0 and degree 2 motivated by Pell's Diophantine equation: $x^2+pxy-dy^2=1$ where $p\in\{0,1\}$), a corresonding Tate-Shafarevich group $Ш(\mathcal{P}/\mathbb{Z})$ can be defined and Lemmermeyer proves that it is isomorphic to the square of the narrow class group of binary quadratic forms of discriminant $\Delta=p+4d$ (because the Pell conic can be equivalently defined by $X^2-\Delta Y^2=4$). Since the theory of binary quadratic forms is intimately related to quadratic field extensions, we arrive at the following isomorphism with the narrow ideal class group of such field extension:
$$Ш(\mathcal{P}/\mathbb{Z})\cong \operatorname{Cl}^{+}(\mathbb{Q}\sqrt{\Delta})^2.$$
In particular, Hambleton obtains a cohomological definition of the Tate-Shafarevich group of Pell conics analogous to the usual definition of elliptic curves, i.e. as the kernel of a homomorphism between cohomology groups of Pell conics:
$$Ш(\mathcal{P}/\mathbb{Z})\cong \operatorname{ker}\left(H^1(G,\mathcal{P}(\bar{\mathbb{Z}})) \rightarrow H^1(G,\mathcal{P}(\bar{\mathbb{Q}}))\right),$$
checking that it is well defined to be used as the starting definition.
Let me elaborate on your mentioning that the class group measures the obstruction to unique factorization. These results on Pell conics make the whole subject fascinating because historically the introduction of ideal numbers and finally ideals in quadratic number fields, and the crucial definition of their (narrow) equivalence to get the class group, was motivated by the (proper) equivalence of binary quadratic forms, i.e. forms representing the same integers. This is because there is a bijection, in fact a group isomorphism, between proper classes of such quadratic forms and narrow classes of ideals in the ring of integers of quadratic fields, given by the fact that those ideals are generated by two elements in this case and thus have a naturally associated quadratic form; then requiring two ideals to generate equivalent quadratic forms leads us to the definition of equivalent ideals. All this makes ideal class groups and class numbers (and their finer narrow counterparts) a central topic in algebraic number theory: the ideal class group of a general number field is an obstruction to unique factorization of its integers because it measures how many non-principal non-equivalent ideals are needed to recover unique factorization. In modern expositions the treatment via fractional ideals obscures sometimes the original motivation and meaning (i.e. that $h\neq 1$ is an obstruction is clear, but what does it actually count?). This approach makes algebraic number theory wonderfully and tightly tied together after studying class field theory, where a major theorem is the existence of the Hilbert class field, that any number field $K$ always has an extension $E/K$ such that its degree is the class number, $[E:K]=h_k$, the ideal class group is isomorphic to the Galois group $\operatorname{Cl}(K)\cong\operatorname{Gal}(E/K)$ and that every ideal of its algebraic integers $\mathcal{O}_K$ is principal in the ring extension $\mathcal{O}_E$. This means that we can see our original approach fulfilled since this means that the non-principal ideals of $\mathcal{O}_K$ can be correctly seen as the multiples of algebraic integers "outside" of $K$ but in $E$.
Thus, the Tate-Shafarevich group serves again as a bridge between classical algebraic numbers and modern arithmetic geometry, like Alex mentions in his answer because of its role in generalizing the class number formula via BSD. For more on the arithmetic of Pell conics as an introduction to number theory, check out the book in progress by Lemmermeyer and his other articles:

*

*Lemmermeyer - Pell Conics, an Alternative Approach to Elementary Number Theory.

A: One has (ignoring the contribution of the infinite places) $Ш(A/K) = \mathrm{H}^1_\mathrm{et}(\mathcal{O}_K,\mathscr{A})$ and $\mathrm{Cl}(\mathcal{O}_K) = \mathrm{H}^1_\mathrm{et}(\mathcal{O}_K,\mathbf{G}_m)$.

A: As a preliminary remark, note that the Tate-Shafarevich group also measures a certain defect, just like the class group. Its elements correspond to homogeneous spaces that have points everywhere locally but no global points. This is explained e.g. in Silverman.
First, let us agree that the Birch and Swinnerton-Dyer conjecture is the elliptic curves analogue of (the square of!) the analytic class number formula. Just like the latter, the former gives an algebraic interpretation of the central value of the $L$-function associated with a Galois representation (in fact a compatible family of $l$-adic Galois representations). See this MO post for more on the comparison of these two formulae.
In both formulae, a central role is played by a certain finitely generated abelian group. In the class number formula, it's the unit group of the ring of integers, in the BSD formula it's the Mordell-Weil group. Both formulae contain the size of the torsion subgroup in the denominator, and the volume (to be precise the covolume under a suitable map) in the numerator. Also, both contain some Tamagawa numbers. In the class number formula, we can only see the Tamagawa numbers at the infinite places, in the guise of some powers of 2 and $\pi$. Finally, both contain the discriminants of the number fields involved. The only other ingredient is the class number in the one case and the size of sha in the other. It is therefore natural to conclude that these "correspond to each other" in these two situations.
There is in fact a more precise correspondence, but one that is much harder to explain. Both formulae have a common generalisation, the Bloch-Kato conjecture. Under this generalisation, sha and the class number literally become the same object attached to a motive. In particular, the class number can, just like sha, be expressed in terms of Galois cohomology. This is explained in some surveys on the Bloch-Kato conjecture and on its equivariant refinement, but even the surveys have quite a lot of prerequisites in order to be able to read and to understand them.


text:
Q: how can i do unit test of this method? How can i do unit test of this method
public static ICollection<Person> SelectPersonByCountry(string Country, LinkedList<Person> personList)
    {
        ICollection<Person> selectedPerson = new List<Person>();
          if (Country != String.Empty)
        {
            foreach (Person item in personList)
            {
                  if (item.Country.ToUpper().Equals(Country.ToUpper()))
                  {
                    selectedPerson.Add(item);
                }
            }
        }
        else
        {
            // do something
            return null;
        }
        return selectedPerson;

Method CollectionAssert.AreEqual() wants 2 arguments ICollection and ICollection but i have
generic ICollections. What do i need to do?
public void TestMethod1()
    {
        string country = "Ukraine";

        LinkedList<lab1.Person> personList = new LinkedList<lab1.Person>();
        personList.AddFirst(new Person("Dasda", "Sasha", "Ukraine", "23131", "Ukrainian"));
        personList.AddFirst(new Person("Sasa", "OLeg", "Ukraine", "23131", "Ukrainian"));
        personList.AddFirst(new Person("Popa", "Sveta", "Ukraine", "23131", "Ukrainian"));
        personList.AddFirst(new Person("Bezik", "Vitya", "Ukraine", "23131", "Ukrainian"));
        personList.AddFirst(new Person("Hoi", "Oleg", "Ukraine", "23131", "Ukrainian"));
        ICollection<Person> expected = new LinkedList<Person>();
        expected.Add(new Person("Dasda", "Sasha", "Ukraine", "23131", "Ukrainian"));
        expected.Add(new Person("Sasa", "OLeg", "Ukraine", "23131", "Ukrainian"));
        expected.Add(new Person("Popa", "Sveta", "Ukraine", "23131", "Ukrainian"));
        expected.Add(new Person("Bezik", "Vitya", "Ukraine", "23131", "Ukrainian"));
        expected.Add(new Person("Hoi", "Oleg", "Ukraine", "23131", "Ukrainian"));

        ICollection expected1 = (ICollection)expected;

        ICollection actual = (ICollection)lab1.Person.SelectPersonByCountry(country, personList);

        CollectionAssert.AreEqual(expected1, actual );

    }

My method have to return collection like expected becouse of all my Person from "Ukraine", but test didn't pass..

A:
Method CollectionAssert.AreEqual() wants 2 arguments ICollection and ICollection but i have generic ICollections. What do i need to do?

Most generic collections also implement the non-generic ICollection interface, so you can pass a generic collection anyway.
ICollection actual = (ICollection)SelectPersonByCountry(country, personList);
ICollection expected = new[] { person1, person2 };

CollectionAssert.AreEqual(actual, expected);

A: There are actually two (potential) reasons for this:
First, the order of your lists. To add elements to personList you use addFirst, which prepends the element to the list. To add elements to expected you use Add, which appends the element to the list. Yet, you pass the persons in the same order. Therefore, expected and personList have reversed order. The Doc of CollectionsAssert.AreEquals states that

the collections must have the same count, and contain the exact same objects in the same order.

Second, Person may not redefine Equals. If this is the case, C# defaults to reference equality, what means that
new Person("Dasda", "Sasha", "Ukraine", "23131", "Ukrainian")
  .Equals(new Person("Dasda", "Sasha", "Ukraine", "23131", "Ukrainian")) == false

There are three ways to resolve this issue:

*

*Override Equals (and HashCode) in your Person class

*Create the Person instances once and use them in both the expected and the personList lists. This solution would also reduce the risk of typos, btw. But it makes your test depend on the implementation , which needs to return the same instances.

*Use CollectionAssert.AreEqual(IEnumerable, IEnumerable, IComparer) to define the equality relation outside of the Person class. Remember that you should write test for the IComparer then!

A: Yeah, while I've never used CollectionAssert.AreEqual, I'm pretty sure this is going to be related to how the underlying object comparison of each element in the collection is performed. The AreEqual doco states;

Elements are equal if their values are equal, not if they refer to the
  same object. The values of elements are compared using Equals by
  default.

My guess is that you need to make sure that your Person object implements the Equals method to allow object comparison. The link to the equals method above states;

The static Equals(Object, Object) method indicates whether two
  objects, objA and objB, are equal. It also enables you to test objects
  whose value is null for equality. It compares objA and objB for
  equality as follows:
It determines whether the two objects represent
  the same object reference.
If they do, the method returns true. This
  test is equivalent to calling the ReferenceEquals method. In addition,
  if both objA and objB are null, the method returns true. It determines
  whether either objA or objB is null. If so, it returns false. If the
  two objects do not represent the same object reference and neither is
  null, it calls objA.Equals(objB) and returns the result. This means
  that if objA overrides the Object.Equals(Object) method, this override
  is called.

See the examples at the Equals documentaion page for an idea on how to go about implementing this to ensure that one person object is actually the same as what you are expecting.
Edit : If you don't want to override Equals in your Person Object, then maybe create them once under where you define the country variable, and then add the same Person records to your LinkedList and your ICollection. That way, the reference is likely to be the same...I think.

A: Thank you. I'm override my Equals method in Person and it works now.
I'm override like this, maybe it's badway but you can improve
  public override bool Equals(object objA)
  {
    Person person = objA as Person;
    if (person == null) return false;
    return (person.FirstName == this.FirstName && person.LastName == this.LastName && person.Language == this.Language && person.PersonId == this.PersonId)
  }


text:
Q: YouTube Reporting API Reports are blank I'm attempting to collect channel reports for a specific set of YouTube channels. I'm able to do this successfully for most (if not all) of the channels I'm interested in except one. All requests in the request flow to collect channel reports are successful with the only indication of an undesired result being that the reports for this problem channel only contain headers for the metrics and dimensions.
At present, I'm only interested in three channel reports, namely channel_basic_a2, channel_province_a2, and channel_demographics_a1. Here are the sample report urls for each report type that I was expecting to return a report that contains data.
channel_basic_a2 report url:
https://youtubereporting.googleapis.com/v1/media/CHANNEL/Vuk4_JY-UdgIDI5Fib445g/jobs/bd2e6b26-904f-4ad0-9aff-3df14993262e/reports/2323462937?alt=media
channel_province_a2 report url: https://youtubereporting.googleapis.com/v1/media/CHANNEL/Vuk4_JY-UdgIDI5Fib445g/jobs/08f7eec7-f2f7-4060-9b26-9ba9965d5b91/reports/2323288791
channel_demographics_a1 report url: https://youtubereporting.googleapis.com/v1/media/CHANNEL/Vuk4_JY-UdgIDI5Fib445g/jobs/0affb5ff-e795-431c-8d66-4be05fab3b28/reports/2323564263

A: After taking a deeper look, I discovered that this is a case of mistaken identity. I was pulling data from a different channel (one that is actually empty) than I intended to.


text:
Q: SQL Join Query to missing Some records from first table I am creating a database application in SQL Server. I have 2 tables named tblClient (Client Table) and tblExpEntry (Expense Table). I want to select all Clients from tblClient table and show their expense from tblExpEntry. But I am getting records from tblClient only that are non-zero records in tblExpEntry table like I am missing 2 records that have 0 expense. I want to get them also in selected records. I am using the below query for selecting data
select tblClient.ProjectName, ISNULL(SUM(tblExpEntry.TotalPayment), 0)
     AS 'Total Expense'
FROM tblExpEntry
LEFT OUTER JOIN tblClient ON tblClient.Client_ID=tblExpEntry.Client_ID
WHERE tblCLient.StatusID=1
GROUP BY ProjectName


text:
Q: With supervisord, is it possible to run a process without intercepting stdout? I have a docker image running supervisord in a kubernetes pod.  I would like the output of processes running via supervisord to appear in the k8s logs.  It seems that the simplest way to do that is to have the subprocesses write directly to supervisord's stdout.  To that end, I can perform the following horrible hack:
root@714811eb811b:/tmp# cat a.sh
#!/bin/sh

exec > /proc/$(cat /tmp/supervisord.pid)/fd/1
echo This text goes to the k8s log
root@714811eb811b:/tmp# cat config
[supervisord]
nodaemon=true
pidfile=/tmp/supervisord.pid

[program:write]
command=/tmp/a.sh
exitcodes=0
root@714811eb811b:/tmp# supervisord -c config
2017-12-02 00:34:14,245 CRIT Supervisor running as root (no user in config file)
2017-12-02 00:34:14,248 INFO supervisord started with pid 451
2017-12-02 00:34:15,256 INFO spawned: 'write' with pid 454
This text goes to the k8s log
2017-12-02 00:34:15,262 INFO exited: write (exit status 0; not expected)
2017-12-02 00:34:16,270 INFO spawned: 'write' with pid 456
This text goes to the k8s log
2017-12-02 00:34:16,276 INFO exited: write (exit status 0; not expected)
^C2017-12-02 00:34:17,027 WARN received SIGINT indicating exit request

As stated above, this is a horrible hack.  Is there an appropriate way to tell supervisord to tie stdout of the children to its own stdout?  (ie, tell supervisord to do nothing and just let the children inherit the normal file descriptors)
On an unrelated note, why is the script restarting?  Even without the explicit assignment of exitcodes, supervisord ought to expect the exit code of 0.


text:
Q: Align value labels in horizontal stacked bar plot (Matplotlib) Using the following code, I've added value labels to the horizontal stacked bar plot in Matplotlib:
import pandas
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline

def sumzip(*items):
    return [sum(values) for values in zip(*items)]

fig, ax = plt.subplots(figsize=(10,6))

N = 5
values1 = [130, 120, 170, 164, 155]
values2 = [120, 185, 162, 150, 153]
values3 = [100, 170, 160, 145, 150]

ind = np.arange(N) + .15
width = 0.3

rects1 = plt.barh(ind, values1, width, color='blue')
rects2 = plt.barh(ind, values2, width, left = sumzip(values1), color='green')
rects3 = plt.barh(ind, values3, width, left = sumzip(values1, values2), color='red')

extra_space = 0.15
ax.set_yticks(ind+width-extra_space)
ax.set_yticklabels( ('Label1', 'Label2', 'Label3', 'Label4', 'Label5') )
ax.yaxis.set_tick_params(length=0,labelbottom=True)

for i, v in enumerate(values1):
    plt.text(v * 0.45, i + .145, str(v), color='white', fontweight='bold', fontsize=10,
             ha='center', va='center')

for i, v in enumerate(values2):
    plt.text(v * 1.45, i + .145, str(v), color='white', fontweight='bold', fontsize=10,
             ha='center', va='center')

for i, v in enumerate(values3):
    plt.text(v * 2.45, i + .145, str(v), color='white', fontweight='bold', fontsize=10,
             ha='center', va='center')

ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)

plt.show()

And the code gives me the following result:

As you can see, the labels in green and red sections are not aligned properly. What to I need to do to correct this issue?

A: The factors 1.45 and 2.45 will give the desired result only when the numbers in values1, values2, values3 are all equal.
You need to do the following:
For the second bar, x = first bar value + 0.45 * second bar value
For the third bar, x = first bar value + second bar value + 0.45 * third bar value

Following is how you can do it.
# Use values1[i] + v * 0.45 as the x-coordinate
for i, v in enumerate(values2):
    plt.text(values1[i] + v * 0.45, i + .145, str(v), color='white', fontweight='bold', fontsize=10,
             ha='center', va='center')

# Use values1[i] + values2[i] + v * 0.45 as the x-coordinate
for i, v in enumerate(values3):
    plt.text(values1[i] + values2[i] + v * 0.45, i + .145, str(v), color='white', fontweight='bold', fontsize=10,
             ha='center', va='center')

A: Simply add the value from each of the previous lists with the corresponding index, like this:
for i, v in enumerate(values1):
    plt.text(v * 0.45, i + .145, str(v), color='white', fontweight='bold', fontsize=10,
             ha='center', va='center')

for i, v in enumerate(values2):
    plt.text(v * 0.45 + values1[i], i + .145, str(v), color='white', fontweight='bold', fontsize=10,
             ha='center', va='center')

for i, v in enumerate(values2):
    plt.text(v * 0.45 + values1[i] + values2[i], i + .145, str(v), color='white', fontweight='bold', fontsize=10,
             ha='center', va='center')

Result:

A: I would replace all three for i,v loops with this:
for patch in ax.patches:
    x,y = patch.get_xy()
    w, h = patch.get_width(), patch.get_height()
    ax.text(x+w/2, y+h/2, str(w),
            ha='center', va='center',
            color='white', fontweight='bold', fontsize=10,
           )

Output:


text:
Q: Create an instance from .yml I have a Rails unit test for an Article class, I have an assertion to test the create! method.  I want to create the object from .yml data basically.  Like this:
In my yaml file .../test/fixtures/articles.yml:
one:
  id: 1
  title: MyText
  abstract: MyText
  place: MyString
  subject: MyString

And in article_test.rb :
def test_create_a_new_article
  assert Article.create!(articles(:one))
end

I keep getting NoMethodError: undefined methodstringify_keys' for #<\Article:0x0000010819b640>which I'm not surprised by, but how do call create! from the instance of Article created by articles(:one)?  I'm instantiating Article in my running code by passing params in a hash.  Would be great if I could just do something like: assert Article.create!(articles(:one).to_hash)`
Thanks for any help.

A: When you call articles(:one) your are getting back an Article object with the attributes defined in the fixture. This means you can use it as is i.e.
articles(:one).some_method

or assign it to a variable
article = articles(:one)

Basically rails fixture magic
EDIT
Article.create articles(:one).attributes.except("id")
Not sure if excluding the id is necessary

A: After quite a lot of experimenting, it seems there is now straight forward way to do this. You can always load yaml directly:
def test_create_a_new_article
  attributes = YAML.load_file(File.join fixture_path, 'articles.yml')['one']
  assert Article.create!(articles(:one))
end


text:
Q: Blazor. How to capture mouse in onmousemove event? How to capture mouse in onmousemove event in Blazor like UIElement.CaptureMouse() in WPF?

A:
... in Blazor like UIElement.CaptureMouse()

The closest match would be Element.setPointerCapture()
In order to use it you will need to get an ElementReference in Blazor with @ref and a JS method to invoke setPointerCapture on it. You need to pass a pointerId that you get from PointerEventArgs.
Do not use the Mouse* related events/methods, they are more or less deprecated in JS.
So you can start with something like:
 <div @ref="myTarget" @onpointerdown="StartCapture">  ... </div>

@code{
    ElementReference myTarget;

    async Task StartCapture(PointerEventArgs args)
    {
        await JSRuntime.InvokeVoidAsync("myJsFunctions.capturePointer",
                 myTarget, args.PointerId);
    }
}


text:
Q: Error Dictionary.get: Dictionary does not contain key: NDVI I am trying export NDVI result to CSV file for 35 shapefiles farmers in Earth Engine. But it did not work. I tried find any solution from internet. How can I solve this problem?
var Akdarya = ee.FeatureCollection("users/xodjayevshovkat/Akdarya_GEE_35");

//Define a geometry.
Map.addLayer(Akdarya);

// Make the geometry a feature collection.

// Import S2 image collection.
var S2 = ee.ImageCollection('COPERNICUS/S2')
  // Filter collection.
  .filterDate('2018-05-01','2018-09-30')
  .filterBounds(Akdarya)
  .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 20);

// Define a cloud masking function.
var maskcloud1 = function(image) {
  var QA60 = image.select(['QA60']);
  return image.updateMask(QA60.lt(1))
};

//

// Define an index function (return only NDVI).
var NDVI = function(image) {
  return image.expression(
    '(NIR - RED) / (NIR + RED)',
    {
      'NIR': image.select('B8'),
      'RED': image.select('B4'),
    }).rename('NDVI').copyProperties(image, image.propertyNames());
};

// Apply the cloud mask function.
var NDVIcol = S2.map(maskcloud1)
 // Apply the NDVI transformation.
 .map(NDVI);

// Calculate the per-pixel median/mean NDVI for all images in collection.
var NDVImed = NDVIcol.mean();

// Define vis params.
var NDVIvis = {min: -0.001, max: 0.9, palette: 'FFFFFF, CE7E45, DF923D, F1B555, FCD163, 99B718, 74A901, 66A000, 529400,' +
    '3E8601, 207401, 056201, 004C00, 023B01, 012E01, 011D01, 011301'};

//

// create a collection of the NDVI

var NDVIclip = NDVImed.clipToCollection(Akdarya)

// get the mean value for the region from each image
var ts = S2.map(function(image){
  var date = image.get("DATE_ACQUIRED")//.format("Y-M-D");
  var mean = image.reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: Akdarya,
    scale: 30
  });

// and return a feature with 'null' geometry with properties (dictionary)
  return ee.Feature(null, {'mean': mean.get('NDVI'),
                            'date': date})
});

// Export a .csv table of date, mean NDVI for watershed
Export.table.toDrive({
  collection: ts,
  description: 'NDVI',
  fileFormat: 'CSV'
});

'''

A: You are mapping over the S2 collection and try to extract the mean NDVI. That collection doesn't contain NDVI. You probably wanted to map over NDVIcol.
When you're getting errors in exports, try to print the collection you're exporting. It will give you a lot faster feedback on what errors you might have.
var ts = NDVIcol.map(function(image){
  var date = image.get("DATE_ACQUIRED")//.format("Y-M-D");
  var mean = image.reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: Akdarya,
    scale: 30
  });

// and return a feature with 'null' geometry with properties (dictionary)
  return ee.Feature(null, {'mean': mean.get('NDVI'),
                            'date': date})
});

https://code.earthengine.google.com/c0ef682554ed8c442840ea8a5169cebf


text:
Q: Migrating to Meteor 1.7.0.4 : MongoDB : "updating the path ... would create a conflict at ..." Im using meteor, and im trying to go from meteor 1.6 to 1.7
But im encountering errors im unable to get informations about in my tests :
tests.jpg
I get multiple things like this (some are maybe redondant, unused or obsolete) :
Error: Updating the path 'relationChangeRate' would create a conflict at 'relationChangeRate'
at Function.MongoError.create (C:\Users\fquesselaire\AppData\Local\.meteor\packages\npm-mongo\3.0.11\npm\node_modules\mongodb-core\lib\error.js:45:10)
at toError (C:\Users\fquesselaire\AppData\Local\.meteor\packages\npm-mongo\3.0.11\npm\node_modules\mongodb\lib\utils.js:149:22)
at C:\Users\fquesselaire\AppData\Local\.meteor\packages\npm-mongo\3.0.11\npm\node_modules\mongodb\lib\collection.js:1029:39
at C:\Users\fquesselaire\AppData\Local\.meteor\packages\npm-mongo\3.0.11\npm\node_modules\mongodb-core\lib\connection\pool.js:544:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)

not occurring in 1.6.*
I tried upgrade my mongodb to 3.6.6, no effect.
Im also unable to get the entire stack in tests to see what is exactly enforcing.
my .meteor/versions :
255kb:meteor-status@1.5.0
accounts-base@1.4.2
accounts-password@1.5.1
akasha:fs-extra@0.26.3
alanning:roles@1.2.16
aldeed:autoform@6.3.0
aldeed:autoform-bs-button-group-input@2.0.0
aldeed:autoform-select2@3.0.1
aldeed:collection2-core@2.1.2
aldeed:template-extension@4.1.0
allow-deny@1.1.0
arillo:flow-router-helpers@0.5.2
autoupdate@1.4.1
babel-compiler@7.1.1
babel-runtime@1.2.4
base64@1.0.11
binary-heap@1.0.10
blaze@2.3.2
blaze-html-templates@1.1.2
blaze-tools@1.0.10
boilerplate-generator@1.5.0
caching-compiler@1.1.12
caching-html-compiler@1.1.3
callback-hook@1.1.0
check@1.3.1
coffeescript@1.0.17
cultofcoders:mocha@2.4.6
dburles:collection-helpers@1.1.0
dburles:factory@1.1.0
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
ddp-rate-limiter@1.0.7
ddp-server@2.2.0
deps@1.0.12
diff-sequence@1.1.0
dynamic-import@0.4.1
ecmascript@0.11.1
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.7.2
ecmascript-runtime-server@0.7.1
ejson@1.1.0
email@1.2.3
es5-shim@4.8.0
fourseven:scss@4.9.0
geojson-utils@1.0.10
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
http@1.4.1
id-map@1.1.0
idmontie:migrations@1.0.3
jquery@1.11.11
kadira:blaze-layout@2.3.0
kadira:flow-router@2.12.1
lai:collection-extensions@0.2.1_1
launch-screen@1.1.1
livedata@1.0.18
lmieulet:meteor-coverage@1.1.4
localstorage@1.2.0
logging@1.1.20
matb33:collection-hooks@0.8.4
meteor@1.9.2
meteor-base@1.4.0
meteorhacks:picker@1.0.3
meteortesting:browser-tests@1.0.0
meteortesting:mocha@1.0.0
minifier-css@1.3.1
minifier-js@2.3.5
minimongo@1.4.4
mobile-experience@1.0.5
mobile-status-bar@1.0.14
modern-browsers@0.1.2
modules@0.12.2
modules-runtime@0.10.2
momentjs:moment@2.22.2
mongo@1.5.1
mongo-dev-server@1.1.0
mongo-id@1.0.7
mouse0270:bootstrap-notify@3.1.3
natestrauser:select2@4.0.3
npm-bcrypt@0.9.3
npm-mongo@3.0.11
observe-sequence@1.0.16
ordered-dict@1.1.0
ostrio:cookies@2.3.0
ostrio:files@1.10.1
practicalmeteor:chai@2.1.0_1
practicalmeteor:loglevel@1.2.0_2
practicalmeteor:mocha-core@1.0.1
practicalmeteor:sinon@1.14.1_2
promise@0.11.1
raix:eventemitter@0.1.3
random@1.1.0
rate-limit@1.0.9
reactive-dict@1.2.1
reactive-var@1.0.11
reload@1.2.0
retry@1.1.0
rocketchat:streamer@0.5.0
routepolicy@1.0.13
service-configuration@1.0.11
session@1.1.8
sewdn:collection-behaviours@0.3.0
sha@1.0.9
shell-server@0.3.1
socket-stream-client@0.2.2
softwarerero:accounts-t9n@1.3.11
spacebars@1.0.15
spacebars-compiler@1.1.3
srp@1.0.12
standard-minifier-css@1.4.1
standard-minifier-js@2.3.4
templating@1.3.2
templating-compiler@1.3.3
templating-runtime@1.3.2
templating-tools@1.1.2
tmeasday:check-npm-versions@0.3.2
tmeasday:test-reporter-helpers@0.2.1
tracker@1.2.0
ui@1.0.13
underscore@1.0.10
url@1.2.0
useraccounts:bootstrap@1.14.2
useraccounts:core@1.14.2
useraccounts:flow-routing@1.14.2
webapp@1.6.2
webapp-hashing@1.0.9
zimme:active-route@2.3.2

my node packages :
  "dependencies": {
    "@babel/runtime": "^7.0.0-beta.54",
    "@mdi/font": "^2.5.94",
    "babel-runtime": "^6.26.0",
    "bcrypt": "^3.0.0",
    "bootstrap": "^3.3.7",
    "bootstrap-material-design": "^0.5.10",
    "bootstrap-slider": "^10.0.2",
    "bootstrap-toggle": "^2.2.2",
    "clone": "^2.1.1",
    "csv-parse": "^2.5.0",
    "d3": "^5.5.0",
    "file-saver": "^1.3.8",
    "fs-extra": "^3.0.1",
    "gm": "^1.23.0",
    "jquery": "^2.2.4",
    "jsondiffpatch": "^0.3.11",
    "lodash": "^4.17.10",
    "meteor-node-stubs": "^0.4.1",
    "mkdirp": "^0.5.1",
    "object-path": "^0.11.4",
    "popper.js": "^1.14.3",
    "select2": "^4.0.4",
    "select2-bootstrap-theme": "^0.1.0-beta.10",
    "simpl-schema": "^1.5.3",
    "uuid": "^3.3.2",
    "xmldoc": "^1.1.0",
    "zip-local": "^0.3.4"
  },
  "devDependencies": {
    "chromedriver": "^2.40.0",
    "gulp": "^3.9.1",
    "selenium-webdriver": "^3.6.0"
  }

if you have any clue about what is going on ?
i can give more informations about what's happening in the app, but right now a simple explain about what this error mean would be awesome already. as i said, this error only append in 1.7.
EDIT: forget to say that my test throw this on WORKING code.
Features are working well, but not the tests.
EDIT²:
This method is the one that update the collection projectSettings.
_duplicateProjectSettings(newSession) {
  const settings = this.session.projectSettings();
  delete settings._id;
  settings.sessionId = newSession._id;
  const newSettings = newSession.projectSettings();
  ProjectSettings.update(newSettings._id, { $set: settings });
}

relationChangeRate is a simpl-schema field of projectSettings collection as it (i use collection2-core) :
relationChangeRate: {
  type: Number,
  allowedValues: _.values(RelationRates),
  defaultValue: 0.0
}

projectSettings extends mongo.collection, but in this case, update method is not override.
The code seams correct to me, as the _id is well removed and set to the new object before update request. but maybe im wrong ?
EDIT³:
ProjectSettings is a collection-helper:
Here is the code :
Sessions.helpers({
[...]
  projectSettings() {
      const conds = { sessionId: this._id };
      return ProjectSettings.findOne(conds);
  },
[...]

A collection helper basically add a method on each document from this collection. It means that any session object will have this method. In a collection helper, "this" refer to the current collection object.
so should  be good ?
_duplicateProjectSettings could be write like this:
_duplicateProjectSettings(newSession) {
  // const settings = this.session.projectSettings();
  const settings = ProjectSettings.findOne({ sessionId: this.session._id });
  delete settings._id;
  settings.sessionId = newSession._id;
  // const newSettings = newSession.projectSettings();
  const newSettings = ProjectSettings.findOne({ sessionId: newSession._id });
  ProjectSettings.update(newSettings._id, { $set: settings });
}

(I tried it too, same result)

A: Running this from shell worked for me... not the best solution. I had the problem when I tried to login with accounts-password package.
$ meteor mongo
meteor:PRIMARY> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )

A: Ok,
This is an half-answer but
After some extended search i figured that i had a test script that reset MONGO_URL as follow :
set MONGO_URL=
set TEST_BROWSER_DRIVER=chrome
set TEST_WATCH=1
set TEST_CLIENT=0
set TEST_SERVER=1

meteor test -p 3100 --driver-package=cultofcoders:mocha %*

after figuring that i launched the tests on my local dev db, and tests passed (smashing my db by the way lol). So, it means it could be version related, or test-conditions related.
I am not able to print the version of mongodb used for tests, so i don't know the tests conditions exactly.
All i know is so :
Meteor "normal run" Mongo version : 3.6.4
My local Mongo version : 3.6.6


text:
Q: PDF doesn't show characters even though font is embedded and /ToUnicode is present I have a problem with generating a PDF file. I have embedded the font by using a /ToUnicode character map. Then I've written the glyph IDs as a text stream.
The strange thing is: I can select and copy text from the PDF into other applications an paste the text. This works with every character, even russian, greek, etc. However, the text does not display on-screen.
Below is the structure of my PDF:

The PDF itself is available at: https://drive.google.com/file/d/0B9J8lfyB3w2PX3R3N0dfT0VhRTA/view?usp=sharing
If I view this PDF inside a browser (Firefox or Chrome), the text "Hello" shows up. If I open this PDF inside Adobe Reader or other document viewers such as xpdf or the Linux document viewer, the glyphs do not show up.
I have set the Encoding to Identity-H and created a valid /ToUnicode table. I've set the Font as CIDFontType0 / (CIDFontType0C in the FontDescriptor).
The FontFile3 contains a full copy of the .otf file of the font "Asimov", since I wanted to embed the complete font.
The Linux PDF viewer tells me that the font is embedded:

I can't figure out why the text isn't displaying. I wrote the text by looking up the glyph ID for the font. What do I need to do in order to make the font show up?

A: Your (first) problem is the definition and use of color spaces named DefaultGray, DefaultRGB and DefaultCMYK, these names have specific meanings.
These spaces are used to map colours defined in DeviceGray, DeviceRGB and DeviceCMYK into CIE colour space, in order to colour manage the definitions. You do not use the Default* colour spaces directly. The text is turning out invisible because you are (in effect) using the same colour space twice, once directly as DefaultCMYK, then again to map the resulting CMYK values into CIE and then back to RGB (for the display).
You should either;

*

*Set the colour space to DeviceCMYK etc instead of DefaultCMYK

*Call the named colour spaces something other than DefaultCMYK etc

I also think, as Jan Slabon stated, there's something wrong with the ICC profile you are using.
Finally, it looks like the font is broken too, so even when you fix the colour space (which I've done by changing the content stream to use /DevcieCMYK) the text still doesn't render with Acrobat.

A: The FontBBox in the FontDescriptor looks incorrect:
[0 1327 472912 1327]
472912 seems too big, but having the same values for the second and fourth entries would indicate that this font has no height.
You might also want to consider setting the Ascent, Descent, and CapHeight entries to non-zero values.

A: The problem was I compressed the font when saving the document. For whatever reason, you may not compress the font stream or the PDF viewer can't extract the data anymore. As soon as I disabled the compression on the PDF, the font showed up again.


text:
Q: Filter a list by another list C# LINQ Consider following lists:
class user {
   public int id {get; set;}
   public string name {get; set;}
   public bool selected {get; set;}
}

class coupon {
   public string username {get; set;}
   public string coupontype {get; set;}
   public string code {get; set;}
}

List<user> lUser = new List<user>();
List<coupon> lCoupon = new List<coupon>();

How is it possible (with LINQ) to filter lCoupon with lUser so that the only values that remain are those with lCoupon.username field present in lUser.name , with lUser.selected being true?
Pseudo code:
lCoupon = lCoupon.Where (w => lUser.name == w.name AND lUser.selected == true).ToList();

A: You could use the LINQ Any method on the lUser list, as in:
var coupons = lCoupon
    .Where(c => lUser.Any(u => u.selected && u.name == c.username))
    .ToList();

A: You can also do this with a join:
var coupons = from coupon in lCoupons
          join user in lUser on coupon.username equals user.name
          where user.selected
          select coupon;

This way you can easely select values from both object types, e.g.:
var selectedObjects = from coupon in lCoupons
          join user in lUser on coupon.username equals user.name
          where user.selected
          select new { CouponCode = coupon.code, UserId = user.Id} ;

You can ToList() this if you prefer.


text:
Q: What is the best practices in Java for secure storage of data? I have java application and I need save passwords into encrypted file. I got advice to use Windows API. I found JDPAPI what is JNI wrapper around the MS DPAPI. It seems good. But I want to know does another libraries or methods exist to use Windows API for secure storage of data into file? Or does some methods exist for secure storage in Java without using Windows API? I never use secure storage. Can you talk me about the best practices in Java for secure storage of data with and without Windows API?

A: First: Using Windows API is kind of senseless. Even when you can't imagine that, it might be possible that you have to migrate.
Second: Storing a password encrypted only makes sense when you enter the encryption key during the applications runtime. If you store it in a configuration file, it does not make any sense.
The encryption key could be stored as a thread local variable after it was entered.
I would suggest using property files and encrypt and decrypt the values in a service layer using bouncy castle. This way you can mix encrypted and unencrypted values in the same file.
You could of course use Spring and do the necessary stuff quite easily using Spring security crypto.
In case we are talking of a web app using hibernate, I'd suggest using properties stored in a database and use jasypt for transparent encryption.


text:
Q: Will cassandra full compaction remove expired data in files generated by previous compaction? I have a table TTL=10days in cassandra, I usually do full compaction on every Monday and Thursday.
I noticed that after compaction on Thursday, Cassandra did not touch/compact the files generated on Monday.
Why is that? Is that possible the file generated on Monday is too big? How can I fix it? BTW, I uses SizeTieredCompactionStrategy.

A: When you say you do a "full compaction" what exactly are you doing to trigger this?
In general, SizeTieredCompaction will only compact a set number of similarly sized SSTables.  This means that if your table (table 1) from Monday is say size X MBs and you have min_threshold on the table set to 4 then it would require 4 tables of ~X Mbs before the table 1 would be compacted again.  This means that if you say generate a new compacted table of ~ X MBs every 3 days it would take 9 days before the original table was compacted again.


text:
Q: Problema con buffer de entrada - Tengo un problema con un programa en C. Quiero crear un arreglo de datos de tipo unc, creado previamente con struct. El programa pide ingresar datos tipo string y tipo  int. El programa puede ser compilado pero cuando quiero usar el programa pasa lo siguiente:

*

*Puedo ingresar lo que se guarda en n a y e de la primera posicion (l[0])

*Despues de escribir una edad para guardar en e de la primera posicion, al apretar enter, no puedo ingresar nada para n de la segunda posicion, como si ya tomara algo del buffer.
Algo como esto:
Ingresar n (1):
aca_puedo_escribir
Ingresar a (1):
aca_puedo_escribir
Ingresar e (1):
10
Ingresar n (2): // ACA NO PUEDO INGRESAR NADA
Ingresar a (2):
aca_puedo
Ingresar e (2):
20

Es decir, n se "llena solo", como si ya hubiera algo en el  buffer, acá va el código:
struct unc{
    char n[30];
    char a[30];
    int e;
    };

int main(){
    struct unc l[5];
    int i;
    for (i=0;i<5;i++){
        printf("Ingresar n (%d):\n",i+1);
        gets(l[i].n);
        printf("Ingresar a (%d):\n",i+1);
        gets(l[i].a);
        printf("Ingresar e (%d):\n",i+1);
        scanf("%d",&l[i].e);
        }

A: Tu problema es que scanf() no lee el ENTER que tu pulsas al introducir el entero. Eso es así, y así debe ser.
Puedes intentar varias cosas (la solución depende de cada implementación de esas funciones en particular):

*

*scanf("%d\n",&l[i].e); ( añade un '\n' ).

*scanf("%d",&l[i].e); getc( stdin ); ( recogemos a mano ese ENTER ).

A: Si tienes problemas para leer, justamente después del scanf vacía el buffer de entrada. Esto lo puedes hacer incluyendo la línea siguiente: fflush(stdin), ya que stdin es el buffer de entrada estandar.


text:
Q: Selenium get_screenshot_as_file vs get_screenshot_as_base64? I'm wondering what the advantages/disadvantages of one over the other are?
I'm running against Selenium Server on a headless remote instance with Xvfb acting as the display.
Both methods work fine and the resulting screen capture file (if I convert the base64 one and save it as an image file) are identical file size and look identical.
So why would I want to use/not use one over the other?

A: With the get_screenshot_as_file, the screenshot get saves into a binary file, while with get_screenshot_as_base64 this will return you base64 encoded version of that screenshot.
So, why would anyone use the base64 version? The whole idea behind base64 is that it allows you to create ASCII representation of binary data, which will increase the data size but will also allow you to actually work with it. For example if you've tried to send over a stream of binary data to a socket, without encoding it then unless server was prepared to handle binary data, the result is hard to predict.
As a result of that the data transferred may be malformed, cut the transfer early and cause many other results that are almost impossible to predict. For example if you were to run a very simple socket server that just prints out everything as it receives to std::out, receiving a binary file would most likely corrupt your console terminal (you can try it on your very own Linux box).
Of course if the server is designed to receive and handle binary data then this will not be an issue, but most often the server-end will interpret user input as string which makes using base64 a wise choice.


text:
Q: Security Scan for remote site Can you please help me running scan for a remote site setting. SFDC asked for chimera report for remote Site setting.
eg. I have a remote site setting with URL as: https://abc.abc.com and which  gets pointed in rest-call Outs in APEX.
When i run chimera scan for same, its ask for user name and password, but Site owner not ready to provide credentials.
Thanks,
Rahul

A: Scanned using Zap scanner.
Thanks


text:
Q: NullReference Exception in date Conversion I am working on Hijri to Gregorian conversion of date. However, I get this NullReferenceExceptionerror message:

Object reference not set to an instance of an object.

pprivate HttpContext cur;

    private const int startGreg=1900;
    private const int endGreg=2100;
    private string[] allFormats={"yyyy/MM/dd","yyyy/M/d",
        "dd/MM/yyyy","d/M/yyyy",
        "dd/M/yyyy","d/MM/yyyy","yyyy-MM-dd",
        "yyyy-M-d","dd-MM-yyyy","d-M-yyyy",
        "dd-M-yyyy","d-MM-yyyy","yyyy MM dd",
        "yyyy M d","dd MM yyyy","d M yyyy",
        "dd M yyyy","d MM yyyy"};
    private CultureInfo arCul;
    private CultureInfo enCul;
    private HijriCalendar h;
    private GregorianCalendar g;

    public void Dates()
    {
        cur = HttpContext.Current;

        arCul=new CultureInfo("ar-SA");
        enCul=new CultureInfo("en-US");

        h=new  HijriCalendar();
        g=new GregorianCalendar(GregorianCalendarTypes.USEnglish);

        arCul.DateTimeFormat.Calendar=h;

    }

    public string HijriToGreg(string hijri)
    {

        if (hijri.Length<=0)
        {

            cur.Trace.Warn("HijriToGreg :Date String is Empty");
            return "";
        }
        try
        {

            DateTime tempDate=DateTime.ParseExact(hijri,allFormats,
               arCul.DateTimeFormat,DateTimeStyles.AllowWhiteSpaces);
            return tempDate.ToString("yyyy/MM/dd",enCul.DateTimeFormat);
        }
        catch (Exception ex)
        {
            cur.Trace.Warn("HijriToGreg :"+"\n"+ex.ToString());
            return "";
        }
    }

A: That means that somewhere you are accessing a field, property or method on a reference-type variable that is null (or accessing .Value on Nullable<T> struct). We can't tell you where, but ex.StackTrace can, as can adding a break-point and stepping through the code near where it errors, looking at the variables etc for the rogue null (or the correct null with a missing null-check)

A: WhatEver cur = new WhatEver();

A: This means you are using an object without initialing it. use new keyword to initialize  it.


text:
Q: Problems with excessive white space in Quarto document I have a Quarto (RMarkdown) document which is supposed to display a table showing task completion. The code works well but there is excessive white space displayed, to the point where the table is displayed on page 2 where a single page would have sufficed and page 1 is mostly white space. How can I make the table fit on one page? The code is as below:

---
title: "Debug"
author: "Data Kilimba"
format: pdf
editor: visual
---

## FAAB Market Survey Task Completion

```{r setup}
#| include: false
library(tidyverse)

monthly_submissions = tibble::tribble(
  ~Year, ~Month,               ~FAAB, ~Submissions,
  2022L,     3L,      "Simon",           0L,
  2022L,     3L,  "Kabula",           0L,
  2022L,     3L,  "Innocent",           0L,
  2022L,     3L, "Renatus",           0L,
  2022L,     3L,  "Staphord",           2L,
  2022L,     3L, "Salome",           0L,
  2022L,     3L, "Imani",           0L,
  2022L,     3L,       "Petro",          10L,
  2022L,     3L,   "Mihayo",           0L,
  2022L,     3L,     "Baraka",           0L,
  2022L,     3L,     "Swaum",           0L
  )

```

```{r}
#| label: tbl-stats
#| tbl-cap: "FAAB Market Survey Task completion"
#| echo: false

monthly_submissions %>%
  kableExtra::kable(escape = FALSE,format = "latex", booktabs = T) %>%
  kableExtra::kable_styling(latex_options="scale_down",font_size = 2)

```

UPDATE:: After editing the document as suggested by Lucas, I add the YAML header and yet there seem to be syntax errors of some kind ... `

A: I have arrived at a solution, although I have to say there are some weird goings-on with regards to my YAML. There were two issues.

*

*This is my YAML (this worked)
---
title:"Debug"
author: "Data Kalimba"
format: pdf
editor: visual
header-includes:
   \usepackage{float}
   \floatplacement{table}{H}
---

As you can see...
header-includes:
   - \usepackage{float}
   - \floatplacement{table}{H}

is what shoul have worked according not only to @Lucas, but countless other examples online (notice the minus signs before the backslashes). However this for me resulted in the errors in the below screenshot. What did work was removing the minus signs.
.
But this was not enough...

*Secondly was the specification within kable_styling's latex_option. What Lucas had suggested was

 kableExtra::kable_styling(latex_options="scale_down",font_size = 2,position = "float_left")
However what I found to work was the float_left argument WITHIN the latex_options argument list, so the below amendment worked:
kableExtra::kable_styling(latex_options=c("scale_down","float_left"),font_size = 2)

So, the entire (working) code is:

---
title: "Debug"
author: "Data Kilimba"
format: pdf
editor: visual
header-includes:
   \usepackage{float}
   \floatplacement{table}{H}
---

## FAAB Market Survey Task Completion

```{r setup}
#| include: false
library(tidyverse)

monthly_submissions = tibble::tribble(
  ~Year, ~Month,               ~FAAB, ~Submissions,
  2022L,     3L,      "Simon",           0L,
  2022L,     3L,  "Kabula",           0L,
  2022L,     3L,  "Innocent",           0L,
  2022L,     3L, "Renatus",           0L,
  2022L,     3L,  "Staphord",           2L,
  2022L,     3L, "Salome",           0L,
  2022L,     3L, "Imani",           0L,
  2022L,     3L,       "Petro",          10L,
  2022L,     3L,   "Mihayo",           0L,
  2022L,     3L,     "Baraka",           0L,
  2022L,     3L,     "Swaum",           0L
)

```

```{r}
#| label: tbl-stats
#| tbl-cap: "FAAB Market Survey Task completion"
#| echo: false

monthly_submissions %>%
  kableExtra::kable(escape = FALSE,format = "latex", booktabs = T) %>%
  kableExtra::kable_styling(
    # Change happens in YAML and here, float_left argument is WITHIN
    # latex_options arguments,
    latex_options=c("scale_down","float_left"),font_size = 2)

```

A: The YAML header causing an error shouldn't be occurring -- Quarto was in this case being too picky about it during validation. We've just made a change to permit use of multiple values for header-includes here: https://github.com/quarto-dev/quarto-cli/commit/5a685aee484f4d5914e7a899968f654584e24904

A: The latex placement can be tricky. One option is to tell kable_styling the position argument:
kableExtra::kable_styling(latex_options="scale_down",font_size = 2,position = "float_left")

Also I am not sure about the yaml header. The following works for me:
---
title: "Debug"
author: "Data Kilimba"
output: pdf_document
header-includes:
   - \usepackage{float}
   - \floatplacement{table}{H}
---


text:
Q: Error deploying the apache:superset image on Kubernetes I am trying to deploy the latest docker image apache:superset on Kubernetes. When I deploy the YAML I get below error:
[2021-04-29 01:34:10 +0000] [8] [INFO] Starting gunicorn 20.0.4
[2021-04-29 01:34:10 +0000] [8] [INFO] Listening at: http://0.0.0.0:8088 (8)
[2021-04-29 01:34:10 +0000] [8] [INFO] Using worker: gthread
[2021-04-29 01:34:10 +0000] [11] [INFO] Booting worker with pid: 11
logging was configured successfully
2021-04-29 01:34:12,332:INFO:superset.utils.logging_configurator:logging was configured successfully
2021-04-29 01:34:12,340:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
100.106.25.194 - - [29/Apr/2021:01:34:20 +0000] "GET / HTTP/1.1" 302 243 "-" "kube-probe/1.18"
/usr/local/lib/python3.7/site-packages/flask_caching/__init__.py:192: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
2021-04-29 01:34:20,145:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped
2021-04-29 01:34:20,147:ERROR:root:DBEventLogger failed to log event(s)
2021-04-29 01:34:20,147:ERROR:root:(sqlite3.OperationalError) no such table: logs
[SQL: INSERT INTO logs (action, slice_id, json, dttm, duration_ms, referrer) VALUES (?, ?, ?, ?, ?, ?)]
[parameters: ('welcome', 0, '{"path": "/superset/welcome/", "object_ref": "Superset.welcome"}', '2021-04-29 01:34:20.147331', 0, 'http://100.106.25.213:8088/')]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: logs

It seems it is trying to connect to default SQLLite. I am trying to give postgres credentials in config.py but not able to modify the file in the image. I have below command in my Docker file:
USER root
COPY updated_config.py /app/superset/config.py
USER superset

the command runs fine but not updating the file.How can I update the config.py. I also tried using Config Map in YAML but that also gave error:
"ModuleNotFoundError: No module named 'superset.app'"

A: *

*The error which you shared should happen only when we didn't run superset db upgrade.

*You should not replace complete default config file. Instead create new file and added necessary variables with export SUPERSET_CONFIG_PATH.

Here Dockerfile
FROM apache/superset
USER root

USER superset
EXPOSE 8088

RUN superset fab create-admin \
               --username admin \
               --firstname Superset \
               --lastname Admin \
               --email admin@superset.com \
               --password admin

COPY updated_config.py /app/config.py
RUN export SUPERSET_CONFIG_PATH=/app/config.py
RUN superset db upgrade

RUN superset init

I'll better suggest install superset through helm chart as you already using kubernetes.


text:
Q: How to define a rbenv version per executable We've got a project where we use capistrano for deployments. Capistrano 3 depends on Ruby 2.2.x to run which is the default version configured with rbenv.
I also use git-up but that depends on ruby 1.9.3, is there a way to make git-up always work with ruby 1.9.3 regardless of where I run it from?
Now I need to constantly switch between ruby versions to run either capitrano or git-up from my project root directory.

A: You can try to alias the executables with specific ruby executable file like this:
alias capistrano="/Users/USER/.rbenv/versions/2.2.3/bin/ruby /path/to/capistrano"
alias gitup="/Users/USER/.rbenv/versions/1.9.3/bin/ruby /path/to/gitup"

Then you can call directly capistrano/gitup with preferred ruby version.

A: Simpler than Babar's answer, I would make some aliases like this in my zshrc/bashrc
alias capistrano="RBENV_VERSION=2.2.3 rbenv exec capistrano"
alias gitup="RBENV_VERSION=1.9.3 rbenv exec gitup"

That way we do not need to explicitly set ruby path, it will automatically resolved by rbenv.


text:
Q: How to pass parameters from Data Factory to Azure Function? I try to pass 2 parameters from Data Factory to Azure Functions. Everything works well if I hardcode the parameter values in Body as follows:
{"param1":"value1","param2":"value2"}

However, if I try to use @pipeline().parameters.param1 and @pipeline().parameters.param2, then it fails because the values are None. The pipeline parameters param1 and param2 are defined correctly and they are passed correctly to, e.g., Databricks.
{"param1":@pipeline().parameters.param1,"param2":@pipeline().parameters.param2}

As the header I pass: Content-Type equal to application/json.
What is wrong in my expression?

A: Please try this expression:

@concat('{"param1":"', pipeline().parameters.param1, '", "param2":"', pipeline().parameters.param2,'"}')


text:
Q: Button not correctly centered in flex container I am trying to center a button in a fluid container with 100% vertical height and give it an offset from the bottom of the screen. I am pretty much there, however, the button is offset from the left and not correctly centered. See the example in my code snippet.
I am not sure what I am missing here... how can I correctly center the button to the center of the screen?
In my site code I have an image as my background in the main fluid container, hence why I have background size: cover; etc in my css.

.main-div {
    background-color: pink;
    min-height: 100vh;
    min-width: auto;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
    text-align: center;
}

.centered-button {
    position: absolute;
    bottom: 3rem;
    width: 15rem;
    border-radius: 3rem;
    border-top-width: 4px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-left-width: 4px;
    box-shadow: 5px 5px 10px 2px rgba(0,0,0,.8);
    transition: all 0.3s ease 0s;
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
        <link href="styles.css" rel="stylesheet"/>

        <button type="button" class="btn btn-primary centered-button">Primary</button>

A: You should implement bootstrap alignment instead of using regular css, Try Flex containers. See my example below:
<button type="button" class="d-flex justify-content-center btn btn-primary">Primary

Adding d-flex justify-content-center will horizontally align your element. To align the element vertically have a look at Vertical alignment

A: add

left: 50%;
transform: translateX(-50%);

to .centered-button element for center that.
this link is complete answer for centering with position

.main-div {
    background-color: pink;
    min-height: 100vh;
    min-width: auto;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
    text-align: center;
}

.centered-button {
    position: absolute;
    bottom: 3rem;
    width: 15rem;
    border-radius: 3rem;
    border-top-width: 4px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-left-width: 4px;
    box-shadow: 5px 5px 10px 2px rgba(0,0,0,.8);
    transition: all 0.3s ease 0s;
    left: 50%;
    transform: translateX(-50%);
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
        <link href="styles.css" rel="stylesheet"/>

        <button type="button" class="btn btn-primary centered-button">Primary</button>

and you can use flex to do that simply .

.main-div {
    background-color: pink;
    min-height: 100vh;
    min-width: auto;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
}

.centered-button {
    bottom: 3rem;
    width: 15rem;
    border-radius: 3rem;
    border-top-width: 4px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-left-width: 4px;
    box-shadow: 5px 5px 10px 2px rgba(0,0,0,.8);
    transition: all 0.3s ease 0s;
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
        <link href="styles.css" rel="stylesheet"/>

        <button type="button" class="btn btn-primary centered-button">Primary</button>

A:

.main-div {
    background-color: pink;
    min-height: 100vh;
    line-height:100vh;
    min-width: auto;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
    text-align: center;
}

.centered-button {
    vertical-align: middle;
    bottom: 3rem;
    width: 15rem;
    border-radius: 3rem;
    border-top-width: 4px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-left-width: 4px;
    box-shadow: 5px 5px 10px 2px rgba(0,0,0,.8);
    transition: all 0.3s ease 0s;
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
        <link href="styles.css" rel="stylesheet"/>

        <button type="button" class="btn btn-primary centered-button">Primary</button>

A:

/*You need to use display:flex; property of css on parent div of button to align it centerly regardless of any device you view it on
along with display: flex; you need these two property also
- align-items:center; ( this aligns button in center vertically )
- justify-content:center; ( this aligns button in center horizontally )

using positon absolute will not center the button on every device. as well as using left 50% will also not work for every device */

.main-div {
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    background-color: pink;
    min-height: 100vh;
    line-height:100vh;
    min-width: auto;
    position: relative;
}

.centered-button {
    bottom: 3rem;
    width: 15rem;
    border-radius: 3rem;
    border-top-width: 4px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-left-width: 4px;
    box-shadow: 5px 5px 10px 2px rgba(0,0,0,.8);
    transition: all 0.3s ease 0s;
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
        <link href="styles.css" rel="stylesheet"/>

        <button type="button" class="btn btn-primary centered-button">Primary</button>


text:
Q: Windows 7 Wireless unable to detect network after windows update Ever since a windows update my laptop, an asus ul30vt, has been unable to detect wireless networks. I found that I could get it to detect them if I uninstall the drivers and reinstall. I reinstalled the operating system fresh and the issue still happens. I also bought a USB wifi dongle and I still continue to have the issue. I am stuck on how to fix this issue. Fresh install of windows 7 and new wifi stick and the issue continues. I'm not sure how to go about fixing this. Here are the few things I know about this so far...

*

*Started after a windows update.

*Affects any Wireless network device

*disable/reenable doesn't fix this

*toggling the Laptop's Disable Wireless key doesn't bring the
wireless back

*Reinstall from the locked Recovery partition doesn't fix the issue

*update of wireless driver didn't fix it

*Tried a Winsock repair on it in the old OS Install with no luck

Given that it does work when uninstall and reinstall and the new wifi works but suffers from the same issue, makes me think this is a solvable software related issue.
Laptop: ASUS UL30VT Operating System: Windows 7 Professional Internal Wireless card: Atheros ar9285 USB Wireless stick: TP-LINK TL-WN725N v2.0


text:
Q: How the requirement of Itô's lemma is satisfied in this theorem about integration by parts? I'm reading a theorem (about integration by parts) from page 9 of these notes, i.e.,

Theorem Let $X$ and $Y$ be continuous semi-martingales such that
$$
\mathbb E \bigg [ \int_0^t X_s^2 \mathrm d \langle Y \rangle_s +  \int_0^t Y_s^2 \mathrm d \langle X \rangle_s\bigg ] <\ \infty \quad \forall t \ge 0. \quad (\star)
$$
Then
$$
X_t Y_t - X_0 Y_0 = \int_0^t X_s \mathrm d Y_s + \int_0^t Y_s \mathrm d X_s + \langle X, Y \rangle_s
\quad \text{a.s.} \quad \forall t \ge 0.
$$

and its proof, i.e.,

Proof. By using Itô's lemma, we have:
$$
\begin{aligned}
\left(X_t+Y_t\right)^2-\left(X_0+Y_0\right)^2 &= 2 \int_0^t\left(X_s+Y_s\right) \mathrm d\left(X_s+Y_s\right)+\langle X+Y\rangle_t \\
\left(X_t-Y_t\right)^2-\left(X_0-Y_0\right)^2 &= 2 \int_0^t\left(X_s-Y_s\right) \mathrm d\left(X_s-Y_s\right)+\langle X-Y\rangle_t
\end{aligned}
$$
Subtracting these two formulas gives:
$$
4 X_t Y_t-4 X_0 Y_0=4 \int_0^t X_s \mathrm d Y_s+4 \int_0^t Y_s \mathrm d X_s+\underbrace{\left(\langle X+Y\rangle_t-\langle X-Y\rangle_t\right)}_{=4\langle X, Y\rangle_t}
$$
which completes the proof.

In the proof, the author applies Itô's lemma on the continuous semi-martingale $X+Y$ with function $f(x) = x^2$. Itô's lemma requires
$$
\mathbb E \bigg [ \int_0^t (f'(X_s + Y_s))^2 \mathrm d \langle X+Y \rangle_s \bigg ] = 4\mathbb E \bigg [ \int_0^t (X_s + Y_s)^2 \mathrm d \langle X+Y \rangle_s \bigg ]  < \infty \quad \forall t\ge 0.
$$

Could you explain how this requirement is satisfied from the assumption $(\star)$?

Related definition: Let $(\Omega, \mathcal F, \mathbb P)$ be a probability space and $\mathfrak F = (\mathcal{F}_t, t \ge 0)$ a filtration.
Let $M$ be a continuous square-integrable martingale w.r.t. $\mathfrak F$. Then $M^2$ is a continuous sub-martingale w.r.t. $\mathfrak F$. By Doob's decomposition theorem, there exists a unique continuous increasing process $\langle M \rangle$ adapted to $\mathfrak F$ such that $\langle M \rangle_0 = 0$ a.s. and that $M^2 - \langle M \rangle$ is a continuous martingale w.r.t. $\mathfrak F$. Then $\langle M \rangle$ is called the quadratic variation of $M$.
A process $X$ is called a continuous semi-martingale w.r.t. $\mathfrak F$ is that can be written as $X_t = M_t+V_t$ where

*

*$M$ is a continuous square-integrable martingale w.r.t. $\mathfrak F$.

*$V$ is a continuous process that has bounded variation and is adapted to $\mathfrak F$ such that $V_0 = 0$ a.s.

Then the quadratic variation of $X$ is defined as
$$
\langle X \rangle := \langle M \rangle.
$$
Let $H$ be a continuous adapted process such that
$$
\mathbb E \bigg [ \int_0^t H_s^2 \mathrm d \langle X \rangle_s \bigg ] < \infty \quad \forall t\ge 0.
$$
Then the stochastic integral of $H$ with respect to $X$ is defined as
$$
(H \cdot X)_t := \int_0^t H_s \mathrm d X_s := \underbrace{\int_0^t H_s \mathrm d M_s}_{\text{Itô's integral}} + \underbrace{\int_0^t H_s \mathrm d V_s}_{\text{Riemann-Stieltjes's integral}}.
$$

Itô's lemma. Let $X$ be a continuous semi-martingale and $f:\mathbb R \to \mathbb R$ twice continuously differentiable such that
$$
\mathbb E \bigg [ \int_0^t (f'(X_s))^2 \mathrm d \langle X \rangle_s \bigg ] < \infty \quad \forall t\ge 0.
$$
Then for all $t \ge 0$,
$$
f(X_t)-f(X_0) = \int_0^t f'(X_s) \mathrm d X_s + \frac{1}{2} \int_0^t f''(X_s) \mathrm d \langle X \rangle_s
\quad \text{a.s.}
$$

A: I sent an email to the author and have got the reply. The assumption should be
$$
\mathbb E \bigg [ \int_0^t X_s^2 \mathrm d \langle Y \rangle_s +  \int_0^t Y_s^2 \mathrm d \langle X \rangle_s + \int_0^t X_s^2 \mathrm d \langle X \rangle_s +  \int_0^t Y_s^2 \mathrm d \langle Y \rangle_s \bigg ] <\ \infty \quad \forall t \ge 0.
$$


text:
Q: server side response in twig page for button I want to get a server side response for a button in a twig page.
As a example - there will be 2 button in the page ----
ON/OFF
When the page load it should check from server (check from elasticsearch database) whether it returns True or false, for both button.
So for instanse we say that for ON button it return "True" it should change it color to green, like ----
$(this).addClass('btn-success');
$(this).removeClass('btn-primary');

The main purpose is to check what's the current status, when the page load.
So this is not a on-click function, because it show show the status when the page is loaded.
I believe there will be some simple solution to solve this problem.
Do anyone knows how to solve this problem.

A: This has actually nothing to do with Symfony. All you need to do is send an ajax request to the server side script (controller) to get the status of the server. like so:
$(document).ready(function(){
   //send the request with empty data to the server to check the status
   $.post('/url/to/action', {}, function(msg){
     // we return a response like {status: 'on'} to the client if the search is on
     if (msg.status == 'on'){
       $('#your-button').addClass('success');
     }
     // else it is disabled
     else
       $('#your-button').addClass('primary');
   });
});

the above is your client side code, now to integrate it with your symfony app, /url/to/action must point to some controller action in your symfony app that returns the status, a sample implementation would be like this:
//in your controller, /url/to/action must lead to getStatusAction in your routing
public function getStatusAction(Request $request){
    if($this->isElasticEnabled())
      return new \Symfony\Component\HttpFoundation\JsonResponse(array('status' => 'on'));
      else
        return new \Symfony\Component\HttpFoundation\JsonResponse(array('status' => 'off'));
}


text:
Q: Getting Error While Installing Heroku Toolbelt on Ubuntu I am Trying to install Heroku on Ubuntu i am getting following error and while installing i am getting error please check i am new to rails project
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
 This script requires superuser access to install apt packages.
 You will be prompted for your password by sudo.
 [sudo] password for giri:
 --2016-04-11 23:56:12--  https://toolbelt.heroku.com/apt/release.key
  Resolving toolbelt.heroku.com (toolbelt.heroku.com)... 23.21.68.222,       23.23.160.223, 107.20.233.51
 Connecting to toolbelt.heroku.com   (toolbelt.heroku.com)|23.21.68.222|:443... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 1737 (1.7K) [application/octet-stream]
 Saving to: 'STDOUT'

 100%[======================================>] 1,737       --.-K/s   in 0s
 2016-04-11 23:56:14 (148 MB/s) - written to stdout [1737/1737]

  OK
     Ign http://dl.google.com stable InRelease
     Hit http://dl.google.com stable Release.gpg
    Hit http://dl.google.com stable Release
    Hit http://security.ubuntu.com trusty-security InRelease
    Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/restricted Sources
Ign http://toolbelt.heroku.com ./ InRelease
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/multiverse Sources
Hit http://toolbelt.heroku.com ./ Release.gpg
Hit http://security.ubuntu.com trusty-security/main i386 Packages
Hit http://security.ubuntu.com trusty-security/restricted i386 Packages
Hit http://toolbelt.heroku.com ./ Release
Hit http://security.ubuntu.com trusty-security/universe i386 Packages
Hit http://security.ubuntu.com trusty-security/multiverse i386 Packages
Hit http://toolbelt.heroku.com ./ Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse Translation-en
Hit http://security.ubuntu.com trusty-security/restricted Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://ppa.launchpad.net trusty InRelease
Ign http://extras.ubuntu.com trusty InRelease
Ign http://in.archive.ubuntu.com trusty InRelease
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://extras.ubuntu.com trusty Release.gpg
Hit http://in.archive.ubuntu.com trusty-updates InRelease
Hit http://extras.ubuntu.com trusty Release
Hit http://in.archive.ubuntu.com trusty-backports InRelease
Ign http://toolbelt.heroku.com ./ Translation-en_IN
Hit http://in.archive.ubuntu.com trusty Release.gpg
Hit http://extras.ubuntu.com trusty/main Sources
Hit http://in.archive.ubuntu.com trusty-updates/main Sources
Hit http://extras.ubuntu.com trusty/main i386 Packages
Ign http://toolbelt.heroku.com ./ Translation-en
Hit http://in.archive.ubuntu.com trusty-updates/restricted Sources
Hit http://in.archive.ubuntu.com trusty-updates/universe Sources
Hit http://in.archive.ubuntu.com trusty-updates/multiverse Sources
Hit http://in.archive.ubuntu.com trusty-updates/main i386 Packages
Hit http://in.archive.ubuntu.com trusty-updates/restricted i386 Packages
Hit http://in.archive.ubuntu.com trusty-updates/universe i386 Packages
Hit http://in.archive.ubuntu.com trusty-updates/multiverse i386 Packages
Hit http://in.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://in.archive.ubuntu.com trusty-updates/multiverse Translation-en
Ign http://extras.ubuntu.com trusty/main Translation-en_IN
Hit http://in.archive.ubuntu.com trusty-updates/restricted Translation-en
Ign http://extras.ubuntu.com trusty/main Translation-en
Hit http://in.archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://in.archive.ubuntu.com trusty-backports/main Sources
Hit http://in.archive.ubuntu.com trusty-backports/restricted Sources
Hit http://in.archive.ubuntu.com trusty-backports/universe Sources
Hit http://in.archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://in.archive.ubuntu.com trusty-backports/main i386 Packages
Hit http://in.archive.ubuntu.com trusty-backports/restricted i386 Packages
Hit http://in.archive.ubuntu.com trusty-backports/universe i386 Packages
Hit http://in.archive.ubuntu.com trusty-backports/multiverse i386 Packages
Hit http://in.archive.ubuntu.com trusty-backports/main Translation-en
Hit http://in.archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://in.archive.ubuntu.com trusty-backports/restricted Translation-en
Hit http://in.archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://in.archive.ubuntu.com trusty Release
Hit http://in.archive.ubuntu.com trusty/main Sources
Hit http://in.archive.ubuntu.com trusty/restricted Sources
Hit http://in.archive.ubuntu.com trusty/universe Sources
Hit http://in.archive.ubuntu.com trusty/multiverse Sources
Hit http://in.archive.ubuntu.com trusty/main i386 Packages
Hit http://in.archive.ubuntu.com trusty/restricted i386 Packages
Hit http://in.archive.ubuntu.com trusty/universe i386 Packages
Hit http://in.archive.ubuntu.com trusty/multiverse i386 Packages
Hit http://in.archive.ubuntu.com trusty/main Translation-en
Hit http://in.archive.ubuntu.com trusty/multiverse Translation-en
Hit http://in.archive.ubuntu.com trusty/restricted Translation-en
Hit http://in.archive.ubuntu.com trusty/universe Translation-en
Ign http://in.archive.ubuntu.com trusty/main Translation-en_IN
Ign http://in.archive.ubuntu.com trusty/multiverse Translation-en_IN
Ign http://in.archive.ubuntu.com trusty/restricted Translation-en_IN
Ign http://in.archive.ubuntu.com trusty/universe Translation-en_IN
W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release  Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file)

E: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  heroku
The following NEW packages will be installed:
  heroku heroku-toolbelt
0 upgraded, 2 newly installed, 0 to remove and 678 not upgraded.
Need to get 0 B/1,828 kB of archives.
After this operation, 0 B of additional disk space will be used.
Selecting previously unselected package heroku.
(Reading database ... 211926 files and directories currently installed.)
Preparing to unpack .../heroku_3.42.50_all.deb ...
Unpacking heroku (3.42.50) ...
Selecting previously unselected package heroku-toolbelt.
Preparing to unpack .../heroku-toolbelt_3.42.50_all.deb ...
Unpacking heroku-toolbelt (3.42.50) ...
Setting up heroku (3.42.50) ...
Setting up heroku-toolbelt (3.42.50) ...

After installation get check version i get error like this
 giri@giri:~$ heroku -v
 !    Heroku client internal error.
 !    Search for help at: https://help.heroku.com
 !    Or report a bug at: https://github.com/heroku/heroku/issues/new

    Error:       undefined method `[]' for nil:NilClass (NoMethodError)
    Command:     heroku -v
    Version:     heroku-toolbelt/3.42.50 (i686-linux) ruby/1.9.3
    Error ID:    59e2f7f1adc64081af2a4ab6a95becdb

    More information in /home/giri/.heroku/error.log

A: @user5065277 try this  "The mirror in your software sources might not be up-to-date"(...)


text:
Q: the space between the section title and the page margin is too much I face a large space between the start edge of the page and the section, please forgive me as I am new user for Latex.
The problem is the distance from the paper's edge to the text body is too large

A: I don't know what picture you are referring to, but probably adding something like
\addtolength{\voffset}{-1in}
\addtolength{\textheight}{1in}

in your preamble might help you.
Change -1in and 1in (in = inch) to whatever you need.
Also see LaTeX/Page Layout for more info about page layout.


text:
Q: Express-session is getting wiped by react router link I have a game and it store all users data in Session body on Node Server. (To make it unique per player).
But when i am using react-router (Basic routing to another page) my session is getting wiped.
Does anyone know how i can keep session while routing from page to page.?
I attached the github repo with Server code and React code below.
This is GitHub repo with session problem
I tried to google what is the solution but haven't found anything.

A: Proxy was not set up on project.
My endpoints were pointing to localhost instead of having a proxy in "package.json".
Example of proxy:  "proxy": "http://localhost:3001"
Than when you do endpoints in react instead of 'http://localhost/:3001/api/letter', you should use '/api/letter'.


text:
Q: Can't run npm on ubuntu slave I'm new in jenkins, I want ubuntu 14.04 slave to run nodejs project, I'm using nvm and my nodejs version is 6.3.0, but npm install is failure,
[ubuntuElectron] $ /bin/sh -xe /tmp/hudson7587739392227498268.sh
+ npm install
Build step 'exec Shell' marked build as failure
Finished: FAILURE

How to set my node environment variable?I have set npm to

/usr/local/bin/npm

but it still not working.
Can you help me please ? Thanks.

A:
https://issues.jenkins-ci.org/browse/JENKINS-27170

try this it may help you. i think it may be of path issue....


text:
Q: MVC 3 Video.Flash helper not working I'm trying to use the Video helper to show a flash video on a site I'm working on but nothing is showing. I tried the MediaPlayer helper and that worked fine, I've loaded up the flash video I'm trying to play in a media player on my machine and it loads and plays. I've gone right back to basics and just entered the path into the helper but still no joy. Here is the code in my view:

Movies

@Video.Flash(path: @Url.Content("~/Media/07477279-df26-4a6e-895a-2ead51d90d21.flv"))

When I looked at the HTML generated there is a  there but nothing is loading. I'm stumped! Anyone got any ideas?

A: You'd need to use a url of a flash file (.swf) rather than the direct url to an flv, and then the flash file plays the flv.


text:
Q: Phantomjs launcher Fatal Windows Exception encountered I am having issues running karma tests through gulp.
I am using the phantomjs launcher plugin, and when it attempts to launch I see the following:
[09:27:02] Starting 'karma-tests'...
DEPRECATED: use your own version of lodash, this will go away in karma@2.0
DEPRECATED: use your own version of lodash, this will go away in karma@2.0
28 01 2017 09:27:04.817:INFO [karma]: Karma v1.4.0 server started at http://0.0.0.0:9876/
28 01 2017 09:27:04.817:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
28 01 2017 09:27:04.817:INFO [launcher]: Starting browser PhantomJS
28 01 2017 09:27:07.882:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket VwHY_WyYXMEj3RvZAAAA with id 284
68634
28 01 2017 09:27:08.436:ERROR [phantomjs.launcher]: Fatal Windows exception, code 0xc0000005.
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.

28 01 2017 09:27:08.471:ERROR [launcher]: PhantomJS crashed.

28 01 2017 09:27:08.475:INFO [launcher]: Trying to start PhantomJS again (1/2).
28 01 2017 09:27:10.457:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (1 times)
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  Disconnectedundefined

[09:27:10] 'karma-tests' errored after 7.9 s
[09:27:10] Error: 1
    at formatError (C:\Users\asus\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:169:10)
    at Gulp.<anonymous> (C:\Users\asus\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:195:15)
    at emitOne (events.js:101:20)
    at Gulp.emit (events.js:188:7)
    at Gulp.Orchestrator._emitTaskDone (C:\Users\asus\Documents\Github\interACT\node_modules\orchestrator\index.js:264
:8)
    at C:\Users\asus\Documents\Github\interACT\node_modules\orchestrator\index.js:275:23
    at finish (C:\Users\asus\Documents\Github\interACT\node_modules\orchestrator\lib\runTask.js:21:8)
    at cb (C:\Users\asus\Documents\Github\interACT\node_modules\orchestrator\lib\runTask.js:29:3)
    at removeAllListeners (C:\Users\asus\Documents\Github\interACT\node_modules\karma\lib\server.js:380:7)
    at Server.<anonymous> (C:\Users\asus\Documents\Github\interACT\node_modules\karma\lib\server.js:391:9)
    at Server.g (events.js:291:16)
    at emitNone (events.js:91:20)
    at Server.emit (events.js:185:7)
    at emitCloseNT (net.js:1555:8)
    at _combinedTickCallback (internal/process/next_tick.js:71:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

I am using the latest versions of karma and phantomjs launcher, with the following entries in my package.json:
"karma": "^1.4.0",
"karma-phantomjs-launcher": "^1.0.2"

Plus I have Phantomjs 2.1.1 installed globally
The nature of the error seems to suggest this is Windows related, I am running on a windows 10 64 bit platform.
The project I am running is actually installed on some other machines which are a mix of windows 7, windows 10 and linux. I have seen this issue on the other win 10 machines, the rest of the platforms seem fine. Up until recently (past couple of weeks approx) I havent seen this issue on win 10, so I am wondering if some sort of windows update has caused an unforeseen side effect.
I did by chance change the port number in my karma config file and it managed to run the tests, but on a further run it failed again with the same error. Changing the port again made no difference.
My karma config looks as follows:
module.exports = function(config) {
  config.set({
    logLevel : config.LOG_INFO,
    colors: true,
    browsers: ['PhantomJS'],
    singleRun: true,
    port: 9876,
    autoWatch: false,
    basePath: '../',
    reporters: ['progress', 'coverage'],

    coverageReporter: {
      dir : 'test/coverage/',
      reporters: [{
        type: 'lcovonly',
        subdir: '.',
        file: 'karma-coverage.dat'
      }, {
        type : 'json',
        subdir: '.',
        file : 'karma-results.json'
      }]
    },

    frameworks: ['jasmine'],
    exclude: ['../dist/client/assets/scripts/angular_app.js'],
    files: [
      'dist/client/assets/scripts/jquery.js',
      'dist/client/assets/scripts/bootstrap.js',
      'dist/client/assets/scripts/bower_libs.js',
      'dist/client/assets/scripts/d3.min.js',
      'dist/client/assets/scripts/main.js',
      'test/mocks/mocks.config.js',
      'test/mocks/**/*.mock.js',
      'src/client/app/**/*.module.js',
      'src/client/app/**/!(*spec).js',
      'src/client/app/**/*.spec.js'
    ],

    preprocessors: {
      'src/client/app/**/!(*spec).js': ['coverage']
    }
  });
};

Has anyone out there encountered this issue and if so have you managed to find a solution?
Let me know if you require further details.
Thanks

A: I found a solution in the end by using the 2.5.0 beta which can be grabbed from here and replacing for the exe in the phantom library folder that comes with the phantomjs-built module.
So for me I had to stick in here:
PROJECT_ROOT\node_modules\phantomjs-prebuilt\lib\phantom\bin

This has done the trick, no more fatal exceptions! It doesn't look like 2.5 will be be released anytime soon though - https://github.com/ariya/phantomjs/milestones
Use at your own peril!