text:
Q: Python segmentation fault 11 on Mojave MacOS 10.14.5 (Mojave)
Python 3.7.3
wxPython 4.0.6
Keep getting crashes with "Segmentation fault: 11"
For example, I have an app that displays a wx.RearrangeCtrl. It displays and populates OK but Python crashes if I try to check a box or move an item.
I found numerous threads on this topic but they all refer to much older versions, and the solutions they offer are not valid for the current versions.
Any advice would be appreciated.
I wrote a simple app to reproduce the problem. As before, it lints clean, and runs OK initially. The window opens, and the list box gets its three items added. The segmentation fault crash occurs if I try to move an item or check a box. This happens consistently, every time.
import wx

class mainFrame(wx.Frame):

    def __init__(self, *args, **kw):
        super(mainFrame, self).__init__(*args, **kw)
        pnl = wx.Panel(self)
        mainsizer = wx.BoxSizer(orient=wx.VERTICAL)

        self.vlist = wx.RearrangeCtrl(pnl)
        self.vlist.Create(pnl, -1, size=(600,400))
        mainsizer.Add(self.vlist, 1, wx.EXPAND | wx.ALL, 10)

        pnl.SetSizerAndFit(mainsizer)

        self.loadList()

    def loadList(self):
        self.vlist.GetList().Append("first line")
        self.vlist.GetList().Append("second line")
        self.vlist.GetList().Append("third line")

if __name__ == '__main__':
    app = wx.App()
    frm = mainFrame(None, title='Crash Test', size=wx.Size(800, 600))
    frm.Show()
    app.MainLoop()

A: Your code also crashes in macOS 10.14.4 and Win10. The problem seems to be that you must give the list of items and order during the creation of the wx.RearrangeCtrl widget.
The code below is now working fine in both OS.
import wx

class mainFrame(wx.Frame):

    def __init__(self, *args, **kw):
        super(mainFrame, self).__init__(*args, **kw)
        pnl = wx.Panel(self)
        mainsizer = wx.BoxSizer(orient=wx.VERTICAL)

        items = ['first line', 'second line', 'third line']
        order = [0, 1, 2]

        self.vlist = wx.RearrangeCtrl(pnl, -1, size=(600, 400), order=order, items=items)

        mainsizer.Add(self.vlist, 1, wx.EXPAND | wx.ALL, 10)

        pnl.SetSizerAndFit(mainsizer)

if __name__ == '__main__':
    app = wx.App()
    frm = mainFrame(None, title='Crash Test', size=wx.Size(800, 600))
    frm.Show()
    app.MainLoop()

Just in case, the description for showing the items as selected or not is here.


text:
Q: using several rich:orderinglist in the same view with some having buttons hidden (richfaces 4) Hie all, I would like to use two rich:orderinglists in the same view having one with the control buttons and the other without them.
I manage to hide them globaly by introducing :
<h:outputStylesheet>
.rf-ord-btn{display:none;}
</h:outputStylesheet>

At the beginning of my form.
But then buttons are hidden for all lists...
What would be the right way to limit the re-styling to only one of my lists?
Thanks for help

A: Use the styleClass attribute.
<rich:orderingList styleClass="list-with-hidden-buttons">

and then change the rule to cover only that list
.list-with-hidden-buttons .rf-ord-btn {
    display:none;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: On $\lambda(n)$. Let $\lambda(n)$ be the Carmichael Lambda Function of $n$.
We know that for every $m$ there is the largest $n_m\in\Bbb N$ such that for every $n>n_m$ we have $\lambda(n)\neq m$ and $\lambda(n_m)=n$ holds?
Given $m$ what is a good bound on $n_m$?


text:
Q: JsonArrayRequest not giving any response I am trying to fetch an array from a database on a remote server using the Android Volley library. The problem is that the JSONobject is not returning any data in the onResponse method. When I try to show the data in JSONobject, the application crashes and logcat shows a NullPointerException.
Java code is given below:
public class AudioFragmentThree extends Fragment {
    View view;
    TextView text;
    String url = "http://www.muftiattaullahmultani.com/android/get_all_bayan.php";
    int count = 0;
    int i = 0;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.audio_fragment_three, container, false);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.POST, url, null, new Response.Listener<JSONArray>() {
            public void onResponse(JSONArray response) {
                while(count<response.length())
                {
                    JSONObject object= null;
                    try {
                        object = response.getJSONObject(count);
                        String s = object.getString("id") +"  "+ object.getString("topic");

                        text.setText(s);

                        count++;
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                text.setText("ERROR");
            }
        });

        MySingleton.getInstance(getActivity()).addToRequestQueue(jsonArrayRequest);
    }
}

LogCat is given below:
FATAL EXCEPTION: main Process: com.example.mashood.muftiattaullahmultanicom, PID: 22596
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference at
com.example.mashood.muftiattaullahmultanicom.AudioFragmentThree$1.onResponse(AudioFragmentThree.java:81)
        at com.example.mashood.muftiattaullahmultanicom.AudioFragmentThree$1.onResponse(AudioFragmentThree.java:69)
        at com.android.volley.toolbox.JsonRequest.deliverResponse(JsonRequest.java:65)
        at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5910)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)

Below is my PHP code:
<?PHP include 'database.php';
$query = 'SELECT * FROM audio_bayan ORDER BY no DESC';
$result = $conn->query($query);
$response = array();
while($row = $result->fetch_assoc()) {
    array_push($response,array("id"=>$row['no'],"topic"=>$row['topic']));
}
echo json_encode($response);
?>

A: Looks like your TextView is null.

java.lang.NullPointerException: Attempt to invoke virtual method
       'void android.widget.TextView.setText(java.lang.CharSequence)' on a
         null object reference

It means you are trying to call setText on a null reference. You have to assign a reference of your TextView from xml layout to the TextView, something like this in onCreateView or onActivityCreated:
TextView text =(TextView) view.findViewById(R.id.text_view);

where, text_view is the id of your TextView in xml.

A: You forget the findViewById your text field add :
text = (TextView) view.findViewById(R.id.text_id);

to your onCreateView method

A: You have to define textview like below:
Textview text;

text = (TextView) view.findViewById(R.id.textid);


text:
Q: mvc3 is there a way to change the naming system of razor I have a partial view that allows Html and the rendered name attribute of the <textarea> is throwing everything off, for instance this is my text area
     @Html.TextAreaFor(model => model.cars.mycars)

causes the attribute to render as name="cars.mycars", is there anyway to change that to cars_mycars without using @Name ?
The reason why I want cars_mycars is because it is a field that has AllowHtml in it in the model
   [AllowHtml]
     public string mycars { get; set; }

In order for AllowHtml to work I would need a strongly typed model such as @Html.TextAreaFor(model => model.mycars) but I am using multiple models in 1 view therefore I have
@Html.TextAreaFor(model => model.cars.mycars, @new{id="cars_mycars",@Name="cars_mycars"})

This is all in a partialview and when I try to submit it nothing happens at all. That is the only field in the form so the issue much lie there and in addition if I put
ValidateInput(False)

on the action method then everything works fine which leads me back to the @name convention not working .

A: You can try like this
@Html.TextArea("cars_mycars")


text:
Q: Does anyone know a solution to this PDE? I ran into this PDE:
$$\frac{\partial y(x,t)}{\partial t} = A\,x^{\gamma-1} \left(\frac{\partial y(x,t)}{\partial x} + x \, \frac{\partial^2 y(x,t)}{\partial x^2}\right)$$
If it helps in any way, this is for a physical system, where $x,y,t$ and $A$ are positive real numbers and we just care about solutions in $x>0$.
For starters, a solution for $\gamma=1$ would already be enough:
$$\frac{\partial y(x,t)}{\partial t} = A \left(\frac{\partial y(x,t)}{\partial x} + x \, \frac{\partial^2 y(x,t)}{\partial x^2}\right)$$
I got as far as to find the solution in Fourier space for a Dirac delta distribution as initial condition $y(x,0)= F \, \delta(x-\hat x)$, which is:
$$ y(k,t) = \frac{F}{2\pi}\,\exp\left(-\frac{\mathrm{i} \, \hat x \, k}{1-A\, \mathrm{i} \, k\, t}\right) \, \left(1-A\, \mathrm{i} \, k\, t\right).$$
But now I fail to get a nice closed-form expression for the inverse Fourier transform of that solution. Can anyone find that, or find another way to solve for $y(x,t)$?

A: $\newcommand{\+}{^{\dagger}}%
 \newcommand{\angles}[1]{\left\langle #1 \right\rangle}%
 \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}%
 \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}%
 \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}%
 \newcommand{\dd}{{\rm d}}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\fermi}{\,{\rm f}}%
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
 \newcommand{\half}{{1 \over 2}}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\isdiv}{\,\left.\right\vert\,}%
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}%
 \newcommand{\ol}[1]{\overline{#1}}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
 \newcommand{\sech}{\,{\rm sech}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
$\ds{\partiald{{\rm y}\pars{x,t}}{t}
=
Ax^{\gamma}\,\partiald[2]{{\rm y}\pars{x,t}}{x}
+
Ax^{\gamma - 1}\,\partiald{{\rm y}\pars{x,t}}{x}}.$
With the scaling $x = \alpha\tilde{x}$ and $t = \beta\tilde{t}$, we have

\begin{align}
{1 \over \beta}\,\partiald{y}{\tilde{t}}
&=A\alpha^{\gamma}\tilde{x}^{\gamma}\,{1 \over \alpha^{2}}\,
\partiald[2]{y}{\tilde{x}}
+ A\alpha^{\gamma -1}\tilde{x}^{\gamma - 1}\,{1 \over \alpha}\,\partiald{y}{x}
\\[3mm]
\partiald{y}{\tilde{t}}
&=A\pars{\beta\alpha^{\gamma - 2}}\tilde{x}^{\gamma}\,\partiald[2]{y}{\tilde{x}}
+ A\pars{\beta\alpha^{\gamma - 2}}\tilde{x}^{\gamma - 1}\,\partiald{y}{x}
\end{align}
such that the equation is invariant whenever $\beta\alpha^{\gamma - 2} = 1$:
$$
1 = {t \over \tilde{t}}\,\pars{x \over \tilde{x}}^{\gamma - 2}\quad\imp\quad
{x^{1 - \gamma/2} \over t^{1/2}} = {\tilde{x}^{1 - \gamma/2} \over t^{1/2}}
$$
Let $\ds{\xi \equiv {x^{1 - \gamma/2} \over t^{1/2}}}$ and
${\rm y}\pars{x,t} \equiv \fermi\pars{\xi}
 = \fermi\pars{x^{1 - \gamma/2} \over t^{1/2}}$:
\begin{align}
\partiald{{\rm y}\pars{x,t}}{t}
&=
\fermi'\pars{\xi}\,\pars{-\,{1 \over 2}\,{x^{1 - \gamma/2} \over t^{3/2}}}
\\[3mm]
\partiald{{\rm y}\pars{x,t}}{x}
&=
\fermi'\pars{\xi}\,{\pars{1 - \gamma/2}x^{-\gamma/2} \over t^{1/2}}
\\[3mm]
\partiald[2]{{\rm y}\pars{x,t}}{x}
&=
\fermi''\pars{\xi}\,{\pars{1 - \gamma/2}^{2}x^{-\gamma} \over t}
-
\fermi'\pars{\xi}\,{\gamma \over 2}\,
{\pars{1 - \gamma/2}x^{-\gamma/2 - 1} \over t^{1/2}}
\end{align}

\begin{align}
-\,{x^{1 - \gamma/2} \over 2t^{3/2}}\,\fermi'\pars{\xi}
&=
Ax^{\gamma}\bracks{%
{\pars{1 - \gamma/2}^{2}x^{-\gamma} \over t}\,\fermi''\pars{\xi}
-
{\gamma\pars{1 - \gamma/2}x^{-\gamma/2 - 1} \over 2t^{1/2}}\,\fermi'\pars{\xi}}
\\[3mm]&\phantom{=}\mbox{}+
Ax^{\gamma -1}\bracks{%
{\pars{1 - \gamma/2}x^{-\gamma/2} \over t^{1/2}}\,\fermi'\pars{\xi}}
\end{align}
Multiplying both members by the factor $\ds{2t^{3/2}x^{\gamma/2 - 1}}$
\begin{align}
-\fermi'\pars{\xi}
&=\bracks{%
2A\pars{1 - {\gamma \over 2}}^{2}\,\overbrace{t^{1/2}x^{\gamma/2 - 1}}
^{\ds{\xi^{-1}}}\,\fermi''\pars{\xi}
-
A\gamma\pars{1 - {\gamma \over 2}}\,
\overbrace{tx^{\gamma - 2}}^{\ds{\xi^{-2}}}\fermi'\pars{\xi}}
+
2A\pars{1 - {\gamma \over 2}}\,\overbrace{tx^{\gamma - 2}}^{\ds{\xi^{-2}}}
\fermi'\pars{\xi}
\\[3mm]&=
{2A\pars{1 - \gamma/2}^{2} \over \xi}\,\fermi''\pars{\xi}
+
{2A\pars{1 - \gamma/2}^{2} \over \xi^{2}}\,\fermi'\pars{\xi}
\end{align}
$\fermi\pars{\xi}$ obeys the equation:
$$
\fermi''\pars{\xi}
+
\bracks{%
{1 \over \xi} + {\xi \over 2A\pars{1 - \gamma/2}^{2}}}\fermi'\pars{\xi} = 0
$$
Now, we multiply both members by the integrating factor
$\ds{\braces{\xi\exp\pars{{\xi^{2} \over 4A\bracks{1 - \gamma/2}^{2}}}}}$. It leads to:
$$
\totald{}{\xi}\bracks{%
{\xi\exp\pars{\xi^{2} \over 4A\pars{1 - \gamma/2}^{2}}\fermi'\pars{\xi}}} = 0
\quad\imp\quad
\fermi'\pars{\xi}
=
{B \over \xi}\,\exp\pars{-\xi^{2} \over 4A\pars{1 - \gamma/2}^{2}}
$$
where $B$ is a $\it constant$.

\begin{align}
\fermi\pars{\xi}
&=\fermi\pars{\xi_{0}}
+
B\int_{\xi_{0}}^{\xi}\exp\pars{-z^{2} \over 4A\pars{1 - \gamma/2}^{2}}
\ {\dd z \over z}
\end{align}


text:
Q: Creating a looping background animation in jquery What I want is:
when the page loads - the background has color red
after 10 seconds the bgColor changes to green with a fade in fade out animation...
after another 10 seconds it changes to orange....then again to red and so on..
Could someone help

A: Use setinterval with a callback that changes the background:
$("document").ready(function() {
    var colours = [ "blue", "orange", "pink" ];
    var counter = 0;
    function cycleBackground() {
        $("body").animate({ backgroundColor: colours[counter] }, 500 );
        counter++;
        if(counter == colours.length) {
            counter = 0;
        }
    }
    setInterval(cycleBackground, 10000);
});

You will need to use jQuery UI's animate function if you want to smoothly cycle between colors.


text:
Q: How to only include a single (first) duplicate row in a SQL query My issue here is the revenue field, where the value has been duplicated three times. I need a select query which excludes two of the duplicate values but retains a single row. The query must include the non duplicates rows as well.
timeStamp             fieldValue          prevValue     newValue
17/11/2017 11:41      Revenue             £0.00         £12,000.00
17/11/2017 11:41      Revenue             £0.00         £12,000.00
17/11/2017 11:41      Revenue             £0.00         £12,000.00
17/11/2017 11:42      Revenue             £0.00         £16,000.00
17/11/2017 11:42      Revenue             £0.00         £16,000.00
17/11/2017 11:42      Revenue             £0.00         £16,000.00
17/11/2017 11:42      Revenue             £16,000.00      £18,000.00
17/11/2017 11:42      Revenue             £18,000.00      £16,000.00
17/11/2017 11:42      Status              Open          Won
17/11/2017 11:42      Est. Close Date     24/11/2017      21/12/2017
17/11/2017 18:17      Est. Close Date     19/01/2018      16/02/2018
17/11/2017 18:17      Revenue             £16,000.00      £18,000.00
17/11/2017 18:18      Revenue             £18,000.00      £16,000.00
17/11/2017 18:18      Status              Open          Won
17/11/2017 14:35      Est. Close Date     24/11/2017      21/12/2017
20/11/2017 10:26      Est. Close Date     19/01/2018      16/02/2018

Completely stuck on this, any guidance would be greatly appreciated. Using SQL Server 2014.

A: WITH cte as (
      SELECT *,
             ROW_NUMBER() OVER (Partition BY timeStamp, fieldValue, prevValue) as rn
      FROM YourTable
)
SELECT *
FROM cte
WHERE rn = 1

A: You can use a subquery to achieve this
SELECT timeStamp, fieldValue,prevValue,newValue FROM
    (SELECT timeStamp, fieldValue,prevValue,newValue,
            ROW_NUMBER() OVER (Partition BY timeStamp, fieldValue, prevValue,
            newValue ORDER BY timestamp) as rownum ) AS T1
WHERE T1.rownum = 1

A: ;WITH CTE
AS
(
SELECT timeStamp,
       fieldValue,
       prevValue,
       newValue,
       ROW_NUMBER() OVER(PARTITION BY timeStamp, fieldValue, prevValue, newValue ORDER BY timeStamp) AS RowNumb
    FROM TableName
    WHERE fieldValue = 'Revenue'
)
SELECT timeStamp,
       fieldValue,
       prevValue,
       newValue
    FROM CTE
    WHERE RowNumb = 1
UNION
SELECT timeStamp,
       fieldValue,
       prevValue,
       newValue
    FROM TableName
    WHERE fieldValue != 'Revenue'


text:
Q: How to remove currency amounts from a list? ["9.358,26 €", "Hello World", "3.562,77 €", "3,77 €"] -> ["Hello World"] ["9.358,26 €", "Hello World", "3.562,77 €", "3,77 €"] -> ["Hello World"]
I was thinking of using regex, but is there a more easy way?

A: Assuming this is Python, a simple List Comprehension should suffice:
lst = ["9.358,26 €", "Hello World", "3.562,77 €", "3,77 €"]
[el for el in lst if "€" not in el]
>>> ["Hello World"]

Another option is using the filter() function:

def contains_currency(s):
    return "€" not in s

list(filter(contains_currency, lst))

more compactly using an anonymous function:
list(filter(lambda s: "€" not in s, lst))

A: Assuming this is Javascript, a simple filter() should suffice:
let array = ["9.358,26 €", "Hello World", "3.562,77 €", "3,77 €"];

filteredArray = array.filter((item) => !item.includes('€'));

console.log(filteredArray);
// ["Hello World"]

Read more about the includes() method here.


text:
Q: How to put advertising in a Maven generated site like GoogleAds I have a Maven generated site, and I would like to include some Google Ads or similar type of publicity in the site.
GoogleAds works with a script tag in the HTML, however when using a simple Maven site with only APT files, I cannot see a way to put the publicity in the files.
Is there a way to include those script tag in order to add publicity to my site?

A: To put Google publicity inside a Maven generated site you can use the plugin MGAIP.
You just add this as a report

  net.sf.mgaip
  mgaip
  1.1

And then put the googleAds as a poweredBy.
For more information please visit http://mgaip.sourceforge.net


text:
Q: Object call from PHP form submit not setting properties in object/class I have a User object which I use throughout the project with no problem. This User object is created when logged into the site and is initialized on a nav/header file attached to the frontend PHP file.
I have designed a simple set method that takes in a string. Later in a different place, the get method (getStockSearchParam) should return an array with two values. I am finding that when the form is submitted and the string is passed to the set method (setStockSearchParam) the get method returns completely empty. I am not even receiving error messages, it's almost like the form is completely bypassing the set method.

*

*I have been using printR to check the contents of the get method return array.

*For troubleshooting purposes, I manually initialized the properties from within the class and when the get method is called it returns with the values as expected. From this, I can assume my getter method is not the problem but a problem with the set method only from within the form submission process.

*I have called the get & set methods from within the PHP page (not going through the "form submission" process) and that seems to work fine and the get method returns an array with values.

*To troubleshoot I manually input a string parameter instead of using the value from the form input, but still with unsuccessful return results.
<!-- SUBMISSION FORM ON FRONTEND PHP -->
<form method="post">
    <input type="text" name="symbol-search-input" placeholder="Symbol">
    <input id="stock-search-submit" name="symbol-search-btn" type="submit" value="Search">
</form>

/* THIS IS LOCATED AT THE TOP OF THE FRONTEND PHP & USED FOR THE SUBMISSION FORM PROCESS */
require "includes/nav-header.php";

if(isset($_POST['symbol-search-btn'])) {
    $symbolInput = $_POST['symbol-search-input'];

    if(empty($symbolInput)){
        header("Location: testdir.php?error=emptyfield");
        exit();
    } else {
        strtoupper($symbolInput);

        if($user-> getStockData($symbolInput, "exist") == "found") {
            //The line below is where the error is occuring
            $user-> setStockSearchParam($symbolInput);

            header("Location: testdir.php?symbolsearch=success");
            exit();
        } else {
            header("Location: testdir.php?error=symbolnotfound");
        exit();
        }
    }
}

/* THIS IS THE NAV/HEADER FILE CREATED/INCLUDED IN FRONTEND PHP WHEN USER LOGS IN, ALSO USED TO CREATE/USE USER OBJECT */
$dirPre = 'classes/';
$dirPost = '.class.php';

include $dirPre . 'user' . $dirPost;

$indexPage = "index2.php";

session_start();

if(!$_SESSION['userId']) {
    header("Location: " . $indexPage);
    exit();
}

$user = new User();
$user->setUserId($_SESSION['userId']);

class User {

    private $symbolInput;
    private $symbolSearchPrice;

    public function getStockSearchParam() {

        $stockSearchData = array(
            'symbol' => $this->symbolInput,
            'price' => $this->symbolSearchPrice
        );

        return $stockSearchData;
    }

    public function setStockSearchParam($symbol) {

        $this->symbolInput = $symbol;
        $this->symbolSearchPrice = 4.99; //demo/test value
    }
}

When get method (getStockSearchParam) is called I expect an array to return with set values for the "symbol" index & the "price" index. All the get method is returning at this moment is an empty array. FYI, this is only happening upon form submission/process. Both the setter and getter method work fine within the PHP/outside of the form submit.

A: Your core problem is that the header() function sets an HTTP header.  When you set that and exit, it kills the process and dumps everything that is currently in memory.  If you set $user in your current scope like that, the moment you hit the exit(), it will be lost.
Try using the $_SESSION variable for the user object, as well as for the id.
$_SESSION["user"] = new User();
$_SESSION["user"]->setUserId($_SESSION['userId']);
//other code
$_SESSION["user"]->setStockSearchParam($symbolInput);


text:
Q: Adobe Edge and dynamic images Is it possible to use Adobe Edge and have, say the background a dynamic image pulled up from my mysql database? I was thinking of something like below somehow.
I can't find a way to, or anything related on internet searches, so if anyone has any ideas please let me know.
<?php echo $row_rsTable['tablePicture1']; ?> OR MAYBE THIS

<img class="picture" src="<?php echo $row_rsTable['tablePicture1']; ?>">

A: Once you're finished with your site in edge, you can always open up the html, css, and javascript files in your favorite text editor to make changes afterwards.
So for instance, you could animate an image in edge, then just go in afterwards and change the src to whatever image you like, dynamic or not.

A: If you want to get your file name/path from database without breaking auto-generated html/js architecture from Edge, you could use for that purpose simple, php REST Api.
Just make simple REST service which returns the name/path of desired image file in JSON format, and parse it with jQuery $.post() anywhere in your Edge app.
-
You could also do it by changing your main Edge app html file to .php extension and read data from webserwer's database in the 'traditional' way. Then assign that data to global javascript variable, and then use that variable anywhere in your Edge app.


text:
Q: MariaDB REGEXP_REPLACE backreferences not works in FUNCTION I have this simple expression:
SELECT REGEXP_REPLACE('aaa 123 bbb 456 ccc', '([0-9]+)', LPAD('\\1', 10, '0'));
+-------------------------------------------------------------------------+
| REGEXP_REPLACE('aaa 123 bbb 456 ccc', '([0-9]+)', LPAD('\\1', 10, '0')) |
+-------------------------------------------------------------------------+
| aaa 00000000123 bbb 00000000456 ccc                                     |
+-------------------------------------------------------------------------+

But if i put this into a FUNCTION:
CREATE FUNCTION test()
RETURNS VARCHAR(4000)
BEGIN
       RETURN REGEXP_REPLACE('aaa 123 bbb 456 ccc', '([0-9]+)', LPAD('\\1', 10, '0'));
END

It doesn't works:
SELECT test();
+-----------------------------------+
| test()                           |
+-----------------------------------+
| aaa 0000000001 bbb 0000000001 ccc |
+-----------------------------------+

How can i fix it? (10.1.38-MariaDB-0+deb9u1)

A: Use '\1' instead of '\\1'....


text:
Q: Can we create .mobileconfig file programmatically? <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>AutoJoin</key>
            <true/>
            <key>EncryptionType</key>
            <string>WPA</string>
            <key>HIDDEN_NETWORK</key>
            <false/>
            <key>Password</key>
            <string>12345678</string>
            <key>PayloadDescription</key>
            <string>Configures wireless connectivity settings.</string>
            <key>PayloadDisplayName</key>
            <string>Wi-Fi (WIFI1)</string>
            <key>PayloadIdentifier</key>
            <string>com.orgName.p2m.wifi</string>
            <key>PayloadOrganization</key>
            <string>orgName</string>
            <key>PayloadType</key>
            <string>com.apple.wifi.managed</string>
            <key>PayloadUUID</key>
            <string>3FEF4439-A554-4CB9-8CD6-6D842D1612F4</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>ProxyType</key>
            <string>None</string>
            <key>SSID_STR</key>
            <string>WIFI1</string>
        </dict>
        <dict>
            <key>AutoJoin</key>
            <true/>
            <key>EncryptionType</key>
            <string>WPA</string>
            <key>HIDDEN_NETWORK</key>
            <false/>
            <key>Password</key>
            <string>12345678</string>
            <key>PayloadDescription</key>
            <string>Configures wireless connectivity settings.</string>
            <key>PayloadDisplayName</key>
            <string>Wi-Fi (WIFI2)</string>
            <key>PayloadIdentifier</key>
            <string>com.orgName.p2m.wifi1</string>
            <key>PayloadOrganization</key>
            <string>orgName</string>
            <key>PayloadType</key>
            <string>com.apple.wifi.managed</string>
            <key>PayloadUUID</key>
            <string>00846FEC-0649-48D1-81FC-508D9E167436</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>ProxyType</key>
            <string>None</string>
            <key>SSID_STR</key>
            <string>WIFI2</string>
        </dict>
    </array>
    <key>PayloadDescription</key>
    <string>This profile will be installed to allow connectivity to the internet and network resources of Please2Meet locations. If this profile is removed, all internet and network access will be removed for orgName locations.</string>
    <key>PayloadDisplayName</key>
    <string>HotspotProfile</string>
    <key>PayloadIdentifier</key>
    <string>com.orgName.p2m</string>
    <key>PayloadOrganization</key>
    <string>orgName</string>
    <key>PayloadRemovalDisallowed</key>
    <false/>
    <key>PayloadType</key>
    <string>Configuration</string>
    <key>PayloadUUID</key>
    <string>D285694F-9975-4A0E-8B88-F245FE607885</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
</dict>
</plist>

Is it possible to create .mobileconfig file in iOS with wifi payloads?


text:
Q: unable to start ./spark-shell i am new to spark an dtrying to install spark on my ubuntu machine and
i am facing below error when am i trying to start spark -shell
please help
Caused by: org.apache.derby.iapi.error.StandardException: Directory    /home/amar/spark-2.2.0-bin-hadoop2.7/bin/metastore_db cannot be created.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at    org.apache.derby.impl.services.monitor.StorageFactoryService$10.run(Unknown  Source)
at java.security.AccessController.doPrivileged(Native Method)
at  org.apache.derby.impl.services.monitor.StorageFactoryService.createServiceRoot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.createPersistentService(Unknown Source)
at org.apache.derby.impl.services.monitor.FileMonitor.createPersistentService(Unknown Source)
at org.apache.derby.iapi.services.monitor.Monitor.createPersistentService(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection$5.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.derby.impl.jdbc.EmbedConnection.createPersistentService(Unknown Source)
... 149 more
<console>:14: error: not found: value spark
   import spark.implicits._
          ^
<console>:14: error: not found: value spark
   import spark.sql
          ^
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /___/ .__/\_,_/_/ /_/\_\   version 2.2.0
    /_/

Using Scala version 2.11.8 (OpenJDK 64-Bit Server VM, Java 1.8.0_131)
Type in expressions to have them evaluated.
Type :help for more information.

A: In my case the problem was in permissions. I was trying to launch spark as not admin user.
 Once I've started as root, all went well. However I'm not recommending such behavior. Just pointing to check permissions and set it up accordingly. Running as root is a bad practice.


text:
Q: Proper Cordova developing environment in VS Community 2015 After having spent some hours trying to figure this out I'm surrendering and hope someone here can help me.
Problem
I doesn't get any IntelliSense suggestions for Bootstrap classes
This is what I've tried
I'm about to develop a Cordova-based app with Bootstrap. While looking at numerous guides and examples I started off by creating a new project, a blank Cordova project. I added jquery and bootstrap under dependencies in bower.json and those packages was downloaded. As stated in a guide at taco.visualstudio.com I then manually copied the js, css and font files into appropriate folders under "www". Finally I added links to these files inside my index.html.
The thing is that I have another web app0 project, a ASP.NET project that was developed at my work. They use Bootstrap and when I work with that project I get IntelliSense suggestions for Bootstrap classes while typing

That makes me wonder that my problem may have something to do with my working environment? That I have to do something else in order for Visual Studio to recognize what libraries I use and read those CSS files and come up with suggestions?


text:
Q: Equivalent to "SIGINT" (posix) signal for catching "CTRL+C" under Windows/MinGW I am porting a Linux/gcc program under windows and implemented common exceptions handling for both. I was wondering what would be the equivalent of SIGINT signal for MinGW/gcc.
Here is how I handle it under Linux :
static void handler(int sig)
{
    // Catch exceptions
    switch(sig)
    {
    case SIGABRT:
        fputs("Caught SIGABRT: usually caused by an abort() or assert()\n", stderr);
        break;
    case SIGFPE:
        fputs("Caught SIGFPE: arithmetic exception, such as divide by zero\n",
                stderr);
        break;
    case SIGILL:
        fputs("Caught SIGILL: illegal instruction\n", stderr);
        break;
    case SIGINT:
        fputs("Caught SIGINT: interactive attention signal, probably a ctrl+c\n",
                stderr);
        break;
    case SIGSEGV:
        fputs("Caught SIGSEGV: segfault\n", stderr);
        break;
    case SIGTERM:
    default:
        fputs("Caught SIGTERM: a termination request was sent to the program\n",
                stderr);
        break;
    }

    // Ctrl+C interrupt => No backtrace
    if (sig != (int)SIGINT)
    {
        fprintf(stderr, "Error: signal %d:\n", sig);
        posix_print_stack_trace();
    }
    exit(sig);

}

signal(SIGABRT, handler);
signal(SIGFPE,  handler);
signal(SIGILL,  handler);
signal(SIGINT,  handler);
signal(SIGSEGV, handler);
signal(SIGTERM, handler);

Under Windows, this looks like :
static LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS * ExceptionInfo)
{
    switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
    {
    case EXCEPTION_ACCESS_VIOLATION:
        fputs("Error: EXCEPTION_ACCESS_VIOLATION\n", stderr);
        break;
    case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
        fputs("Error: EXCEPTION_ARRAY_BOUNDS_EXCEEDED\n", stderr);
        break;
    case EXCEPTION_BREAKPOINT:
        fputs("Error: EXCEPTION_BREAKPOINT\n", stderr);
        break;

    ...
    }
}

if (EXCEPTION_STACK_OVERFLOW != ExceptionInfo->ExceptionRecord->ExceptionCode)
{
    windows_print_stacktrace(ExceptionInfo->ContextRecord);
}

My problem is that I don't see any equivalent of SIGINT in the EXCEPTION_* available for Windows.
How would it be done catching a "CTRL+C" interruption under Windows (MinGW/gcc) ?
Thanks a lot.

A: If you want to catch ctrl+c SetConsoleCtrlHandler may be what you are looking for.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

BOOL WINAPI ConsoleHandler(DWORD);

int main(int argc, char *argv[])
{
    if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler,TRUE)) {
        fprintf(stderr, "Unable to install handler!\n");
        return EXIT_FAILURE;
    }

    for (;;)
        ; /* Null body. */

    return EXIT_SUCCESS;
}

BOOL WINAPI ConsoleHandler(DWORD dwType)
{
    switch(dwType) {
    case CTRL_C_EVENT:
        printf("ctrl-c\n");
        break;
    case CTRL_BREAK_EVENT:
        printf("break\n");
        break;
    default:
        printf("Some other event\n");
    }
    return TRUE;
}


text:
Q: How to debug Django PayPal IPN? I'm using this django app to implement PayPal IPN. I'm testing it using PayPal's IPN simulator, but it's telling me

IPN delivery failed. HTTP error code 500: Internal Server Error

So how can I debug this and see what's really going on? I've dug into code:
@require_POST
def ipn(request, item_check_callable=None):
    """
    PayPal IPN endpoint (notify_url).
    Used by both PayPal Payments Pro and Payments Standard to confirm transactions.
    http://tinyurl.com/d9vu9d

    PayPal IPN Simulator:
    https://developer.paypal.com/cgi-bin/devscr?cmd=_ipn-link-session
    """
    flag = None
    ipn_obj = None
    form = PayPalIPNForm(request.POST)
    if form.is_valid():
        try:
            ipn_obj = form.save(commit=False)
        except Exception, e:
            flag = "Exception while processing. (%s)" % e
    else:
        flag = "Invalid form. (%s)" % form.errors

    if ipn_obj is None:
        ipn_obj = PayPalIPN()

    ipn_obj.initialize(request)

    if flag is not None:
        ipn_obj.set_flag(flag)
    else:
        # Secrets should only be used over SSL.
        if request.is_secure() and 'secret' in request.GET:
            ipn_obj.verify_secret(form, request.GET['secret'])
        else:
            ipn_obj.verify(item_check_callable)

    ipn_obj.save()
    return HttpResponse("OKAY")

All looks fine and dandy there, but since it's not sending a response to my browser, it's kinda tricky to debug. What should I do? I'm trying to look at my apache logs, but it really isn't telling me much.

216.113.191.33 - - [06/Mar/2010:14:10:30 -0600] "POST /paypal/ipn HTTP/1.0" 500 16282 "-" "-"

I tried to send emails and log messages when this view was called, but neither wanted to work. It's possible that I entered the wrong URL into the IPN simulator :) I disabled the "post required" decorator and went to the page directly to see what was going on. My system started to logging "invalid transactions" as expected (since there was no post-data) and then I took a random stab in the dark and figured that Django's CSRF protection was kicking in and preventing PayPal from sending me the data. Adding the @csrf_exempt decorator seems to have fixed it. Yay for guessing errors.

A: In your django settings.py file, set DEBUG = False
Then for any HTTP 500s (incl. for those being returned to PayPal), you'll be sent a debugging email with all the python stack information.
You'll need to have Django email already set up for this to work, see http://docs.djangoproject.com/en/dev/howto/error-reporting/ for more info on that

A: You can install a Poster Add-on and make a POST to IPN notify_url from the browser. You will get a Response with all errors. Pretty helpful for debugging.

A: I just ran into the same problem and this was what I did wrong. Just in case anyone else is as silly as me...
Do not change the method signature from the wiki's
def show_me_the_money(sender, **kwargs):
to something like
def show_me_the_money(ipn, **kwargs):
Reason: in paypal.standard.ipn.models.PayPalIPN.send_signals the listeners are being called with a named argument: payment_was_successful.send(sender=self)
Therefore the method has to have an argument called sender.

A: I recall having hit (something like) this when using django-paypal too. I can't remember for sure what my cause was, but have you created/migrated the appropriate IPN tables in your database after including the ipn app in your setttings.py?


text:
Q: python json to csv,json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 67 (char 66),How to skip errors json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 67 (char 66)
Python cannot recognize some characters in JSON. I tried a lot of encoding, but it still cannot be displayed correctly. The JSON file is very large, I want to skip unrecognized lines and continue working
Below is my code, help me modify it. Use parameters 'ignore'

# -*-coding:utf-8-*-
import csv
import json
import sys
import codecs

def trans(path):
    jsonData = codecs.open('C:/Users/jeri/Desktop/1.json', 'r', encoding='utf-8')
    # csvfile = open(path+'.csv', 'w')
    # csvfile = open(path+'.csv', 'wb')
    csvfile = open('C:/Users/jeri/Desktop/1.csv', 'w', encoding='utf-8',
                   newline='')
    writer = csv.writer(csvfile, delimiter=',')
    flag = True
    for line in jsonData:
        dic = json.loads(line)
        if flag:
            keys = list(dic.keys())
            print(keys)
            writer.writerow(keys)
            flag = False
        writer.writerow(list(dic.values()))
    jsonData.close()
    csvfile.close()

if __name__ == '__main__':
    path = str(sys.argv[0])
    print(path)
    trans(path)

A: try to create a brand new file and paste your json data there and change extension to .json try to import that file and see if that fix the error


text:
Q: spinner have no elements while running the code I add an spinner to toolbar and I fill it with elements but while running my app the spinner looks like empty
my code is `    @Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_tabs, menu);

    getMenuInflater().inflate(R.menu.spinner, menu);

    MenuItem item = menu.findItem(R.id.spinner);
    Spinner spinner = (Spinner) item.getActionView();

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.listArray, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    spinner.setAdapter(adapter);

    return true;
}`

and the spinner menu is

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
    android:id="@+id/spinner"
    android:title="category"
    app:actionViewClass="android.widget.Spinner"
    android:background="#ff00"
    app:showAsAction="always" />
</menu>

and the array is

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="listArray">
        <item>first</item>
        <item>second</item>

    </string-array>
</resources>

A: Try in this way.
First create Spinner in your layout:
<Spinner
    android:id="@+id/dialog_spinner"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:spinnerMode="dialog"
    />

Here SpinnerDemo.java
 public class SpinnerDemo extends Activity {

   Spinner spinner;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        spinner = (Spinner) findViewById(R.id.spinner);
        spinner.setVisiblity(View.Gone)
}

Then Onclick of menu iteam
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_tabs, menu);

    getMenuInflater().inflate(R.menu.spinner, menu);

    MenuItem item = menu.findItem(R.id.spinner);

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.listArray, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    spinner.setAdapter(adapter);
    spinner.performClick();
    return true;
}`


text:
Q: Is it possible to remove the header part of a Jqgrid I would like to know if it's possible to remove the header part of a jqgrid (part with the title of the grid and the expand/collapse button).
Not the column header but the whole Grid header.
Thanks for your answers.
Bertrand

A: If you don't want a header then just don't define the caption parameter of the jqGrid.


text:
Q: CouchDB not "creating" new users I recently install CouchDB on my CentOS box ('yum install couchdb'). I set up an admin account and then set out to create my first non-admin user. I issue the command..
curl -X PUT http://admin:abc123@localhost:5984/_users/org.couchdb.user:brad \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{"name": "brad", "password": "asdf", "roles": [], "type": "user"}'

The response looks good..
{"ok":true,"id":"org.couchdb.user:brad","rev":"3-078014aabce23da851ef243f92a7fc5c"}

Now, to verify the user data has been created properly I get the new user data..
 curl -X GET http://admin:abc123@localhost:5984/_users/org.couchdb.user:brad/

.. and I get the following response which seems to be missing some things..
{"_id":"org.couchdb.user:brad","_rev":"3-078014aabce23da851ef243f92a7fc5c","name":"brad","password":"asdf","roles":[],"type":"user"}

... from everything I've read there should be some additional fields.. "password_scheme", "iterations", "derived_key", and "salt". Further, I've created a database in Futon and set "brad" as a reader for that database, but when I attempt to access the DB as brad from the CLI I get an error..
curl -X GET http://brad:asdf@localhost:5984/test_db

{"error":"unauthorized","reason":"Name or password is incorrect."}

Anyone have any idea why CouchDB isn't processing the new user properly?

A: It looks like your CouchDB is out of date; the new authentication stuff is in 1.3.0+. You may have better luck using build-couchdb: https://github.com/jhs/build-couchdb


text:
Q: What does proving the Riemann Hypothesis accomplish? I've recently been reading about the Millenium Prize problems, specifically the Riemann Hypothesis. I'm not near qualified to even grasp the entire problem, but seeing the hypothesis and the other problems I can't help wonder: what is the practical use of solving it?
Many researchers have spent a lot of time on it, trying to prove it, but why is it so important to solve the problem?
I've tried relating the situation to problems in my field. For instance, solving the $P \ vs. NP$ problem has important implications should it be shown to be either $P = NP$ or $P \neq NP$: for instance, cryptographic algorithms, but it's hard to say WHY the Riemann Hypothesis, or other problems, are so important.
Perhaps a partial answer could be made by seeing which solutions proof of the Poincaré Conjecture has lead to.

A: Proving the Riemann Hypothesis will get you tenure, pretty much anywhere you want it.

A: The Riemann hypothesis is a conjecture about the Riemann zeta function
$$\zeta(s)=\sum_{n=1}^{\infty}\dfrac{1}{n^s}$$
This is a function $\mathbb{C} \rightarrow \mathbb{C}$. With the definition I have provided the zeta function is only defined for $\Re(s)\gt1$. With some complex analysis you can proof that there is a continuous (actually holomorphic if you know what it means) extension of the function so that it is defined in whole $\mathbb{C}$. The Riemann zeta function has some trivial zero points like $-2,-4,-6.$ The hypothesis says that the other zero points lie on the critical line $\Re(s)=\dfrac12$. This hypothesis had many application in analysis and number theory. The first proof of the prime number theorem used this conjecture.
In order to give an anwer to your question a would like to refer to this website, where you can find tons of applications of the Riemann hypothesis.

A: The Millennium problems are not necessarily problems whose solution will lead to curing cancer. These are problems in mathematics and were chosen for their importance in mathematics rather for their potential in applications.
There are plenty of important open problems in mathematics, and the Clay Institute had to narrow it down to seven. Whatever the reasons may be, it is clear such a short list is incomplete and does not claim to be a comprehensive list of the most important problems to solve. However, each of the problems solved is extremely central, important, interesting, and hard. Some of these problems have direct consequences, for instance the Riemann hypothesis. There are many (many many) theorems in number theory that go like "if the Riemann hypothesis is true, then blah blah", so knowing it is true will immediately validate the consequences in these theorems as true.
In contrast, a solution to some of the other Millennium problems is (highly likely) not going to lead to anything dramatic. For instance, the $P$ vs. $NP$ problem. I personally doubt it is probable that $P=NP$. The reason it's an important question is not because we don't (philosophically) already know the answer, but rather that we don't have a bloody clue how to prove it. It means that there are fundamental issues in computability (which is a hell of an important subject these days) that we just don't understand. Solving $P \ne NP$ will be important not for the result but for the techniques that will be used. (Of course, in the unlikely event that $P=NP$, enormous consequences will follow. But that is about as likely as it is that the Hitchhiker's Guide to the Galaxy is based on true events.)
The Poincaré conjecture is an extremely basic problem about three-dimensional space. I think three-dimensional space is very important, so if we can't answer a very fundamental question about it, then we don't understand it well. I'm not an expert on Perelman's solution, nor the field to which it belongs, so I can't tell what consequences his techniques have for better understanding three-dimensional space, but I'm sure there are.

A: The techniques used in the proofs of some of the most difficult theorems are used to prove so many other theorems. A proof of 1 of these theorems will give us access to an incredible amount of new techniques that will definitely make mathematics shorter,simpler and easier to understand.

A: Explaining the true mathematics behind the Riemann Hypothesis requires more text that I'm allotted (took most of my undergraduate degree in mathematics to even touch the surface; required all of graduate school to fully appreciate the beauty).
In very simple terms, the Riemann Hypothesis is mostly about the distribution of prime numbers. The idea is that mathematicians have some very good approximations (emphasis on approximate) for the density of the primes (so you give me an integer, and I can use these approximate functions to tell you roughly how many primes are between 0 [really 2] and that integer). The reason we use these approximations is that no [known] function exists that efficiently and perfectly computes the number of primes less than a given integer (we're talking numbers with literally millions of zeros). Since we can't determine the exact values (again, I'm simplifying a lot of this) the problem mathematicians want to know is exactly HOW good are these approximations.
This is where the Riemann Hypothesis comes in to play. For well over a century, mathematicians have known that a special form of the polylogarithm function (again, more fun math if you're bored) is a really great approximation for the prime counting function (and it's way easier to compute). The Riemann Hypothesis, if true, would guarantee a far greater bound on the difference between this approximation and the real value. In other words, the importance of the Riemann Hypothesis is that it tells us a lot about how chaotic the primes numbers really are. That's an incredibly high-level explanation and the Riemann Hypothesis deals with literally hundreds of other concepts, but the main point is understanding the distribution of the primes.


text:
Q: How to force squid users to logout? I was trying to make squid custom authentication with python which i used to connect and check directly from MySQL Database
When user was removed from the login table , he is still able to use the proxy , the change happen only when i run :

squid -k reconfigure

Any other helpful solution that make this happen easily and fast then using command line every time?


text:
Q: Error copying object to Realm I am trying to update a RealmObject but I keep getting the following error log:

Cannot copy an object from another Realm instance.

java.lang.IllegalArgumentException: Cannot copy an object from another Realm instance.
    at io.realm.RealmList.copyToRealmIfNeeded(RealmList.java:261)
    at io.realm.RealmList.add(RealmList.java:190)
    at com.radioafrica.music.activity.AudioPlayer$1.execute(AudioPlayer.java:193)
    at io.realm.Realm$1.run(Realm.java:1187)
    at io.realm.internal.async.BgPriorityRunnable.run(BgPriorityRunnable.java:34)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)

The code to update the object is:

realm.executeTransactionAsync(new Realm.Transaction() {
                @Override
                public void execute(Realm realm) {
                    Favorite favorite = realm.where(Favorite.class).findFirst();

                    favorite.getTracks().add(getCurrentTrack());
                    realm.copyToRealmOrUpdate(favorite);
                }
            }, new Realm.Transaction.OnSuccess() {
                @Override
                public void onSuccess() {
                    Toast.makeText(AudioPlayer.this, "Added to favorites", Toast.LENGTH_SHORT)
                            .show();
                }
            }, new Realm.Transaction.OnError() {
                @Override
                public void onError(Throwable error) {
                    Log.e(TAG, error.getMessage(), error);
                }
            });


text:
Q: how to check multiple element for the same event same behavior to multiple elements.
// html

<input type="hidden" value="1258" /> value of user id to make friend

<input type="hidden" value="2595" />

<input type="hidden" value="2563" />

now i want to check which div to clicked to add friend and to take the hidden value and send it to server using this code
$().click(function(){
 $x=$("hidden").value(); // the value is friendID
//then send $x to the server using Ajax
});

I'v tried using it like this
$("#div1,#div2,#div3").click(function(){
 $x=$("hidden").value(); // the value is friendID
//then send $x to the server using Ajax
});

but i had more element the code grow and it's not dynamic, also the same thing if i want to make behavior to like button ,i have multiple like button how should i know which  post and which like

A: Your selectors are all wrong. The div elements do not have any id attributes, so selecting them as you are will not work. Secondly, you want to use :hidden or input[type="hidden"] to select the hidden inputs. Finally, to get the value of a form element, use val(), not value().
If you want to make this dynamic, so the code will work for x number of div elements, use a class to identify them and then this within the handler to access the element that raised the event, like this:

    <input type="hidden" value="1258" /> value of user id to make friend

    <input type="hidden" value="2595" />

    <input type="hidden" value="2563" />

$('.foo').click(function(){
    x = $(this).find('input[type="hidden"]').val();
    alert(x)
});

Example fiddle

A: try

<input type="hidden" value="1258" /> value of user id to make friend

$("[id^=div]").click(function() {
   $x=$(this).find("[type=hidden]").val();
});

or

    <input type="hidden" value="1258" /> value of user id to make friend

 $(".classSelector").click(function() {
       $x=$(this).find("[type=hidden]").val();
    });


text:
Q: store output of last executed command in expect script I have an expect script which is as below
#!/usr/bin/expect -f
set user [lrange $argv 0 0]
set password [lrange $argv 1 1]
set ipaddr [lrange $argv 2 2]
set command [lrange $argv 3 3]
set timeout 10
# now connect to remote UNIX box (ipaddr) with given script to execute
spawn ssh -o StrictHostKeyChecking=no $user@$ipaddr $command
expect "*?assword:*"
# Send password aka $password
send -- "$password\r"
interact
# send blank line (\r) to make sure we get back to gui
#send -- "\r"

This expect script is called from a python script which passes the below string to the command variable
"/bin/bash customStart.sh"
$command variable has the above value.
this customStart.sh echos "running" or "not running"  based on conditions.
I want to capture this "running" or "not running" in python script via the expect script.
In short the flow is as follows.
python script--->expect script --->customStart.sh
customStart.sh-------"running" or "not running"-----> expect script ---> python.
Python calls the expect script using subprocess.check_output(). So first I need to bring the "running" or "not running" in expect script which can be then passed to python.
How should I do this? Any help would be appreciated.

A:
...but is there any command in expect which should follow send_user ,
  like $? in shell which prints status of last executed command

There is a global variable "errorCode" that contains the error code from command that failed.
Please see Tcl manual "Debugging and errors":
https://www.tcl.tk/man/tcl8.5/tutorial/Tcl36.html


text:
Q: My system is constantly processing something, heating up my laptop My system heats up when running Ubuntu, with no major processing tasks. I also run Windows 10, on the same machine, and it never heats up when on Windows, so we can rule out hardware issues. My best guess is a driver issue, since this problem started after I fiddled with my system in order to emulate a Nvidia GPU on AMD Radeon, using Ocelot, but I undid all my changes, and the problem persists.
Or any way to check which driver my system is using for graphics card?
My Resource Monitor Screenshot:

My top result (it says user root using 48% processing):
top - 23:17:25 up  3:15,  1 user,  load average: 3.10, 3.11, 2.93
Tasks: 346 total,   2 running, 279 sleeping,   0 stopped,   0 zombie
%Cpu(s): 15.5 us, 20.1 sy,  0.1 ni, 63.4 id,  0.2 wa,  0.0 hi,  0.8 si,  0.0 st
KiB Mem : 12209596 total,  3167008 free,  3717188 used,  5325400 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  7155104 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
  374 root      20   0  220908 178912   3140 S  48.0  1.5  25:38.91 systemd-ud+
 4948 ashutosh  20   0 1162840 137192 103660 S   3.3  1.1   4:00.39 Xorg
26005 ashutosh  20   0 2855536 381020 151472 S   2.6  3.1   4:27.62 firefox
 5308 ashutosh  20   0 3851468 264376  75324 S   2.3  2.2   3:00.62 gnome-shell
    1 root      20   0  226204  10040   6768 S   2.0  0.1   1:26.18 systemd
 4788 root      20   0   29012    840    780 R   1.7  0.0   0:00.05 modprobe
18343 ashutosh  20   0  723704  39712  30020 S   1.7  0.3   0:07.60 gnome-term+
 8648 ashutosh  20   0 2112580 233300 140332 S   1.3  1.9   3:30.49 Web Content
26421 ashutosh  20   0 2184448 458740  90536 S   1.3  3.8   3:24.41 WebExtensi+
  339 root      19  -1  266948 137392 132132 S   1.0  1.1   0:41.54 systemd-jo+
 1328 root      20   0   48000   5524   2348 S   1.0  0.0   0:58.36 systemd-ud+
14747 _apt      20   0   81832   8772   7788 S   1.0  0.1   0:25.84 http
19207 ashutosh  20   0 5137248 660948  53060 S   1.0  5.4   3:30.89 java
 1698 root      20   0 1803284  35956  27112 S   0.7  0.3   0:37.50 libvirtd
 2604 root      20   0   48000   4772   1600 S   0.7  0.0   0:44.92 systemd-ud+
 4701 root      20   0   48000   6616   3416 S   0.7  0.1   0:43.52 systemd-ud+
21966 root      20   0  780024  31784  17092 S   0.7  0.3   0:33.25 snapd

udevadm monitor result:
ashutosh@ashutosh-Lenovo-G50-80:~$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

UDEV  [4527.590214] remove   /kernel/slab/:0012288 (slab)
UDEV  [4527.605280] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4527.720709] add      /module/nvidia (module)
KERNEL[4527.721492] add      /kernel/slab/:0012288 (slab)
KERNEL[4527.721563] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4527.721932] remove   /kernel/slab/:0012288 (slab)
KERNEL[4527.721984] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4527.736603] add      /kernel/slab/:0012288 (slab)
KERNEL[4527.744206] remove   /module/nvidia (module)
UDEV  [4527.746470] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4527.759300] remove   /kernel/slab/:0012288 (slab)
UDEV  [4527.774551] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4527.885168] add      /module/nvidia (module)
KERNEL[4527.885935] add      /kernel/slab/:0012288 (slab)
KERNEL[4527.886011] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4527.886380] remove   /kernel/slab/:0012288 (slab)
KERNEL[4527.886433] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4527.900224] remove   /module/nvidia (module)
UDEV  [4527.902492] add      /kernel/slab/:0012288 (slab)
UDEV  [4527.911873] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4527.926199] remove   /kernel/slab/:0012288 (slab)
UDEV  [4527.940766] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.048687] add      /module/nvidia (module)
KERNEL[4528.049406] add      /kernel/slab/:0012288 (slab)
KERNEL[4528.049477] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.049817] remove   /kernel/slab/:0012288 (slab)
KERNEL[4528.049866] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4528.066313] add      /kernel/slab/:0012288 (slab)
KERNEL[4528.072171] remove   /module/nvidia (module)
UDEV  [4528.075653] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4528.088961] remove   /kernel/slab/:0012288 (slab)
UDEV  [4528.090611] add      /module/nvidia (module)
UDEV  [4528.101611] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4528.112995] remove   /module/nvidia (module)
KERNEL[4528.245592] add      /module/nvidia (module)
KERNEL[4528.246903] add      /kernel/slab/:0012288 (slab)
KERNEL[4528.247002] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.247526] remove   /kernel/slab/:0012288 (slab)
KERNEL[4528.247599] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.260227] remove   /module/nvidia (module)
UDEV  [4528.262239] add      /kernel/slab/:0012288 (slab)
UDEV  [4528.272641] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4528.288292] remove   /kernel/slab/:0012288 (slab)
UDEV  [4528.300851] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.402297] add      /module/nvidia (module)
KERNEL[4528.403053] add      /kernel/slab/:0012288 (slab)
KERNEL[4528.403126] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.403492] remove   /kernel/slab/:0012288 (slab)
KERNEL[4528.403542] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.416235] remove   /module/nvidia (module)
UDEV  [4528.419266] add      /kernel/slab/:0012288 (slab)
UDEV  [4528.428287] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4528.443380] remove   /kernel/slab/:0012288 (slab)
UDEV  [4528.456770] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.555878] add      /module/nvidia (module)
KERNEL[4528.556659] add      /kernel/slab/:0012288 (slab)
KERNEL[4528.556739] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.557108] remove   /kernel/slab/:0012288 (slab)
KERNEL[4528.557160] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.572199] remove   /module/nvidia (module)
UDEV  [4528.572770] add      /kernel/slab/:0012288 (slab)
UDEV  [4528.582049] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4528.595829] remove   /kernel/slab/:0012288 (slab)
UDEV  [4528.610358] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.713648] add      /module/nvidia (module)
KERNEL[4528.714387] add      /kernel/slab/:0012288 (slab)
KERNEL[4528.714461] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.714798] remove   /kernel/slab/:0012288 (slab)
KERNEL[4528.714856] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.728260] remove   /module/nvidia (module)
UDEV  [4528.731368] add      /kernel/slab/:0012288 (slab)
UDEV  [4528.741057] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4528.751104] add      /module/nvidia (module)
UDEV  [4528.754985] remove   /kernel/slab/:0012288 (slab)
UDEV  [4528.765928] remove   /module/nvidia (module)
UDEV  [4528.769766] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.898017] add      /module/nvidia (module)
KERNEL[4528.898776] add      /kernel/slab/:0012288 (slab)
KERNEL[4528.898852] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.899224] remove   /kernel/slab/:0012288 (slab)
KERNEL[4528.899274] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4528.912328] remove   /module/nvidia (module)
UDEV  [4528.913607] add      /kernel/slab/:0012288 (slab)
UDEV  [4528.923057] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4528.938895] remove   /kernel/slab/:0012288 (slab)
UDEV  [4528.951204] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.053251] add      /module/nvidia (module)
KERNEL[4529.053993] add      /kernel/slab/:0012288 (slab)
KERNEL[4529.054067] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.054430] remove   /kernel/slab/:0012288 (slab)
KERNEL[4529.054482] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.068218] remove   /module/nvidia (module)
UDEV  [4529.069977] add      /kernel/slab/:0012288 (slab)
UDEV  [4529.079324] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4529.094377] remove   /kernel/slab/:0012288 (slab)
UDEV  [4529.107379] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.210655] add      /module/nvidia (module)
KERNEL[4529.211399] add      /kernel/slab/:0012288 (slab)
KERNEL[4529.211476] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.211834] remove   /kernel/slab/:0012288 (slab)
KERNEL[4529.211881] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.224166] remove   /module/nvidia (module)
UDEV  [4529.226843] add      /kernel/slab/:0012288 (slab)
UDEV  [4529.237124] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4529.252801] remove   /kernel/slab/:0012288 (slab)
UDEV  [4529.265856] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.366827] add      /module/nvidia (module)
KERNEL[4529.367552] add      /kernel/slab/:0012288 (slab)
KERNEL[4529.367626] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.367955] remove   /kernel/slab/:0012288 (slab)
KERNEL[4529.368055] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4529.383073] add      /kernel/slab/:0012288 (slab)
KERNEL[4529.384195] remove   /module/nvidia (module)
UDEV  [4529.392245] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4529.404878] add      /module/nvidia (module)
UDEV  [4529.408027] remove   /kernel/slab/:0012288 (slab)
UDEV  [4529.419792] remove   /module/nvidia (module)
UDEV  [4529.425247] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.567700] add      /module/nvidia (module)
KERNEL[4529.568567] add      /kernel/slab/:0012288 (slab)
KERNEL[4529.568670] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.569048] remove   /kernel/slab/:0012288 (slab)
KERNEL[4529.569120] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4529.585039] add      /kernel/slab/:0012288 (slab)
UDEV  [4529.595090] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.600162] remove   /module/nvidia (module)
UDEV  [4529.609379] remove   /kernel/slab/:0012288 (slab)
UDEV  [4529.623199] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.763077] add      /module/nvidia (module)
KERNEL[4529.764182] add      /kernel/slab/:0012288 (slab)
KERNEL[4529.764299] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4529.764784] remove   /kernel/slab/:0012288 (slab)
KERNEL[4529.764865] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4529.780412] add      /kernel/slab/:0012288 (slab)
KERNEL[4529.788177] remove   /module/nvidia (module)
UDEV  [4529.790516] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4529.803121] remove   /kernel/slab/:0012288 (slab)
UDEV  [4529.818311] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4530.027936] add      /module/nvidia (module)
KERNEL[4530.029017] add      /kernel/slab/:0012288 (slab)
KERNEL[4530.029131] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4530.029612] remove   /kernel/slab/:0012288 (slab)
KERNEL[4530.029691] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4530.045657] add      /kernel/slab/:0012288 (slab)
KERNEL[4530.052206] remove   /module/nvidia (module)
UDEV  [4530.057300] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4530.070458] remove   /kernel/slab/:0012288 (slab)
UDEV  [4530.086839] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4530.206142] add      /module/nvidia (module)
KERNEL[4530.206865] add      /kernel/slab/:0012288 (slab)
KERNEL[4530.206955] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4530.207302] remove   /kernel/slab/:0012288 (slab)
KERNEL[4530.207336] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4530.223105] add      /kernel/slab/:0012288 (slab)
KERNEL[4530.224214] remove   /module/nvidia (module)
UDEV  [4530.234185] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4530.243977] add      /module/nvidia (module)
UDEV  [4530.247910] remove   /kernel/slab/:0012288 (slab)
UDEV  [4530.259226] remove   /module/nvidia (module)
UDEV  [4530.262211] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4530.391019] add      /module/nvidia (module)
KERNEL[4530.391904] add      /kernel/slab/:0012288 (slab)
KERNEL[4530.391982] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4530.392415] remove   /kernel/slab/:0012288 (slab)
KERNEL[4530.392468] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)
UDEV  [4530.408068] add      /kernel/slab/:0012288 (slab)
UDEV  [4530.418642] add      /bus/pci/drivers/nvidia-nvswitch (drivers)
KERNEL[4530.420181] remove   /module/nvidia (module)
UDEV  [4530.431689] remove   /kernel/slab/:0012288 (slab)
UDEV  [4530.445422] remove   /bus/pci/drivers/nvidia-nvswitch (drivers)

My lspci -k and dmesg output, dmesg output just repeats forever as shown below:
[ 7645.281540] PKCS#7 signature not signed with a trusted key
[ 7645.295973] nvidia-nvlink: Nvlink Core is being initialized, major device number 240
[ 7645.296392] NVRM: No NVIDIA graphics adapter found!
[ 7645.296614] nvidia-nvlink: Unregistered the Nvlink Core, major device number 240
[ 7645.462797] PKCS#7 signature not signed with a trusted key
[ 7645.478302] nvidia-nvlink: Nvlink Core is being initialized, major device number 240
[ 7645.478703] NVRM: No NVIDIA graphics adapter found!
[ 7645.478886] nvidia-nvlink: Unregistered the Nvlink Core, major device number 240
ashutosh@ashutosh-Lenovo-G50-80:~$ man lspci
ashutosh@ashutosh-Lenovo-G50-80:~$ lspci -k
00:00.0 Host bridge: Intel Corporation Broadwell-U Host Bridge -OPI (rev 09)
    Subsystem: Lenovo Broadwell-U Host Bridge -OPI
    Kernel driver in use: bdw_uncore
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 5500 (rev 09)
    Subsystem: Lenovo HD Graphics 5500
    Kernel driver in use: i915
    Kernel modules: i915
00:03.0 Audio device: Intel Corporation Broadwell-U Audio Controller (rev 09)
    Subsystem: Lenovo Broadwell-U Audio Controller
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd_hda_intel
00:14.0 USB controller: Intel Corporation Wildcat Point-LP USB xHCI Controller (rev 03)
    Subsystem: Lenovo Wildcat Point-LP USB xHCI Controller
    Kernel driver in use: xhci_hcd
00:16.0 Communication controller: Intel Corporation Wildcat Point-LP MEI Controller #1 (rev 03)
    Subsystem: Lenovo Wildcat Point-LP MEI Controller
    Kernel driver in use: mei_me
    Kernel modules: mei_me
00:1b.0 Audio device: Intel Corporation Wildcat Point-LP High Definition Audio Controller (rev 03)
    Subsystem: Lenovo Wildcat Point-LP High Definition Audio Controller
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd_hda_intel
00:1c.0 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #1 (rev e3)
    Kernel driver in use: pcieport
    Kernel modules: shpchp
00:1c.2 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #3 (rev e3)
    Kernel driver in use: pcieport
    Kernel modules: shpchp
00:1c.3 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #4 (rev e3)
    Kernel driver in use: pcieport
    Kernel modules: shpchp
00:1c.4 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #5 (rev e3)
    Kernel driver in use: pcieport
    Kernel modules: shpchp
00:1d.0 USB controller: Intel Corporation Wildcat Point-LP USB EHCI Controller (rev 03)
    Subsystem: Lenovo Wildcat Point-LP USB EHCI Controller
    Kernel driver in use: ehci-pci
00:1f.0 ISA bridge: Intel Corporation Wildcat Point-LP LPC Controller (rev 03)
    Subsystem: Lenovo Wildcat Point-LP LPC Controller
    Kernel driver in use: lpc_ich
    Kernel modules: lpc_ich
00:1f.2 SATA controller: Intel Corporation Wildcat Point-LP SATA Controller [AHCI Mode] (rev 03)
    Subsystem: Lenovo Wildcat Point-LP SATA Controller [AHCI Mode]
    Kernel driver in use: ahci
    Kernel modules: ahci
00:1f.3 SMBus: Intel Corporation Wildcat Point-LP SMBus Controller (rev 03)
    Subsystem: Lenovo Wildcat Point-LP SMBus Controller
    Kernel driver in use: i801_smbus
    Kernel modules: i2c_i801
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10)
    Subsystem: Lenovo RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
    Kernel driver in use: r8169
    Kernel modules: r8169
03:00.0 Network controller: Broadcom Limited BCM43142 802.11b/g/n (rev 01)
    Subsystem: Lenovo BCM43142 802.11b/g/n
    Kernel driver in use: wl
    Kernel modules: wl
04:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Sun LE [Radeon HD 8550M / R5 M230]
    Subsystem: Lenovo Sun LE [Radeon HD 8550M / R5 M230]
    Kernel driver in use: radeon
    Kernel modules: radeon, amdgpu

A: Nvidia drivers are causing problems with Ubuntu 18.04+. Uninstall Nvidia drivers and everything related to it. This solved my problem:
sudo apt-get purge nvidia-*


text:
Q: Excel 2019 not opening CSV correctly - not parsing columns When I open a CSV files in Excel 2019 the file is not being parsed correctly. When I opened the same files in Excel 2016 they would be parsed correctly, with the commas used as delimiters. But I have just installed Excel 2019 and it is opening files without recognizing that they are CSV.
I am not trying to import data from a CSV file I opening it directly. This always worked just fine. And I thought that 2019 would be better with CSVs.
Here's an example file samplecsvs.s3.amazonaws.com/Sacramentorealestatetransactions.csv
How can I tell excel that a CSV file is a CSV file?!?! Is there an option somewhere? I don't want to use the "import data" option, it should work automatically.

A: Check your system separator in Excel > File > Options > Advanced and make sure that Decimal and thousands separators are set correctly (., resp. ,).

A: Seems related to this:
Problem:
*.csv files (comma-separated) used to open as tables in Excel (automatically) but then started opening just as plain text, not tables. (and now Excel expect semicolon instead of commas -- then opens as table.)
Perhaps relates for many Excel versions, but for me seems this happened after recent upgrade of Excel in Office365 on OSX - to Excel 16.31 19111002
Debug:
On Windows there is explicit "List separator" setting in the Region / Language:
https://stackoverflow.com/questions/17953679/how-to-correctly-display-csv-files-within-excel-2013/37021203#37021203
but this one seems hidden somewhere in MacOS / OSX (i.e. there is not explicit "List separator" setting (or some similar parameter)). This seems to be set in OSX when you're changing your REGION / COUNTRY. (Apparently Excel expects that in German-speaking countries people use semi-colon instead of comma in *.CSV files: http://forum.provue.com/t/using-semicolons-instead-of-commas-in-european-format-csv-files/2780/11)
It does not help to just changing settings like "Number separators - Grouping / Decimal" settings in System Preferences > Language & Region > Advanced ..
HELPED:
Changed Region to UK/US, but then tweaked all settings back to normal:
1. System Preferences > Language & Region > set to "UK" (or US)
2. Customize System Preferences > Language & Region > Advanced.. -- changing there Number / Decimal / Currency / Measurement units to the ones you have in your real country.

A: As others have pointed out the problem is in your Regional Settings, and you need to change the List separator in Windows to a comma. Another option, in case you are generating the file, is to use a semi-colon as a delimiter.


text:
Q: How to iterate typescript string literal? I have this literal type export type names = 'n1' | 'n2' | 'n3' | 'n4' | 'n5' | 'n6';
I wonder how would you iterate that type ?
May be you can convert that type in something else and iterate that?
Should you redefine the type in a different way?
names.forEach(value => {
  console.log(value);
});

A: Short Answer
You could define it as a const and a type like this:
const names = ['n1' , 'n2' , 'n3' , 'n4' , 'n5' , 'n6'] as const;

// This produces the union type 'n1' | 'n2' | 'n3' | 'n4' | 'n5' | 'n6';
type names = typeof names[number];

// use names as a type here
const n1: names = 'n1';

console.log({
  names,
  n1,
  // use names as an array here
  mapped: names.map(name => `I am ${name}`)
});

Explanation and Demo
What is going on here?
The as const creates an array with a const context. That means the array is not a string array but is a readonly array of specific string literal values.
Then, the typeof names[number] uses an indexed access operator to extract those string literal values into a union type.
If we did not use as const to define our array, then the typeof names[number] would give us string type instead of a union of the array's string literal values.
The end result is pretty neat. We can use names as a union type for type checking and as an array at runtime.
Here it is in the playground, and here is the playground output in JavaScript:

"use strict";
const names = ['n1', 'n2', 'n3', 'n4', 'n5', 'n6'];
const n1 = 'n1';
console.log({
names,
n1,
mapped: names.map(name => `I am ${name}`)
});

Caveat: The use of names as both a union type an an array value raises a question about naming conventions. Usually types are PascalCased (e.g. Names) and values are camelCased (e.g. names). Which naming conventions ought we to follow here?
For completeness, here is how it looks in VS Code across two files:

A: Types do not exist in the compiled code - there is nothing emitted to iterate over.
If you need the union type as shown in the question and need to be able to iterate over it as an array, first create the array as const, and define the type as the array's values:
const arr = ['n1', 'n2', 'n3', 'n4', 'n5', 'n6'] as const;
export type names = typeof arr[number];
for (const num of arr) {
  console.log(num);
}


text:
Q: Minimal Qt program makes memory leak Here is a nearly minimal Qt program, which should release all the resources, including the memory:
#include <QApplication>
#include <QMainWindow>
#include <memory>

int main(int argc, char** argv) {
    QApplication app(argc, argv);
    std::unique_ptr<QWidget> wnd{new QWidget()};
    wnd->show();
    return app.exec();
}

However, valgrind says that:
LEAK SUMMARY:
   definitely lost: 979 bytes in 24 blocks
   indirectly lost: 7,858 bytes in 56 blocks
     possibly lost: 912 bytes in 19 blocks
   still reachable: 75,719 bytes in 1,080 blocks
                      of which reachable via heuristic:
                        newarray           : 832 bytes in 16 blocks
        suppressed: 0 bytes in 0 blocks
Rerun with --leak-check=full to see details of leaked memory

I expected to get zeros for "definitely lost" and "indirectly lost", but have got lost bytes. Why? Do I interpret valgrind output incorrectly, or should I call some additional exit function of Qt?

A: It is a mistaken assumption that "correct/proper/whatever your goodness metric is" code will leak no memory.
There are two kinds of leaked memory: startup, or one-time allocations that won't ever be repeated, and ongoing leaks from allocations that can be repeated an arbitrary and ever-increasing number of times. The latter are understandably problematic and should be fought viciously until they perish.
On the contrary, it is absolutely, no-qualms-about it wasteful to free startup memory. Every CPU cycle devoted to it wasted when the very next thing to happen is process termination where all the memory is released in the most cycle- and energy-efficient way possible. These allocations aren't leaks. They are on you to add to your memory debug tool's exception list.
The cultish freeing of every single block of memory right before process termination has a measurable impact on energy efficiency of applications that are executed multiple times in rapid succession. For common short-lived processes such as many Unix core utilities and build tools, including compilers, the frees prior to exit have wasted many railcar-loads of coal in power plants all over the world, and this trend shows no signs of slowing down.
Valgrind is a godsend. But you can't treat its output with veneration best afforded a finer deity. Don't develop software based on Valgrind's output as if it was a cargo cult. Understand what the output means, and act accordingly.

A: A better reformulation of the question is: "valgrind suppress qt errors". There is a number of recipes, also here on stackoverflow, for example:
Suppression files for Qt memory leaks with Valgrind
Suppression files for Qt memory leaks with Valgrind
The answer refers to this document from wxWidgets: Valgrind Suppression File Howto https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto


text:
Q: How does TreeTagger get the lemma of a word? I am using TreeTagger to get the lemmas of words in Spanish, but I have observed there are too much words which are not transformed as should be. I would like to know how this operations works, if it is done with techniques such as decision trees or machine learning algorithms or it simply contains a list of words with its corresponding lemma. Does someone know it?
Thanks!!

A: On basis of personal communication via email with H. Schmid, the author of TreeTagger, the answer to your question is:
The lemmatization function is based on the XTAG Project, which includes a morphological analyzer. Within the XTAG project several corpora have been analyzed. Considerung TreeTagger, especially the analysis of the Penn Treebank Corpus seems relevant, since this corpus is the training corpus for the English parameter file of TreeTagger. Considering lemmatization, the lemmata have simply been stored in a lexicon. TreeTagger finally uses this lexicon as a lookup table.
Hence, with TreeTagger you may only retreive the lemmata that are available in the lexicon.
In case you need additional funtionality regarding lemmatization beyond the options in TreeeTagger, you will need a morphological analyzer and, depending on your approach, a suitable training corpus, although this does not seem mandatoriy, since several analyzers perform quite well even when directly applied on the corpus of interest to be analyzed.


text:
Q: Why are these representations of e the same? I heard that $e$ can be defined as the limit as n approaches infinity of $(1 + 1/n)^n$, but I also heard that $e$ is also defined as the sum of the reciprocals of the factorials from $0$ to $\infty$. How are these the same?

A: Let's find an infinite polynomial $p(x)$ having $p(0) = 1$ and $\frac{d}{dx}p(x) = p(x)$.  We know that the constant term must be 1, and the coefficient of $x^1$ must be 1.  After a little reflection, it's easy to see that
$$p(x) = \sum_{i=0}^{\infty} \frac{x^i}{i!}$$
This must be the only continuous function having these two properties.
Now let's look at the limit
$$L(x) = \lim_{n \rightarrow \infty} \left(1 + \frac{x}{n}\right)^n$$
$$\begin{align}
\frac{d}{dx} L(x)
& = \frac{d}{dx} \left\{\lim_{n \rightarrow \infty} \left(1 + \frac{x}{n}\right)^n\right\}\\
& = \lim_{n \rightarrow \infty} \frac{d}{dx} \left\{\left(1 + \frac{x}{n}\right)^n\right\}\\
& = \lim_{n \rightarrow \infty}\left(\frac{d}{dx} \left\{1 + \frac{x}{n}\right\}n\left(1 + \frac{x}{n}\right)^{n-1}\right)\\
& = \lim_{n \rightarrow \infty}\left(1 + \frac{x}{n}\right)^{n-1}\\
\end{align}$$
So:
$$\begin{align}
L(x) - \frac{d}{dx}L(x) & = \lim_{n \rightarrow \infty}\left(1 + \frac{x}{n}\right)^{n}-\lim_{n \rightarrow \infty}\left(1 + \frac{x}{n}\right)^{n-1}\\
& = \lim_{n \rightarrow \infty}\left(\left(1 + \frac{x}{n}\right)^{n}-\left(1 + \frac{x}{n}\right)^{n-1}\right)\\
& = \lim_{n \rightarrow \infty}\left(\left(1 + \frac{x}{n}\right)^{n-1}\left(\left(1 + \frac{x}{n}\right)-1\right)\right)\\
& = \lim_{n \rightarrow \infty}\left(\left(1 + \frac{x}{n}\right)^{n-
1}\left(\frac{x}{n}\right)\right)\\
& = \lim_{n \rightarrow \infty}\left(\left(1 + \frac{x}{n}\right)^{n-1}\left(0\right)\right)\\
L(x) - \frac{d}{dx}L(x) & = 0
\end{align}$$
So $L(x) = \frac{d}{dx}L(x)$, $L(0) = 1$, and $L$ is a continuous function.  So $L(x) = p(x)$, and specifically $L(1) = p(1) = e$.

A: Hint: use the binomial theorem


text:
Q: Is it possible to have dirty reads with CL Quorum? Based on
http://docs.datastax.com/en/cassandra/2.0/cassandra/dml/dml_config_consistency_c.html
Write Consistency

The consistency level determines the number of replicas on which the write must succeed before returning an acknowledgment to the client application

Read Consistency:

The consistency level specifies how many replicas must respond to a read request before returning data to the client application.

This means, if I specify CL as Quorum for both read and writes, within the same client application (and presumably the same thread), my consequent read of the data (with CL = Quorum) after a write (again, with CL = Quorum) ensures I get the latest data.
What I am not very clear about however is: does this apply across different processes and different threads within the same application as well?
Is it possible to specify CL = Quorum and yet have missed updates (old data) or dirty reads?
Update:
To clarify, I'm not talking about AFTER the CL QUORUM has finished. The question is more along these lines:
If in the middle of the write (@ QUORUM) another process connecting to the same cluster attempts to read the same partition with CL = QUORUM, would it be possible to read old data?
Imagine the write hasn't yet finished writing to all the replicas so the CL hasn't yet been satisfied and a read occurs. Could it be possible that the write has only been written to one node (and in the process of being replicated) and therefore, when the read (with CL = QUORUM) comes in, it reads the older data? Do the nodes somehow know they should "wait" until the writes have finished
Many thanks,

A: As long as both reads and writes are done at QUORUM it will be consistent. Since more than half has seen the write and more than half are returning the read there is guaranteed to be some overlap.

A: There is an official formula to know if you will achieve immediate consistency ( = no stalled data)
If NUM_READ + NUM_WRITE > Replication Factor then Immediate Consistency
So if RF is 3 , quorum = 2 so if both read and write = QUORUM , then 2 + 2 > 3 = immediate consistency
But if you had read = QUORUM and write = ONE then 2 + 1 = 3 , you only get eventual consistency


text:
Q: translating CLLocation coordinates into SCNVector3 matrics Goal: Have a AR item fixed to a location in real world based on CLLocation coordinates (LLA), and have it in the same place regardless of my orientation on viewload.
Ive been trying to convert geo LLA coordinates into an SCNVector3 matrix. The issues im having are as followed:
1) Lat1 and Long1 are based on my current coordinates from a CLLocationManager on my device. Im looking for a way to get the relative SCNVector3[x,y,z] needed by my device to and place an item at lat2 and long2's location in the real world.
2) How do I get this targeted Lat2, Long2 to be in the same place every time. I feel like the alignment of . gravityAndHeading isn't working to always orient the matrix facing true north. So though sometimes I may get the correct distance from my device location, the orientation is off.
3) I would like the values to be accurate enough to recognize something at least 2-3 meters away. even when i manually program the SCNVector3 from the same position, it seems a bit off.
Any guidance would be greatly appreciated. I've already looked at http://www.mathworks.com/help/aeroblks/llatoecefposition.html and  http://www.jaimerios.com/?p=39 but it seems to return the distance but not the relative position to the phone in an SCNVector format.
    import SceneKit
    import ARKit
    import CoreLocation
...
func latLonToECEF(_ lat1: Double,_ lon2: Double,_  alt: Double?) -> [String:Double] {
    let x = 6371 * cos(lat1) * cos(long1)
    let y = 6371 * cos(lat1) * sin(long1)
    let z = 6371 * sin(lat1)

    let lat2 = static_lat
    let long2 = static_long
    let x2 = 6371 * cos(lat2) * cos(long2)
    let y2 = 6371 * cos(lat2) * sin(long2)
    let z2 = 6371 * sin(lat2)
    return ["x": (x2 - x), "y": (y2 - y), "z": (z2 - z)]
}


text:
Q: Fail to install Spyder 3.3.6 in Anaconda with Python 3.5 version I created a new environment in Anaconda choosing Python 3.5 as the version. As I continue installing the Spyder software through clicking the "Install" button within Anaconda interface, I receive the following message:

python==3.3.6 cannot be installed on this environment. Do you want to install the package in an existing environment or...."

I even tried clicking setting → install specific version → and choose other versions yet wit the same warning.
Appreciate your very kind help.

A: I just run into the same problem.
Run:
conda install spyder

from the environment terminal


text:
Q: How to sort key in std::map base on alphabet case insensitive? C++ Here is my code

#include <iostream>
using namespace std;
int main()
{
    std::map<std::string, std::string> mp;
    mp["abb"] = "foo";
    mp["Abc"] = "foo";
    mp["aba"] = "foo";

    for (std::map<string, string>::iterator it = mp.begin(); it != mp.end(); ++it)
        std::cout << it->first << " => " << it->second << '\n';

}

I want my output print sort base on alphabet case insensitive like:
aba => foo
abb => foo
Abc => foo


text:
Q: Keras Sequential model loss won't decrease & remains constant through all epochs import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
df = pd.read_csv('insurance.csv')
X = df.drop(['sex', 'children', 'smoker', 'region'], axis = 1)
X = X.values
y = df['charges']
y = y.values.reshape(1331,1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.3, random_state = 75)
from keras import Sequential
from keras.layers import Dense
model = Sequential()
model.add(Dense(5, activation = 'sigmoid'))
model.add(Dense(4, activation = 'sigmoid'))
model.add(Dense(1, activation = 'sigmoid'))
from keras import optimizers
sgd = optimizers.SGD(lr=0.1)
model.compile(sgd, 'mse')
model.fit(X_train, y_train, 32, 100, shuffle=False)

This right here is my code, the data I am feeding in is all numerical, and I have tried different hyperparameters, nothing seems to work.
Any help would be much appreciated.
I just don't know what is going wrong over here.

A: If you are indeed in a regression setting (as implied by your choice of loss, MSE) and not in a classification one, the basic mistake in your code is the activation of your last layer, which should be linear:
model.add(Dense(1, activation = 'linear'))

Of course, there can be several other things going wrong with your approach, including the architecture of your model itself (there is not any kind of "guarantee" that, whatever model architecture you throw in your data, it will produce decent results, and your model looks too simple), the activation functions of the other layers (usually today we start with relu) etc., but it is impossible to say more without knowing your data.


text:
Q: Change Codec of hls stream in Nginx Currently I am trying to play the Hls stream that is being sent to my nginx server via rtmp, in Unity with this plugin: AVPro. It is working on my PC but I want to play it on Android and it seems like the codec is not supported for Android regardless of which Video API I use. Currently im sending the stream with Streamlabs if that is important.
So I wondered if it is possible to somehow change the codec that nginx is using for the Hls stream.
When I watch the stream on my PC with VLC Media Player and look at the codec information it tells me this:
Videocodec: H264 - MPEG-4 AVC(part 10) (h264)
Audiocodec: ADTS
Im using nginx for Windows and this version: nginx 1.7.11.3 Gryphon
And if it is not possible with nginx I would like to know if there is an alternative that you can use as a streaming server. I haven't really found anything yet.


text:
Q: Email using SMTP python from gmail account with html body I am trying to send email using gmail account from python script using SMTP library. It is working fine with normal message body. But when i try to send it using HTML body. It does not allow me to send.
# Import smtplib to provide email functions
import smtplib

# Import the email modules
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

# Define email addresses to use
addr_to   = 'xxxx@localdomain.com'
addr_from = "xxxxx@gmail.com"

# Define SMTP email server details
smtp_server = 'smtp.gmail.com'
smtp_user   = 'xxxxxx@gmail.com'
smtp_pass   = 'xxxxxxx'

# Construct email
msg = MIMEMultipart('alternative')
msg['To'] = *emphasized text*addr_to
msg['From'] = addr_from
msg['Subject'] = 'Test Email From RPi'

# Create the body of the message (a plain-text and an HTML version).
text = "This is a test message.\nText and html."
html = """\

This is a test message.

Text and HTML

"""

# Record the MIME types of both parts - text/plain and text/html.
part1 = MIMEText(text, 'plain')
part2 = MIMEText(html, 'html')

# Attach parts into message container.
# According to RFC 2046, the last part of a multipart message, in this case
# the HTML message, is best and preferred.
msg.attach(part1)
msg.attach(part2)

# Send the message via an SMTP server
s = smtplib.SMTP(smtp_server,587)
s.login(smtp_user,smtp_pass)
s.sendmail(addr_from, addr_to, msg.as_string())
s.quit()

A: Add these two lines before attempting to login, it won't gave you the authentication error.
server.ehlo()
server.starttls()

So your code should look like this:

    # Import smtplib to provide email functions
    import smtplib

    # Import the email modules
    from email.mime.multipart import MIMEMultipart
    from email.mime.text import MIMEText

    # Define email addresses to use
    addr_to   = 'xxxx@localdomain.com'
    addr_from = "xxxxx@gmail.com"

    # Define SMTP email server details
    smtp_server = 'smtp.gmail.com'
    smtp_user   = 'xxxxxx@gmail.com'
    smtp_pass   = 'xxxxxxx'

    # Construct email
    msg = MIMEMultipart('alternative')
    msg['To'] = *emphasized text*addr_to
    msg['From'] = addr_from
    msg['Subject'] = 'Test Email From RPi'

    # Create the body of the message (a plain-text and an HTML version).
    text = "This is a test message.\nText and html."

    (your html code)

    # Record the MIME types of both parts - text/plain and text/html.
    part1 = MIMEText(text, 'plain')
    part2 = MIMEText(html, 'html')

    # Attach parts into message container.
    # According to RFC 2046, the last part of a multipart message, in this case
    # the HTML message, is best and preferred.
    msg.attach(part1)
    msg.attach(part2)

    # Send the message via an SMTP server
    s = smtplib.SMTP(smtp_server,587)
    s.ehlo()
    s.starttls()
    s.login(smtp_user,smtp_pass)
    s.sendmail(addr_from, addr_to, msg.as_string())
    s.quit()

A: The issue could be that google isn't letting using that service anymore as far as i know


text:
Q: Second-Order Linear Homogeneous Recurrence Relations with Constant Coefficients How would I find sequences that satisfy the following relation?
$$a_{n+2} = -a_{n+1} + 5a_{n}$$
$$\text{given:}\quad a_{0} = 2,  a_{1} = 8, \text{ and }(n \ge 0)$$

A: You can find every sequence satisfying $b_{n+2}=-b_{n+1}+5b_n$ by supposing $b_n=c^n$. This yields:
$$
c^{n+2}=-c^{n+1}+5c^n \iff c^n\left(c^2+c-5\right)=0$$
This equation has the three roots
$$c_0=0, c_1=\frac{\sqrt{21}-1}{2}, c_2=\frac{-\sqrt{21}-1}{2}
$$
So the sequences $b_n=c_1^n$ and $b_n=c_2^n$ satisfy the given relation. And so does an arbitrary linear combination $xc_1^n+yc_2^n$. Now you need to solve
$$
xc_1^0+yc_2^0=x+y=2
$$
$$
xc_1^1+yc_2^1=xc_1+yc_2=8
$$
For $x,y$.


text:
Q: What are scalar types in GraphQL From their docs, it says:

The leaf values of any request and input values to arguments are Scalars (or Enums) and are defined with a name and a series of serialization functions used to ensure validity

but I am unable to comprehend that definition. From the answer to my previous question, I think scalars are associated with enums. Can someone break down in simpler terms what do GraphQL scalar types do and when to use scalar types as opposed to enum types?

A: Scalars are equivalent to primitive data types in a programming language. In GraphQL, there are five built-in scalar types:

*

*Boolean, true or false

*Int, a signed 32‐bit numeric non‐fractional value

*Float, a signed double‐precision fractional values

*String, a sequence of UTF‐8 characters

*ID, a unique identifier

A scalar simply represents a single value and are the basic building blocks of your schema. This is in comparison to object types, which represent a collection of values. An object type has fields, and each field has a type which may be a scalar or an object type itself. If the field's type is an object, that object will have fields that are also scalars or other objects, and so on. In this way we end up with a tree-like structure in both our schema and the queries made against it.
query {       # <- The "root" of the tree
  movies {
    actors {
      name    # <- A "leaf" on the tree
    }
    crew {
      name    # <- Another "leaf"
    }
  }
}

Enums are similar to scalars, in that an enum represents a single, concrete value. However, each enum type is defined explicitly in the schema (there are no "built-in" enums) and its definition must include a set of values that the enum type can be. For example, we might create an enum like:
enum Animal {
  Cat
  Dog
  Bird
}

A field that returns an Animal will still have a single value, like a scalar, but that value will be either "Cat", "Dog" or "Bird" -- no other values are allowed.
A leaf type is a term that encompasses both scalars and enums. Leaf types represent the leaves or terminating points in our tree-like queries and their responses.
When a field returns an object type (like movies, actors, or crew in the above example), we have to tell GraphQL which of the object type's fields we want to query. This selection of fields is called a selection set and is wrapped by curly brackets. In our example, name is the selection set for the crew field, crew and actors are the selection set for the movies field, and even the movies field is part of the selection set for the query root type.
The important thing to notice here is that leaf types do not have fields, so any field that returns a leaf type will not have a selection set.
For more information, you can check out the official spec.