text:
Q: Histogram statistical comparison reference recommendation I am currently wrestling with several pairs of discrete probability distribution histograms (n = 60,000,000+ for each) and are seeking to determine the significance of any and all dissimilarity between the histograms in each pair.
In my research meanderings, I have come across the Bhattarcharyya distance, which is nice and very straight forward to use - but, what is not clear to me is how to measure the statistical significance of the calculated distance.
Is there a reference that explains the statistical significance of values determined when using the Bhattarcharyya distance?

A: I seem to have found an answer regarding this. According to the conference paper The Bhattacharyya Metric as an Absolute Similarity
Measure for Frequency Coded Data.
 (Thacker et al. 1997), the significance of the Bhattarcharyya distance:

As the Bhattacharyya measure is equivalent to the Matusita measure we see that the Bhattacharyya metric is
  a chi-squared type statistic in the sense of squared Euclidean distance, although unlike the chi-squared statistic,
  the Bhattacharyya metric measures similarity in a domain where all errors are constant

and specifically, for histograms, the authors propose that the

Bhattacharyya statistic $\sum_{i} \sqrt{R_i} \sqrt{S_i}$ as a measure of similarity between the
  two histograms. For the case of two identical histograms we obtain $\sum_{i} \sqrt{R_i} = 1$ indicating a perfect match.

Where the probability distributions of each of the histograms are $R_i$ and $S_i$
and that

Matusita and Bhattacharyya measures are themselves a form of test statistic but because of their construction
  they require no systematic error correction.


text:
Q: Postman overwrites environment variable prior to sending request I am sending a GET request that uses an environment variable used for an access token.
Prior to sending the request, I see that the variable has the correct value.
After sending, the request gets an Unauthorized response.  I look at the environment variable and see that it's now "undefined".
I am not setting this variable in any way with this request.  It's just a simple GET.  I have checked various code outputs before sending the request and they all show valid values for the token.  However once the I sent the GET request, the values are undefined.
Any ideas???

redpajama_set_name: RedPajamaStackExchange


text:
Q: Gathering binary data from a file in C# and editing or adding data without writing the whole file again I know this sounds kind of confusing. but i was wondering if there is a way to maintain the structure of the file and editing it even if it's adding data at some part of the file or editing a value from a certain position.
What i do right now to edit binary files is to code the parser with the BinaryReader class (in C#), reading a certain structure with reader.readSingle, readInt, and so on.
Then i write the exact same thing with BinaryWriter, which seems kind of inefficent and maybe i can make mistakes and making differences between both reader and writer, making the format inconsistent.
Is there any sort of way, to define the file structure and do the whole process automatically for reading and writing with a single format definition? Or being able to open a file, edit some values of it, (or adding, since it's not a fixed format, reading it would imply some for loops for example), and saving those changes?
I hope i explained myself in a sightly understandable way

A: If you want to insert new data into a binary file, you have three options:

*

*Move everything from that point forward down a bit so that you make space for the new data.

*Somehow mark the existing data as no longer relevant (i.e. a deleted flag), and add the new data at the end of the file.

*Replace the existing data with a pointer to another location in the file (typically the end of the file) where the new data is stored.

The first method requires rewriting the entire file.
The second method can work well if it's a file of records, for example, and if you don't depend on the order of records in the file. It becomes more difficult if the file has a complex structure of nested records, etc. It has the drawback of leaving a lot of empty space in the file.
The third method is similar to the second, but works well if you're using random access rather than sequential access. It still ends up wasting space in the file.


text:
Q: cannot reference to cursor instances oracle pl/sql CREATE OR REPLACE PROCEDURE employee_info_all_in_one
     (p_id IN NUMBER)
IS
 CURSOR c_city IS
    (SELECT l.city
     FROM employees e
     INNER JOIN departments d
     ON (e.department_id = d.department_id)
     INNER JOIN locations l
     ON (l.location_id = d.location_id)
     WHERE e.employee_id = p_id);
 CURSOR c_manager IS
    (SELECT e1.last_name
     FROM employees e1
     INNER JOIN
          employees e2
     ON (e1.employee_id = e2.manager_id)
     WHERE e2.employee_id = p_id);
 CURSOR c_department_name IS
    (SELECT department_name
     FROM employees e
     INNER JOIN
     departments d
     ON (e.department_id = d.department_id)
     WHERE e.employee_id = p_id);
 TYPE EmpRecTyp IS RECORD
 (  v_annual_sal      NUMBER(9,2),
    v_monthly_sal     NUMBER(9,2),
    v_last_name       VARCHAR2(10),
    v_deptno          NUMBER(3),
    v_length          NUMBER(2),
    v_tenure          NUMBER(5),
    v_job_id          VARCHAR2(20),
    v_hire_date       DATE,
    v_city            VARCHAR(25),
    v_commission_pct  NUMBER(2,2),
    v_phone_number    VARCHAR2(20),
    v_manager         VARCHAR2(20),
    v_comm_calc       NUMBER(10,2),
    v_email           VARCHAR2(10),
    v_department      VARCHAR2(20),
    v_count           NUMBER(4)
 );
 TYPE EmpRecTyp IS REF CURSOR;
 emp_c_v EmpRecTyp;
BEGIN
 DBMS_OUTPUT.PUT_LINE('Welcome to the summary of an employee based on his unique id');
 DBMS_OUTPUT.PUT_LINE('============================================================');
 SELECT salary, last_name, department_id,
        TRUNC(MONTHS_BETWEEN(SYSDATE,hire_date),0), job_id,
        hire_date, commission_pct, phone_number, email
 INTO   emp_c_v.v_monthly_sal, emp_c_v.v_last_name, emp_c_v.v_deptno,
        emp_c_v.v_tenure, emp_c_v.v_job_id, emp_c_v.v_hire_date, emp_c_v.v_commission_pct,
        emp_c_v.v_phone_number, emp_c_v.v_email
 FROM   employees
 WHERE  employee_id = p_id;

 emp_c_v.v_count := SQL%ROWCOUNT;

 DBMS_OUTPUT.PUT_LINE(emp_c_v.v_count||' row retrieved...');
 DBMS_OUTPUT.PUT_LINE('=============================');

 emp_c_v.v_annual_sal := emp_c_v.v_monthly_sal * 12;
 emp_c_v.v_length := LENGTH(emp_c_v.v_last_name);
 DBMS_OUTPUT.PUT_LINE('Employee:-> ' || emp_c_v.v_last_name || ' ,and his name contains: ' || emp_c_v.v_length ||' chars');
 DBMS_OUTPUT.PUT_LINE('=============================');
 DBMS_OUTPUT.PUT_LINE(q'[Belong's to department: ]' || emp_c_v.v_deptno);
 DBMS_OUTPUT.PUT_LINE('=============================');

 IF (emp_c_v.v_monthly_sal < emp_c_v.v_annual_sal)
 THEN
   DBMS_OUTPUT.PUT_LINE('Has a annual salary of:-> ' || emp_c_v.v_annual_sal);
 ELSE
   DBMS_OUTPUT.PUT_LINE('Something wrong in the formula!');
 END IF;

 IF emp_c_v.v_commission_pct IS NULL
 THEN
   DBMS_OUTPUT.PUT_LINE('No Commission added to the annual salary!');
 ELSE
   DBMS_OUTPUT.PUT_LINE('Commission percentage to the salary is:-> '|| emp_c_v.v_commission_pct ||'%');
   emp_c_v.v_comm_calc := (emp_c_v.v_annual_sal * emp_c_v.v_commission_pct) + emp_c_v.v_annual_sal;
   DBMS_OUTPUT.PUT_LINE('And calculated with annual salary is:->' ||v_comm_calc);
 END IF;

 DBMS_OUTPUT.PUT_LINE('Working for:-> '|| emp_c_v.v_tenure || ' months as '|| emp_c_v.v_job_id);
 DBMS_OUTPUT.PUT_LINE('=============================');
 DBMS_OUTPUT.PUT_LINE('Started in:-> '|| emp_c_v.v_hire_date);
 DBMS_OUTPUT.PUT_LINE('=============================');
 DBMS_OUTPUT.PUT_LINE('Phone number:-> '||emp_c_v.v_phone_number);
 DBMS_OUTPUT.PUT_LINE('=============================');
 DBMS_OUTPUT.PUT_LINE('Email:-> '||emp_c_v.v_email);
 DBMS_OUTPUT.PUT_LINE('=============================');

 OPEN c_city;
 FETCH c_city INTO v_city;
 IF c_city%FOUND
 THEN
   DBMS_OUTPUT.PUT_LINE('Location:-> '||emp_c_v.v_city);
 ELSE
   DBMS_OUTPUT.PUT_LINE('Employee location unknown');
 END IF;
 CLOSE c_city;

 OPEN c_manager;
 FETCH c_manager INTO emp_c_v.v_manager;
 IF c_manager%FOUND
 THEN
   DBMS_OUTPUT.PUT_LINE('Is in the eyes of manager:-> '||emp_c_v.v_manager);
 ELSE
   DBMS_OUTPUT.PUT_LINE('Slave '||emp_c_v.v_last_name||' is free!');
 END IF;
 CLOSE c_manager;

 OPEN c_department_name;
 FETCH c_department_name INTO emp_c_v.v_department;
 IF c_department_name%FOUND
 THEN
   DBMS_OUTPUT.PUT_LINE('Department Name:-> '||emp_c_v.v_department);
 ELSE
   DBMS_OUTPUT.PUT_LINE('Employee ' ||emp_c_v.v_last_name||' belongs to no department!');
 END IF;

 DBMS_OUTPUT.PUT_LINE('================================');
 DBMS_OUTPUT.PUT_LINE('Checking for employee with id '|| p_id ||'..');
 IF (check_sal2(p_id) IS NULL)
 THEN
   DBMS_OUTPUT.PUT_LINE('The function returned NULL due to exception, therefore employee does not exist!');
 ELSIF (check_sal2(p_id))
 THEN
   DBMS_OUTPUT.PUT_LINE('Employees salary > average of department '||emp_c_v.v_deptno||' where he belongs.');
 ELSE
   DBMS_OUTPUT.PUT_LINE('Salary < average of department '||emp_c_v.v_deptno||', where he belongs.');
 END IF;
 DBMS_OUTPUT.PUT_LINE('=====================================================');
END;

Initially i had only simple variables (v_...) declared in this sub-program but i wanted to make use of true cursor variables i.e like-pointers? i suppose. So i modified and defined a type of record and referenced a cursor "...IS REF CURSOR" for the variables or fields inside it. But when i compile this whole thing i get the error of invalid reference to variable "emp_c_v", why? I am still in the learning stages so sorry for talking nonsense. Thanks

A: A cursor is a pointer to a result set (sort of), not to an individual record. You can't ever modify a result set. In this case the pointer wouldn't actually point to anything as there isn't a result set (from a query) for it to point to.
Your code will almost compile if you drop the ref cursor and make your variable a record type; so instead of:
TYPE EmpCurTyp IS REF CURSOR;
emp_c_v EmpCurTyp;

use:
emp_c_v EmpRecTyp;

You've also missed a couple of places when changing your references:
   DBMS_OUTPUT.PUT_LINE('And calculated with annual salary is:->' ||v_comm_calc);

and
 FETCH c_city INTO v_city;

... both need the emp_c_v. prefix before v_comm_calc and v_city respectively.
I assume you're using this as a learning exercise, otherwise this could all be done much more simply.


text:
Q: How to add event listener to each cell in a table? Let's say I have a grid that looks like this (the numbers inside the cell is just for labeling, it could just be empty cells):

Written in HTML as follows:

        0
        1

        2
        3

There are two things that I would like to do:

*

*Add some JavaScript code that log the number of the cell to the console when each cell is clicked. Here is how I did it:

const cells = document.querySelectorAll('td');
for (var i = 0; i < cells.length; i++) {
  cells[i].addEventListener('click', function () {
    console.log(i);
  });
}

But the console always returns the value 4 wherever I click the table. My questions are:

*

*By adding cells[i].addEventListener in each iteration of the for loop, does it add an event listener for each cell?

*Why does the console always return 4 even if I clicked the cells[0], cells[\1], cells[2] or cells[3]?

*What should I do to make the console return the desired position in the array cells, i.e. return 0 if I clicked cells[0], return 1 if I clicked cells[\1], return 2 if I clicked cells[2], return 3 if I clicked cells[3]?

Next,

*The second thing that I would like to do is to change the colour of each cell depending on the colour that I chose from the colour picker as set by the HTML: <input type="color" id="colorPicker">
Here is how I did it:
const cells = document.querySelectorAll('td');
for (var i = 0; i < cells.length; i++) {
  cells[i].addEventListener('click', function () {
    const color = document.querySelector('#colorPicker').value;
    cells[i].style.backgroundColor = color;
  });
}

But the colour of the cell did not change.
I don't plan to use jQuery, I would just like to use basic JavaScript that add an event listener to each cell. I have tried to figure some ways out for hours but still clueless in the end. Could somebody please give some help? I really appreciate it, thanks!

A: Since i is incrementing then after the for loop is complete i == cells.length.
in place of...

for (var i = 0; i < cells.length; i++) {
  cells[i].addEventListener('click', function () {
    console.log(i);
  });
}

use...

for (var i = 0; i < cells.length; i++) {
  cells[i].addEventListener('click', function (e) {
    console.log(e.target);
  });
}

And the same for your latter example...

A: is because you use "i" variable on your callback. And "i" have value : 4 at the end of your loop, so when you click callback, your app use this last value.
Just change your code by :
const cells = document.querySelectorAll('td');
for (var i = 0; i < cells.length; i++) {
  console.log(cells[i].innerText);
  cells[i].addEventListener('click', (event) => {
    console.log(event.target.innerText); // Take the text node from the element who fire the click event.

    // If you don't want to use innerText, you can do like this.
        console.log(
           //We transform querySelectorAll to traversable array. Then we find index of current event target.
           Array.from(document.querySelectorAll('td')).findIndex(e => e === event.target)
        );

  });
}

And for you second case base on colorPicker :
const cells = document.querySelectorAll('td');
for (var i = 0; i < cells.length; i++) {
  cells[i].addEventListener('click', function (event) {
    const color = document.querySelector('#colorPicker').value;
    event.target.style.backgroundColor = color;
  });
}

live sample


text:
Q: Angular + Rails: Angular cannot find controller function Problem: I wrote an Angular / Rails app and when I attempt to access a Rails controller function from the Angular controller, I get an error: Uncaught TypeError: tasks.moveOrder is not a function, but all other functions on that page are available
tasks_controller.rb
def index
    respond_with Task.all
end

def create
    respond_with Task.create(task_params)
end

def destroy
    task = Task.find(params[:id])
    task.destroy

    respond_with task
end

def show
    respond_with Task.find(params[:id])
end

def moveOrder # This is the function that cannot be found
    task = Task.find(task_id)
    task.position = pos

    respond_with task
end

def up_completion
    task = Task.find(params[:id])
    task.increment!(:completion)

    respond_with task
end

def down_completion
    task = Task.find(params[:id])
    task.decrement!(:completion)

    respond_with task
end

private
def task_params
    params.require(:task).permit(:title, :completion, :importance, :steps, :clicked, :position)
end

Each of these functions have routes and each function is called through my angular controller:
MainCtrl.js
.controller('MainCtrl', [
'$scope',
'tasks',
function($scope, tasks){

    $scope.tasks = tasks.tasks;
    $scope.items = ['one', 'two', 'three'];

    $scope.addTask = function() {
        var taskPosition = tasks.tasks.length + 1;
        if(!$scope.title || $scope.title === '') { return; }
        tasks.create({ // This call to the .rb file works!
            title: $scope.title,
            importance: $scope.importance,
            completion: 0,
            steps: $scope.steps,
            clicked: false,
            position: taskPosition // puts position as field in db (needs to be updated when dragged)
        });
        $scope.title = '';
        $scope.importance = '';
        $scope.steps = '';
    };

    $scope.moveTask = function(start_pos, end_pos) {
        $.get( "http://localhost:3000/tasks.json" )
        .done(function( data ) {
                var task_id = data[start_pos].id;
                tasks.moveOrder(task_id, end_pos) // This call to the .rb file fails!
        });
    };

    ...

app.js
.config([
'$stateProvider',
'$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {

  $stateProvider

    .state('home', {
      url: '/home',
      templateUrl: 'home/_home.html',
      controller: 'MainCtrl',
            resolve: {
                taskPromise: ['tasks', function(tasks){
                    return tasks.getAll();
                }]
            }
    })

        .state('tasks', {
            url: '/tasks/{id}',
            templateUrl: 'tasks/_tasks.html',
            controller: 'TasksCtrl'
        });

  $urlRouterProvider.otherwise('home');
}]);

Is the function call failing because I wrote something incorrectly or is there some other issue altogether?

A: You should check the documentation for $resource. RESTful routes are provided (thus create, get, etc. will work), but you need to explicitly define additional actions, which you will map to the routes corresponding to the controller actions. You would do something like this:
app.factory('Tasks', ['$resource', function($resource) {
return $resource('/tasks/:id', null,
  {
    'moveOrder': { method:'POST', url: 'route_to_your_action' },
    'otherAction': { url: 'route_to_your_action' }
  });
}]);


text:
Q: Typescript switch case with union type Given the following enum and types:
export enum MessageType {
  Text = 'TEXT',
  Image = 'IMAGE',
  Pdf = 'PDF',
  File = 'FILE',
}

export type MessageMediaType = MessageType.Image | MessageType.Pdf | MessageType.File;

export interface MessageText {
  type: MessageType.Text;
  // ...
}

export interface MessageMedia {
  type: MessageMediaType;
  // ...
}

How can I switch case If I want to achieve something like:
switch(message.type) {
  case MessageType.Text: // do something if its a Text Message
    break;
  case MessageMediaType: // do something if its a Media Message - DOES NOT WORK
    break;
  // possible more cases ...
}

However the case MessengerMediaType does not compile in Typescript.
'MessengerMediaType' only refers to a type, but is being used as a value here.
Is there a more better solution than:
switch(message.type) {
  case MessageType.Text:
    // do something if its a Text Message
    break;
  case MessageType.Image:
  case MessageType.Pdf:
  case MessageType.File:
  // do something if its a Media Message
    break;
  // here are more cases but I left it out for simplicity.
}

Whats bothering me is that i have defined the union type MessageMediaType so I though I can reuse it in the switch case.
How can I achieve this, or any good workaround?


text:
Q: POSTMAN: Get Generated Request in test to compare to Response I am using some of the auto generated parameters in my request body in a postman request(i.e: {{$guid}}).
I would like in my test to retrieve the request that was sent to the server to compare what this variable value was, and what the response parroted back to me me in my request.
for example, my request's body looks like this:
{
 "Description": "testing this {{$guid}}"
}

and I would in the tests be able to do:
var req = JSON.parse(requestBody);
var resp = JSON.parse(responseBody);
test['description should match'] = req.Description === resp.Description;

is this doable?

A: This is possible.
But you have several small syntax errors.
To access the request body data use:
var req = JSON.parse(request.data);
I named the variable req to not be confused with the predefined request variable. You can log the result like this:
console.log(req.Description);
In the tests tab make sure you reference the correct variable tests with "s". Also you pass the test case name as a string e.g. "description should match".
var res = JSON.parse(responseBody);
console.log(res.Description);
tests["description should match"] = req.Description === res.Description;


text:
Q: how to connect DJANGO app to AWS RDS connected to a bastion via SSH Is there a way to connect Django to a private RDS connected to a bastion via SSH?
My current AWS infrastructure has a EC2 Bastion in a public subnet and two private subnets where postgres RDS DB reside.
DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "NAME": "aaaa",
        "USER": "bbbb",
        "PASSWORD": "cccc",
        "HOST": "xxx.zzz.us-east-z.rds.amazonaws.com", # RDS Endpoint
        "PORT": 5432,
    }
}

using the terminal i can ssh into the bastion and check the connection with RDS, OK.
Now i want to connect Django settings above to RDS so:

*

*i connected my RDS to https://dbeaver.com/ software (result say: connected!)

*On Django side now when I edited the settings.py above with the AWS RDS credentials
and started django python manage.py runserver i receive the following error:

django.db.utils.OperationalError: could not translate host name "xxx.zzz.us-east-z.rds.amazonaws.com" to address: nodename nor servname provided, or not known.
My expectation was that since the DBeaver software is connected to my private RDS, i would be able to connect Django to the RD instance. (I have used this approach with a public RDS)
Is there something that i am missing on the approach?

A: This is a DNS issue. If you use the IPs to connect, you will probably resolve this.
But if you need name resolution to the database, I would suggest that you run django in AWS as well to use the private dns resolution.

A: You need to create an SSH tunnel using putty or SSH clients
https://www.skyverge.com/blog/how-to-set-up-an-ssh-tunnel-with-putty/
then connect to Django  using the link below
https://gist.github.com/mhulse/1954422


text:
Q: 64-bit program segmentation fault on HP-UX PA RISC I am using 3  HP-UX PA RISC  machines for testing. My binary is failing on one PA RISC machine where as others it working. Note that, even though binary is executed with version check i.e. it just print version and exit and don't perform any other operation , still binary is giving segmentation fault. what could be probable reason for Segmentation fault. It is important to me to find out root cause of the failure on one box. As program is working on 2 HP-UX, it seems that it is environment issue?
I tried to copy same piece of code (i.e. declare variables, print version and exit) in test program and build with same compilation options but it is working. Here is gdb output for the program.
$ gdb prg_us
Detected 64-bit executable.
Invoking /opt/langtools/bin/gdb64.
HP gdb 5.4.0 for PA-RISC 2.0 (wide), HP-UX 11.00
and target hppa2.0w-hp-hpux11.00.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.4.0 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
..
(gdb) b  5573
Breakpoint 1 at 0x4000000000259e04: file pmgreader.c, line 5573 from /tmp/test/prg_us.
(gdb) r -v
Starting program: /tmp/test/prg_us -v

Breakpoint 1, main (argc=2, argv=0x800003ffbfff05f8) at pmgreader.c:5573
5573       if (argc ==2 && strcmp (argv[1], "-v") == 0)
Current language:  auto; currently c++
(gdb) n
5575           printf ("%s", VER);
(gdb) n
5576           exit(0);
(gdb) n

Program received signal SIGSEGV, Segmentation fault
  si_code: 0 - SEGV_UNKNOWN - Unknown Error.
0x800003ffbfb9e130 in real_free+0x480 () from /lib/pa20_64/libc.2
(gdb)

What should be probable cause? why it is working on one and not on another?

A: Just a long shot - are you including both stdio.h and stdlib.h so the prototypes for printf() and exit() are known to the compiler?
Actually, after a bit more thought (and noticing that C++ is in the mix), you may have some static object initialization causing problems (possibly corrupting the heap?).
Unfortunately, it looks like valgrind is not supported on PA-RISC - is there some similar tool on PA-RISC you can run?  If not, it might be worthwhile running valgrind on an x64 build of your program if it's not too difficult to set that up.

A: Michael Burr already hinted at the problem: it's a global object.
Notice that the crash is from a free function. That indicates a memory deallocation, and in turn a destructor. This makes sense given the context: global destructors run after exit(0). A stack trace will show more detail.


text:
Q: Confirmation of Proof: $f(x)= x^5 - x - 16$ has at most three real roots. I've been struggling to find a way to solve this question for a while now.
I can prove that there is at least one real root using IVT but have no idea how to prove that there can exist more.
Currently my idea is to prove that there cannot be $5$ real roots somehow and then I can say that as complex numbers come with conjugates, there cannot only be one complex root and so there can be at most $3$ real roots.
I had another idea to assume that there are at most $2$ real roots. Then use the fact that complex conjugates come in pairs to say there must be at most 3 roots as we have already shown there are at least $2$. But then there would be nothing to account for if there are $5$ real roots.
Am I just overthinking this and there's an easier way to go about it?

A: We can actually do this directly. Note that between each pair of adjacent but distinct real roots, the polynomial must have a local maximum or a local minimum, since it has to turn around to get back to zero. Thus between each pair of adjacent and distinct real roots, the derivative of $f$ has a real root. So let's look at $f'(x)=5x^4-1$. We can see immediately that this has the four fourth roots of $\frac{1}{5}$ as its roots: $\frac{1}{\sqrt[4]{5}}$, $\frac{i}{\sqrt[4]{5}}$, $\frac{-1}{\sqrt[4]{5}}$, $\frac{i}{\sqrt[4]{5}}$. Since only two of these are real, $f$ can only have at most three distinct real roots.
All that remains is to check that $f$ has no repeated roots. We can do this by checking that $f$ and $f'$ are relatively prime. Dividing $f$ by $f'$, we get $f(x)=f'(x)(\frac{1}{5}x) -\frac{4}{5}x - 16$.
Then since the remainder is linear, it divides $f'$ if and only if they share a root, but the root of $-\frac{4}{5}x-16$ is the same as the root of $x+20$, and we know $-20$ is not a root of $f'(x)$. Thus $f$ and $f'$ are relatively prime, so $f$ has no repeated roots.
Hence $f$ has at most three real roots.

A: You can use Descartes' Sign Rule. http://mathworld.wolfram.com/DescartesSignRule.html

For positive roots, start with the sign of the coefficient of the lowest (or highest) power. Count the number of sign changes n as you proceed from the lowest to the highest power (ignoring powers which do not appear). Then n is the maximum number of positive roots. Furthermore, the number of allowable roots is n, n-2, n-4, ....
...For negative roots, starting with a polynomial f(x), write a new polynomial f(-x) with the signs of all odd powers reversed, while leaving the signs of the even powers unchanged. Then proceed as before to count the number of sign changes n. Then n is the maximum number of negative roots.

$$f\left( x \right) = {x^5} - x - 16$$
^^^ 1 sign change, so there is a maximum of 1 positive, real roots.
$$f\left( { - x} \right) = {\left( { - x} \right)^5} - \left( { - x} \right) - 16 =  - {x^5} + x - 16$$
^^^ 2 sign changes, so there is a maximum of 2 negative, real roots. So there are a maximum of 2+1 = 3 real roots.
Here's a proof of Descartes' Rule of Signs.

A: If it has more than $3$ it has $5$, since complex roots come in conjugate pairs...
So multiply $(x-a)(x-b)(x-c)(x-d)(x-e)$ and check the implications...

A: Using change of sign rule,
I.e, 1) number of positive roots of a polynomial equation p(x) cannot exceed the number of changes in the signs of given equation p(x).
2) number of negative roots of a polynomial equation cannot exceed the number of changes in the signs of equation obtained by p(-x)
Applying this, we have atmost 1 positive and 2 negative roots of given equation.
So the equation cannot have 5 real roots.

A: Just to give a different approach tailored to the specific polynomial in question, note that
$$f(x)=x^5-x-16=x(x^4-1)-16$$
If $x\lt-1$, then $x(x^4-1)\lt0$, so $f(x)\lt-16\lt0$. for all $x\in(-\infty,-1)$. If $|x|\le1$, then $|x^4-1|\le1$ as well, so $|x(x^4-1)|\le1$, hence $f(x)\le-15\lt0$ for all $x\in[-1,1]$. Finally, if $x\gt1$, then $x(x^4-1)$ is positive and strictly increasing, hence can (and does) take the value $16$ exactly once. Thus $f(x)=x^5-x-16$ has exactly one real root, and that real root lies in $(1,\infty)$.


text:
Q: Displaying the title based on slider item that is in center I have a slider (owl slider - https://owlcarousel2.github.io/OwlCarousel2/index.html) . The slider has images as items, displaying 3 items per slide. Above the slider I have a title which will change when certain item from the slider is active.

  PROJECT PARTNERS

How can I do this?

A:  $('.partners').owlCarousel({
     center: false,
     items: 1,
     loop: false,
     autoWidth: true,
     margin: 70,
     responsive: {
         600:{
             items:3,
             autoWidth: true,
             margin:200
         }
     },
     onChange: function (event) {
         console.log(event);
         if (event.item.index == 2) {
             $("h6").text("chnaged title");
         }
    }
})

https://jsfiddle.net/vdqj60a5/1/


text:
Q: Implementing low-power variable resistance measurement I am looking to implement a small coin cell operated circuit that uses a microcontroller, a current source and an op-amp to measure a variable resistance between 10 Ω and 1 MΩ. In order to implement this, I've made a preliminary schematic to outline which parts to use, in no way final or fully specified (resistor values to be calculated / determined).
I have used a PMOS to turn the entire circuit on via a momentary switch, as I would like the circuit to show information on a small OLED screen (not in the schematic) while the button is pressed.
The button press supplies a VDD of 3 V to the MCU, op-amp, and current source. The resistor, specified by R-top and R-bottom, can be within another circuit which is already powered on, and therefore the entire sense circuit should be off and "disconnected" from the resistor (hence the two N-MOSFETs). The things I am wary about in the circuit:

*

*10 Ω - 1 MΩ is a very large range; I plan on using a microcontroller with a 10 bit ADC at 3 V or 12 bit ADC at 1.2-1.8 V. Which op-amp configurations should I look at? Which op-amp would be a good fit for this purpose (I am thinking low voltage, rail-to-rail)? Would a log op-amp be better in this case (considering they seem to use many more pins / this circuit should be battery operated)?

*Will the two NMOSFETs properly allow the measurement of the resistor? I am unsure if the drain-source potential difference will be enough to keep them conducting / provide a low resistance path, low enough for a measurement out of the op-amp.

*I am unsure if there are better ways to implement this, or if there are better ICs available specifically for this purpose.

A: As stated by jp314, you absolutely must specify the required precision everywhere in your range. You also must specify the required sample rate.
If your only requirement is 10 - 1M ohm , with 10 ohm absolute precision (i.e. 10 ppmFS resolution or ~17 bits) and low sample rate, a very simple way is the following:
Pass a constant current through your resistor and buffer the voltage dropped across it with a simple op amp follower. Then convert the voltage using a single comparator into a pulse density stream (poor man's delta-sigma modulation), which you can read directly with your MCU.

A: You can also use an integrator with a reset pulse.
You need just "count" until a programmed level. Calibration would obviously be needed. Don't forget to make a self-calibration of the voltage power supply as a reference before measuring.
As it is powered by a small battery, I would add also a Tx 433MHz for transmitting data to a remote receiver, on a regular time basis ... or when pressing a button, then going to a very low current "sleep mode".


text:
Q: How to configure buildspec.yml in AWS CodeBuild for MERN stack app I have configured CodePipeline in aws for MERN stack app. When I deployed the artifacts to beanstalk, I'm getting this error.
Instance deployment failed to generate a 'Procfile' for Node.js. Provide one of these files: 'package.json', 'server.js', or 'app.js'. The deployment failed.
MERN App structure

buildspec.yml
version: 0.2

phases:
  install:
    commands:
      - echo Installing Node 14...
      - curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
      - apt install -y nodejs
      - echo Installing Yarn...
      - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
      - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
      - apt install --no-install-recommends yarn
  pre_build:
    commands:
      - echo Installing root dependencies
      - yarn install
      - echo Installing frontend dependencies
      - yarn --cwd frontend install
  build:
    commands:
      - echo Building...
      - yarn --cwd frontend run build
artifacts:
  files:
    - '**/*'
  discard-paths: no
  base-directory: frontend/build

I'm providing frontend/build directory as base-directory. What is the reason for this error ?


text:
Q: Command line program invoked as a "slave" considered dynamically linked? I'm trying to get clarification on exactly what dynamically linked means. I understand if my program links to a separate .dll and makes function calls at run time, that's dynamically linked. But say my program invokes a separate .exe via command line. That .exe can act as a slave by passing "-slave" in the command line and a handle to a window in my app which it communicates to. My program then sends it commands, for example: -dothis or -dothat and the output is sent to my program's window. Is that considered dynamically linked?
I ask because the .exe I'm using via command line is an open-source GPL program and my program is not. My understanding is that if I don't actually link to any GPL libraries, I'm not in violation of the license.
Thanks

A:
Is that considered dynamically linked?

No. You are dynamically linking to another program only if you load its code in your own process's address space.
Your suggested solution of running the GPLed program as a separate process and then communicating with it using standard IPC facilities is exactly how this problem is solved in the field.