text:
Q: Babel has no effect on my Javascript I'm following Get To Know Babel The JavaScript Compiler Tutorial, and this is my polygon.js
class Polygon {
  constructor(height, width) {
    this.height = height;
    this.width = width;
  }

  getArea() {
    return this.calcArea()
  }

  calcArea() {
    return this.height * this.width;
  }
}

I run
babel polygon.js -o output.js
cat output.js | pbcopy

pasting:
class Polygon {
  constructor(height, width) {
    this.height = height;
    this.width = width;
  }

  getArea() {
    return this.calcArea();
  }

  calcArea() {
    return this.height * this.width;
  }
}

I was expecting a transpiling to ES5 but the code remained unchanged.
What's going on?
$ .babel --version
6.2.0 (babel-core 6.2.1)

EDIT: I installed the presets with npm install babel-preset-2015 -g
~/es6:.babel polygon.js -o output.js --presets es2015
Error: Couldn't find preset "es2015" relative to directory "."
    at OptionManager.mergePresets (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:327:17)
    at OptionManager.mergeOptions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:287:12)
    at OptionManager.init (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:416:10)
    at File.initOptions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:190:75)
    at new File (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:121:22)
    at Pipeline.transform (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
    at transform (/usr/local/lib/node_modules/babel-cli/lib/babel/util.js:53:22)
    at Object.compile (/usr/local/lib/node_modules/babel-cli/lib/babel/util.js:62:12)
    at /usr/local/lib/node_modules/babel-cli/lib/babel/file.js:130:23
    at arrayEach (/usr/local/lib/node_modules/babel-cli/node_modules/lodash/index.js:1289:13)

EDIT: -g after the install was the issue. I installed locally and it works.

A: This caught me out too. The new version of Babel requires you to install a preset, probably the ES2015 one, and explicitly specify it in the CLI command.
Depending on where Babel is installed (globally/locally) that's where you need to install the preset:
npm install babel-preset-es2015

Then you can run Babel. This, for example, transforms all the files in one folder to another using the preset.
babel [srcFolder] --out-dir [outFolder] --presets es2015


text:
Q: Upon CICD Pipeline deployment to another environment I get a bad resource error for a Linked Service in ADF. I can't update it or delete it I am pushing an ADF factory to another environment via a CICD Pipeline and YAML Config file in Azure Devops. I can successfully deploy but one of my linked services becomes a "bad resource" although it works in the master branch when I published it.
Furthermore I cannot delete this in the target data factory nor can I edit it. Getting the bad resource error. I suspect I need to edit something in the ARM file but I don't really understand this error nor can I find much information on similar.

{"stack":"Error: Error: Unable to save [SERVICENAME]. Bad resource\n at Rl.<anonymous> (https://adf.azure.com/app.06b0e174dd8e6fa8.js:1:11274843)\n at Generator.next (<anonymous>)\n at https://adf.azure.com/main.d1fe4ec6f69aa72f.js:1:66326\n at new c
That when I deploy my ADF to a new environment it succeeds with connections intact or at least that I can fix/edit.
EDIT: Even when I recreate the Linked Service I get the same error.

A: The answer to this is to store all of your connection credentials as secrets in Azure Keyvault then reference that. I am unclear why using the parameters in a linked service do not transfer into the ARM template and this cause it to be a "bad resource" but the Keyvault method translates into ARM correctly and the problem doesn't persist.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Windows server is restarting by itself each 2 minutes I am going crazy. My windows server 2008 r2 keep restarting by itself each 2 minutes. I cannot see the view logs.. Pls suggest what can be performed.. I saw the fixing in registry part but for me I am very fresh there .. And our system is life...
Thank you in advance.

A: Did you try this link?

To Stop automatic restart of server please un-check the marked option
  in below snap shot. Also try to boot server in safe mode and check for
  the similar kind of issue? Another useful step is go to run and type
  msconfig|startup|uncheck startup items which are not required.


text:
Q: SQL Server 2008R2 sys.dm_exec_procedure_stats - unusual last execution time I have a job which captures data from sys.dm_exec_procedure_stats.
The job runs every minute. It is a straight insert from, no joins.
I'm have a scenario where, quite regularly ( exactly the same two days every week without fail) one particular object id returns something like below
timeOfCapture /LastExecutionTime

16:58 / 16:30

16:59 / 16:30

17:00 / 16:30

17:01 / 17:00       (no explanation)

17:02 / 16:30       (no explanation - back to normal)

17:03 / 16:30

The stored procedure is invoked by a job which started around 16:30
The stored procedure did NOT run at 17:00 (as far as I know).
There is a job which starts at 17:00 but does not execute this stored procedure.
The stored procedure takes about 30 seconds to complete.
the object id is the same for all, the database id is also the same.
The fact this occurs regularly without fail means perhaps there is another process
I don't know if there's anything going on like reboots etc
I'm also not sure if there is an external process ( other server/ excel/etc)  that maybe invokes the stored procedure, or maybe there's a rollback.
thid could be a red herring, something I've overlooked, but I've checked everything I can think of.
Any ideas on those LastExecutionTimes?
Thanks

A: That DMV contains one row for each cached stored procedure plan, and the lifetime of the row is as long as the stored procedure remains cached. This means that a stored procedure can have multiple rows in this table, or none at all if they don't have a plan in cache. The last_execution_time corresponds to the last time that procedure was executed with the query plan for that row. So, in your case, the procedure could have been executed at 1630 on a previous day (since you didn't show the date) and then 1700 on the current day, or visa versa.  Given the repeat-ability of your scenario, your current job is likely using one plan, and another job (even on another day) is using another plan. It's unclear how you are choosing which row to insert... perhaps TOP 1 without an ORDER BY. This could cause this behavior. We'd need to see insert statement that is doing the logging
Note that there are many things that could cause the plan to get removed from cache or a new one created. The latter is less likely in a Job with fixed parameters.
If you really want to track the execution of the procedure (not only the last execution of a cached plan), you'll need to set up a logging mechanism. Aaron has a good article on it here.


text:
Q: DirectX vertex buffer Default vs Default + Staging I was searching for the difference between these two in terms of GPU reading speed and occasionally CPU writing(less then once per frame or even only once). I don't want to use D3D11_USAGE_DYNAMIC cause data will not be updated >= once per frame.
Is there a significant performance increase with Default + Staging combo over the Default buffer?

A: The best performance advice for Direct3D 11 here is actually the same as Direct3D 10.0. Start by reviewing this talk Windows to Reality: Getting the Most out of Direct3D 10 Graphics in Your Games from Gamefest 2007.
To your question, any updates to a resource (texture or buffer) will have some potential performance impact due, but for 'occasional' updates, the best option is to use a STAGING resource and then CopyResource to a DEFAULT resource for actual rendering.
DYNAMIC for textures should be reserved for very frequent updates (like say video texture playback), and of course for vertex buffers when doing dynamic draw submission. Constant buffers are really intended to be DYNAMIC or use UpdateSubresource which really depends on your update pattern (a topic covered in the talk above).
Whenever possible, creating resources as IMMUTABLE and with pInitialData is the best option with DirectX 11 as it potentially allows the driver some opportunity for multi-threaded resource creation which is more efficient.
The main thing to be aware of with this pattern is that STAGING resources can result in virtual-memory fragmentation which can be a problem for 32-bit (X86) apps, so you should try to use them rather than creating a lot of them or destroying them and recreating them. See the talk "Why Your Windows Game Won't Run In 2,147,352,576 Bytes" which is attached to this blog post.
I'd suggest your initial version would be to try to use DEAFAULT+UpdateSubresource and then compare it with a DEAULT+STAGING+CopyResource solution because it really heavily depends on your content and code.


text:
Q: Convergence of a integral: $\int_{0}^{1} |\ln (x)|^n \ dx$ Let $n \in \mathbb N$ be arbitrary. Does the integral
$$\int_{0}^{1} |\ln (x)|^n \, dx$$
converge? I asked myself this question and I have no idea of a proof or counter example. Someone can give me a help?

A: The only problem is at $0$. The absolute value is irrelevant (just multiply by $(-1)^{n+1}$ the final result when no absolute value is used), so we can consider
$$
\int_a^1(\log x)^n\,dx
$$
with $a>0$.
An integration by parts gives
$$
\Bigl[x(\log x)^n\Bigr]_a^1-\int_a^1 x\cdot n(\log x)^{n-1}\frac{1}{x}\,dx
$$
Can you go on from here?

A: For $n$ even and $a>0$:
$\int_{a}^{1} |lnx|^n dx=\int_{a}^{1}(x)^{'}(lnx)^ndx=xlnx_{a}^{1}-\int_{a}^{1}xn(lnx)^{n-1}\frac {1}{x}dx=xlnx_{a}^{1}-\int_{a}^{1}n(lnx)^{n-1}dx$. By induction $\int_{a}^{1} (lnx)^{n}dx$ converges iff $\int_{a}^{1} lnx dx$ converges.
Same tactic for $n$ odd.


text:
Q: How to call JavaScript object via variable? I've got a series of JavaScript objects and a function to tie them together as a questionnaire.
If I call the function directly from the code like setQuestion(Q1), it works fine;
function setQuestion(Q) {
     console.log(Q);          \\ Logs the Q1 object
     console.log(Q.answers);  \\ Logs the Q1.answers object
     console.log(Q2.answers); \\ Logs the Q2.answers object
}

But the variable Q is based upon a dynamically created attribute followup on a input field, for instance;
<input type="radio" name="Q1" followup="Q2" value="A2" id="A2">

But when I use that attribute to call the setQuestion function, it doesn't recognize the object;
var followup = this.getAttribute('followup');
setQuestion(followup);

Say that followup is Q2;
function setQuestion(Q) {
     console.log(Q);          \\ Logs `Q2` as text
     console.log(Q.answers);  \\ Logs `undefined`
     console.log(Q2.answers); \\ Logs the Q2.answers object
}

It's clear that the function sees the attribute value as a textvalue, and thus doesn't get the object, so how can I make it see the attribute value variable as the related object?
FYI: the objects are defined like this;
var Q1 = { ... };
var Q2 = { ... };
etc.

A: You could move the questions into a questionaire and use the handed over values as key.
var Q1 = { ... },
    Q2 = { ... },
    questionaire = { Q1, Q2, ...};


text:
Q: Notify users that the change was ok after saga, react redux I want to notify the user that the change he did was successful, and to confirm what he changed. E.g. if the users hit a button called "activate".
I have a saga that fires a PUT to change the object in the database, then I fire a GET to fetch the new list of objects, where the updated object are in it. I want to have a notification message showing that object x changed state from inactive to active, and then I want the notification to go away.


text:
Q: How to serialize and deserialize an object into/from binary files manually? I've been trying to write the below object into a file and got lot of trouble since strings are dynamically allocated.
class Student{
    string name, email, telephoneNo;
    int addmissionNo;
    vector<string> issued_books;
public:
    // There are some methods to initialize name, email, etc...
};

So I got to know that I can't just write into a file or read from a file an object with serialization. So I searched all over the internet about serialization with cpp and got to know about Boost library.But I wanted to do it my own (I know writing a library that already exist is not good, but I wanna see what's going on inside the code). So I got to know about overloading iostream << and >>. And I also know that serialize/deserialize into/from text.
But I want to serialize into a binary file. So I tried overloading ostream write and istream read. But then I got size issues(as write and read needs the sizeof the object it writes/reads).Then I also got to know about stringstream can help to serialize/deserialize objects into/from binary. But I don't how to do that?
So my real question is How to serialize and deserialize an object into/from binary files without third party libraries?

A: I have found a solution serialize and deserialize an object into/from a file. Here is an explaination
As I told you this is my class. And I have added two functions which overload the iostream's write and read.
class Student{
    string name, email, telephoneNo;
    int addmissionNo;
    vector<string> issuedBooks;
public:
    void create();  // initialize the private members
    void show();  // showing details

    // and some other functions as well...

    // here I'm overloading the iostream's write and read
    friend ostream& write(ostream& out, Student& obj);
    friend istream& read(istream& in, Student& obj);
};

But I have also told you that I have tried this already. The problem I have was how to read without object member's size. So I made changes as below (Please read comments also).
// write: overload the standard library write function and return an ostream
// @param out: an ostream
// @param obj: a Student object
ostream& write(ostream& out, Student& obj){
    // writing the objet's members one by one.
    out.write(obj.name.c_str(), obj.name.length() + 1); // +1 for the terminating '\0'
    out.write(obj.email.c_str(), obj.email.length() + 1);
    out.write(obj.telephoneNo.c_str(), obj.telephoneNo.length() + 1);
    out.write((char*)&obj.addmissionNo, sizeof(obj.addmissionNo)); // int are just cast into     a char* and write into the object's member

    // writing the vector of issued books
    for (string& book: obj.issuedBooks){
        out.write(book.c_str(), book.length() + 1);
    }
    return out;
}

// read: overload the standard library read function and return an istream
// @param in: an istream
// @param obj: a Student object
istream& read(istream& in, Student& obj){
    // getline is used rather than read
    // since getline reads a whole line and can be give a delim character
    getline(in, obj.name, '\0');  // delimiting character is '\0'
    getline(in, obj.email, '\0');
    getline(in, obj.telephoneNo, '\0');
    in.read((char*)&obj.addmissionNo, sizeof(int));

    for (string& book: obj.issuedBooks){
        getline(in, book, '\0');
    }
            return in;
}

As you can see I have wrote length+1 for the terminating '\0'. It is usefull in read function as we have used getline instead of read. So getline reads until the '\0'. So no need of a size. And here I'm writing and reading into/from a file.
void writeStudent(Student s, ofstream& f){
    char ch; // flag for the loop
    do{
        s.create(); // making a student
        f.open("students", ios::app | ios::binary); // the file to be written
        write(f, s); // the overloaded function
        f.close();

        cout << "Do you want to add another record? (y/n): ";
        cin >> ch;
        cin.ignore();
    } while(toupper(ch) == 'Y'); // loop until user stop adding records.
}

void readStudent(Student s, ifstream& f){
    char ch; // flag for the loop
    do{
        f.open("students", ios::in | ios::binary);

        cout << "Enter the account no of the student: ";
        int no;
        cin >> no;

        int found = 0;
        while (read(f, s)){
            if (s.retAddmissionNo() == no){
                found = 1;
                s.show();
            }
        }
        if (!found)
            cout << "Account Not found!\n";

        f.close();
        cout << "Do you want another record? (y/n): ";
        cin >> ch;
    } while(toupper(ch) == 'Y');
}

That's how I solved my problem. If something wrong here please comment. Thank you!


text:
Q: Is it possible to allow only a certain secure USB boot media to boot an UEFI system? I want to restrict all USB boot media from my system, except for a certain USB boot drive that I declare secure via a certain key.
Is this possible using UEFI/Secure Boot/TPM? Maybe via TPM? TPM gets a private key and checks if public key on USB boot drive is valid?
It's a Debian Linux system.


text:
Q: How to remove html tag from webpage with some other text?
I'm writing a simple parser for one site and I'm novice. However, that website has WBR HTML-tag inside links. For example, links look like this:
[The Aven"<wbr></wbr>"gers [720p, DVDRIP]
 <[Home alo"<wbr></wbr>"ne [1080p, BDRIP]
And I need to remove "<wbr></wbr>" text.
I've managed to remove wbr tag with this Tampermonkey script:
del = document.getElementsByTagName("wbr");
 if (del.length > 0) {
  for (i = 0, j = del.length; i < j; i++) {
   del[i].parentNode.removeChild(del[i]);
 }
}

But I still can't remove quotes, so my new text looks like this:
[The Aven""gers [720p, DVDRIP]
<[Home alo""ne [1080p, BDRIP]

And my parser doesn't work. I've tried searching for function to select text, not HTML-tag, but can't find it. Could you help me to modify this script?
Thanks in advance.

A: After removing the wbr tag, you can remove the quotes by using javascript's replace() functions as:
del = document.getElementsByTagName("wbr");
if (del.length > 0) {
   for (i = 0, j = del.length; i < j; i++) {
      var parentElement = del[i].parentNode;
      parentElement.removeChild(del[i]);
      parentElement.text().replace(/"/g, '');
   }
}

A: Question is quite confusing but running it on Fiddle makes it clear, you need to remove only the quotes from the html body and that should do the work:
document.body.innerHTML = document.body.innerHTML.replace(/"/g, '');

See the working fiddle here. Let me know if this is what you were looking for


text:
Q: How to scrape ... INSIDE another ... with puppeteer Alright, so the page I'm trying to scrape with node.js puppeteer is structured like this

    ....

            Go to link

I tried to click by selector and XPath. Neither worked, and I triple checked that both were right. I feel like it has something to do with this embedded html, and I don't know how to handle it? Can anyone help?

A: Other comments pointed out that content inside an iframe are not accessible from the parent document. I checked the code again, and turns out it was actually structured like this:

....

           Go to link

So all I had to do was page.goto(url), and then I could scrape as normal. Thanks everyone!


text:
Q: How do I install Urduhack in python 3.7? Hi I would like to install Urduhack in my python3.7 So I tried
pip install Urduhack

and got the error message
tensorboard 2.1.1 has requirement grpcio>=1.24.3, but you'll have grpcio 1.14.1 which is incompatible.
tensorboard 2.1.1 has requirement setuptools>=41.0.0, but you'll have setuptools 39.1.0 which is incompatible.
mystic 0.3.3 has requirement numpy<1.16.0,>=1.0, but you'll have numpy 1.18.1 which is incompatible.
Installing collected packages: google-pasta, wrapt, keras-applications, gast, scipy, tensorflow, Urduhack
Found existing installation: wrapt 1.10.11
Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Can you help me to install the package?

A: Try Install using this command.
pip install urduhack[tf]


text:
Q: Add the value to the next and previous textbox on dropdown change in html table I am trying to add the data value to the previous input and next input when the dropdown of the same row changes but am unable to add the value input textbox on dropdown change am using this to add the value from the sqlite as present am using a variable to add the value to the textbox .
DEMO
HTML:

                    <input type="text" name="renewal1" id="renewal1">

                    <select class="dd" name="Phonenumberdd1" id="Phonenumberdd1">
                        <option value="Select">Select a Option</option>
                        <option value="asd">asd</option>
                        <option value="243">243</option>
                        <option value="test 1 3 ">test 1 3</option>
                    </select>

                    <input type="text" name="renewal_by1" id="renewal_by1">

                    <input type="text" name="Renivaul_to1" id="Renivaul_to1" value="">

                    <input type="text" name="renewal2" id="renewal2">

                    <select class="dd" name="Phonenumberdd2" id="Phonenumberdd2">
                        <option value="Select">Select a Option</option>
                        <option value="asd">asd</option>
                        <option value="243">243</option>
                        <option value="test 1 3 ">test 1 3</option>
                    </select>

                    <input type="text" name="renewal_by2" id="renewal_by2">

                    <input type="text" name="Renivaul_to2" id="Renivaul_to2" value="">

                    <input type="text" name="renewal3" id="renewal3">

                    <select class="dd" name="Phonenumberdd3" id="Phonenumberdd3">
                        <option value="Select">Select a Option</option>
                        <option value="asd">asd</option>
                        <option value="243">243</option>
                        <option value="test 1 3 ">test 1 3</option>
                    </select>

                    <input type="text" name="renewal_by3" id="renewal_by3">

                    <input type="text" name="Renivaul_to3" id="Renivaul_to3" value="">

                    <input type="text" name="renewal4" id="renewal4">

                    <select class="dd" name="Phonenumberdd4" id="Phonenumberdd4">
                        <option value="Select">Select a Option</option>
                        <option value="asd">asd</option>
                        <option value="243">243</option>
                        <option value="test 1 3 ">test 1 3</option>
                    </select>

                    <input type="text" name="renewal_by4" id="renewal_by4">

                    <input type="text" name="Renivaul_to4" id="Renivaul_to4" value="">

JS:
  $('#productanddates tr').on('change','[class="dd"]', function(e) {
      var data ="dummy data";
      $(this).prev('td input').val(data);
      $(this).next('td input').val(data);
   });

A: Try this code snippets using parent and children.

 $('#productanddates tr').on('change', '.dd', function(e) {
   var data = "dummy data";
   $(this).parent('td').prev('td').children('input').val(data);
   $(this).parent('td').nextAll('td').children('input').val(data);
 });

        <input type="text" name="renewal1" id="renewal1">

        <select class="dd" name="Phonenumberdd1" id="Phonenumberdd1">
          <option value="Select">Select a Option</option>
          <option value="asd">asd</option>
          <option value="243">243</option>
          <option value="test 1 3 ">test 1 3</option>
        </select>

        <input type="text" name="renewal_by1" id="renewal_by1">

        <input type="text" name="Renivaul_to1" id="Renivaul_to1" value="">

        <input type="text" name="renewal2" id="renewal2">

        <select class="dd" name="Phonenumberdd2" id="Phonenumberdd2">
          <option value="Select">Select a Option</option>
          <option value="asd">asd</option>
          <option value="243">243</option>
          <option value="test 1 3 ">test 1 3</option>
        </select>

        <input type="text" name="renewal_by2" id="renewal_by2">

        <input type="text" name="Renivaul_to2" id="Renivaul_to2" value="">

        <input type="text" name="renewal3" id="renewal3">

        <select class="dd" name="Phonenumberdd3" id="Phonenumberdd3">
          <option value="Select">Select a Option</option>
          <option value="asd">asd</option>
          <option value="243">243</option>
          <option value="test 1 3 ">test 1 3</option>
        </select>

        <input type="text" name="renewal_by3" id="renewal_by3">

        <input type="text" name="Renivaul_to3" id="Renivaul_to3" value="">

        <input type="text" name="renewal4" id="renewal4">

        <select class="dd" name="Phonenumberdd4" id="Phonenumberdd4">
          <option value="Select">Select a Option</option>
          <option value="asd">asd</option>
          <option value="243">243</option>
          <option value="test 1 3 ">test 1 3</option>
        </select>

        <input type="text" name="renewal_by4" id="renewal_by4">

        <input type="text" name="Renivaul_to4" id="Renivaul_to4" value="">

A: You are doing it wrong there. The event attachment to select was something fishy and you could have done it in a better way as below:
$('#productanddates tr').on('change','.dd', function(e) {
    var data ="dummy data";
    $(this).closest('td').prev().find('input').val(data);
    $(this).closest('td').next().find('input').val(data);
});

And to find previous and next inputs you need to first find select's parent using closest and then navigate back/forth using prev/next and then find input.
DEMO

UPDATE
To get all the textbox in that row you can do it as below:
$('#productanddates tr').on('change','.dd', function(e) {
    var data ="dummy data";
    $(this).closest('td').prevAll().find('input').val(data);
    $(this).closest('td').nextAll().find('input').val(data);
});

get using nextAll and prevAll
DEMO

A: Hope this helps
$('#productanddates tr').on('change','[class="dd"]', function(e) {
    var data = $(this).val();
    var $tr = $(this).closest('tr');
    $tr.find('td:nth-child(1) input').val(data);
    $tr.find('td:nth-child(3) input').val(data);
 });


text:
Q: Which NLP methods use gradient and activation methods? I am doing a literature review of gradient-based methods for NLP. Yet, apart from linear and logistic regression, I have little knowledge of other methods using the gradient. So I have no knowledge of methods using gradient-based methods for NLP. From what I have read I have decided to search in three directions (gradient based methods using 1. activation 2. hidden state 3. integrated gradient). So my question is : "Which NLP methods use gradient and activation methods?"
Browsing for "gradient" and "activation" I've only found Gradient-weighted Class Activation Mapping (Grad-CAM) so far, the example is on Computer Vision (and there is a disclaimer on the Medium article that the Grad-CAM can be difficult to wrap your head around ;p)
PS: let me know if this question is more suitable to Data science site.


text:
Q: How can I understand "(.) . (.)"? I believe I understand fmap . fmap for Functors, but on functions it's hurting my head for months now.
I've seen that you can just apply the definition of (.) to (.) . (.), but I've forgot how to do that.
When I try it myself it always turns out wrong:
(.) f g = \x -> f (g x)
(.) (.) (.) = \x -> (.) ((.) x)
\x f -> (.) ((.) x) f
\x f y  -> (((.)(f y)) x)
\x f y g-> (((.)(f y) g) x)
\x f y g-> ((f (g y)) x)
\x f y g-> ((f (g y)) x):: t2 -> (t1 -> t2 -> t) -> t3 -> (t3 -> t1) -> t

If "just applying the definition" is the only way of doing it, how did anybody come up with (.) . (.)?
There must be some deeper understanding or intuition I'm missing.

A: Your solution diverges when you introduce y. It should be
\x f y -> ((.) ((.) x) f) y     :: (c -> d) -> (a -> b -> c) -> a -> b -> d
\x f y z -> ((.) ((.) x) f) y z :: (c -> d) -> (a -> b -> c) -> a -> b -> d
\x f y z -> ((.) x (f y)) z     :: (c -> d) -> (a -> b -> c) -> a -> b -> d
-- Or alternately:
\x f y z -> (x . f y) z         :: (c -> d) -> (a -> b -> c) -> a -> b -> d
\x f y z -> (x (f y z))         :: (c -> d) -> (a -> b -> c) -> a -> b -> d

Which matches the original type signature: (.) . (.) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
(It's easiest to do the expansion in ghci, where you can check each step with :t expression)
Edit:
The deeper intution is this:
(.) is simply defined as
\f g -> \x -> f (g x)

Which we can simplify to
\f g x -> f (g x)

So when you supply it two arguments, it's curried and still needs another argument to resolve.
Each time you use (.) with 2 arguments, you create a "need" for one more argument.
(.) . (.) is of course just (.) (.) (.), so let's expand it:
(\f0 g0 x0 -> f0 (g0 x0)) (\f1 g1 x1 -> f1 (g1 x1)) (\f2 g2 x2 -> f2 (g2 x2))

We can beta-reduce on f0 and g0 (but we don't have an x0!):
\x0 -> (\f1 g1 x1 -> f1 (g1 x1)) ((\f2 g2 x2 -> f2 (g2 x2)) x0)

Substitute the 2nd expression for f1...
\x0 -> \g1 x1 -> ((\f2 g2 x2 -> f2 (g2 x2)) x0) (g1 x1)

Now it "flips back"! (beta-reduction on f2):
This is the interesting step - x0 is substituted for f2 -- This means that x, which could have been data, is instead a function.
This is what (.) . (.) provides -- the "need" for the extra argument.
\x0 -> \g1 x1 -> (\g2 x2 -> x0 (g2 x2)) (g1 x1)

This is starting to look normal...
Let's beta-reduce a last time (on g2):
\x0 -> \g1 x1 -> (\x2 -> x0 ((g1 x1) x2))

So we're left with simply
\x0 g1 x1 x2 -> x0 ((g1 x1) x2)

, where the arguments are nicely still in order.

A: Coming up with (.) . (.) is actually pretty straightforward, it's the intuition behind what it does that is quite tricky to understand.
(.) gets you very far when rewriting expression into the "pipe" style computations (think of | in shell). However, it becomes awkward to use once you try to compose a function that takes multiple arguments with a function that only takes one. As an example, let's have a definition of concatMap:
concatMap :: (a -> [b]) -> [a] -> [b]
concatMap f xs = concat (map f xs)

Getting rid of xs is just a standard operation:
concatMap f = concat . map f

However, there's no "nice" way of getting rid of f. This is caused by the fact, that map takes two arguments and we'd like to apply concat on its final result.
You can of course apply some pointfree tricks and get away with just (.):
concatMap f = (.) concat (map f)
concatMap f = (.) concat . map $ f
concatMap = (.) concat . map
concatMap = (concat .) . map

But alas, readability of this code is mostly gone. Instead, we introduce a new combinator, that does exactly what we need: apply the second function to the final result of first one.
-- .: is fairly standard name for this combinator
(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
(f .: g) x y = f (g x y)

concatMap = concat .: map

Fine, that's it for motivation. Let's get to the pointfree business.
(.:) = \f g x y -> f (g x y)
     = \f g x y -> f ((g x) y)
     = \f g x y -> f . g x $ y
     = \f g x   -> f . g x

Now, here comes the interesting part. This is yet another of the pointfree tricks that usually helps when you get stuck: we rewrite . into its prefix form and try to continue from there.
     = \f g x   -> (.) f (g x)
     = \f g x   -> (.) f . g $ x
     = \f g     -> (.) f . g
     = \f g     -> (.) ((.) f) g
     = \f       -> (.) ((.) f)
     = \f       -> (.) . (.) $ f
     =             (.) . (.)

As for intuition, there's this very nice article that you should read. I'll paraphrase the part about (.):
Let's think again about what our combinator should do: it should apply f to the result of result of g (I've been using final result in the part before on purpose, it's really what you get when you fully apply - modulo unifying type variables with another function type - the g function, result here is just application g x for some x).
What it means for us to apply f to the result of g? Well, once we apply g to some value, we'll take the result and apply f to it. Sounds familiar: that's what (.) does.
result :: (b -> c) -> ((a -> b) -> (a -> c))
result = (.)

Now, it turns out that composition (our of word) of those combinators is just a function composition, that is:
(.:) = result . result -- the result of result

A: So, this is what I get when I do a slightly more incremental expansion
(.) f g   = \x -> f (g x)
(.) . g   = \x -> (.) (g x)
          = \x -> \y -> (.) (g x) y
          = \x -> \y -> \z -> (g x) (y z)
          = \x y z -> (g x) (y z)
(.) . (.) = \x y z -> ((.) x) (y z)
          = \x y z -> \k -> x (y z k)
          = \x y z k -> x (y z k)

Which, according to ghci has the correct type
Prelude> :t (.) . (.)
(.) . (.) :: (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c
Prelude> :t \x y z k -> x (y z k)
\x y z k -> x (y z k)
  :: (t1 -> t) -> (t2 -> t3 -> t1) -> t2 -> t3 -> t
Prelude>

While I don't know the origins of this combinator, it is likely that it was
developed for use in combinatory logic, where you work strictly with combinators,
so you can't define things using more convenient lambda expressions. There may be
some intuition that goes with figuring these things out, but I haven't found it.
Most likely, you would develop some level of intuition if you had to do it enough.

A: It's easiest to write equations, combinators-style, instead of lambda-expressions: a b c = (\x -> ... body ...) is equivalent to a b c x = ... body ..., and vice versa, provided that x does not appear among {a,b,c}. So,
-- _B = (.)

_B f g x = f (g x)
_B _B _B f g x y = _B (_B f) g x y
                 = (_B f) (g x) y
                 = _B f (g x) y
                 = f ((g x) y)
                 = f (g x y)

You discover this if, given f (g x y), you want to convert it into a combinatory form (get rid of all the parentheses and variable repetitions). Then you apply patterns corresponding to the combinators' definitions, hopefully tracing this derivation backwards. This is much less mechanical/automatic though.

A: You can also use your understanding of fmap . fmap.
If you have two Functors foo and bar, then
fmap . fmap :: (a -> b)  ->  foo (bar a)    ->   foo (bar b)

fmap . fmap takes a function and produces an induced function for the composition of the two Functors.
Now, for any type t, (->) t is a Functor, and the fmap for that Functor is (.).
So (.) . (.) is fmap . fmap for the case where the two Functors are (->) s and (->) t, and thus
(.) . (.) :: (a -> b) -> ((->) s) ((->) t a) -> ((->) s) ((->) t b)
          =  (a -> b) -> (s -> (t -> a))     -> (s -> (t -> b))
          =  (a -> b) -> (s ->  t -> a )     -> (s ->  t -> b )

it "composes" a function f :: a -> b with a function of two arguments, g :: s -> t -> a,
((.) . (.)) f g = \x y -> f (g x y)

That view also makes it clear that, and how, the pattern extends to functions taking more arguments,
(.)             :: (a -> b) -> (s ->           a) -> (s ->           b)
(.) . (.)       :: (a -> b) -> (s -> t ->      a) -> (s -> t ->      b)
(.) . (.) . (.) :: (a -> b) -> (s -> t -> u -> a) -> (s -> t -> u -> b)

etc.


text:
Q: Logout error in codeigniter I am trying to design a login/logout page in code igniter framework.My problem is that when I logout of the web-page I am getting redirected to a login page. When I go back I am getting a page which says:
Document Expired

This document is no longer available.

My Login controller is
public function __construct() {
        parent::__construct();

        //date_default_timezone_set("Asia/Kolkata");
        $this->load->helper(array('form', 'url'));
        $this->load->database();
        $this->load->model('User_model');
        $this->load->library(array('session', 'form_validation', 'email'));
        $this->load->file('smtp/Send_Mail.php');

        $this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
        $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
        $this->output->set_header('Pragma: no-cache');
        $this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    }

function Logout() {

        $user_data = $this->session->all_userdata();
        foreach ($user_data as $key => $value) {
            if ($key != 'session_id' && $key != 'ip_address' && $key != 'user_agent' && $key != 'last_activity') {
                $this->session->unset_userdata($key);
            }
        }
        $this->session->sess_destroy();
        redirect('Login');
    }

Login view page where i checked if session is exists then redirect on other page.
<?php
if($this->session->is_user_login==TRUE)
{
   redirect('User/Emailverification');
}
?>

I am not getting how to resolve this document expired error.I have dono lots of searching but i am not getting the solution of this problem.Please help me thanks in Advance.


text:
Q: What Development board should I choose if my final target is STM32F030CC I'm thinking of using a STM32F030CC for its 6 U(S)ART ports, but I can't find a development kit for that specific microcontroller. Is there another development kit that's compatible with STM32F030CC?
It doesn't have to have as many U(S)ARTs as I can make the application work with as few as 3 UARTs (but I want to be able to reuse the code on the STM32F030CC).
How do I choose a development environment suitable to eventually reach my target goals?

A: You have to spend some time developing your sandbox.  Look at it this way.  You seem like you're about to build a prototype with a different Arm Cortex M0, because you can't find a dev kit for the one you're interested in, and that you "can make the application work with as few as 3 UARTs".  For this particular step, ask yourself if you really need to make it "work", or do you need to convince yourself that it will work when you move over to the chip you want, and what you need to know before you do the move.
My own preference is to build a sandbox with really strong tools, with the intention of using that to cut down later.  You didn't let us know what all your requirements are, which makes guiding you a bit difficult.  My experience is that code is fairly portable between ST ARM families, and even if it isn't, redeveloping with a slightly different library isn't a killer.  My inclination for a project like this would be to go with the biggest beefiest M0 in the family, and see how big my code is, how fast it runs, how much current it uses, etc, and then pare down-- but again, I don't really know the questions you need to ask this iteration.

A: There is a very high degree of compatibility between STM32 controllers in the same series, so you can safely choose any STM32F0 that has at least 6 UARTS and the same amount of memory or more than an F030CC.
Look at the the inexpensive NUCLEO-F091RC board in CubeMX, and start a project with the F030CC side-by-side. Configure USARTs 1 to 6 and any other peripheral you'd like to use, and move around the peripheral pins on the Nucleo board (CTRL-Mouseclick) to pins that are present on the smaller controller. It turns out that you can't use PA5 for USART6_TX on the Nucleo, because it's connected to a LED, but that's probably the only thing you'll have to change when porting to your final board, setting some bits in the GPIO->MODER registers differently.
When you start developing with the Nucleo, just pretend as if it had a F030RC, so you'll have access to the extra pins, but no extra features of the F091RC.


text:
Q: Firestore "array-contains-any" not working I'm trying to use query for Firestore on iOS (Swift):
db.collection(FS_PICS)
            //.whereField("category", arrayContains: "Animals")
            .whereField("category", arrayContains: ["Animals", "Dogs"])
            .getDocuments() { (querySnapshot, err) in
                if let err = err {
                    print("Error getting documents: \(err)")
                } else {
                    for document in querySnapshot!.documents {
                        print("\(document.documentID) => \(document.data())")
                    }
                }
        }

It doesn't return any result with
// doesn't work
.whereField("category", arrayContains: ["Animals", "Dogs"])

or with
// doesn't work
.whereField("category", in: ["Animals", "Dogs"])

but I have 8 result for:
// It works!!
.whereField("category", arrayContains: "Animals")

It doesn't work like OR even like AND, because it is also does't work:
// It works!!
.whereField("category", arrayContains: ["Animals"])

So what is the idea of this function, what should I do to get OR ?

A: EDIT: Based on the screenshot, the documentation is incorrect, you're right. Some clarifications, regardless:
This is wrong:
.whereField("category", arrayContains: ["Animals", "Dogs"])

arrayContains must input a singular type of what that array contains (i.e. a string array inputs a string), not a collection. arrayContains does not perform OR or AND operations, it only performs equals of a single instance of an element inside an array.
This is correct:
.whereField("category", arrayContains: "Dogs")

This is also correct:
.whereField("category", arrayContainsAny: ["Animals", "Dogs"])

The arrayContainsAny query performs an OR operation where category must contain "Animals" or "Dogs".
And for measure, there is also in which performs an OR operation on a non-collection (i.e. non-array) field. If the "category" field were just a String (and not an Array), you could perform an OR query with:
.whereField("category", in: ["Animals", "Dogs"])

A: The problem is in the example of the code in the documentation. It should be arrayContainsAny

It is correct for other languages:


text:
Q: How to get all possible combinations from an array using two elements from each group in PHP? I'm stuck and putting my brain to work trying to solve this problem.
I have this array:
$options = array(
  'Group 1' => array( 'Track 1', 'Track 2', 'Track 3'),
  'Group 2' => array( 'Track 4', 'Track 5', 'Track 6'),
  'Gruop 3' => array( 'Track 7', 'Track 8', 'Track 9'),
  'Group 4' => array( 'Track 10', 'Track 11', 'Track 12'),
  'Group 5' => array( 'Track 13', 'Track 14', 'Track 15')
);

And I need to create a full set of 10 elements using two elements of each group following the ascendent order and avoiding a set with the same elements as another, like the example below:
I'm actually able to get only one item from each group:
function create_set( $t, $terms, $i ) {
    $text = '';
    if ( $i >= count( $terms ) ) {
        $text .= trim( $t ) . "\n";
    }
    else {
        foreach ( $terms[$i] as $term ) {
            $text .= create_set( $t . $term . '##', $terms, $i + 1 );
        }
    }

    return $text;
}

$options = array(
 'Group 1' => array( 'I am track 1', 'I am track 2', 'I am track  3'),
 'Group 2' => array( 'I am track 4', 'I am track 5', 'I am track 6'),
 'Gruop 3' => array( 'I am track 7', 'I am track 8', 'I am track 9'),
 'Group 4' => array( 'I am track 10', 'I am track 11', 'I am track 12'),
 'Group 5' => array( 'I am track 13', 'I am track 14', 'I am track 15')
);

$combine = array();
foreach( $options as $k => $v ) {
    $combine[] = $v;
}

$text = create_set( '', $combine, 0 );
$text = preg_split( '/\n/', $text, -1, PREG_SPLIT_NO_EMPTY );
$combinations = array();
foreach( $text as $k => $v ) {
   $combinations[] = preg_split( '/##/', $v, -1, PREG_SPLIT_NO_EMPTY );
}
echo "<pre>";
print_r( $combinations );
echo "</pre>";
exit;

Result:
 Array
(
[0] => Array
    (
        [0] => I am track 1
        [1] => I am track 4
        [2] => I am track 7
        [3] => I am track 10
        [4] => I am track 13
    )

Thank you very much for any help.

A: Since I do not know how the correct output should be I created this code:
$result = [];
foreach ($options as $tracklist) {
    foreach (array_rand($tracklist, 2) as $key) {
        $result[] = 'I am '.$tracklist[$key];
    }
}

Output is
Array
(
    [0] => I am Track 1
    [1] => I am Track 3
    [2] => I am Track 4
    [3] => I am Track 5
    [4] => I am Track 7
    [5] => I am Track 9
    [6] => I am Track 11
    [7] => I am Track 12
    [8] => I am Track 13
    [9] => I am Track 14
)


text:
Q: TCP Bandwidth throttling Slow VPN Speed My local ISP gives 2 MBPS speed for first 500 MB data.
After that speed becomes restricted to 64 KBPS.
I have a custom made Android TCP VPN ( TUN Based ) for Android ( Server Linux Centos)
After speed limit is reached My VPN becomes very slow I can not see youtube without Buffering. But I have tried few TCP VPNs for Android
Out of those two VPNs considerably fast, even after speed limit reached. I can see youtube properly.
I have investigated. Out of two VPNs, one VPN use double TCP connections to server and split traffic  and send it via 2 different TCP connections which  may make it fast if ISP limiting speed per TCP connection basis.
But another VPN still using Single TCP connection like My VPN..But still it is fast.
1.   Please give me some idea about .how ISP limiting speed In this case and how to get maximum possible speed as other two VPNs doing. In MY VPN Encryption is implemented so ISP can not see data like other two VPNs.
My ISP limiting speed per IP basis?.or It is limiting speed per TCP connection .
Do I need to modify MTU size, TCP window scaling, send receive buffer size or anything in TCP settings both in Linux server kernel and Android client.
Because that VPN which using Single TCP connection also working properly with good speed.
I mean when Speed restricted to 64 KBPS...Those 2 VPNs can achieve
40-50 KBPS  which is okay for Youtube non HD movie
Where as My VPN giving only 5- 10 KBPS. But at full speed My VPN is good like other VPNs. What I am missing in My VPN or server TCP settings.
2.  Also please tell me when I set TUN MTU value 1450 or 1500 both in server and client ...My TCP VPN working fine.
But if I reduce MTU to 1350 or 1370 ...It becomes very slow even at full internet speed. Browsing, youtube all are very slow.
As I thought decreasing MTU does not harm. What could be the reason? Surprisingly in few mobiles MTU 1450 ,1500 working fine but MTU 1350 1300 etc..gives very slow speed. For few other mobiles things completely different, there MTU 1350 working very good but MTU 1500 giving very slow speed. All testes are done in same mobile netwrok.  How to trouble shoot the issue
Can you please focus some light.
Thank you
pap

A: For second question,
when you downgrade of MTU value, more ip packet is created. More IP packet means more headers and it will downgrade the server performance.
You should always use maximum MTU value and for etherenet it is 1500 byte.


text:
Q: Python Neural Network and Stock Prices: What to use for input? I'm working with the back-propagating neural network written in Python found here. It works quite well with the simple XOR example provided.
However, I want to use it to do something a bit more complex: attempt to predict stock prices. I know that neural networks aren't necessarily the best choice and may not be accurate at all, but I would still like to try.
My first attempt was to get 10 days of past closing prices for a specified stock (GOOG, for example). I then hoped to train the neural network with this data and then predict the next day's closing price, but then I realized something: I only had 1 input value, and would not have any input to provide when trying to get the prediction. This is the root of all my confusion, the number of input/hidden/output nodes.
In a paper here, they mention using the lowest, the highest, and the average value of a stock in  the last d days as input. This is 3 inputs (or 4? if you count d), yet in order to predict the next day's price you wouldn't be able to provide any of this as input (except maybe d?).
How do you account for this variation in the number of inputs when training and predicting with a neural network? Am I missing some fundamental part of NN's and how they're used? Thanks!

A: @anana's comment helped me click on how the neural network should work. As she said, I can just provide the average value of a stock in the last d (in my case, 5) days as the input to attempt to get a prediction.
This means that my training input is of the format:
[[rollingAverage, rollingMinimum, rollingMaximum], normalizedClosePrice] for the past five days (so a total of 9 days are analyzed due to the rolling windows).
When I want to get a prediction after training, I provide input nodes of just the format:
[rollingAverage, rollingMinimum, rollingMaximum] for the most recent 5 days.
Below is all the relevant logic, combined with the neural network I linked in the original question:
## ================================================================

def normalizePrice(price, minimum, maximum):
    return ((2*price - (maximum + minimum)) / (maximum - minimum))

def denormalizePrice(price, minimum, maximum):
    return (((price*(maximum-minimum))/2) + (maximum + minimum))/2

## ================================================================

def rollingWindow(seq, windowSize):
    it = iter(seq)
    win = [it.next() for cnt in xrange(windowSize)] # First window
    yield win
    for e in it: # Subsequent windows
        win[:-1] = win[1:]
        win[-1] = e
        yield win

def getMovingAverage(values, windowSize):
    movingAverages = []

    for w in rollingWindow(values, windowSize):
        movingAverages.append(sum(w)/len(w))

    return movingAverages

def getMinimums(values, windowSize):
    minimums = []

    for w in rollingWindow(values, windowSize):
        minimums.append(min(w))

    return minimums

def getMaximums(values, windowSize):
    maximums = []

    for w in rollingWindow(values, windowSize):
        maximums.append(max(w))

    return maximums

## ================================================================

def getTimeSeriesValues(values, window):
    movingAverages = getMovingAverage(values, window)
    minimums = getMinimums(values, window)
    maximums = getMaximums(values, window)

    returnData = []

    # build items of the form [[average, minimum, maximum], normalized price]
    for i in range(0, len(movingAverages)):
        inputNode = [movingAverages[i], minimums[i], maximums[i]]
        price = normalizePrice(values[len(movingAverages) - (i + 1)], minimums[i], maximums[i])
        outputNode = [price]
        tempItem = [inputNode, outputNode]
        returnData.append(tempItem)

    return returnData

## ================================================================

def getHistoricalData(stockSymbol):
    historicalPrices = []

    # login to API
    urllib2.urlopen("http://api.kibot.com/?action=login&user=guest&password=guest")

    # get 14 days of data from API (business days only, could be < 10)
    url = "http://api.kibot.com/?action=history&symbol=" + stockSymbol + "&interval=daily&period=14&unadjusted=1&regularsession=1"
    apiData = urllib2.urlopen(url).read().split("\n")
    for line in apiData:
        if(len(line) > 0):
            tempLine = line.split(',')
            price = float(tempLine[1])
            historicalPrices.append(price)

    return historicalPrices

## ================================================================

def getTrainingData(stockSymbol):
    historicalData = getHistoricalData(stockSymbol)

    # reverse it so we're using the most recent data first, ensure we only have 9 data points
    historicalData.reverse()
    del historicalData[9:]

    # get five 5-day moving averages, 5-day lows, and 5-day highs, associated with the closing price
    trainingData = getTimeSeriesValues(historicalData, 5)

    return trainingData

A: A supervised machine learner is an algorithm that takes a bunch of cases consistent of features (a set of numbers, input) and a result (output).
What you need is a training dataset, for example, time series for several months, for which you know the output. Once your network is trained, you take the stock values in the last few days (known, because it has happened) in order to predict what is going to happen tomorrow, so you know what to buy.
At last, d is not an input, is a constant. And the number of input/outputs is independent (well, as long as you have enough input features). In theory, having more features increases the accuracy of the predictions, but takes longer processing time, needs bigger training sets, and may be prone to overfitting.

A: You're eliminating a lot of information by using rolling averages.  There are a few other ways to present time-series data to a NN, e.g. the sliding windows approach.
Say you use 3 days worth of data as input in order to forecast the 4th day.  Instead of averaging the previous 3 days, you could instead present each to an input node.  Roll this 3-day window over the first half of your data to train your model.  To test, present the 3 days worth of prices immediately prior the day you wish to forecast.  E.g.
Training Set
[[day 1 price, day 2 price, day 3 price], day 4 price]
[[day 2 price, day 3 price, day 4 price], day 5 price]
[[day 3 price, day 4 price, day 5 price], day 6 price]
[[day 4 price, day 5 price, day 6 price], day 7 price]

Testing
[day 5 price, day 6 price, day 7 price]


text:
Q: Convergence of a sequence over supremum Given a cadlag-process $X_{t}$ with stationary independent increments (Levy process) for which $E\left[\sup_{s\in[0,t]}\left|X_s\right|\right]<+\infty$ for all $t>0$.
For $n\in \mathbb{N}$ the sequence $K_{n}=\sup_{t\in [n,n+1]}\left|X_t-X_n\right|$ is i.i.d.
Can we conclude, that $\sqrt{n}^{-1}K_{n}\rightarrow 0$ a.s.?
If not, by centering $\tilde{X}_t=X_t-E\left[X_t\right]$ is a martingale. Defining $\tilde{K}_{n}$ analogous via $\tilde{X}_t$, can we conclude
$\sqrt{n}^{-1}\tilde{K}_{n}\rightarrow 0$ a.s.?
Note in both cases $X_t$ and $\tilde{X}_t$ can be written as random walks, for which one can use inequalities e.g. Martingale maximal inequality.
I hope you can help me out. Best regards

A: Note that for a sequence of nonnegative random variables $\{Z_n\}_{n\geq0}$ the following identity holds
$$\left\{\limsup_{n\to\infty}Z_N=0\right\}
= \bigcap_{N=1}^\infty\bigcup_{k=1}^\infty \bigcap_{n=k}^\infty \{Z_n\leq 1/N\}
= \bigcap_{N=1}^\infty \left(\limsup_{n\to\infty} \{Z_n> 1/N\} \right)^C.$$
Hence, by the continuity of the probability measure $\mathbb{P}$,
$$\mathbb{P}\left(\limsup_{n\to\infty}Z_n=0\right)
=1 - \lim_{N\to\infty}\mathbb{P}\left(\limsup_{n\to\infty}\{Z_n>1/N\}\right).$$
Since our random variables $Z_n=K_n/\sqrt{n}$ are independent, this is closely related to the finiteness $\sum_{n=1}^\infty \mathbb{P}(Z_n>1/N)$ via the second Borel-Cantelli lemma. If the Lévy process is heavy-tailed, then the random variables $\{K_n\}_{n\geq0}$ will be so too.
Counter-example
Consider the case where $X$ is an $\alpha$-stable process with $1<\alpha<2$. Let $K^+_n =\sup_{t\in[n,n+1]}X_t-X_n$ and $K^-_n=\sup_{t\in[n,n+1]}-(X_t-X_n)$. It is known that $\mathbb{P}(K^\pm_1>x)\sim C_\pm x^{-\alpha}$ as $x\to\infty$ for some positive constants $C_\pm$ (see Doney and Savov's paper https://arxiv.org/abs/1001.4872) except for the spectrally one-sided cases where exactly one of $K_n^+$ or $K_n^-$ is light-tailed, depending on whether $X$ is spectrally negative or positive, respectively (and then, the other one does have said asymptotic behaviour).
Assume that at least $K_n^+$ is heavy-tailed (that is, $X$ is not spectrally-negative) and otherwise use the same argument for $K_n^-$. Then
$$\mathbb{E}\left(\sup_{s\in[0,t]}|X_s|\right)
=t^{1/\alpha}\mathbb{E}\left(\sup_{s\in[0,1]}|X_s|\right)
\leq t^{1/\alpha}\mathbb{E}\left(K_1^++K_1^-\right)<\infty,$$
however, we also get $$\mathbb{P}\left(K_n/\sqrt{n}>1/N\right)
\geq \mathbb{P}\left(K^+_n>\sqrt{n}/N\right)\sim C_+ N^{\alpha} n^{-\alpha/2}.$$
Since the latter expession is not summable (i.e., $\sum_{n=1}^\infty n^{-\alpha/2}=\infty$), then neither is the expression on the left and so the second Borel-Cantelli lemma implies that
$$\mathbb{P}\left(\limsup_{n\to\infty}\left\{K_n/\sqrt{n}>1/N\right\}\right)=1 \implies\mathbb{P}\left(\limsup_{n\to\infty}K_n/\sqrt{n}=0\right)=0.$$
Sufficient conditions
If you knew that $\mathbb{E}(K_1^p)<\infty$ for some $p>2$, then Markov's inequality yields
$$\sum_{n=1}^\infty \mathbb{P}(K_n/\sqrt{n}>1/N)
\leq \sum_{n=1}^\infty \mathbb{E}(K_1^p)N^pn^{-p/2}<\infty, $$
so the first Borel-Cantelli lemma would instead give
$$\mathbb{P}\left(\limsup_{n\to\infty}\left\{K_n/\sqrt{n}>1/N\right\}\right)=0 \implies\mathbb{P}\left(\limsup_{n\to\infty}K_n/\sqrt{n}=0\right)=1,$$
as required.


text:
Q: Connect to local sql express database from my web application I need to add a feature to connect to local sql express database from my web app . Is these any option to make it from javascript , I can do that with html5 but It isn't supported on each browser.
Thanks in advance ...

A: Take a look this:
var connection = new ActiveXObject("ADODB.Connection") ;

var connectionstring="Data Source=<server>;Initial Catalog=<catalog>;User ID=<user>;Password=<password>;Provider=SQLOLEDB";

connection.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");

rs.Open("SELECT * FROM table", connection);
rs.MoveFirst
while(!rs.eof)
{
   document.write(rs.fields(1));
   rs.movenext;
}

rs.close;
connection.close;


text:
Q: Boost signals and passing class method I've defined some signal:
typedef boost::signals2::signal<void (int temp)> SomeSig;
typedef SomeSig::slot_type SomeSigType;

I have some class:
class SomeClass
{
   SomeClass()
   {
     SomeSig.connect(&SomeClass::doMethod);
   }
   void doMethod(const SomeSig &slot);
};

And got a lot of errors:
error: 'BOOST_PP_ENUM_SHIFTED_PARAMS_M' was not declared in this scope
error: 'T' was not declared in this scope
error: a function call cannot appear in a constant-expression
error: a function call cannot appear in a constant-expression
error: template argument 1 is invalid
error: 'BOOST_SIGNALS2_MISC_STATEMENT' has not been declared
error: expected identifier before '~' token
error: expected ')' before '~' token
error: expected ';' before '~' token

UPD:
New code (the same error):
typedef boost::signals2::signal<void (int keyCode)> SigKeyPressed;
typedef SigKeyPressed::slot_type SigKeyPressedType;

class SomeClass
{
        SigKeyPressed mSigKeyPressed;

    public:
        SomeClass() { mSigKeyPressed.connect(&SomeClass::keyPressed); }
        void keyPressed(const SigKeyPressedType &slot);
};

A: Both Pavel and Keith are correct (+1 for both).  SomeSig is a type, you cannot call on a type.  You must instantiate SomeSig.  You also must provide a pointer to the object when using method function pointers.  The _1 is a place holder required during a bind indicating that the method function pointer being bound requires a single argument.
typedef boost::signals2::signal<void (int keyCode)> SigKeyPressed;
typedef SigKeyPressed::slot_type SigKeyPressedType;

class SomeClass
{
        SigKeyPressed mSigKeyPressed;

    public:
        SomeClass() { mSigKeyPressed.connect(boost::bind(&SomeClass::keyPressed, this, _1); }
        void keyPressed(const SigKeyPressedType &slot);
};

A: Use boost::bind.
SomeSig.connect(bind(&SomeClass::doMethod, this, _1));

The thing is, that your signal requires a hidden this pointer, i.e. to act on some object.
Alternatively, you can pass it a pointer to static method.

A: SomeSig is a type, not an object.  You need to define a signal object and call connect on that object.  Also, is doMethod(), the type of the slot parameter was wrong.
class SomeClass
{
  SomeClass()
  {
    signal.connect(&SomeClass::doMethod);
  }
  void doMethod(const SomeSigType &slot);
private:
    SomeSig signal;

};


text:
Q: How to put media buttons on the lockscreen with ExoPlayer I am using ExoPlayer (https://github.com/google/ExoPlayer) and custom notifications.
I want to access my music player from lock screen and headphone like in google play music and wync.
Please help me.

A: For playback controls on the lock screen you need to do a MediaStyle notification.
If you want to have an artwork as the lockscreen background you need to support MediaSession and maintain the metadata of the session properly:
new MediaMetadata.Builder(track)
   .putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, bitmap)
   .putBitmap(MediaMetadata.METADATA_KEY_DISPLAY_ICON, bitmap)
   .build();

A: I am also using Exoplayer with PlayerNotificationManager, And I used MediaSessionConnector and TimelineQueueNavigator to build notifications for the lock screen and background image for the lock screen.
Here, is my question with the Exoplayer team which is resolved for android 11 and above, regarding how to use MediaSessionConnector:
Why PlayerNotificationManager not showing Notification on startForeground in Android 11(R)?
Now, I just added a bitmap (using putParcelable()) for the current session track for MediaDescriptionCompact which will be set to the current MediaSession internally.
Here is the code for that:
val mediaSession = MediaSessionCompat(serviceContext, "DPS_APP")
mediaSession.isActive = true
mediaSessionConnector = MediaSessionConnector(mediaSession).also {
                it.setQueueNavigator(
                    object : TimelineQueueNavigator(mediaSession) {
                        override fun getMediaDescription(
                            player: Player,
                            windowIndex: Int
                        ): MediaDescriptionCompat {
                            val data: MediaMetaData =
                                getEmptyOfNullMedia(player)
                            isBitmapAvailable(getCurrentMediaArt(data))
                            val extras = Bundle().apply {
                                putString(
                                    MediaMetadataCompat.METADATA_KEY_TITLE,
                                    getCurrentTitle(data)
                                )
                                putString(
                                    MediaMetadataCompat.METADATA_KEY_ARTIST,
                                    getMediaTitle(data)
                                )
                                putParcelable(
                                    MediaMetadataCompat.METADATA_KEY_ALBUM_ART,
                                    sessionCurrentBitmap
                                )
                            }

                            return MediaDescriptionCompat.Builder()
                                .setIconBitmap(sessionCurrentBitmap)
                                .setExtras(extras)
                                .build()
                        }
                it.setPlayer(mPlayer)
            }

Here is a small brief on that how to refresh or invalidate MediaSession in the given below issue on GitHub:
https://github.com/google/ExoPlayer/issues/5494


text:
Q: Protected mode and physical addresses When CPU is in protected mode it expects all addresses to be virtual. Kernel resides in physical memory and uses physical addresses for its internal purposes. When developing a driver driver framework routines must access some memory locations with specific physical address (regarding to memory mapping addresses for that device). So what mechanism allows to use physical address in protected mode?

A: The driver framework or API will tell these to you. I've been using windriver (http://www.jungo.com/) to write a PCI driver. When you allocate memory using this API, it will give you two addresses, one the virtual one which is valid for the application, and a physical one which you give to the device. Other frameworks/apis will most likely do it similarly.


text:
Q: MySQL Connection through ASP.NET How do I solve this?
I'm trying to figure out how to pass my mysql data into a textbox.
Also, I'm having an error when i run my program (Connection must be valid and open).
try
    {
        string sCon = "SERVER=localhost;DATABASE=pac;UID=root";
        String s = "select * from pac.pac_excel where employeenumber=" + this.employeenumber_txt.Text + ";";
        MySqlConnection con = new MySqlConnection(sCon);
        MySqlCommand myCommand = new MySqlCommand(s, con);
        MySqlDataAdapter dat = new MySqlDataAdapter(s, con);
        DataSet ds = new DataSet();
        dat.Fill(ds, "pac");

        MySqlCommand cmdDatabase = new MySqlCommand(s);
        MySqlDataReader myReader;
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
        con.Open();
        myCommand.ExecuteNonQuery();

            myReader = cmdDatabase.ExecuteReader();
            while (myReader.Read())
            {
                status_txt.Text = myReader["status"].ToString();
            }
            myReader.Close();
            con.Close();

    }

    catch (Exception ex)
    {
        Response.Write(ex.Message);
    }

A: Change your sCon like this,
string sCon = "Data Source=localhost\SQLEXPRESS;Initial Catalog=pac;Integrated Security=True;UID=root";

If you using Sql Express edition, you need to add \SQLEXPRESS otherwise no need of this.And Change your con.Open() to the line below of con declaration.


text:
Q: Why does -u mean remember for git push [-u]? In the manual it states that -u will tell git to remember where to push to.
However, I think this is a strange abbreviation.  -r would make more sense.
It works fine I'm just wondering where these abbreviations come from.

A: it means
--set-upstream

and that means:

git push --set-upstream sets the default remote branch for the current local branch.

(see this answer)


text:
Q: What are the pros and cons of DynamoDB with respect to Google Cloud Datastore My understanding is DynamoDB behave like a giant table which you must specify a hash key and range key.
The core concept of Google Cloud Datastore is entity based (like Cassandra) and is more flexible, i.e. can use more than 1 index.
But are there any more in-depth comparison?

A: AWS DynamoDB is a pretty simple flat key-value store. It has support for conditional writes and sets which allow for some cool features. You specify the amount of horsepower you want (which you can only adjust a few times a day) and AWS splits up your dataset uniformly across enough database nodes to meet your demands. You have to make sure your key values are sufficiently random as to guarantee balanced access across your dataset. AWS almost guarantees single-digit latencies. Transactions are not supported. You specify the consistency of operations.
Google Cloud Datastore is a more sophisticated key-valueish store with built-in transaction support and entity hierarchy. You don't have to worry about the capacity of the system, it automatically scales to your data size and access patterns. You have less control of some things so you have to pay attention. You cannot specify for a read to be consistent, but you can force consistency by structuring your entities in a certain way.
One downside of Google Cloud products I have experienced is that documentation and language support is not very uniform. Sometimes you have to read documentation of another language to understand the system fully and many features are not supported in certain languages.
There are a lot of other differences. Look at the API reference of your favorite language on both documentation pages and you'll get a decent feel of the specific features of each.


text:
Q: Question on formatting author \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{indentfirst}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{graphicx}
\graphicspath{ {Desktop/} }

\title{Improvement of the Cascadic Multigrid Algorithm with a Gauss Seidel Smoother to Efficiently Compute the Fiedler Vector of a Graph Laplacian}
\author{Shivam Gandhi \href{email: [email]}
\and \href{Tufts University Department of Mathematics}}
\date{November 2015}

I am writing a paper and the above code is causing problems when I compile in TeXworks through pdfTeX. It returns this issue:
Undefined control sequence.
\@author ->Shivam Gandhi \href
                           {email: shivam.jgandhi@gmail.com} \and \href ...
l.20 \maketitle

I am not sure why this error is happening. I wrote the paper in ShareLaTeX and it compiled fine, but now there are problems.

A: \href refers to a hyper reference that you want to include. In order to do so, you need to include
\usepackage{hyperref}

in your preamble. Note that there may be conflicts when using that package. If this occurs, load order may be important. Additionally, \href[<options>]{<URL>}{<text>} takes two mandatory arguments. The first would be a URL, while the second is what's displayed in the text.

\documentclass{article}

\usepackage{hyperref}

\title{Here is a title}
\author{A Author \href{abc}{abc}
  \and B Author \href{def}{def}}

\date{November 2015}
\begin{document}
\maketitle
\end{document}

A: I would use it this way:
\documentclass{article}
\usepackage[a6paper]{geometry}%% only for demo
\usepackage{hyperref}
\title{Here is a title}
\author{A Author\thanks{\url{abc@de}}
    \and B Author\thanks{\url{def.de}}}
\date{November 2015}
\begin{document}
    \maketitle
\end{document}


text:
Q: Can we know iPhone "Portrait Orientation Lock" is On/Off I want to know the iPhone is currently in Portrait mode or in Landscape mode. If I forcefully do the "Portrait orientation mode" is on then there is way to know programmatically.

A: You can simply use orientation to get the current device's orientation,
UIDevice.currentDevice().orientation

To check for portrait mode, you can simply do,
if UIDevice.currentDevice().orientation == .portrait {
    //add your code here...
}

These can be the possible orientation values,
public enum UIDeviceOrientation : Int {
    case unknown
    case portrait // Device oriented vertically, home button on the bottom
    case portraitUpsideDown // Device oriented vertically, home button on the top
    case landscapeLeft // Device oriented horizontally, home button on the right
    case landscapeRight // Device oriented horizontally, home button on the left
    case faceUp // Device oriented flat, face up
    case faceDown // Device oriented flat, face down
}


text:
Q: Domain users cannot change password if domain name is written before username we have multiple sites every site has RODC and Headoffice has two RWDC 2008 r2 and 2012 std .
clients are win 7 and win 10 .
domain users cannot change their domain password error the security database on the server does not have computer account .
if they enter pdc name before their user then they can change their password .

A: As the error message states, the computer does not have a domain computer account. You might want to remove the computer from domain and join it again.


text:
Q: pdo Member function query error coming I am getting Call to a member function query() on a non-object in G:\PleskVhosts\angelsoftweb.com\angelunitrax.angelsoftweb.com\header.php on line 116

db.php
<?php
$servername = "########";
$username = "########";
$password = "########";
$dbh = "rfid";
try {
$conn = new PDO('mysql:host=localhost;dbname=$dbh', $username,
$password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'Error: ' . $e->getMessage();
}
?>

header.php
<?php

foreach($sql=$conn->query("SELECT * FROM header_section") as $st) {
echo'

'.$st['call_us_name'].'
'.$st['number'].'

';
}

?>

I tried to solve this but not got what is the problem van some one help me with this to solve this as soon as possible...

A: First of all, please specify in the question which line is 116, it would be much easier to answer if we can see the exact operator.
Usually this error happens when the connection object is not created properly.
Try to set error mode to exception and put it in a try..catch block.
EDIT: it's not quite clear where does $conn come from in header.php. The database handler in db.php is $pdo

A: The issue is variable interpolation in this line
'mysql:host=localhost;dbname=$dbh'
Replace single quote ' with double quote "
Your script is taking variables in that line as string.
That line should look like this
"mysql:host=localhost;dbname=$dbh"
Your db.php shoud look like this
<?php
$servername = "########";
$username = "########";
$password = "########";
$dbh = "rfid";
try {
$conn = new PDO("mysql:host=localhost;dbname=$dbh", $username,
$password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'Error: ' . $e->getMessage();
}


text:
Q: bootstrap popover not work in jquery load function I have a specific problem with bootsrap popover.
All jquery and bootstrap files are included in file index.php, in this same file i have this div:

 Loadding

And I have a jquery function which loads a content from php file
 $(document).ready(function(){
  var auto_refresh = setInterval(
  function()
  {

  $('#con').load('ajax/some.php');
  }, 1000);
});

In some.php file I have link with to activate a bootstrap popover.
        echo ' ';
    echo 'Some one';

the content from some.php will work great, but bootstrap popover doesn't show.
Can you help me?

A: When adding a tooltip to, say a button, according to bootstraps documentation, you'd end up with something like this (within the external file you're using Jquery Load to return).
<button type="button" class="btn btn-primary" data-toggle="tooltip" data-placement="top" title="Tooltip info here">Some Button</button>

Within your Jquery callback, you can initialize all tooltips. This is according to Bootstrap's Documentation for "opt-in" Bootstrap Tooltip Examples
Your callback for Jquery Load would then look like this
  $('#con').load('ajax/some.php', function() {
    $('[data-toggle="tooltip"]').tooltip()

  });


text:
Q: NSDateFormatter returns nil in swift 2 When I converting my string to NSDate, it is returning nil
And show error :

fatal error: unexpectedly found nil while unwrapping an Optional value

for example :     date = 8/9/2016 9:45:19 AM
convertDate(DateString:String) -> NSDate{
    let dateFormatter = NSDateFormatter()
    dateFormatter.dateFormat = "MM/dd/yyyy hh:mm:ss a"
    let date = dateFormatter.dateFromString(DateString)
    print(date) // return nil

    return date!
}

You can guide what is the reason?

A: The problem is that your dateFormatter can not convert the DateString you are passing it, given the dateFormat you have told it to use.
Therefore it gives up and returns nil, meaning that when you've run this line:
let date = dateFormatter.dateFromString(DateString)

the value of date is nil
Next, you take the value of date and say "force unwrap this value and return it, I don't care if it is nil or not", as can be seen here.
return date!

As your function is expected to return a NSDate...meaning that you guarantee that you will always return an instance of NSDate and not nil, and you then tell it to force unwrap something that can be (and is in this case) nil your app keels over when you try to force unwrap date.
In general, force unwrapping things in Swift is almost always a bad idea, unless you are absolutely sure that the value is not nil.
So, a couple of things to consider:

*

*How does your DateString actually look? There must be something wrong with either that or your dateFormat string since this value can not be parsed.

*Should you always return a NSDate? Or could you return an optional instead and let the caller of your method worry about whether your convertDate method returns something useful or not?
Hope that gives you something to work with.


text:
Q: jQuery Ui Slider Handler not getting dragged with mouse in PhoneGap application I am working on an iPhone Application. I am using PhoneGap in Xcode4 to develop the application and testing it with iPhone simulator 4.3.
My issue is I am using jQuery ui slider in my application to implement audio bar, the slider is moving properly with the audio but I can't drag the slider handle with mouse and when I test the same application with Safari browser it is working fine there.

A: jQuery UI currently does not support touch events.  I would recommend using jQuery UI Touch Punch to add that functionality - http://touchpunch.furf.com/.


text:
Q: Maven install folder structure problem j2ee (spring, struts ..) i'm using maven 2.1-SNAPSHOT as eclipse plugin.
My project structure is like this:
src/main/java
   -model
    -service
    -action
src/test/java
    empty atm
src/main/resources
    empty atm
src/test/resources
    empty atm
src/main/webapp
    -js
        -dojo
    -META-INF
    -WEB-INF
        web.xml
        appcontext.xml
       struts.xml
    index.jsp
I'm having trouble understanding the build process and where to put which file.
I use as Application Server Jetty but i want to deploy my project on  tomcat as well
(so i have set up in my pom packaging war).
When i run my project with the maven:install command my target folder looks like this:
myproject.war
war
    not relevant
test-classes
    empty atm
myproject
    js
    META-INF
    WEB-INF
    index.jsp
classes
    model
    service
    action
My problem is that i need in the classes folder my persistence.xml which i have in META-INF. And struts.xml too i guess. I'm not sure about dojo either if it is right there. And honestly i don't know if this structure is right at all. I also dont know how to configure that the output changes.
I hope somebody can help me i really want to understand this process how it should be right, maybe there are even nice ressources to lookup to get
better at these things. Thanks in advance kukudas

A: I believe files that you want deployed to the classpath go in the resources/ folder.
Take a look at the Maven in 5 Minutes guide, along with the Getting Started guide.

A: I think you are missing the resources directory under the src/main/webapp directory. Thats where you can put in your properties and config files for hibernate, struts and spring.
That will allow Maven to copy the files over the the classes directory in the WAR.
Hope this helps.


text:
Q: different number of posts by RSS feed (in Wordpress) I've done a bunch of searching on this site, Wordpress.com, and Google, and I haven't found an answer, so I'll try posting here! If it's already been answered, I apologize in advance for my search-fu failure.
I run a podcast and blog using a WordPress/PowerPress combo. Because of the limit on many aggregators, I have to keep my site's main feed under 512kb, so I've limited the number of posts that show in RSS to 50. However, we frequently get people asking for a feed that has our entire catalog so they can pull down our show's full history.
Is there a plugin or some feature in WordPress that would allow me to leave my main feed with its length restrictions but launch a parallel feed that shows everything?  Or is there a relatively simple trick I can do in the PHP?
Thanks in advance for any help!

A: Why not to make the second feed yourself? WP Codex

A: Yes create your own feed, this link might help with some of the hooks
https://github.com/ChelseaStats/wp-plugin-custom-rss-feeds
disclaimer: link/repo is mine


text:
Q: How to manage multiple coredata MOC while sharing it with App Extension? Am facing a semaphore issue in my application randomly, can this be due to coredata locking the main thread? The coredata context is being used as below:
App
 1. Main context(Main Queue) that deals with UI and every CRUD operation.
 2. Private Context(private queue with main context as parent) used in NSOperation subclass to sync data to and from cloud kit.
Both the context share a single persistentstore coordinator.
Extension
 1. Main context(main queue) with its own persistent store co-ordinator.
This all context can be live at a time. How can i best manage them without losing data and causing deadlocks.
Note: Have debugged using the coredata concurrency variable. This is my first time with coredata any help is appreciated.


text:
Q: How come Facebook's Graph API issue a cookie for "access_token", "secret", "session_key", "sig"... so many fields? The following is what Facebook gives as a cookie to a website that uses Facebook connect.
It issues one cookie with the name fbs____<appID>_____, and can be splitted using the & character:  (numbers changed... but they are in similar form)
Array
(
    [0] => "access_token=32480239450325|2.39F_lt3098asddASDL__.3600.1287892800-123456789|H9348aKljsakasd
    [1] => base_domain=www.example.com
    [2] => expires=1287892800
    [3] => secret=032480XYZ023489__
    [4] => session_key=2.39F_lt3098asddASDL__.3600.1287892800-123456789
    [5] => sig=8023948acbd43243
    [6] => uid=123456789"
)

The 32480239450325 is the appID.
I thought if we MD5 or SHA1 the access_token's 1st part with the uid with our app's secret key, then we can verify that it equals to the access_token's 2nd part or the last part, and confirm that it is a valid access_key and user.
So why do we need session_key, secret, and sig?  In fact, the session_key is part of the access_token, so why repeat it...?

A: To support legacy applications that might still be using the old fb_sig parameter


text:
Q: Calling local api on a server from a hosted website I'm currently hosting a website and I'm trying to call an API on a remote server. This remote server has a website running locally, and I'm trying to call a certain API from my website to the remote server's localhost. Is something like this possible, or would I have to host the website on the remote server so it isn't locally hosted.
For instance, would something like http://IP_address_of_server_goes_here:8000/get_matching_data/?XXXX be possible to get some data from this localhost?

A: If you have a computer that is running a server with an API locally, you can only access it with the same computer and other computers on the same network. You have a few options:
Connecting on the same wifi
IF your client (connecting) device is on the same wireless network as the server, you can often access the server by using http://12.0.0.1:8000/whatever. There are plenty of resources for learning how to do this as it can be a tricky process. It looks like it may be slightly different for Django, check out this question: django accessing localhost from any machine connected to any network
Connecting from anywhere with localhost tunneling
If you would like to connect to your server to test without being restricted by the localhost, you can take a look at providers such as ngrok or pagekite. Essentially, localhost tunneling is miniature hosting. These providers give you limited access to using their subdomains for remote testing. DO NOT use this as a production solution, as they are not secure or very stable.
Host it
Check out heroku for free, easy hosting.


text:
Q: Best way to arrange different views in a single page website I have an app using AngularJS and Bootstrap.
The way I have arranged my different views is using ng-show. That is, views change according to button presses, etc. and enabling/disabling ng-show values.
I have a single HTML file with a lot of DIVs. All these DIVs show/dissapear.
My questions are:

*

*Is this the usual way of doing a single page web app? I.e. have all the views in different DIV's and show/hide them as needed?

*Is there a more efficient way to arrange all different views in to a more structured way than having all of them in a single HTML file?

Thank you.

A: If your application is quite big and you have more than two or three views, you have to use a router like ngRouter, UI Router is more powerful but more complex. This is the best solution.
If your application is rather small (two or three views), and doesn't evolve, you can use ng-switch.
Ng-if may be an option but it is less convenient.
But you should avoid ng-show, because DOM elements are always in the page and just hide.

A: You should really use a routing service, such as ngRouter or ui.router, because if the app becomes more complex it will become increasingly hard to maintain.
Here's one article I googled on routing and using templates in Angular.

A: It is very easy to show multiple pages on the single page applications on according to their menu's using Routing in angularjs.
AngularJS Single Page Template and ng.Net Template, Both are based on mvc pattern, and easy to understand. So in below have some references. Check it.
https://visualstudiogallery.msdn.microsoft.com/5af151b2-9ed2-4809-bfe8-27566bfe7d83
https://github.com/BBird40/ng.NET
https://visualstudiogallery.msdn.microsoft.com/48d928e3-9b5c-4faf-b46f-d6baa7d9886c


text:
Q: What does this notation regarding covariant differentiation mean? Suppose we are considering the Levi-Civita connection $\nabla$ on a Riemannian manifold $M$. By definition, $\nabla$ is a map
$$\nabla:\Gamma(TM)\to\Gamma(TM^*\otimes TM)$$
satisfying certain conditions. If $X,Y$ are vector fields on $M$, I can understand that $\nabla Y\in\Gamma(TM^*\otimes TM)$, and $\nabla_XY\in\Gamma(TM)$.
However, I've seen $\nabla$ used in the following way: Let $\xi^j\frac{\partial}{\partial x^j}$ be a tangent vector field. Then $\sum_{j}\nabla_j\xi^j$ equals the divergence of $\xi^j\frac{\partial}{\partial x^j}$. See here.
Questions:

*

*What does it mean to write $\nabla_j\xi^j$? $\xi^j$ itself is not a tensor, but a component of a tensor. But by definition, the input of $\nabla_j$ should be a tensor. Is it a shorthand or something else?

*I think using local coordinates, we have $\nabla_if=\frac{\partial f}{\partial x^i}$ and $\nabla_i\nabla_jf=\frac{\partial^2f}{\partial x^i\partial x^j}-\Gamma_{ij}^k\frac{\partial f}{\partial x^k}$. Is this the definition? What about higher derivatives?

*Even though I am fine with local coordinates, I hope someone can explain this to me in an intrinsic way.

A: For $V=V^\mu\partial_\mu$ a vector field, when physicists write something like $\nabla_\mu V^\nu$ they actually mean:
$$\nabla_\mu V^\nu=\partial_\mu V^\nu+V^\rho\Gamma^\nu_{\mu\rho}$$
So this is indeed not just $\nabla_{\partial_\mu}$ applied to the function $V^\nu$. To see what it is, let also $X=X^\mu\partial_\mu$ be a vector field. In coordinates we have:
$$\begin{array}{}
\nabla_X V & =X^\mu\nabla_{\partial_\mu} V \\
&=X^\mu(\nabla_{\partial_\mu} V^\nu)\partial_\nu+X^\mu V^\nu\nabla_{\partial_\mu}\partial_\nu\\
&=X^\mu(\partial_\mu V^\nu)\partial_\nu+X^\mu V^\nu\Gamma^{\rho}_{\mu\nu}\partial_\rho \\
&=X^\mu(\nabla_\mu V^\nu)\partial_\nu
\end{array}$$
This means that:
$$\nabla_\mu V^\nu=dx^\nu (\nabla_{\partial_\mu} V)$$
I.e. the $\nabla_\mu V^\nu$ are the coefficients of the map $X\mapsto\nabla_X V$. In particular the quantity you are looking for is the trace of this map:
$$\nabla_\mu V^\mu=Tr(X\mapsto\nabla_X V)$$
(Note that the covariant derivative $\nabla_X V$ is linear in $X$, hence this map is a well defined vector bundle homomorphism, i.e. linear on fibres, and it makes sense to take a trace.)


text:
Q: XMLHttpRequest not returning full response text I am calling some url which returns an html content. I am receiving full response for this url from poster plugin of firefox. For the same url, XMLHttpRequest returning half response body. The response headers are same for both the requests. Surprisingly, readyState = 4 and http status = 200 for XMLHttpRequest. Can some one tell me what I missing.
Thanks


text:
Q: Dedekind cut of an irrational number I have looked around at the questions about Dedekind cuts and still have some questions.
For example,
1)
Why is $\{r \in \mathbb{Q}: r^2 < 2 \}$ not a Dedekind cut and yet $\big( 0^{\ast}:=\{r \in \mathbb{Q}: r < 0\} \big) \cup \{r \in \mathbb{Q}: r \geq 0 \textrm{ and } r^2 < 2 \}$ is a Dedekind cut (for representing $\sqrt{2}$)?
I can verify the union is a Dedekind cut for $\sqrt{2}$ by drawing an open interval, $(-\infty,0)$, union-ed with the open interval $[0,\sqrt{2})$ to produce what I think is the definition of a Dedekind cut "by the lower half", $(-\infty,\sqrt{2})$.
The first part - I use the definition:
(a) Cut $A \neq \varnothing$ and $A \neq \mathbb{Q}$.
(b) If $r \in A$ and $s \in \mathbb{Q}$ and $s < r$, then $s \in A$.
(c) A contains no largest rational
Doesn't the first "cut" satisfy all these? Because can't I just write it as $\{r \in \mathbb{Q}: r < \sqrt{2} \}$? Then (a) is satisfied, (b) is satisfied, and (c) is true because you can get arbitrarily close to $\sqrt{2}$.
It seems that in both $\{r \in \mathbb{Q}: r^2 < 2 \}$ and $\{r \in \mathbb{Q}: r^3 < 2\}$, the suprema of each are irrational....?

2) For $\{r \in \mathbb{Q}: r^3 < 2 \}$ is a Dedekind cut - can't I just say that it is because it is the set $\{r \in \mathbb{Q}: r < 2^{1/3}\}$ and $r^3 - 2 = 0$ can only have rational roots that are multiples of $\frac{r\,a_0}{s\,a_n}: \pm 1, \pm 2$?
The separation is on an irrational number and that this cut represents an irrational number?

3)
Is it fair to say that a rational is represented by the cut, $\{(-\infty,r),[r,+\infty)\}$; and an irrational is represented by the cut, $\{(-\infty,i),(i,+\infty)\}$?

Thank you all for the help!

A: For (1):  As Dylan Moreland points out in a comment, the problems lies in (b).  It's not true that a rational smaller than an element of your $S$ is also in $S$.
For (2) and (3), I have the same comment in both:  A common and understandable confusion when being first exposed to Dedekind cuts is that you have to completely forget that real numbers exist.  It doesn't really make sense to say that a cut is on an irrational number, since there are no such thing as rational numbers when you're defining Dedekind cuts.  (Of course, most of the things you're saying in this respect are "morally correct" in the sense that they end up being true once you've defined real numbers, but in the long run, this is circular.)
Similarly, for your $2^{1/3}$ Dedekind cut, it may be helpful while you're going through this to never ever use notations like $2^{1/3}$ or $\sqrt[3]{2}$, except possibly as shorthand for the Dedekind cut $S$ you describe (and even then, only once you've defined multiplication of cuts and checked that $S^3=2$), since in the rational world, this number does not exist.  So no, you can't just say it's that set, because you don't know that set is a Dedekind cut.  You need to prove that it has no maximal element, and if you think about it, checking that there is no rational number whose cube equals 2 is a little shy of that stronger conclusion.

A: A Dedekind cut is a partition of the rational numbers $$\mathbb{Q} = L \cup U,$$
so that for all $x\in L$ and $y\in U$, we have $x < y$.
This should answer your question about $\{x\in \mathbb{Q}| x^2 < 2\}$.

A: If $r$ is in the left part of the cut, and $s$ is a rational such that $s<r$, then $y$ must be in the left part of the cut. That is part of the definition of cut, it is your condition (b).
If you look at the rationals $r$ such that $r^2<2$, note that for example $-17$ is not in. But for example $1$ is in which violates part of the definition of cut.
Added: For $\sqrt[3]{2}$, it so happens that the rationals $r$ such that $r^3<2$ satisfy your condition (b), since the function $x^3$ is increasing on the rationals, and goes to $-\infty$ as $x$ goes to $-\infty$. The function $x^2$ has neither of these properties.
Your characterization of "rational" and "irrational" cuts near the end sounds reasonable enough. The main trouble with it is that the standard meaning of say $(-\infty,5)$ is the set of all reals $x$ such that $x<5$. However, a cut is a certain set of rationals.  Also, we use cuts to define the reals. Before the reals are defined, the expression $(-\infty,\sqrt{2})$ has no official meaning.
Please note that there are some inessential differences between cuts as defined by various people. Some definitions allow a largest number for the "left" part, and not for the "right" part. Some, following Dedekind's original definition, mention explicitly both parts, so a cut is an ordered pair $(L,U)$ such that neither is empty, together they make up the rationals, and so on.


text:
Q: ERROR Error: dataKey must be defined to use row expansion I'm trying to figure out how to use Row Expansion in PrimeEng. I was just following the guide in their documentation and it shows that I should define my datakey. I already defined it below if I'm not mistaken. I'm new to this, please don't judge.

<ng-template pTemplate="header">

        blank
        ID
        Name
        Username
        Email
        Street
        Suite
        City
        Zip code
        LAT
        LNG
        Phone
        Website

</ng-template>

<ng-template pTemplate="body" let-user let-expanded="expanded">

            <button type="button" pButton pRipple [pRowToggler]="posts" (click)="viewPostUser(user.id)" class="p-button-text p-button-rounded p-button-plain" [icon]="expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'"></button>

        {{user.id}}
        {{user.name}}
        {{user.username}}
        {{user.email}}
        {{user.address.street}}
        {{user.address.suite}}
        {{user.address.city}}
        {{user.address.zipcode}}
        {{user.address.geo.lat}}
        {{user.address.geo.lng}}
        {{user.phone}}
        {{user.website}}

</ng-template>

Here is my row expansion ng-template.
<ng-template pTemplate="rowexpansion" let-posts>

                    <ng-template pTemplate="header">

                            userID
                            ID
                            Title
                            Body

                    </ng-template>
                    <ng-template pTemplate="body" let-posts>

                            {{posts.userId}}
                            {{posts.id}}
                            {{posts.title}}
                            {{posts.body}}

                    </ng-template>

</ng-template>

I've tried searching the error that I have, but it points me to updating the version.

A: I think here is where you get it wrong:
[value]="posts.userId" [dataKey]="posts.userId"

[value] is the collection that you want to iterate through, which should be posts in this case
[dataKey] is the property of one item in that collection which you could just define by name: userId
So the final code is:
[value]="posts" [dataKey]="userId"

A: First, to fix the error you're seeing, add the attribute dataKey="id" to the p-table element.
Next, using let-posts is probably not what you wanted. You didn't write how your data structure is constructed but I'll assume each user has a property called posts. You need to change your template like this:
<ng-template pTemplate="rowexpansion" let-user>

                    <ng-template pTemplate="header">

                            userID
                            ID
                            Title
                            Body

                    </ng-template>
                    <ng-template pTemplate="body" let-post>

                            {{post.userId}}
                            {{post.id}}
                            {{post.title}}
                            {{post.body}}

                    </ng-template>

</ng-template>

Explanation:

*

*Use let-user in the rowexpansion template. Now the user variable will contain the user data for the current expandable row.

*In the inner p-table, provide the [value] input with the data for the sub table, i.e., the posts for the current user.

*In the inner p-table, provide the dataKey input with the name of the field which is the unique key of the table. This might be even not necessary in your case.

*In the inner p-table, in the body template, use let-post instead of let-posts since each iteration, i.e., each row of the inner table showing posts for the user, will store the current row, which is a single post.

*In each  element in the inner table's body template, use post.<field-name>. post will contain the data for the current row so all you need to do is access the field you need inside the object.

A: You can add dataKey in first line, like this

Maybe it will solve your problem.


text:
Q: Opening a Google Maps API infowindow from URL parameter (KML layer) I have a Google Map that loads a layer of markers from a KML file. Each placemark has an ID (simply id="1" through id="25").
Is it possible to open a specific placemark's infowindow from a URL parameter? If so, how?
The idea is that an address on another page is linked to its corresponding placemark http://MAPURL.COM/?id=4 or something.
Here's a jsfiddle to see the whole thing in action:
http://jsfiddle.net/natejones/JAyCF/3/
Thanks!

A: Your customization options are really limited using a KML Overlay.  As far as I know there's no way to open a KML marker's InfoWindow without going through and clicking on the marker; the InfoWindow isn't always loaded in many cases until the KmlLayer's click event is fired.
I'd suggest using native marker elements (google.maps.Marker) which would easily let you trigger an InfoWindow's open event.


text:
Q: How to programatically turn off GPS in andoid? I know this is a question that got asked a lot. But all of the answers I could find are very old so I wanted to ask again.
I want to turn off GPS services on the phone programmatically. What is the up to date answer to this ?
Thanks in advance.

A: Use this code to turn off GPS
String provider = Settings.Secure.getString(getContentResolver(),
    Settings.Secure.LOCATION_PROVIDERS_ALLOWED);

    if(provider.contains("gps")){
        final Intent poke = new Intent();
        poke.setClassName("com.android.settings",
       "com.android.settings.widget.SettingsAppWidgetProvider");
        poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
        poke.setData(Uri.parse("3"));
        sendBroadcast(poke);
    }


text:
Q: Let $d=(m,n)$. Prove: $φ (mn) = φ (m) φ (n)\frac{d}{φ (d)}$ Let $d=(m,n)$. Prove: $$φ (mn) = φ (m) φ (n)\frac{d}{φ (d)}$$
Can anyone help me with this proof?

A: I use the fact that phi-function is multiplicative.
If a prime $p^{\alpha-1}||m$ and $p$ does not divide $n$ then it contributes $p^{\alpha-1}(p-1)$ to the left hand side. Also its obvious that it will "create" a factor of $p^{\alpha-1}(p-1)$ on the right hand side.
If a prime $p^{\alpha-1}||n$ and $p$ does not divide $m$ then it contributes $p^{\alpha-1}(p-1)$ to the left hand side. Also its obvious that it will "create" a factor of $p^{\alpha-1}(p-1)$ on the right hand side.
If a prime $q$ such that $q^{r}||m$ and $q^{s}||n$ then it contributes a factor $q^{r+s-1}(q-1)$ on the left and side. On the right hand side the $q$ will contribute a factor of $\frac{q^{r-1}(q-1)q^{s-1}(q-1)q^{min(m,n)}}{q^{min(m,n)-1}(q-1)}=q^{r+s-1}(q-1)$.
So, we are done.
We can rigorise this using canonical factorisation representation of the $m$ and $n$.