text:
Q: How to expand lists nested in DataFrame columns to their own columns I've just started working with the Pandas library for Python, and I've hit upon a problem that I can't work out.
dictionary = {key:list}
series = pd.Series(dictionary)
dataframe = pd.DataFrame(series)
print(dataframe)

So the output is:
    0
key list
key list
key list
key list

I want to get that list and have every value in the list have it's own column like this:
       0    1    2    3    4
key val0 val1 val2 val3 val4
key val0 val1 val2 val3 val4
key val0 val1 val2 val3 val4
key val0 val1 val2 val3 val4

How would I go about doing this?

A: You can directly create the DataFrame from the dictionary, but when creating that, the keys would become the column and 0/1 , etc would become the indices, if you want it the other way round - keys as indices and 0/1 , etc as columns - you can then take its transpose.
Please note, all keys should have same amount of elements in the lists.
Code -
dataframe = pd.DataFrame(dictionary).T

Example/Demo -
In [1]: import pandas as pd

In [2]: d = {'key1':[1,2,3,4],'key2':[2,3,4,5],'key3':[3,4,5,6]}

In [3]: df = pd.DataFrame(d).T

In [4]: df
Out[4]:
      0  1  2  3
key1  1  2  3  4
key2  2  3  4  5
key3  3  4  5  6

A: One way you can accomplish this is to skip creating a pandas series altogether and just go right to a DataFrame, then transpose the dataframe:
In [1]: import pandas as pd

In [2]: dict = {1: ['val0', 'val1', 'val2', 'val3', 'val4'],
   ...:         2: ['val0', 'val1', 'val2', 'val3', 'val4'],
   ...:         3: ['val0', 'val1', 'val2', 'val3', 'val4'],
   ...:         4: ['val0', 'val1', 'val2', 'val3', 'val4']}

Read the dictionary into the DataFrame, then transpose it with .T, or with transpose():
In [3]: df = pd.DataFrame(dict).T

In [4]: df
Out[4]:
      0     1     2     3     4
1  val0  val1  val2  val3  val4
2  val0  val1  val2  val3  val4
3  val0  val1  val2  val3  val4
4  val0  val1  val2  val3  val4


text:
Q: groovy quoted function identifiers Groovy allows a quoted function identifier such as
def "my cool method"()
{
    "foo"
}

but I can't find this in the specification. Is it a groovy feature or maybe some lib relies on quotes being used in identifiers? Or is it an omission in the official doc?

A: It is an integral part of Groovy to be able to do this. If it is missing in the documentation, then it is a documentation bug at most. Basically the same as written at http://groovy-lang.org/syntax.html#_quoted_identifiers is also valid for function names.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Europa Universalis IV: Keeping Army Tradition HIgh I just did a difficult economical-challenged achievement (Lucky of the Irish as kildore).
It was difficult in the early years to keep army tradition higher than 10-25ish Army Tradition.
I was wondering is there an easier first 4 at most idea group order that can reach at least 50ish army tradition hovering ignoring National Ideas (Like Prussian .5 bonus to Army Tradition).
Requirements:
+Two military ideas in three or four first idea groups at most
+possible use of policies is ok
+Assuming western tech group country
+assume National Idea will not contribute one way or another to army tradition
+stuff that indirectly reduce boost army tradition like building cost and less maintenance is ok
+Assume growing tall gameplay with few war or mostly defensive mentality
+reach hovering 50 army tradition or higher
+assume this country will either start small or medium (One province up to 30ish) and grow to afford +1/2 advisers across the board
+idea group obviously have to be practical like second idea is military to avoid falling behind
+ideally doable before 1600 (Thirty Years' War)
+fewer monarchy points used the better
I know it is possible to reach 100% hovering (did it for an achievement) but it requires lot of idea group picks to be practical in every possible situation.

A: Duh, I already could figure out the answer myself. I will post here for anyone else who are curious.
At the most you only need 1200 military monarch points + lot of admin to unlock the third idea group slot.
With updated one fort per each 50 development. You get one army tradition per month.
With defensive and quality. You get two army tradition per month from each. Be sure to pick another diplomacy or admin idea group in between.
No policies necessary.
With decay of 5 percent each month. You will hover at 60 army tradition.
Monthly army tradition divide by decay percent = hovering army tradition.
3/.05 = 60


text:
Q: Gnuplot "vector line" I am trying to generate a plot which uses arrows as markers in Gnuplot. These arrows I want to turn in a specific angle which I know. So I have value triples of x1 ... xn, y1...yn, alpha1...alphan. Sorry, I wasn't able to include a pic from my hard drive to illustrate what I want to achieve.
Basically, for every (15th or so) x-y pair, the marker should be an arrow which uses a certain angle.
The measured data is tightly packed so I suppose I will have to define an increment between the markers. The length of the arrow can be the same all over.
I would appreciate your ideas.

A: Gnuplot has a plot mode with vectors that is what you want
Given that your file has the following format, x y angle and assuming that
your angle is in radians, you have to take into account that

*

*with vectors requires 4 parameters, namely x y dx dy where dx
  and dy are the  projections of the lenght  of the arrow.

*this draws only the arrows, if you want a line you have to make
  two passes on the data.

*you want to draw an arrow for a data point over, say, 10 points.
That said, I'd proceed like this
dx(a) = 0.2*cos(a) # 0.2 is an arbitrary scaling factor
dy(a) = 0.2*sin(a)
# this draws the arrows
plot 'mydata.dat' every 10 using 1:2:(dx(a)):(dy(a)) with vectors
# this draws the line
plot 'mydata.dat'

You may want to use help plot to find the detailed explanation of all the parameters that you can apply to a with vectors plot.
Credits: An article on the gnuplotting site


text:
Q: Where does the t.GUID value come from in my RegisterFunction(Type t) Where does t.GUID value come from on Type t. If I set the GUID in Visual Studio 2017, under the Project menu, Solution Properties, Application tab, Assembly Information, does that get associated with the t.GUID?

A: From the .NET "Type" reference:

A GUID is associated with a type using the GuidAttribute attribute.

Where the GuidAttribute is applied to your class as follows:
[GuidAttribute("EE2BFDAD-CB79-494F-978E-1171B1FA131F")]
public class MyClass
{
}

The docs also say:

Supplies an explicit Guid when an automatic GUID is undesirable.

So if no GUID is assigned then one is automatically assigned.
The GUID in your assembly information is for identifying your assembly as opposed to an individual Type.


text:
Q: wifstream.tellg() advancing position in the stream? I've been doing some basic file manipulations with iostreams in Visual Studio 2015 and noticed this weird behavior.
#include <fstream>
#include <iostream>
#include <sstream>

void main(int argc, char** argv)
{
    std::wifstream stream("example.txt");
    //std::ifstream stream("example.txt");
    //std::wstringstream stream(L"abcdefghijklmnopqrstuvxyz");

    std::wcout << (char)stream.peek() << "\n"; // a
    stream.tellg();
    std::wcout << (char)stream.peek() << "\n"; // b
    stream.tellg();
    std::wcout << (char)stream.peek() << "\n"; // c
    stream.tellg();
    std::wcout << (char)stream.peek() << "\n"; // d
    stream.tellg();
    std::wcout << (char)stream.peek() << "\n"; // e
    stream.tellg();
    std::wcout << (char)stream.peek() << "\n"; // f
    stream.tellg();
    std::wcout << (char)stream.peek() << "\n"; // g
    stream.tellg();
}

example.txt contains:
abcdefghijklmnopqrstuvxyz

It seems like stream.tellg() advances the stream's current character by one. This happens only for std::wifstream. std::ifstream and std::wstringstream seem not to be affected.
Is this a bug in visual studio stl implementation?

A: This issue is similar with wifstream/wfstream implementation bug in Visual C++ 2010.
As Stephan said:

C++ Standard does not provide behavior guarantees when calling tellg()
  on a file opened in text mode.

I guess that's the cause.


text:
Q: How to replace key/value pairs in an object of two arrays of objects I would like to replace the key 'id' and it's value with the property of 'type' with a value of 'inc'or 'exp'. I also want to delete the property 'percentage' from the objects in the exp array.
In the end I want to merge al the objects into one array.
This is what I did, it has the desired outcome but there must be a shortcut to achieve this, with less code and cleaner. Thanks!
const list = {
     exp: [
       { id: 0, value: 57, percentage: 12 },
       { id: 1, value: 34, percentage: 10 },
    ],
     inc: [
       { id: 1, value: 18 },
       { id: 1, value: 89 },
    ],
};

// Deep copy of list object
let newList = JSON.parse(JSON.stringify(list));

// Destructuring
const { exp, inc } = newList;

for (let obj of exp) {
  obj.type = "exp";
  delete obj.id;
  delete obj.percentage;
}

for (let obj2 of inc) {
  obj2.type = "inc";
  delete obj2.id;
}

//Spread operator
newList = [...newList.exp, ...newList.inc];
console.log(newList);

A: You could use flatMap in the support of Object.entries()

const list = {
  exp: [
    { id: 0, value: 57, percentage: 12 },
    { id: 1, value: 34, percentage: 10 },
  ],
  inc: [
    { id: 1, value: 18 },
    { id: 1, value: 89 },
  ],
};

const res = Object.entries(list).flatMap(([type, values]) =>
  values.map((value) => ({
    value: value.value,
    type: type,
  }))
);

console.log(res);

Step by step
A = Object.entries(list)

// -->

[
  [
    "exp",
    [
      { "id": 0, "value": 57, "percentage": 12 },
      { "id": 1, "value": 34, "percentage": 10 }
    ]
  ],
  [
    "inc",
    [
      { "id": 1, "value": 18 },
      { "id": 1, "value": 89 }
    ]
  ]
]

B = A.map(...)

// -->

[
  [
    { "value": 57, "type": "exp" },
    { "value": 34, "type": "exp" }
  ],
  [
    { "value": 18, "type": "inc" },
    { "value": 89, "type": "inc" }
  ]
]

C = B.flat()

// -->

[
  { "value": 57, "type": "exp" },
  { "value": 34, "type": "exp" },
  { "value": 18, "type": "inc" },
  { "value": 89, "type": "inc" }
]

flatMap is the combination of step B and C (.map then .flat)

A: If value is the only property you want:

const list = {
  exp: [
    { id: 0, value: 57, percentage: 12 },
    { id: 1, value: 34, percentage: 10 }
  ],
  inc: [
    { id: 1, value: 18 },
    { id: 1, value: 89 }
  ]
};

const newList = [];
const types = Object.keys(list);
types.forEach((type) => {
  list[type].forEach(({ value }) => {
    newList.push({ type, value });
  });
});

console.log(newList);
console.log(JSON.stringify(newList));


text:
Q: 'except ValueError' is not executing I am trying to ask the user for a string only but whenever the user types an integer or a float, it does not execute the except ValueError code.
Here is my code:
word = input('Enter a string.')

try:
    word1 = str(word)
    print(word1)
    print(type(word1))
except ValueError:
    print('The value you entered is not a string.')

A: The function input always returns a string. you can check if the input is a number in one of the following ways:
Use build in methods in str Class:
word = input('Enter a string.')

# Check if the input is a positive integer without try except statements:
if word.isnumeric():
    # The word contain only numbers - is an positive integer.
    print("positive int")

Try convert the variable in try expect statement:
word = input('Enter a string.')

# Check if the input is a positive integer with try except statements:
try:
    word = float(word)
    print("the input is a float")

except ValueError:
    print("the input is a string")

A: *

*input() function in python always takes input as string only. So your code will never throw an exception.
The valueError will catch the error in this case ->  int(word). Where word does not contain a pure number.

*Always include your statements in double-quotes. Eg.
input("Enter the name: ")
Good, you asked this doubt. It's always good to ask for mistakes.

A: By defaults input function in python consider your input as "string "  whatever enter code hereyou type it is string .
for converting your input into integer you have to type this code .
word = int(input('Enter a string.'))

try:
    word1 = str(word)
    print(word1)
    print(type(word1))
except ValueError:
    print('The value you entered is not a string.')

In this case your code is working .


text:
Q: Swift not calling class init method on CAGradientLayer I have an Objective-C subclass of 'CAGradientLayer' that overrides the '+ (CAGradientLayer *)layer' initializer.  It is correctly included in my Bridging-Header
#import "ONCGradientLayer.h"

@implementation ONCGradientLayer

+ (ONCGradientLayer *)gradientLayer {
    return [ONCGradientLayer layer];
}

+ (ONCGradientLayer *)layer {
    ONCGradientLayer * layer = [super layer];
    layer.colors = @[(id)[[UIColor colorWithWhite:0.0 alpha:1] CGColor], (id)[[UIColor colorWithWhite:0.1 alpha:1] CGColor]];
    layer.startPoint = CGPointMake(0, 0);
    layer.endPoint = CGPointMake(0, 1);
    return layer;
}

This all works as expected from Objective-C, by calling either [ONCGradientLayer layer] or [ONCGradientLayer gradientLayer]
When I try to call it from swift, I'm given a compiler warning that the method has been renamed init, so I must call ONCGradientLayer() This, however, does not work, and the overridden initializer is never called.
I can work around this by adding a differently named initializer :
+ (ONCGradientLayer *)swiftInit {
    return [ONCGradientLayer layer];
}

I can successfully called that in swift using ONCGradientLayer.swiftInit()
What is going on that prevents me from calling ONCGradientLayer() and getting the overridden initializer?
UPDATE :
I can make the ONCGradientLayer() work by refactoring it to use the init method, though I'm still curious why the other approach does not work.
- (instancetype)init {
    if (self = [super init]) {
        self.colors = @[(id)[DEFAULT_BACKGROUND_COLOR CGColor], (id)[[UIColor colorWithWhite:.1 alpha:1] CGColor]];
        self.startPoint = CGPointMake(0, 0);
        self.endPoint = CGPointMake(0, 1);
    }
    return self;
}

A: It's all about a Swift component called the Clang Importer. It is responsible for translating Objective-C method names into Swift method names (and vice versa).
The Clang Importer assumes that if an Objective C class has a class method with the same name as the class except for the prefix and the lowercasing, possibly extended by with, it is a class factory method.
It also assumes that a class factory method is the same effectively as the initializer whose name is constructed the same way, and hides the corresponding factory method completely, because with ARC there is no meaningful difference between the two.

EXAMPLE: NSString has factory method stringWithFormat: and initializer initWithFormat:.
Well, string is the same as NSString stripped of its prefix and lowercased; so the Clang Importer assumes that stringWithFormat: is a factory method. Moreover, it is constructed just like initWithFormat:, so the Clang Importer assumes they are effectively the same, and hides the former.
Therefore you have to say String(format:), meaning String.init(format:), in Swift. [The Clang Importer also strips the with, but that's another story.] There is no String.withFormat(_:) (or similar) in Swift, matching Objective-C stringWithFormat:.

That is exactly the situation with your ONCGradientLayer and gradientLayer. Your class method follows the class factory method naming convention.  Therefore, thanks to the Clang Importer, if there is an init — and there is — then the class factory method is hidden. Therefore you have to call init instead, saying ONCGradientLayer() in Swift.
But you didn't define init to return a modified ONCGradientLayer, so the result is a plain layer without your modifications.
If you don't like that, you have two choices. And you already discovered what they are!

*

*Change the class factory name, to e.g. makeGradientLayer. (That is exactly what you did by supplying the name swiftInit.)

*Or, define init to return a ONCGradientLayer modified in the same way as you did in layer. (That is what you did too.)


text:
Q: Objetos dentro de un array en JavaScript -> generar un nuevo array con propiedades del objeto anidado Cómo están. Tengo un problemón que ya no sé si es conceptual o porque soy muy nueva y entiendo todo por la mitad. Teniendo este objeto literal :
const persona = {
nombre: 'Fulano',
apellido: 'DeTal',
peliculas: [{titulo: 'Yo Robot', director: 'Alex Proyas'}, {titulo: 'IA', director: 'Steven Spilberg'}],

nombresDePeliculas(){
MÉTODO QUE TODAVÍA NO PUEDO DESCRIFRAR
}
};

En el método nombresDePeliculas debe generar un nuevo array solamente con los títulos de las películas que se encuentran dentro del array 'películas'. Intenté varias cosas, el último código al que llegué es el siguiente:
let listado = [];
for (let libro of objeto.libros){
 listado = objeto['libros']['titulo'].push(libro)
  }
return listado;

}
En la consola me figura este mensaje: Cannot read property 'push' of undefined.
Sospecho que estaría teniendo un desencuentro conceptual y de sintaxis en algún lado, probé métodos for tradicionales, intenté con un map, pero en ningún caso lo conseguí. Busqué en diferentes tutoriales (en video y demás) pero no encontré nada. Este es un pedido desesperado de ayuda, tuve pesadillas toda la noche con este código, jajajajaja.
Desde ya, muchas gracias por la atención :)

A: El método .map() recorre un arreglo y devuelve uno nuevo, donde cada elemento es el valor devuelto internamente, por ejemplo:
// El primer parámetro es el que usarás para acceder a cada elemento
persona.peliculas.map(function(pelicula) {
    // El valor que devuelvas aquí es lo que contendrá
    // cada elemento del nuevo arreglo
    return pelicula.titulo;
});

Usando funciones flecha se puede resumir a una sola línea.
persona.peliculas.map(pelicula => pelicula.titulo);

Sintaxis Básica: Un parámetro. Con una expresión simple no se necesita return

const persona = {
    nombre: 'Fulano',
    apellido: 'DeTal',
    peliculas: [
        {titulo: 'Yo Robot', director: 'Alex Proyas'},
        {titulo: 'IA', director: 'Steven Spilberg'}
    ],
    nombresDePeliculas() {
        // Esto es un método de objeto
        // -- Se usa this para acceder a otras propiedades
        // Crear arreglo nuevo con solo título de película
        return this.peliculas.map(pelicula => pelicula.titulo);
    }
};

// Comprobar funcionamiento
console.log(persona.nombresDePeliculas());

Por otra parte, no es recomendable crear directamente las propiedades de un objeto en la forma que lo estás haciendo, porque no permite flexibilidad. Lo apropiado es crear una clase que se pueda inicializar con datos específicos para cada elemento. Pero supongo que el código que pusiste es solo un ejemplo y posteriormente lo adaptarás a un ejercicio más adecuado.

A: No sé cómo habrás codeado el .map, pero a mi me funciona esto:
nombre: 'Fulano',
apellido: 'DeTal',
peliculas: [{titulo: 'Yo Robot', director: 'Alex Proyas'}, {titulo: 'IA', director: 'Steven Spilberg'}],
nombresDePeliculas() {
  return this.peliculas.map((pelicula) => {
    return pelicula.titulo
  })
}
}
console.log(persona.nombresDePeliculas()) ```

Espero te sirva y dejes de tener pesadillas ;)

Un saludo


text:
Q: (Laravel 5.6, vue) Axios 401 error with PUT,POST,PATCH on Safari Using only Safari (latest version High Sierra) I get a 401 error on every request that is not GET.
I tested the options request with postman and it returns a 200 OK response.
The problem is that the Authorization header is not sent.
This is the request:
safari request and response
I tested it on Chrome, Firefox, and Opera and it works.
Here's the code, note that I'm not using the short version of axios(.post,.get) as described here
      let url = (edit)?'/api/things/'+vm.nthing.id:'/api/things';
      let method = (edit)?'patch':'put';

      axios({
        method:method,
        url:url,
        headers:vm.headers,
        data:{
          final: vm.nthing.final,
          note: vm.nthing.note
        }
      })
      .then(res=>{
        //Some modal stuff
      })
      .catch(err=>{
        console.log(err);
      });

The headers var is:
headers:{
    "Authorization":"Bearer "+this.$auth.getToken()
  },

A: Ok so apparently objects with a string property are ignored in Safari, so the authorization element in the header was never passed, hence the 401 error.
Doesn't work
let headers={
 "Authorization":"abcdef...."
}

Works
let headers={
 Authorization:"abcdef...."
}

Also be careful about trailing slashes in axios's url.


text:
Q: sql server: How can I show show category name although there is no record exisits Can anyone help me to find a way to show category name, age, and total number of 0 even if there is no record exists? Now when I run the below SQL, it returns nothing. Thanks.
SELECT
 'ADMISSION: ' AS CATEGORY_NAME
 ,AGE
 ,COUNT(ID) AS COUNTS
 FROM table
 GROUP BY AGE

A: Leave out the GROUP BY:
SELECT 'ADMISSION: ' AS CATEGORY_NAME,
       COUNT(ID) AS COUNTS
FROM admission;

An aggregation query with no GROUP BY always returns one row.  If you have a GROUP BY, then such a query will return no rows for an empty table (or if all rows are filtered out).
Also COUNT() doesn't return NULL.  It returns 0 in this case.


text:
Q: How to deal with Ajax data not arrive yet? I have a chart that contain

<script type="text/javascript">

console.log('{{ $cpe_mac }}');

var ajax = $.ajax({url: '/api/timebase/'+'{{ $cpe_mac }}'});
ajax.done(function (data) {

console.log(data)

var array_hour_g_down = [];
var array_hour_g_up = [];
var array_hour_p_down = [];
var array_hour_p_up = [];

for (var i = 0; i < data.hour_g_up.length; i++) {

    array_hour_g_down[i] = {"value":data.hour_g_down[i]};
    array_hour_g_up[i]   = {"value":data.hour_g_up[i]};
    array_hour_p_down[i] = {"value":data.hour_p_down[i]};
    array_hour_p_up[i]   = {"value":data.hour_p_up[i]};

}

var granular_time_network_day = new FusionCharts({
    "type": "msstackedcolumn2d",
    "renderAt": "granular-time-network",
    "width": "100%",
    "dataFormat": "json",
    "dataSource": {
        "chart": {
            "caption": "Time-Based Bandwidth Usage",
            "subcaption": "Daily View",
            "xaxisname": data.month + ' ' + data.dth + ',' + ' '+ data.year,
            "yaxisname": "Bandwidth (in Megabytes)",
            "paletteColors": color_home_down+','+color_home_up+','+color_guest_down+','+color_guest_up,
                    // "numbersuffix": "MB",
                    "showvalues": "0",
                    "bgColor": "#ffffff",
                    "borderAlpha": "20",
                    "showCanvasBorder": "0",
                    "usePlotGradientColor": "0",
                    "plotBorderAlpha": "10",
                    "legendBorderAlpha": "0",
                    "legendShadow": "0",
                    "valueFontColor": "#ffffff",
                    "showXAxisLine": "1",
                    "xAxisLineColor": "#999999",
                    "divlineColor": "#999999",
                    "divLineDashed": "1",
                    "showAlternateHGridColor": "0",
                    "subcaptionFontBold": "0",
                    "subcaptionFontSize": "14"
                },
                "categories": [{
                    "category": [{
                        "label": "12am-2am"
                    }, {
                        "label": "2am-4am"
                    }, {
                        "label": "4am-6am"
                    }, {
                        "label": "6am-8am"
                    }, {
                        "label": "8am-10am"
                    }, {
                        "label": "10am-12pm"
                    }, {
                        "label": "12pm-2pm"
                    }, {
                        "label": "2pm-4pm"
                    }, {
                        "label": "4pm-6pm"
                    }, {
                        "label": "6pm-8pm"
                    }, {
                        "label": "8pm-10pm"
                    }, {
                        "label": "10pm-12am"
                    }]
                }],
                "dataset": [{
                    "dataset": [{
                        "seriesname": "Home Network - Downlink",
                        "data": array_hour_p_down
                    }, {
                        "seriesname": "Home Network - Uplink",
                        "data": array_hour_p_up
                    }]
                }, {
                    "dataset": [{
                        "seriesname": "Guest Network - Downlink",
                        "data": array_hour_g_down
                    }, {
                        "seriesname": "Guest Network - Uplink",
                        "data": array_hour_g_up
                    }]
                }]
            }
        });

});

</script>

I wrap my code around ajax.done() because I don't want my page load to wait for that data and rendering the chart as soon as the data arrive. But now I face another issue.
Uncaught ReferenceError: granular_time_network_day is not defined

Error

    $('#granular-time').on('click', function() {
        $('#granular-total-view').hide();
        $('#granular-time-view').fadeIn('slow');
        granular_time_network_day.render();
        granular_time_device_day.render();
        $('#btn-interval').prop('disabled', false);
    });

How do I prevent this from happening?
Did I do anything wrong on my Ajax?
Should I look into promise or something like that?

A: You need to defined granular_time_network_day outside of your ajax.done function

A: I would suggest checking to see if granular_time_network_day exists before calling render.
Example:
$('#interval-day').on('click',function(){
    if (granular_time_network_day) {
        granular_time_network_day.render();
    } else {
        //tell user that the data is still being retrieved or handle another way
    }
});

I did notice a potential other problem related to the variable being declared in the done call - granular_time_network_day will be in scope only for the done function. It would work out to declare it outside the done function, so that the click handler will be able to access it when the ajax call is complete.

A: define the function outside of your .done() callback so the click is aware of it even if the call hasn't completed yet.
EDIT
You don't need to check to see if a function is available, you need to check and see if you have the data yet from the $.ajax call:
var data = null;

$.ajax().done(function(data) {
    // assign data
    data = data;
});

$('#granular-time'.on('click', function() {
    // check to see if you have data
    if (data) {
        // do your stuff
        var granular_time_network_day = new FusionCharts({
        "type": "msstackedcolumn2d",
        "renderAt": "granular-time-network",
        "width": "100%",
        "dataFormat": "json",
            ....
        })
    }
});

});

A: window.
Turn out that window. save my life, and the answer that I am looking for.
Here is my final script
<script type="text/javascript">

var ajax = $.ajax({url: '/api/timebase/'+'{{ $cpe_mac }}'});
ajax.done(function (data) {

    console.log(data)

    var array_hour_g_down = [];
    var array_hour_g_up = [];
    var array_hour_p_down = [];
    var array_hour_p_up = [];

    for (var i = 0; i < data.hour_g_up.length; i++) {

        array_hour_g_down[i] = {"value":data.hour_g_down[i]};
        array_hour_g_up[i]   = {"value":data.hour_g_up[i]};
        array_hour_p_down[i] = {"value":data.hour_p_down[i]};
        array_hour_p_up[i]   = {"value":data.hour_p_up[i]};

    }

    window.granular_time_network_day = new FusionCharts({
        "type": "msstackedcolumn2d",
        "renderAt": "granular-time-network",
        "width": "100%",
        "dataFormat": "json",
        "dataSource": {
        "chart": {
            "caption": "Time-Based Bandwidth Usage",
            "subcaption": "Daily View",
            "xaxisname": data.month + ' ' + data.dth + ',' + ' '+ data.year,
            "yaxisname": "Bandwidth (in Megabytes)",
            "paletteColors": color_home_down+','+color_home_up+','+color_guest_down+','+color_guest_up,
                    // "numbersuffix": "MB",
                    "showvalues": "0",
                    "bgColor": "#ffffff",
                    "borderAlpha": "20",
                    "showCanvasBorder": "0",
                    "usePlotGradientColor": "0",
                    "plotBorderAlpha": "10",
                    "legendBorderAlpha": "0",
                    "legendShadow": "0",
                    "valueFontColor": "#ffffff",
                    "showXAxisLine": "1",
                    "xAxisLineColor": "#999999",
                    "divlineColor": "#999999",
                    "divLineDashed": "1",
                    "showAlternateHGridColor": "0",
                    "subcaptionFontBold": "0",
                    "subcaptionFontSize": "14"
                },
                "categories": [{
                    "category": [{
                        "label": "12am-2am"
                    }, {
                        "label": "2am-4am"
                    }, {
                        "label": "4am-6am"
                    }, {
                        "label": "6am-8am"
                    }, {
                        "label": "8am-10am"
                    }, {
                        "label": "10am-12pm"
                    }, {
                        "label": "12pm-2pm"
                    }, {
                        "label": "2pm-4pm"
                    }, {
                        "label": "4pm-6pm"
                    }, {
                        "label": "6pm-8pm"
                    }, {
                        "label": "8pm-10pm"
                    }, {
                        "label": "10pm-12am"
                    }]
                }],
                "dataset": [{
                    "dataset": [{
                        "seriesname": "Home Network - Downlink",
                        "data": array_hour_p_down
                    }, {
                        "seriesname": "Home Network - Uplink",
                        "data": array_hour_p_up
                    }]
                }, {
                    "dataset": [{
                        "seriesname": "Guest Network - Downlink",
                        "data": array_hour_g_down
                    }, {
                        "seriesname": "Guest Network - Uplink",
                        "data": array_hour_g_up
                    }]
                }]
            }
        });

});

</script>

I'm no longer getting the error.


text:
Q: ExpressJS rendering wrong static path during deeper url link on html5mode I am trying to achieve html5mode in my web application. I am using Angular's ui router to get there. The client side is working well. Whenever I opened the main webpage (127.1.1.1:8080) it loads perfectly. Clicking on a button that links to (127.1.1.1:8080/admin/dashboard) it loads perfectly too.
Refreshing 127.1.1.1:8080 is still fine.
The problem arouse when I refreshed the page of 127.1.1.1:8080/admin/dashboard.
It gives:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://127.1.1.1:8080/admin/libs/components-font-awesome/css/font-awesome.min.css".
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://127.1.1.1:8080/admin/assets/css/style.css".

It seems that it is getting the css style wrongly.
The path http://127.1.1.1:8080/admin/assets/css/style.css is a wrong path, it should be http://127.1.1.1:8080/assets/css/style.css instead. I believe I will have to rewrite the static path in my server.js and I have already done that. What have I missing still?
server.js
var express = require('express'),
    app = express(),
    mongoose = require('mongoose'),
    bodyParser = require('body-parser'),
    api = require('./app/routes'),
    port = process.env.PORT || 8080;

app.use('/app', express.static(__dirname + '/public/app'));
app.use('/assets', express.static(__dirname + '/public/assets'));
app.use('/libs', express.static(__dirname + '/public/libs'));

app.post('/api/user', api.post);
app.all('*', function(req, res, next) {
    res.sendFile('/public/index.html', { root: __dirname });
});

app.use(bodyParser.json());

app.listen('8080');
console.log('The magic happens on port 8080');

app.config.js
angular
    .module('app')
    .config(config);

config.$inject = ['$urlRouterProvider','$stateProvider','$locationProvider'];

function config($urlRouterProvider,$stateProvider,$locationProvider) {
    $urlRouterProvider.otherwise('/');

    $stateProvider
    .state('home', {
        url:'/',
        templateUrl: 'app/home/home.html',
        controller: 'HomeController',
        controllerAs: 'vm'
    })
    .state('admin', {
        url:'/admin',
        templateUrl: 'app/admin/admin.html',
        controller: 'AdminController',
        resolve: {app: check_logged}
    })
    .state('admin.dashboard', {
        url: '/dashboard',
        template: 'I could sure use a drink right dashboad.'
    })
    .state('admin.product', {
        url: '/product',
        template: 'I could sure use a drink right product.'
    })

    $locationProvider.html5Mode({
        enabled: true
    });
}

index.html
    <head>
    <meta  http-equiv="content-type" content="text/html;" charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <link rel="stylesheet" href="/libs/materialize/dist/css/materialize.min.css"></link>
    <link rel="stylesheet" href="/libs/components-font-awesome/css/font-awesome.min.css"></link>
    <link rel="stylesheet" href="/assets/css/style.css">
    <base href="/">
</head>

A: Try adding type attribute in CSS to text/css as follows -
 <link rel="stylesheet" type="text/css"  ref="/libs/materialize/dist/css/materialize.min.css">

The issue is related with the mime-type.


text:
Q: jQuery 1.7 clientX/pageX undefined I use jQuery and draggable from jqueryUI. When I update jQuery from 1.6 to 1.7 clientX and pageX attributes disappeared from event variable. Here is an example:
http://jsbin.com/ezulas/7/edit
If in given example jQuery version is changed to 1.6.4 - it starts working. With latest release - both clientX/Y and pageX/Y are not working. I discovered I can use e=e.originalEvent - but that doesn't seems to be the proper solution.

A:
event.layerX and event.layerY: We have removed these non-standard
  properties in version 1.7. Although we normally would have gone
  through a deprecation notice period for these, Chrome version 16
  generates a flood of console warning messages on the page. Because of
  this, we decided to remove them immediately. On platforms that still
  support these properties, they are available through
  event.originalEvent.layerX and event.originalEvent.layerY.

Source: http://blog.jquery.com/2011/11/03/jquery-1-7-released/
When you console.log(e); inside your dragstop event handler you can see that all the x/y coordinate data is missing in jQuery 1.7; but it can be accessed in event.originalEvent.
UPDATE
If you look around in the event object you can find pageX/pageY in the origionalEvent property:
$('#test').html(e.originalEvent.pageX+','+e.originalEvent.pageY);

Here is an updated version of your jsbin: http://jsbin.com/ezulas/13/edit

A: I had the same problem and was searching similar threads for quite a while.
It is now fairly late, but I hope this will still save some happy coders from despair.
I checked the jQuery UI Touch Punch file that I was also using in my project and found how it refers to the x/y position.
This is what eventually worked for me:
$('.pages').on('touchstart vmousedown', function(e){
    var this_event_touch_start_Y    = e.originalEvent.changedTouches[0].clientY;
    var this_event_touch_start_X    = e.originalEvent.changedTouches[0].clientX;
});

For reference, here a list of all jQuery files I am using:

*

*jquery-3.1.1.min.js

*jquery.touchSwipe.min.js

*jquery-ui.min.js

*jquery.ui.touch-punch.min.js

*jquery.mobile-1.4.5.min.js

A: In the jQuery docs for Event Object it says

The following properties are also copied to the event object, though some of their values may be undefined depending on the event:
altKey, bubbles, button, cancelable, charCode, clientX, clientY, ctrlKey, currentTarget, data, detail, eventPhase, metaKey, offsetX, offsetY, originalTarget, pageX, pageY, prevValue, relatedTarget, screenX, screenY, shiftKey, target, view, which

Which seems to fit what you are saying. In your situation your event does not have pageX and pageY defined.


text:
Q: Blazor WebAssembly login authentication/login from .well-known/openid-configuration gives localhost URL instead of public URL The autogenerated oidc configuration file gives localhost instead of my public URL. How do I set it up so that it gives the right URL?
http://167.172.118.170/.well-known/openid-configuration
In the login link on my test site: http://167.172.118.170/authentication/login the login redirects to a localhost address instead of the public 167.172.118.170 address, like this:

http://localhost:5008/connect/authorize?client_id=MyProject.Web.Client&redirect_uri=http%3A%2F%2F167.172.118.170%2Fauthentication%2Flogin-callback&response_type=code&scope=MyProject.Web.ServerAPI%20openid%20profile&state=b18bc58127b54ea9aaff1a210b7899de&code_challenge=OOIuUi2yJnYcjZZIu4LveJfbLz0Na7IKkzlDTKb81IE&code_challenge_method=S256&response_mode=query

How do I configure it so that it goes to http://167.172.118.170/connect/authorize instead?
This is the content of the authentication razor file:
@page "/authentication/{action}"
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
<RemoteAuthenticatorView Action="@Action" />

@code{
    [Parameter] public string Action { get; set; }
}

https://github.com/jonasarcangel/BlazorLoginNetworkErrorIssue/blob/master/src/MyProject.Web.Client.Shell/Pages/Authentication.razor
There is no option to provide the server URL.

A: Your application is not configured properly.
You need to configure your identity sever using similar code like below in your Program.cs
builder.Services.AddOidcAuthentication(options =>
        {
            builder.Configuration.Bind("OidcConfiguration", options.ProviderOptions);
        });

"OidcConfiguration" comes from your configuration file and will have parameters like below:
"OidcConfiguration": {
    "Authority": "https://YourIdentityServerIP",
    "ClientId": "YourClienId",
    "DefaultScopes": [
      "openid",
      "profile",
      "api"
    ],
    "RedirectUri": "https://yourclientapp/authentication/login-callback",
    "PostLogoutRedirectUri": "https://yourclientapp/authentication/logout-callback",
    "ResponseType": "code"

  }

You can use this two links to see how i configured mine in a pet project
Program Files:
https://github.com/oteebest/edu-client-blazor/blob/master/CBTClient/Program.cs
appsetting.json
https://github.com/oteebest/edu-client-blazor/blob/master/CBTClient/wwwroot/appsettings.json

A: The solution was to add the following:
using IdentityServer4.Extensions;
//...
app.Use((ctx, next) =>
{
    ctx.SetIdentityServerOrigin("http://167.172.118.170");
    return next();
});


text:
Q: Integral Identity for Permanent of a Matrix Say we have an $N\times N$ matrix $A$ with elements $A_{ij} = \alpha_i^{(1- \delta_{ij})}$. For example, for $N=3$ we have
$$ A = \left[ \begin{array}{ccc}
1 & \alpha_1 & \alpha_1 \\
\alpha_2 & 1 &  \alpha_2 \\
\alpha_3 & \alpha_3 &  1  \\
 \end{array}\right]$$
How can we show that $A$ satisfies the identity
\begin{equation}
 \text{perm}(A) =  \int^{\infty}_{0} ds\, e^{-s} \prod_{\ell=1}^{n} \Big[1+(s-1) \alpha_i\Big]
\end{equation}
More generally are there any other known integral identities for the permanent of a (perhaps more general) matrix?

A: For the particular question, do something like this
$$Perm(A)=\sum _{\sigma \in S_n}\prod _{i=1}^nA_{i,\sigma (i)}=\sum _{\sigma \in S_n}\prod _{i=1}^n\alpha _i^{1-\delta _{i,\sigma (i)}},$$
so we have to know exactly where there are fixed points, for a permutation $\sigma, $call $Fix(\sigma)=\{i:\sigma (i)=i\}.$. Notice then than fixing a set $X\subseteq [n]=\{1,\cdots ,n\}$ we can iterate over this.
$$perm(A)=\sum _{X\subseteq [n]}\sum _{\substack{\sigma \in S_n\\ Fix(\sigma)=X}}\prod _{i=1}^{n}\alpha _i^{1-\delta _{i,\sigma (i)}}=\sum _{X\subseteq [n]}\sum _{\substack{\sigma \in S_n\\ Fix(\sigma)=X}}\prod _{x\in [n]\setminus X}\alpha _x=\sum _{X\subseteq [n]}D_{n-|X|}\prod _{x\in [n]\setminus X}\alpha _x,$$
where the last step is noticing that the argument of the sum does not depend really on the sum index. The number of permutations with exactly $|X|$ fixed points are counted by Derangements, denoted by $D_n$.
Now, in the alternative universe of the right hand side,
notice that the product can be seen as
$$\prod _{i=1}^n(1+(s-1)\alpha _i)=\sum _{X\subseteq [n]}(s-1)^{|X|}\prod _{x\in X}\alpha _x,$$
so the integral becomes
$$\sum _{X\subseteq [n]}\prod _{x\in X}\alpha _x\int _{0}^{\infty}(s-1)^{|X|}e^{-s}ds,$$
so the only thing left to check is that $$D_n=\int _{0}^{\infty}(s-1)^{n}e^{-s}ds.$$
I will suggest either expanding $(s-1)^n$ using the binomial expansion and deducing that these are indeed the Derangements or trying integration by parts to deduce a recursion.
For your follow up question, this will help.


text:
Q: Can there be two adjacent solid angles? Thanks for reading. My real question is the second part - in the first part I'm just explaining myself. Please read through! Thanks.
In 2D geometry, it is easy to picture what it means to add up 2 angles. For example, in this random picture I got off the internet, I can say that $\angle A_5A_1A_4 + \angle A_4A_1A_3 = \angle A_5A_1A_3$

However, with 3D geometry, I'm having trouble picturing what it would mean to add up two solid angles. If I'm adding up solid angles $A$ and $B$, I can't just draw the second angle $B$ so that it starts from the endpoint of $A$, as I could if it was in 2 Dimensions, because solid angles don't have a single endpoint.
So, how would I be able to picture 2 adjacent solid angles? Or 3 adjacent solid angles? Or does the idea of adjacency just not exist when we're considering solid angles?

The reason I'm asking is because I'm working on a proof that involves n arbitrary shape with a point somewhere within it. In order for my proof to work, I need to split up the shape's surface into pieces in such a way that the angle subtended by any section of a piece of the shape's surface relative to the point within the shape is equal for all pieces of that shape's surface.

As you can see, the angle subtended by each piece of the shape's surface (with each piece denoted by a different letter) is the same for all the pieces of that shape's surface. They each subtend the angle $\theta$
So, so far my proof is working (kinda) for 2D. But I need it to apply to 3D.
But...how would I be able to do this in 3D? How would I be able to break up the 3D's shape surface into areas such that the angle (now a solid angle?) subtended by each section of that 3D shape's surface is equal for all the sections?
Thanks!!

Something else - when I break up the 3D shape into patches covering equal solid angles of its surface, I need all of the solid angles to be really small. Thanks!
Also, am I thinking of solid angles wrong? I haven't studied them explicitly (which I probably should soon) but have simply used them here and there when I've had to.

A: You should think of solid angles as surface patches on a given sphere of your choice (don't focus on the "cone" - which by the way isn't even a cone technically speaking - the "cone" is just trying to convey "3D-ness." Even for the cleanest surface patch on a sphere, the circle, the "3D cone" still isn't a cone rigorously speaking. For even more crazy surface patches on a sphere, something with crazy bends and sharp points in the boundary of the patch, the "cone" is even more warped). So just focus on the surface patch of your sphere.
Given 2 crazy surface patches anywhere on a common sphere, you might say that the 2 patches have adjacent solid angles if the boundaries of the patches share at least one point in common.
As a side note: angles and solid angles depend on where you place your circle and where you place your sphere (They don't depend on the size of the circle or the size of the sphere - just the placement). Draw some squiggly line on a sheet of paper. What angle does that squiggly line subtend? Depending on where you place your circle, you'll get different answers. For some circles, the angle subtended is close to $0$. Likewise for solid angles. Place a sphere in front of the meat of a sheet of paper (no matter the size of the sphere - you always get the same solid angle). Now look at the same sheet of paper on it's edge. The solid angle is $0$. The area traced out (projected) on a sphere is just a line, which has $0$ area.
As long as your object is closed, and the center of your sphere lies within the object, then the solid angle will be $4\pi$. This is easiest to see if the surface of the sphere is completely contained inside the object, or completely surrounds the object. For sphere's with their center within the object, but whose surface is partly within and partly without, the answer is still $4\pi$, and still fairly easy to see (Put your elbow at the center of the sphere. And point your arm/index finger to every point on the surface of the object of interest. The collection of rays which intersect the sphere's surface is the projected area on the sphere)

A: Solid angles don't have a shape, and this is confusing you. DWade64 explains it nicely. You can also do it the other way round. Imagine a beam of light from a point source placed inside an opaque spherical shell with a hole in it. Outside the shell this beam has a solid angle that is the area of the hole (Strictly, the area of the spherical cap that used to fill the hole) divided by the square of the radius of the sphere. It does not depend on the shape of the hole; it is proportional to the fraction of the light that escapes. Remove the shell entirely and the solid angle that fills of space is $4\pi$.
Calculating the solid angle in a general case is tricky. The easiest case is a 'spherical triangle', formed by three 'great circles'. These are circles whose centers are at the center of the sphere. If the angles at the three vertices are $\alpha, \beta,\gamma$ the area is $(\alpha+\beta+\gamma-\pi) R^2$. The sum of the angles of a spherical triangle are always greater than $\pi$ unless the triangle is very small.
A way to get eight triangles of equal area is to take your great circles as the equator plus two circles passing through the poles at right angles to each other.
Each triangle then has a right angle at each vertex and its area is $3\times\pi/2-\pi=\pi/2$ which is one eighth of $4\pi$.
If you then split each triangle by the great circles that pass from each vertex to the mid-point of the opposite side you get 48 equal areas. But probably you want your solid angles to be arbitrarily small. Im not yet sure how to do that.
ADDENDUM
OK I see it now, but it may or may not help.
Take lines of latitude $\theta_0,\theta_1, \theta_2,..\theta_k,.. \theta_K,$ with $\theta_0=0,\theta_K=\pi/2$. Take lines of longitude with equal spacing $2\pi/M$.
The area of a patch is
$$\frac{2\pi}{M}\int_{\theta_k}^{\theta_{k+1}}(2\pi R)(\sin{\theta}d\theta)=
\frac{4\pi^2R^2}{M}(\cos{\theta_k}-\cos{\theta_{k+1}})$$
The patches will be of equal area if we take
$$\theta_k=\cos^{-1}{k/K}$$


text:
Q: Populating multiple inputs simultaneously from JavaScript array I am trying to populate the right ascension and declination boxes with the values of the option selected in the Target name select box, but have had no success yet, how do I do it?
The script does everything else I want including populating the next drop down and subsequently populating the table at the bottom, but I cant get the Right Ascension and Declination boxes to populate.
I've searched through tutorials and other answered questions on here, but have not found anything that has helped yet.

const celestial_spheres = [{
    "id": 134578521,
    "name": "M15",
    "right_ascension": "21:29:58.33",
    "declination": "+12:10:01.2",
    "filters": [{
        "name": "Red (R)",
        "values": ['M15', "21:29:58.33", "+12:10:01.2", 'N/A', 'Red (R)', '
', 'M15 Red (R)']
      },
      {
        "name": "Green (V)",
        "values": ['M15', "21:29:58.33", "+12:10:01.2", 'N/A', 'Green (V)', '
', 'M15 Green (V)']
      },
      {
        "name": "Blue (B)",
        "values": ['M15', "21:29:58.33", "+12:10:01.2", 'N/A', 'Blue (B)', '
', 'M15 Blue (B)']
      }
    ]
  },
  {
    "id": 21412155,
    "name": "M27",
    "ascension": "19:59:36.34",
    "declination": "+22:43:16.09",
    "filters": [{
        "name": "Red (R)",
        "values": ['M27', "19:59:36.34", "+22:43:16.09", 'N/A', 'Red (R)', '
', 'M27 Red (R)']
      },
      {
        "name": "Green (V)",
        "values": ['M27', "19:59:36.34", "+22:43:16.09", 'N/A', 'Green (V)', '
', 'M27 Green (V)']
      },
      {
        "name": "Blue (B)",
        "values": ['M27', "19:59:36.34", "+22:43:16.09", 'N/A', 'Blue (B)', '
', 'M27 Blue (B)']
      }
    ]
  },
  {
    "id": 452456321347564364,
    "name": "NGC891",
    "ascension": "02:22:33.4",
    "ra": "02:22:33.4",
    "declination": "+42:20:57.0",
    "dec": "+42:20:57.0",
    "filters": [{
        "name": "Red (R)",
        "values": ['NGC891', "02:22:33.4", "+42:20:57.0", 'N/A', 'Red (R)', '
', 'NGC891 Red (R)']
      },
      {
        "name": "Green (V)",
        "values": ['NGC891', "02:22:33.4", "+42:20:57.0", 'N/A', 'Green (V)', '
', 'NGC891 Green (V) (R)']
      },
      {
        "name": "Blue (B)",
        "values": ['NGC891', "02:22:33.4", "+42:20:57.0", 'N/A', 'Blue (B)', '
', 'NGC891 Blue (B)']
      }
    ]
  }
];

const sphere_options = spheres => spheres.map(sphere => `<option value="${ sphere.id }">${ sphere.name }</option>`).join('');
const filter_options = filters => filters.map(filter => `<option value="${ filter.name }">${ filter.name }</option>`).join('');
const sphere_filter_row = (id, filter) => {
  const cells = filter.values.map(value => `<td>${ value }</td>`).join('');
  return `<tr id="sphere_${ id }" data-type="${ filter.name }">${ cells}</tr>`;
};

const select_sphere = event => {
  const sphere_id = parseInt(event.target.value, 10);
  const sphere = celestial_spheres.find(sphere => sphere.id === sphere_id);
  if (!sphere) throw new Error(`application.select_sphere - cannot find the sphere with id ${ sphere_id }`);
  else {
    const filter_selection = document.querySelector('#sphere_filters');
    const filters = filter_options(sphere.filters);
    filter_selection.innerHTML = `<option value="default">Please select a filter...</option>${ filters }`;
    const header = document.querySelector('#sphere_name');
    header.innerHTML = sphere.name;
    const ascension = document.querySelector('#right_ascension');
    ascension.innerText = sphere.ascention;
    const declination = document.querySelector('#declination');
    declination.innerText = sphere.declination;
    const sphere_rows = document.querySelector('#sphere_rows');
    sphere_rows.innerHTML = '';
  }
};

const select_filter = event => {
  const sphere_id = parseInt(document.querySelector('#celestial_spheres').value, 10);
  const sphere = celestial_spheres.find(sphere => sphere.id === sphere_id);
  const filter_name = event.target.value;
  const filter = sphere.filters.find(filter => filter.name === filter_name);
  const row = sphere_filter_row(sphere_id, filter);
  const sphere_rows = document.querySelector('#sphere_rows');
  sphere_rows.innerHTML = row;
};

const show_detail = event => {
  const row = event.target.closest('tr');
  const sphere_id = parseInt(row.getAttribute('id').slice(7), 10);
  const sphere = celestial_spheres.find(sphere => sphere.id === sphere_id);
  alert(`You clicked the value "${ event.target.innerText }" of sphere "${ sphere_id }".`);
  // Do stuff with the clicked cell
};

window.addEventListener('DOMContentLoaded', () => {
  const sphere_selection = document.querySelector('#celestial_spheres');
  sphere_selection.innerHTML += sphere_options(celestial_spheres);
  sphere_selection.addEventListener('change', select_sphere);
  const filter_selection = document.querySelector('#sphere_filters');
  filter_selection.addEventListener('click', select_filter);
  const sphere_rows = document.querySelector('#sphere_rows');
  sphere_rows.addEventListener('click', show_detail);
});

$(document).ready(function() {
  $('[data-toggle="tooltip"]').tooltip();
});

Target Name:

  <select id="celestial_spheres" type="select" name="name" class="button form-control" aria-required="true" aria-invalid="false">
    <option value="default">Select a Target...</option>
  </select>

Right Ascention:

  <input id="#right_ascention" type="text" placeholder="HH:MM:SS.S" name="ascension" class="form-control" aria-required="true" aria-invalid="false">

Declination:

    <input id="#declination" type="text" placeholder="DD:MM:SS.S" name="#declination" id="#declination" class="form-control" aria-required="true" aria-invalid="false">

Filter
  <select id="sphere_filters" type="select" name="name" placeholder="Target Name..." class="button form-control" aria-required="true" aria-invalid="false">
    <option value="default">Select a Filter...</option>
  </select>

Exposure Time: <input name="exposureSeconds" type="number" id="exposure-time-input" placeholder="N/A" class="form-control" aria-required="true"
    aria-invalid="false">

</form>

  <button onClick="getElementById()" type="button" class="btn btn-success btn-block">
              Go!
            </button>

Session Images

LCO Science Archive (this session's images)

                  Target Name
                  Right Ascension
                  Declination
                  Exposure Time (sec)
                  Filter
                  Timestamp (UTC)
                  Image type

The boxes should show the default hh:mm:ss.s and dd:mm:ss.s until the Target name select is clicked on, and then show the RA and Dec of that object, while not stopping the filter select from properly populating.

A: Your script won't ever come to the point where it should populate the ascention and declination boxes because the select_sphere function already crashes here:
const header = document.querySelector( '#sphere_name' );

You have no HTML element which matches this id.
Well, let's say there is, it will crash the next line:
const ascension = document.querySelector( '#right_ascension' );

The matching input field's ID is #right_ascention not #right_ascension.
Even if you fix those two bugs it will crash one more time:
ascension.innerText = sphere.ascention;

the object sphere does not have a key ascention. It's right_ascension.
Furthermore I'd recommend giving your input boxes an unique name and get a reference to it using document.getElementById() instead of querySelector. So in case of the right ascention
<input id="right_ascention_input" type="text" placeholder="HH:MM:SS.S" name="ascension" class="form-control" aria-required="true" aria-invalid="false">

and pupulate it using the .value property instead of .innerText.
Have a look here:

const celestial_spheres = [{
    "id": 134578521,
    "name": "M15",
    "right_ascension": "21:29:58.33",
    "declination": "+12:10:01.2",
    "filters": [{
        "name": "Red (R)",
        "values": ['M15', "21:29:58.33", "+12:10:01.2", 'N/A', 'Red (R)', '
', 'M15 Red (R)']
      },
      {
        "name": "Green (V)",
        "values": ['M15', "21:29:58.33", "+12:10:01.2", 'N/A', 'Green (V)', '
', 'M15 Green (V)']
      },
      {
        "name": "Blue (B)",
        "values": ['M15', "21:29:58.33", "+12:10:01.2", 'N/A', 'Blue (B)', '
', 'M15 Blue (B)']
      }
    ]
  },
  {
    "id": 21412155,
    "name": "M27",
    "ascension": "19:59:36.34",
    "declination": "+22:43:16.09",
    "filters": [{
        "name": "Red (R)",
        "values": ['M27', "19:59:36.34", "+22:43:16.09", 'N/A', 'Red (R)', '
', 'M27 Red (R)']
      },
      {
        "name": "Green (V)",
        "values": ['M27', "19:59:36.34", "+22:43:16.09", 'N/A', 'Green (V)', '
', 'M27 Green (V)']
      },
      {
        "name": "Blue (B)",
        "values": ['M27', "19:59:36.34", "+22:43:16.09", 'N/A', 'Blue (B)', '
', 'M27 Blue (B)']
      }
    ]
  },
  {
    "id": 452456321347564364,
    "name": "NGC891",
    "ascension": "02:22:33.4",
    "ra": "02:22:33.4",
    "declination": "+42:20:57.0",
    "dec": "+42:20:57.0",
    "filters": [{
        "name": "Red (R)",
        "values": ['NGC891', "02:22:33.4", "+42:20:57.0", 'N/A', 'Red (R)', '
', 'NGC891 Red (R)']
      },
      {
        "name": "Green (V)",
        "values": ['NGC891', "02:22:33.4", "+42:20:57.0", 'N/A', 'Green (V)', '
', 'NGC891 Green (V) (R)']
      },
      {
        "name": "Blue (B)",
        "values": ['NGC891', "02:22:33.4", "+42:20:57.0", 'N/A', 'Blue (B)', '
', 'NGC891 Blue (B)']
      }
    ]
  }
];
const sphere_options = spheres => spheres.map(sphere => `<option value="${ sphere.id }">${ sphere.name }</option>`).join('');
const filter_options = filters => filters.map(filter => `<option value="${ filter.name }">${ filter.name }</option>`).join('');
const sphere_filter_row = (id, filter) => {
  const cells = filter.values.map(value => `<td>${ value }</td>`).join('');
  return `<tr id="sphere_${ id }" data-type="${ filter.name }">${ cells}</tr>`;
};

const select_sphere = event => {

  const sphere_id = parseInt(event.target.value, 10);
  const sphere = celestial_spheres.find(sphere => sphere.id === sphere_id);
  if (!sphere) throw new Error(`application.select_sphere - cannot find the sphere with id ${ sphere_id }`);
  else {
    const filter_selection = document.querySelector('#sphere_filters');
    const filters = filter_options(sphere.filters);
    filter_selection.innerHTML = `<option value="default">Please select a filter...</option>${ filters }`;
    // const header = document.querySelector( '#sphere_name' );
    //  header.innerHTML = sphere.name;
    const ascension = document.getElementById('right_ascention_input');
    ascension.value = sphere.right_ascension;
    const declination = document.getElementById('declination_input');
    declination.value = sphere.declination;
    const sphere_rows = document.querySelector('#sphere_rows');
    sphere_rows.innerHTML = '';
  }
};

const select_filter = event => {
  const sphere_id = parseInt(document.querySelector('#celestial_spheres').value, 10);
  const sphere = celestial_spheres.find(sphere => sphere.id === sphere_id);
  const filter_name = event.target.value;
  const filter = sphere.filters.find(filter => filter.name === filter_name);
  const row = sphere_filter_row(sphere_id, filter);
  const sphere_rows = document.querySelector('#sphere_rows');
  sphere_rows.innerHTML = row;
};

const show_detail = event => {
  const row = event.target.closest('tr');
  const sphere_id = parseInt(row.getAttribute('id').slice(7), 10);
  const sphere = celestial_spheres.find(sphere => sphere.id === sphere_id);
  alert(`You clicked the value "${ event.target.innerText }" of sphere "${ sphere_id }".`);
  // Do stuff with the clicked cell
};

const sphere_selection = document.querySelector('#celestial_spheres');
sphere_selection.innerHTML += sphere_options(celestial_spheres);
sphere_selection.addEventListener('change', select_sphere);
const filter_selection = document.querySelector('#sphere_filters');
filter_selection.addEventListener('click', select_filter);
const sphere_rows = document.querySelector('#sphere_rows');
sphere_rows.addEventListener('click', show_detail);

Target Name:

  <select id="celestial_spheres" type="select" name="name" class="button form-control" aria-required="true" aria-invalid="false">
    <option value="default">Select a Target...</option>
  </select>

Right Ascention:

  <input id="right_ascention_input" type="text" placeholder="HH:MM:SS.S" name="ascension" class="form-control" aria-required="true" aria-invalid="false">

Declination:

    <input id="declination_input" type="text" placeholder="DD:MM:SS.S" name="#declination" id="#declination" class="form-control" aria-required="true" aria-invalid="false">

Filter
  <select id="sphere_filters" type="select" name="name" placeholder="Target Name..." class="button form-control" aria-required="true" aria-invalid="false">
    <option value="default">Select a Filter...</option>
  </select>

Exposure Time: <input name="exposureSeconds" type="number" id="exposure-time-input" placeholder="N/A" class="form-control" aria-required="true"
    aria-invalid="false">

</form>

  <button onClick="getElementById()" type="button" class="btn btn-success btn-block">
              Go!
            </button>

Session Images

LCO Science Archive (this session's images)

                  Target Name
                  Right Ascension
                  Declination
                  Exposure Time (sec)
                  Filter
                  Timestamp (UTC)
                  Image type


text:
Q: polar form and argument of $\lvert$1+i$\rvert$? I want to find the polar form and argument of $\lvert$1+i$\rvert$
My try:
Polar form is:  $re^{i\theta},$ where $r = \sqrt{2}\;$ and $\;\theta=\frac{\pi}{4}$ because $\arg(\lvert$1+i$\rvert) = \frac{\pi}{4}$
principal arg($\lvert$1+i$\rvert$) = $\frac{\pi}{4} + 2k\pi$
and the polar form is $\sqrt{2}e^{i\frac{\pi}{4}}$
Question:
is my arg, principal arg, and polar form done correctly?


text:
Q: How can I make my ItemTemplate a bit more like the Messaging Hub on Windows Phone? I need to use an ItemTemplate that will make the items look as similar as possible to the Messaging Hub on Windows Phone. Currently, I have this code as my DataTemplate, but I can't get the TextBlock to align to the right side of the horizontal StackPanel.
<StackPanel Orientation="Right">
    <StackPanel>
        <TextBlock Text="{Binding IP}"/>
        <TextBlock Text="{Binding LastMessage}"/>
    </StackPanel>
    <TextBlock HorizontalAlignment="Right" Text="{Binding Time}"/>
</StackPanel>

An image of the Messaging Hub on Windows Phone:

A: you can use Grid for this, see example:
    <Grid>
       <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.7*"/>
            <ColumnDefinition Width="0.3*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0" HorizontalAlignment="Left">
            <TextBlock Text="{Binding IP}"/>
            <TextBlock Text="{Binding LastMessage}"/>
        </StackPanel>
        <TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding Time}"/>
    </Grid>


text:
Q: Get someone wrong How to say: I got someone wrong with someone else? Like I want to talk to Ben and I call you (while thinking you are Ben)
And when I see you are not Ben, I say:
Sorry,  I got you wrong with Ben.

A: Generally, the three most common ways to say that would be these:

I'm sorry. I mistook you for Ben.
I'm sorry. I thought that you were Ben.
I'm sorry. I confused you with Ben.

In the second example, you can also drop the conjunction that altogether and just say:

I'm sorry. I thought you were Ben.


text:
Q: A noun for someone who is shamelessly uncouth? I'm looking for a noun to describe the people who behave in certain tacky / uncouth ways. In particular, I'm not looking for a classist/racist slur, but rather something to more generally describe people who do culturally inappropriate things like take phone calls in movie theaters, play loud music late at night, or rev the engines of their expensive cars for attention. It should capture a certain brazen obnoxiousness and self-centeredness that would be considered embarrassing or shameful in polite society, no matter who does it.
Is there a word in American English that captures this sort of person? In Britian, I've heard there's "chav" which looks sort-of close. In Mexican Spanish, you might say "naco".

A: A generic word for a person like this would be a jerk.

Merriam Webster:
a : an annoyingly stupid or foolish person
b : an unlikable person; especially : one who is cruel, rude, or
  small-minded

A closer meaning would be a boor, but I rarely (never) hear this word in daily conversation.  (I live in the southern United States.)

A: douchebag TFD

*

*n. a wretched and disgusting person; vile; contemptible

A: Some suggestions:

*

*philistine

*vulgarian

*boor

*narcissist

*dummkopf

*fool

*simpleton

*doofus

*barbarian

*ninny

*slob

*twit

*tw#t (you know . . . wink, wink, nudge, nudge)
I'd link you to definitions, but I'm assuming you are willing and able to look 'em up yourself.


text:
Q: t-test result, what can I say about the data? Suppose I run a t-test and I get the following result:

The p-value is very small, so I reject the null hypothesis.
However, I was wondering if I could say something on the sign of two mean and their relative dimension from this data. Also, can I say something with a significant level of 5% or 0.0001%?

A: *

*You can't decide on the significance level of a test after calculating a p-value. If the prespecified alpha level was 0.05, you can say the test is significant at that level. (You don't reject the null hypothesis just because p-value is small, suppose your alpha level was even lower.

*You can't say anything about the sign of the two samples that you put in this test. The 95% confidence interval just tells you the mean of X is lower than Y. (the average of the CI will give you the actual mean difference). But X mean could be 100 and Y mean could be 102 or X mean could be -100 and Y mean could be -98 and the results are the same.


text:
Q: Kernel "make module_install" always gives error Hey guys i am trying to command a custom system call.
I tried every step given on this website.
But whenever i enter the " make modules_install install " command i always get this error :
      INSTALL arch/x86/crypto/aes-x86_64.ko
cp: cannot stat 'arch/x86/crypto/aes-x86_64.ko': No such file or directory
Can't read module
scripts/Makefile.modinst:30: recipe for target 'arch/x86/crypto/aes-x86_64.ko' failed
make[1]: *** [arch/x86/crypto/aes-x86_64.ko] Error 2
Makefile:1077: recipe for target '_modinst_' failed
make: *** [_modinst_] Error 2

I searched everywhere but i am unable to find any answer.
Looking forward for a solution.


text:
Q: .htaccess 301 redirect Homepage to subdomain I would like to redirect my home page to a subdomain in .htaccess. Ive tried several different ways I found online. None have worked.
https://example.com/index.com to https://sub.example.com/index.com

A: Assuming that you actually want to redirect all requests to that subdomain this probably is what you are looking for:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule ^ https://sub.example.com%{REQUEST_URI} [R=301,L]

It probably makes sense to start using R=302 temporary redirections first. And to only change those to R=301 permanent redirections once everything works as desired. That prevents nasty caching issues on the client side. Also you always want to test using a fresh anonymous browser window.
Best place to implement such rules is in the central http server's host configuration. If you do not have access to that you can use a distributed configuration file instead (".htaccess"), if you have enabled the consideration of such files in the http server ... Above rules will work likewise if that file is placed inside the DOCUMENT_ROOT folder of the http host.


text:
Q: Javascript object that inherits QWidget I am doing something in Javascript and Qt, and for my purpose, I need a javascript object that inherits QWidget. So far, I have tried the following:
function Test()
{
    QWidget.call(this);
    this.button = new QPushButton("test");
    this.layout().insertWidget(1,this.button);
    this.button.clicked.connect(this.slot);
}

Test.prototype.slot = function()
{
    print("Test button clicked");
}

Test.prototype = new QWidget();

I instantiate object from the class "Test" and with the call of the show() method, I get the widget:
var testVariable = new Test();
testVariable.show();

However, I get the following interpreter error:

Error: In run/evaluate: TypeError:
  Function.prototype.connect: target is
  not a function

If I change the line this.button.clicked.connect(this.slot); to call a static method defined like this:
    this.button.clicked.connect(Test.slot);
...
...
    Test.slot = function () { /* code */ }

the program runs fine, but static method is a no-no. I don't want anyone to call slot() except the instantiated object.
What is wrong with this picture? Has anyone had experience with Javascript objects inheriting Qt objects?
Thanks in advance

A: Ok I think I might figured this out. So the magic here is:
Test.prototype = new QWidget();

needs to be before the constructor, also the constructor has to take "parent" argument too. And last but not least, in connect() there are two arguments: first is which class contains the slot (in my case it is this) and the name of the slot with this pointer.
So, having this in mind, the above code will look like this:
Test.prototype = new QWidget();
function Test(parent)
{
    QWidget.call(this, parent);
    this.button = new QPushButton("test");
    this.layout().insertWidget(1, this.button);
    this.button.clicked.connect(this, this.slot);
}

Test.prototype.slot = function()
{
    print("Test button clicked");
}

This is to whom it may concern.


text:
Q: $p_n(x)=p_{n-1}(x)+p_{n-1}^{\prime}(x)$, then all the roots of $p_k(x)$ are real $p_0(x)=a_mx^m+a_{m-1}x^{m-1}+\dotsb+a_1x+a_0(a_m,\dotsc,a_1,a_0\in\Bbb R)$ is a polynomial,  and
$$p_n(x)=p_{n-1}(x)+p_{n-1}^{\prime}(x),\qquad n=1,2,\dotsc$$
then, there exist $N\in\Bbb N$, such that $\forall n \geq N$, all the roots of $p_n(x)$ are real

I think, let $f_n(x)=e^xp_n(x)$, then
$$f_n(x)=\frac {d(f_{n-1}(x))}{dx} $$
we get that
$$f_n(x)=\frac{d^n\left( e^xp_0(x)\right)}{dx^n}$$
so, If there exists a $p_N(x)$ such that $p_N(x)$ has  $m$ real roots, then $\forall n\geq N$,  $p_n(x)$ has  $m$ real roots.
I'd be grateful for any help

A: Not a solution at all, so (down)vote accordingly. Just writing down whatever my toying with Mathematica suggests in the hope that it may inspire somebody else. I think this line of attack should lead to a solution, but it does require careful estimates. Hopefully a more clever method is out there.
The formula in Abiessu's comment shows that the transformation $T_n:p_0\mapsto p_n$ is linear
(this could also be proven directly). A more careful look at that formula reveals that for large $n$ the coefficients coming from the leading term, i.e. $T_n(a_mx^m)$, will dominate the other terms. In a way (that needs to be made more precise) this suggests that the zeros of $T_n(p)$ are close to the zeros of
$$T_n(x^m)=x^m+m{n\choose 1}x^{m-1}+m(m-1){n\choose 2}x^{m-2}+\cdots$$
So I propose the following attack:

*

*Show that for large enough $n$ the polynomial $G_n:=T_n(x^m)$ has $m$ distinct zeros, and that the derivative $G_n'$ has a large enough absolute value at these zeros.

*Show that the difference $|a_m G_n(x)-p_n(x)|$ is small enough (in comparison to $G_n'(x)$) near the zeros of $G_n$ so that we can conclude $p_n$ to also have a zero in the vicinity.

Testing shows that the zeros of $G_n$ will be "near" $x=-n$ for a suitable definition of "near". This is hardly a surprise as it follows from the definitions that
$$
\lim_{n\to\infty}\frac{G_n(nx)}{n^m}=(x+1)^m.
$$
I checked what happens with
$$
p_0(x)=(x^2+1)(x^2+4)=x^4+5x^2+4.
$$
Since I went up to $n=50$ (way overkill, the condition is fulfilled much earlier) I will share a few plots with you.
Here are the plots of $p_{50}$ and $G_{50}$. You see that at this resolution they nearly coincide.

Here's a close up of the neighborhood of one of the zeros.

Edit: I think I figured out a useful scaling. Consider the polynomial (changing the notation a bit, as I need double indexing)
$$
F_{m,n}=T_n(x^m):=\sum_{i=0}^n\frac{m! n! i!}{(m-i)! (n-i)!}x^{m-i}.
$$
Let's do the translation that John Mangual also studied, and scale the variable by $\sqrt n$, and define
$$
H_{m,n}:=\frac1{n^{m/2}}F_{m,n}(\sqrt n x-n).
$$
I'm well on my way to proving (not there yet, but I have computer justification for $m\le5$, and some useful looking identities) that
$$
\lim_{n\to\infty}H_{m,n}(x)=He_m(x),
$$
where $He_m(x)$ is the so called probabilist's Hermite polynomial of degree $m$. I would be surprised if this were not either known or easily deduced from known facts.
Anyway, I conjecture that the zeros $z_{i,n}, i=1,2,\ldots,m$, of $p_n(x)$ can be numbered in such a way that the limits
$$
z_i=\lim_{n\to\infty}\frac{z_{i,n}+n}{\sqrt n}
$$
exist, and are the zeros of $He_m(x)$.

A: Another approach.
I will prove the result step by step.

*

*$$\sum_{j=0}^m (-1)^j \binom{m}{j}j(j-1)\cdots(j-k+1)=0$$ if $0\leqslant k\leqslant m-1$, and $m!$ if $k=m$.

Proof.
Use $j\binom{m}{j}=m\binom{m-1}{j-1}$.

2-$$\sum_{j=0}^m (-1)^j \binom{m}{j}j^k=0$$ if $0\leqslant k\leqslant m-1$, and $m!$ if $k=m$.

Proof.
Follows from Step $1$ by linearity.

3-$$\sigma_k(1,2,\ldots,j-1)$$ is polynomial of degree $2k$ on $j$ with leading coefficient $\dfrac{1}{2^k k!}$.

Proof.
This is shown by induction using Newton's identities

4-$$\sum_{j=0}^m (-1)^j\binom{m}{j}\sigma_k(1,2,\ldots,j-1)=0$$ if $2k<m$,
  and $1\times 3\times\cdots (m-1)$ if $2k=m$.

Follows from Step $2$ and $3$

5 $$\sum_{j=0}^m (-1)^j \binom{m}{j}(1-\frac{1}{n})\cdots (1-\frac{j-1}{n})$$ is equivalent
  when $n\rightarrow +\infty $ to $(-n)^{-m/2}\times 1\times 3\times\cdots (m-1)$ if $m$ is even and, et is $o(n^{-m/2})$ if $m$ is odd.

Proof.
Just develop the product and use step $4$.

6- For $p_0(x)=x^m$, $p_n(-n)$ is equivalent to $(-n)^{m/2}\times 1 \times
 3\times\cdots\times (m-1)$ if $m$ is even, and $p_n(-n)=o(n^{m/2})$ if $m$ is odd.

Proof.
Use $p_n(x)=\sum_{j=0}^m \binom{n}{j}m(m-1)\cdots (m-j+1)x^{m-j}=\binom{m}{j}n(n-1)\cdots (n-j+1)x^{m-j}$  and substitute $x=-n$ to return to step $5$.

7-Denote $q_{m,n}(x)=n^{-m/2}p_{m,n}(-n+x\sqrt{n})$ with $p_0=x^m$
  We show by induction on $n$ as $q_ {m, n} $ converges to the Hermite polynomial $H_m $ when $n$ tends to infinity.

For $n=0$ is obvious.
Suppose the assertion true at rank <$ n $. Then she is true for $\frac{1}{m}p'_{m,0}(x)=x^{m-1}=p_{m-1,0}$.
As the derivation commutes with the transformation $p_0\mapsto p_n$, we have $p'_{m,n}=mp_{m-1,n}$.
It comes $q'_{m,n}=mq_{m-1,n}$, thus $q'_{m,n}$ converges to $mH_{m-1}=H'_m$ as $m$ tends to $+\infty$.
Using step $6$ we have $q_{m,n}(0)$ converges to $H_m(0)$.

8- The result of step 7 is true for any monic polynomial of degree  $m$ instead of $p_0$.

Finally, We boils down to $p_0$ unitary. By continuity of the roots in the coefficients of a polynomial and the fact that the Hermite polynomials are divided to simple roots over $\mathbb{R}$, $p_n$ is also for $n$ large enough after step $8$.

A: Let's recall two observations in this discussion:

*

*$\displaystyle f_n(x)=\frac{d^n\left( e^xp_0(x)\right)}{dx^n}$

*$\displaystyle p_n(x)=\sum_{i=0}^n{n\choose i}p_0^{(i)}(x)$
Notice also, the degree never goes up $\deg p_n = \deg p_0 = m$ for all $n \geq 0$.  Then
$$ \sum_{k=0}^n{n\choose k}p_0^{(k)}(x) = \sum_{k=0}^m{n\choose k}p_0^{(k)}(x)
\approx \sum_{k=0}^m \frac{n^k}{k!}p_0^{(k)}(x) = p_0(x+n)
$$
where $m << n$.  In this regime, we estimate the binomial coefficient by:
$ \binom{n}{k} \approx  \frac{n^k}{k!}$ and then use Taylor formula.

Notice this only holds asymptotically for $n >> 1$ we get $p_n(x) \approx p_0(x+n)$.  Then I wasn't agreeing with Clin's conjecture since $p_0(x)$ may not always have real roots, e.g. $p_0(x) = x^2 + 1$.  In fact $p_n(x) = (x+n)^2 - n + 1$.

A second-order estimate gives $p_n(x) \approx p_0(x+n) - n \,p''_0(x+n)$...
Does $p_0(x) - n \, p_0''(x)$ have all real roots for $n$ sufficiently large?
Generically we can write $p_0(x) = x^m +  ax^{m-2} + \dots$ so that
$p_n(x-n) \approx x^m - n \times m(m-1)x^{m-2} + \dots$

A: It is true that, for $n$ large enough, $p_n(x)$ will have distinct real roots, which I will prove by induction on $m$.
Before proceding with the proof, let me first state what it shows about the behaviour of $p_n$ as $n$ increases. Assuming the leading coefficient is positive, $p_n^{(m-2)}$ are quadratics with a unique minimum. As $n$ increases, the minimum decreases monotonically until it becomes negative, at which point $p_n^{(m-2)}$ has distinct real roots. Then, $p_n^{(m-3)}$ is a cubic with a local maximum and a local minimum. As $n$ increases further, the local maximum increases until it is positive and the local minimum decreases until it is negative, at which point $p_n^{(m-3)}$ has distinct real roots. More generally, for each $k=0,1,2,\ldots,m-2$, once $p_n^{(k+1)}$ has distinct real roots then $p_n^{(k)}$ has $m-k-1$ local extrema. Further increasing $n$, the local maxima increase monotonically until they are positive and the local minima decrease until they are negative, at which point $p_n^{(k)}$ has distinct real roots. By induction then, $p_n$ eventually has distinct real roots.
Now, to continue with the proof.
For $m=1$, $p_n(x)$ is of first order so always has a real root.
For $m > 1$, we now suppose that the statement holds for polynomials of degree $m-1$. Then, setting $q_n(x)=p_n^\prime(x)$, we have $q_n(x)=q_{n-1}(x)+q_{n-1}^\prime(x)$. By the induction hypothesis, $q_n(x)$ has $m-1$ distinct real roots for all large enough $n$. I'll denote these by $a_{n,1} > a_{n,2} > \cdots > a_{n,m-1}$. These are the turning points of $p_n(x)$. I'll show that the for large $n$, the signs of $p_n(a_{n,1}),p_n(a_{n,2}),p_n(a_{n,3}),\ldots$ are alternating, from which it follows that $p_n$ has $m$ distinct roots.
By scaling, we assume wlog that $p_n(x)$ has leading coefficient $1$ (i.e., it is monic). Then, $q_n$ is positive on $(a_{n,1},\infty)$, negative on $(a_{n,2},a_{n,1})$, positive on $(a_{n,3},a_{n,2}))$, etc.
Note that $a_{n,i}$ is a local maximum of $(-1)^ip_n(x)$ (for each $i=1,2,\ldots,m-1$). This means that
$$
(-1)^ip_n(a_{n,i}+h)=(-1)^ip_n(a_{n,i})-ch^{2r}+O(h^{2r+1})
$$
for some positive $c$ and positive integer $r$. So,
$$
(-1)^ip_{n+1}^\prime(a_{n,i}+h)=-c(2r)(2r-1)h^{2(r-1)}+O(h^{2r-1}).
$$
This shows that $(-1)^ip_{n+1}(x)$ is decreasing in a neighbourhood of $a_{n,i}$.
Now, for $i=1,2,\ldots,m-2$, we see that $(-1)^ip_{n+1}(x)$ is increasing at $a_{n,i+1}$ and decreasing at $a_{n,i}$. Hence, it has a local maximum in $(a_{n,i+1},a_{n,i})$, which we will denote by $b_{i}$, so $a_{n,i+1} < b_i < a_{n,i}$ and $(-1)^ip_{n+1}(b_i) > (-1)^ip_{n+1}(a_{n-i})$. Similarly, $(-1)^{m-1}p_{n+1}(x)$ is decreasing at $a_{n,m-1}$ and (as $p_{n+1}$ is monic of degree $m$), it tends to $-\infty$ as $x\to-\infty$. Hence, it has a local maximum, $b_{m-1}$ in the range $(-\infty,a_{n,m-1})$. So, $b_{m-1} < a_{n,m-1}$ and $(-1)^ip_{n+1}(b_{m-1}) > (-1)^ip_{n+1}(a_{n,m-1})$. As $b_1 > b_2 > \cdots > b_{m-1}$ are roots of $p_{n+1}^\prime(x)$, we have $a_{n+1,i}=b_i$.
So far, we have shown that
$$
a_{n,1} > a_{n+1,1} > a_{n,2} > a_{n+1,2} > a_{n,3} > \cdots > a_{n,m-1} > a_{n+1,m-1}
$$
and, for each $i$, $(-1)^ip(a_{n,i})$ is strictly increasing in $n$. If, for each fixed $i$, it can be shown that there is an $\epsilon > 0$ with $(-1)^ip_{n+1}(a_{n+1,i})\ge(-1)^ip_n(a_{n,i})+\epsilon$ for all large $n$ then, for $n$ large enough, $(-1)^ip_n(a_{n,i})$ will be positive. So, the signs of $p_n(a_{n,1}),p_n(a_{n,2}),\ldots$ will be alternating in sign and we are done. Let us proceed by contradiction and assume to the contrary that $(-1)^ip_{n+1}(a_{n+1,i})< (-1)^ip_n(a_{n,i})+\epsilon$ (for small enough $\epsilon$ this will give a contradiction regardless of $n$).
If $i < m-1$ then $(-1)^ip_{n+1}(x)\le(-1)^ip_{n+1}(a_{n+1,i})$ on $(a_{n,i+1},a_{n,i})$. Setting $a_{n,m}=-\infty$ then this also holds for $i=m-1$. By the assumption, $(-1)^ip_{n+1}(x)\le(-1)^ip_{n}(a_{n,i})+\epsilon$ in this range so, setting $f(x)=(-1)^i(p_n(a_{n,i})-p_{n}(x))\ge0$,
$$
f(x)+f^\prime(x)=(-1)^i(p_n(a_{n,i})-p_{n+1}(x))\ge-\epsilon.
$$
Therefore,
$$
f(x)=-\int_x^{a_{n,i}}\frac{d}{dy}(e^{y-x}f(y))dy
=-\int_x^{a_{n,i}}e^{y-x}(f(y)+f^\prime(y))dy\le\epsilon\int_x^{a_{n,i}}e^{y-x}dy=\epsilon(e^{a_{n,i}-x}-1).
$$
This shows that in the range $(a_{n,i+1},a_{n,i})$,
\begin{align}
\lvert p_{n}(x)-p_n(a_{n,i})\rvert\le\epsilon(e^{a_{n,i}-x}-1).&&{\rm(1)}
\end{align}
So, $p_n$ is almost constant here for $\epsilon$ small. I'll need the following lemma, which I'll prove in a moment.

Lemma: Let $p$ be a monic polynominal of degree $m\ge1$. Then, for each $a < b$ we have
  $$
sup_{x\in(a,b)}\lvert p(x)-p(b)\rvert\ge L(b-a)^m.
$$
  where $L$ is a constant depending only on $m$.

We can apply this to (1). For the case $i=m-1$ and any $K>0$, apply to the range $[a_{n,m-1}-K,a_{n,m-1}]$ to get
$$
\epsilon(e^K-1)\ge L K^{m}
$$
which gives a contradiction if $\epsilon$ is small enough.
On the other hand, for $i< m-1$, $(-1)^i(p_n(a_{n,i})-p_n(a_{n,i+1})$ is positive and increasing in $n$ for all large enough $n$, so is greater than some fixed $\delta$. Applying (1),
$$
\delta\le (-1)^i(p_{n,i}(a_{n,i})-p_{n,i}(a_{n,i+1}))\le\epsilon(e^{a_{n,i}-a_{n,i+1}}-1).
$$
Assuming that $\epsilon \le 1$, we choose $K > 0$ such that $\delta\ge e^K-1$. Then, $K\le a_{n,i}-a_{n,i+1}$ and we can apply the lemma to the range $[a_{n,i}-K,a_{n,i}]$ to get
$$
\epsilon(e^K-1)\ge LK^m
$$
again, giving a contradiction for small $\epsilon$. QED

I'll now prove the lemma. For any $\epsilon\in\mathbb{R}$ define the linear operator $T_\epsilon$ of the functions $f\colon\mathbb{R}\to\mathbb{R}$ by $T_\epsilon f(x)=f(x+\epsilon)$. If $f$ is a polynomial of degree $m$ with leading coefficient $c$, then $T_\epsilon f-f$ is a polynomial of degree $m-1$ with leading coefficient $mc\epsilon$. Hence, $(T_\epsilon-1)^mf(x)=m!c\epsilon^m$. On the other hand $\lVert T_\epsilon\rVert=1$ and $(T_\epsilon-1)^mf(x)$ only depends on the values of $f(y)$ with $y$ in the range $[x,x+m\epsilon]$. So, for a monic polynomial $f$ of degree $m$,
$$
m!\epsilon^m=(T_\epsilon-1)^mf(x)\le 2^m\sup_{y\in[x,x+m\epsilon]}\lvert f(y)\rvert
$$
If $p$ is a monic polynomial of degree $m$ and $a < b$, then taking $f(y)=p(y)-p(b)$, $x=a$ and $\epsilon=(b-a)/m$ gives the lemma with $L=m!(2m)^{-m}$.


text:
Q: Adding letters to equation numbers I want to number use a equation and add a letter to the equation number such as:
f(x) =a x and g(x) = b x                     (3.1.1a,b)

That is e.g. using \begin{equation} ... \label{eq} \end{equation}

A: \documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\specialnumber}[1]{%
  \def\tagform@##1{\maketag@@@{(\ignorespaces##1\unskip\@@italiccorr#1)}}%
}
\newcommand{\specialeqref}[2]{\begingroup
  \def\tagform@##1{\maketag@@@{(\ignorespaces##1\unskip\@@italiccorr#2)}}%
  \eqref{#1}\endgroup}
\makeatother

\begin{document}
\begin{equation}
\specialnumber{a,b}\label{myeq}
a=b\qquad c=d
\end{equation}

\specialeqref{myeq}{a}

\end{document}

This doesn't work for alignment environments such as align and gather, though.
The argument to \specialnumber is added after the normal equation number. For references, you have to add it manually, so the \specialeqref command comes handy.

A: The amsmath package provides \tag{<whatever>} that allows you to tag (or number) an equation with <whatever> you want. Here's a minimal working example:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\[
  f(x)=ax \qquad \text{and} \qquad g(x)=bx \tag{3.1.1a,b}\label{myeq}
\]
For example, see \eqref{myeq}.
\end{document}

If you don't want the parentheses around the \tag, use \tag* instead. With this, however, you can only reference the entire equation, not the separate components.

For the ability to reference either the main equation or the sub-equations as a whole, you could use the following setup:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\renewcommand{\theequation}{\thesubsection.\arabic{equation}}
\begin{document}
\setcounter{section}{2}% Just for illustrative purposes
\section{A section} \subsection{A subsection}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.%
\refstepcounter{equation}\label{myeqn1}% Correctly mark and label equation
\[
  f(x)=ax \qquad \text{and} \qquad g(x)=bx \tag{\theequation a,b}\label{myeqn2}
\]
For example, see~\eqref{myeqn1} and~\eqref{myeqn2}.
\end{document}

The idea is to correctly step and reference (using \refstepcounter) the equation before it is typeset, and use the equation number in \tag (via \theequation) for appropriate labelling and referencing.

A: There is an easy way to do this automatically if you put the equations on seperate lines.
The amsmath package provides an environment subequations which can easily be used in conjunction with the align environment for equations.
For example:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
\label{equations}
\begin{align}
  \label{eq:f}
  f(x)&=ax + b \\
  \label{eq:g}
  g(x)&=cx^2 + dx + e
\end{align}
\end{subequations}
For example, see \eqref{equations}.
Or see equations \eqref{eq:f} and \eqref{eq:g}.
\end{document}


text:
Q: What interrupts are available in 8086 real mode? I have read about BIOS interrupts, and know that they can be accessed only in 8086 real mode.
My questions:

*

*Are there any other interrupts also available ? I have read about DOS
interrupts, but I am confused as to if they are available in real
mode also, and what is the list of DOS interrupts.

*Once we enter protected mode, what happens to the BIOS
interrupt table stored at 0x00 ? Is it replaces, or is it present but
just not accessible ?

*BIOS interrupts like 0x13 or 0x19, how are they implemented ? Is it in software or through the processor ?

A: In real mode, you have 256 different SOFTWARE TRIGGERED interrupts. In the early days of BIOS and DOS, they were used as not much more than a "jump address" table. For example, DOS used INT 21 mainly, so applications could be coded to use the INT 21 processor instruction instead of a CALL 1234:5678 - the real address would change with each new version of DOS, but the INT 21 stayed. When dos booted up, it would put the address of its real handler function into that slot of the interrupt table.
The INT XX processor instruction can use interrupt numbers from 0 to 255, so all of them are available. If there was anything useful in the corresponding interrupt table slot was another thing - there were lots of resident programs however, that used some specific interrupt (which led to collisions if you loaded more than one of these programs).
Apart from this are the HARDWARE interrupts - these are not triggered by software, but by an external device like your keyboard, floppy or hard disk, when they wanted to tell the processor "i need some service". So for example, when you pressed a key on the keyboard, the keyboard controller triggers interrupt 9 (not sure about the number, it's a long time ago, but interrupts 8-15 were reserved for hardware). When booting, the BIOS would put the address of its keyboard-handling-procedure into the corresponding entry of the interrupt table. Whenever you pressed a key, the keyboard controller triggered interrupt 9, which made the processor look up the corresponding address in the interrupt table, call it - this transfers control to the bios - the bios did whatever is neccesary to get the actual key from the keyboard, then returned to the application, which had no idea what hat happened.
So to answer your first question: There are 256 interrupts. 0-7 were used for processor-internal stuff. 07-0F were triggered by hardware. 10-1F were reserved for the Bios, and DOS used 20-27. The rest of them were unused, which means, no valid procedure entry point was stored for them in the interrupt table. (This became very murky later, i'm oversimplifying here).
2nd question: Once you enter protected mode, the interrupt table is replaced by the OS that puts the processor in protected mode, because the BIOS routines were written for the 8086 which did not have a protected mode, often aren't safe to use if not in real mode, and don't handle multitasking well. Any decent OS just has to do this kind of stuff itself. And interrupts from 20-27, which were used by DOS, just have no replacement for them in others OSes. So you can't run dos executables on Linux, apart from not being able to run them, they wouldn't work if they use dos interrupts.
3rd question: The BIOS interrupts themselves are purely software, but they trigger hardware events. Interrupt 13 was for the floppy/hard disk. A program that wanted to read sectors directly from the floppy would fill the processor registers with some predefined values, call interrupt 13 (thus jump into the BIOS routine, the address of which was put into the interrupt table when the BIOS booted), and let the bios do its work. No hardware stuff yet. WITHIN the interrupt handler, of course, the bios would read and write the hardware ports of the floppy controller, but the application didn't have to know about the details.

A: *

*DOS interrupts are available in DOS.  (A 16-bit program in Windows will be able to use them as well, as it's running in a virtual 8086 mode and Windows tries to present an environment just like the olden days.)  They're not there before the OS starts loading, though...and if you're building your own OS, they're not there at all unless you put them in.

*Once you switch to protected mode, you're basically running off the interrupt descriptor table (IDT) you set up during the switch.  The old table is still there, because its format is different enough that you can't just go overwriting it without risking trouble if an interrupt occurs before the switch.  And you'd generally keep it around for a couple of reasons anyway, including its usefulness in case you have to switch back to real mode for some reason.  (Windows 9x used to do this.  Some drivers were 16-bit, and no one wanted to update them...so Windows had the ability to have those drivers run in real mode.)  But it's not used while the processor is in protected mode.

*The processor is not directly involved in the actual handling of interrupts.  It doesn't even know what type of computer it's running in. Basically, it just sees an entry in the IDT and calls that interrupt handler.


text:
Q: problem in retriving multiple checkbox values I am unable to access the values of checkboxes i select.
Here is my code which i tried.
<input type="checkbox" id="<%= "gname_" + in.intValue() %>" name="chkBox" onclick='chkboxSelect(localArrGroupNames[<%=in.intValue() %>],<%= "gname_" + in.intValue() %>)'>

JS code:
function chkboxSelect( chkBoxValue, id){
      var i=0;
    if(id.checked)  {
       var selected;
       alert("id:  " + chkBoxValue + i);
       selected[i] = chkBoxValue;
       i++;
    }

    }

I get only one value in my alert though I select more than one value.
For example if i select red, blue, green, After I select each, I get only one in my alert.
Please help me . Thanks in advance.

A: If all checkboxes have the same name chkBox
<!DOCTYPE HTML>

<title>Title of the document</title>

 <input type="checkbox" id="gname_1" name="chkBox" onclick='getValues();' value='red'>Red

 <input type="checkbox" id="gname_2" name="chkBox" onclick='getValues();' value='green'>Green

 <input type="checkbox" id="gname_3" name="chkBox" onclick='getValues();' value='blue'>Blue

A: If you use multiple checkboxes with the same name, your code shoud be like this:
<input type="checkbox" name="chkBox[]" value="red">
<input type="checkbox" name="chkBox[]" value="green">
<input type="checkbox" name="chkBox[]" value="blue">

if you submit the form, you will get an array... ($_POST['chkBox'][0])


text:
Q: why my bootstrap grid has too many margin? I'm using Bootstrap in Angular and I've installed it via npm, but for some reason there is too much margin at the sides, can someone please help me?

and here is the code

Left column

Right column

Left column

Right column

Left column

Right column

Left column

Right column

Left column

Right column

Left column

Right column

update: i dont have any css just the bootstrap css the minified version of the bootstrap installed just this week using npm.
but well i was just thinking that was something new about bootstrap, so i supposed i will setup the project again and see what happens, maybe even downloading another bootstrap version.

A: If you want to set full width for container, use .container-fluid instead of .container

Left column

Right column

Left column

Right column

Left column

Right column

Left column

Right column

Left column

Right column

Left column

Right column

A: Since you use classes like ".container", ".container-fluid" or ".row", you are restricted by the properties that were set for these classes in the bootstrap.css file.
So, your options are to use a regular div with a class with a different name and set the width to 100%.
The other option might be to override the grid classes of bootstrap. In that case, just use pure CSS, because if someone goes for bootstrap is to take advantages of its utilities; otherwise, better I create my grids.
The ".row" class TAKES EXTRA SPACE ON BOTH SIDES, yes, on purpose because the idea is to nest columns inside the rows, which at the same time should be nested inside of containers either fluid, responsive or the default one. Two links of reference:
https://getbootstrap.com/docs/5.0/layout/grid/#how-it-works
And to practice...
https://codepen.io/limakid/pen/zYwdJqQ?editors=1100
TEXT JUST INSIDE OF BODY TAG, no div, no header. Nothing is wrapping this text.

Text wrapped with &lth1&gt only.

This is a ROW class out of ".container" class of Bootstrap.

This is a COL class out of ".container" class of Bootstrap, and it's also out of any ROW.

  Text inside of a Bootstrap container class. Note the PADDING ON THE LEFT and compare with the ROW below.

     Text out of column. Only inside of row. No element, no class attached.

    ".ROW" class takes extra space both sides; more notorious on the left in this example
    Class ".row-cols-{NUMBER}" define how many columns you want inside of that row. Only 1 column in this case.

This is a column inside a row.
      Note the padding on the left.

This is a yellow row inside a row.

This is a yellow column inside a row.

Row inside of a row.

Another column inside a row.

This is a new row. Nothing to do with the row above, but still inside of ".container" class. This will NEST the next 2 contents.

This is a new row, nested.

This is column. ROWS in Bootstrap are thought to wrap columns. When you create a row, automatically get extra paddings, BUT when you create a column inside (".col") you remove automatically that extra padding

// .row-padding{
//   padding-left: 12px;
// }

.personal-text{
 background-color: #E6AFFA; /* Light PURPLE*/
}

.personal-out-of{
  background-color: lime;
}

.personal-col-child{
  background-color: #FAD8AF;
}

A: if you check the container class of bootstrap you can see some like
@media(min-width:1200px){
.container, .container-lg, .container-md, .container-sm, .container-xl {
    max-width: 1140px;
}
@media(min-width:992px){
.container, .container-lg, .container-md, .container-sm {
    max-width: 960px;
}
@media(min-width:768px){
.container, .container-md, .container-sm {
    max-width: 720px;
}
@media(min-width:576px){
.container, .container-sm {
    max-width: 540px;
}

This indicate that, e.g. if your screen is wider than 1200px the max width available will be 1140px. In early times, it's not very common that the screen was more wider. Bootstrap 5 add a new break-point to take account this new screen (If you're using Bootstrap 4.6, e.g. you can add it in your .css
@media(min-width:1400px){
    .container, .container-lg, .container-md, .container-sm, .container-xl {
        max-width: 1320px;
    }

Really I think that it's very hard read lines with a more than 1320px, but you can extend it or not put under "container" your table


text:
Q: Select - Setting a disabled selected option as well as having a bound *ngfor option I have a piece of code that's not behaving the way I want it to.
Basically I want to have the "Please select a team" value to come up as the default selected option so I don't have to have a visible label assigned to the dropdown (I hope that makes sense).
The code works ok in so much as the team values appear and the "Please select a Team" appears, however the drop down selects the first element of the *ngfor option not the "Please select a Team" option
Can anybody shed some light on this please?  I'm pretty new to Angular so be gentle.
<label for="team" class="sr-only">Team </label>
  <select [(ngModel)]="model" autocomplete="off" required>
      <option value="default" disabled selected>Please select a
Team</option>
      <option *ngFor="let team of teams" [value]="team.name"> {{team.name}}</option>
  </select>

A: disabled cannot be selected at the same time. Choose one.

A: You need to use Angular's data binding for the value attribute. Change value="default" to [value]="default". Also be sure to read this Angular doc to learn more about data binding
Take a look at this stackblitz and let me know if this is your expected result