text:
Q: What is the best approach to build a Dashboard? Let me start with a brief explanation of this question. I've been recently getting started into web development. I know the bits and bytes of modern MVC architectures and have already been using it. But now that I am planning to build a Dashboard, I am confused about how to do it.
The traditional flow of data is, it is loaded from database at the backend, processed a little and sent in a response to the frontend. This is what I have worked on till now.
But talking about dashboards, assume that the data that should be shown on the dashboard requires too much processing. Like suppose the dashboard shows how much the person has spent/earned till now.
Now, adding some background context. If the application was about showing how much the person has spent at an online shopping site till now, it might not need too much processing. Loading a few hundreds of records might be okay (maybe!).
But if the dashboard is about showing how much an intraday trader has spent/earned till now (since he/she joined) would be too heavy. In this case, loading tens of thousands of records and calculating (adding/subtracting) will result in load on the server.
In this case, I am thinking about having a separate table for reports which is updated as and when necessary (for ex: when a new trade is executed by the user). And then simply reading and sending the data to frontend. Also, a bit of processing maybe done if needed, but all the heavy work is already done.
These two examples can be classified into two categories:

*

*Processing in real-time

*Processing ahead of time

Now, the question I have here is, "Should I always use the 2nd approach?" I have this question because if the processing is too less, then creating separate tables for reports is just a waste of storage. So, there are trade-offs that I can think of.
Now, coming to the second part of this question. This part refers to how should I be handling data changes at frontend. Three possible ways are:

*

*Periodic changes (okay if the data updates are less frequent)

*Instant / Real-Time changes (using something like data streaming maybe?)

*Instant / Real-Time changes, but only sending the updates (new changes that took place) and not whole data to frontend

Now, coming to what I think about this part. If the data changes are less frequent i.e. once in a day, it's okay to go for the first approach. But I am still unaware about the 2nd and 3rd one. Also, should I use data streaming and can anyone provide some insights of how streaming differs from a normal request-response cycle? I think this might be related to websockets or something similar but I am unaware.
PS: I am currently using Django as my backend, and am planning to use React/Vue or similar framework as my frontend. (The answer will be independent of this, but just for information)

A: With modern front-end technologies, it doesn't really matter if you use pulling data from the server (periodic update) or pushing data to the front-end (instant/real-time). For angular and React you should look at Observables, using this on the front-end both options are treated exactly the same.
In an event-driven front-end, it doesn't matter how you get the data you will write your program to handle the event of "when my data arrives, I will do XYZ"
Generally speaking, it would be better to break your next question down in to 1 or 2 very specific questions. Instead of asking a very broad question with tags "front-end", "back-end" and "everything-in-the middle", you could ask several specific questions focused on each aspect.


text:
Q: Updating react-table values after Dragging and Dropping a row in React Redux I´ve accomplished the react drag and drop functionality into my project so i can reorder a row in a react table´s list. The problem is i have a column named 'Sequence', witch shows me the order of the elements, that i can´t update its values.
Example:
before (the rows are draggable):
Sequence  | Name

    1       Jack
    2       Angel

after ( i need to update the values of Sequence wherea i change their position after dropping a specific draggable row, in this case i dragged Jack at the first position and dropped it at the second position) :
Sequence  | Name

   1        Angel
   2        Jack

React/Redux it´s allowing me to change the index order of this array of elements, without getting the 'A state mutation was detected between dispatches' error message,  but is not allowing me to update the Sequence values with a new order values.
This is what i have tried so far:
    // within the parent class component
    // item is an array of objects from child
    UpdateSequence(startIndex, endIndex, item) {

    // the state.Data is already an array of object
    const result = this.state.Data;
    const [removed] = result.splice(startIndex, 1);
    result.splice(endIndex, 0, removed);

    // this is working without the mutation state error
    this.setState({ Data: result })

    let positionDiff = 0;
    let direction = null;
    let newIndex = 0;

    positionDiff = endIndex - startIndex;
    if (startIndex > endIndex) {
        direction = "up";
    }
    else if (startIndex < endIndex) {
        direction = "down";
    }

    if (positionDiff !== 0) {
        for (var x = 0; x <= Math.abs(positionDiff); x++) {

            if (x === 0) {
                newIndex = startIndex + positionDiff - x;
                this.setState(prevState => ({
                    Data: {
                        ...prevState.Data,
                       [prevState.Data[newIndex].Sequence]: Data[newIndex].Sequence + positionDiff
                    },
                }));
            }
      else {
                if (direction === "down") {
                    newIndex = startIndex + positionDiff - x;
                    this.setState(prevState => ({
                        Data: {
                            ...prevState.Data,
                            [prevState.Data[newIndex].Sequence]: Data[newIndex].Sequence - 1
                        },
                    }));
                }
                else if (direction === "up") {
                    Data= startIndex + positionDiff + x;
                    this.setState(prevState => ({
                        Data: {
                            ...prevState.Data,
                            [prevState.Data[newIndex].Sequence]: Data[newIndex].Sequence + 1
                        },
                    }));
                }
            }
    }
        // so when i call save action i am stepping into the 'A state mutation was detected between dispatches' error message.
        this.props.actions.saveSequence(this.state.Data)
        .then(() => {
            this.props.actions.loadData();
        })
        .catch(error => {
            toastr['error'](error, 'error....');
        })
}

Calling the action 'saveSequence'  whenever i try to update the element of the array, 'Sequence', i am getting the 'A state mutation was detected between dispatches' error message.
Any help will be greatfull! Thank you!
note: The logic applied to reorder the Sequence is ok.

A: While I don't know redux particularly well, I am noticing that you are directly modifying state, which seems like a likely culprit.
const result = this.state.Data;
const [removed] = result.splice(startIndex, 1);

splice is a destructive method that modifies its input, and its input is a reference to something in this.state.
To demonstrate:
> state = {Data: [1,2,3]}
{ Data: [ 1, 2, 3 ] }
> result = state.Data.splice(0,1)
[ 1 ]
> state
{ Data: [ 2, 3 ] }

Notice that state has been modified. This might be what Redux is detecting, and a general React no-no.
To avoid modifying state, the easy way out is to clone the data you are looking to modify
const result = this.state.Data.slice()

Note that this does a shallow copy, so if Data has non-primitive values, you have to watch out for doing destructive edits on those values too. (Look up deep vs shallow copy if you want to find out more.) However, since you are only reordering things, I believe you're safe.

A: Well, i figured it out changing this part of code:
    //code....

    const result = item;
    const [removed] = result.splice(startIndex, 1);

    // i created a new empty copy of the const 'removed', called 'copy' and update the Sequence property of the array like this below. (this code with the sequence number is just a sample of what i came up to fix it )

    let copy;
    copy = {
        ...removed,
        Sequence: 1000,
    };

    result.splice(endIndex, 0, copy);

After i didn´t setState for it, so i commented this line:
    // this.setState({ Data: result })

    //...code

and the end of it was putting the result to the save action as a parameter , and not the state.
     this.props.actions.saveSequence(result)

Works and now i have i fully drag and drop functionality saving the new order sequence into the database with no more 'A state mutation was detected between dispatches' error message!

redpajama_set_name: RedPajamaStackExchange


text:
Q: merge two array column and keep the distinct in BigQuery I have a query output like that. I want to have N3 column is the distinct merge of N1 and N2.
Query output example
My current query is this:
SELECT  rd.cId
        , rd.dId
        ,ARRAY_AGG(ei.IncentiveName IGNORE NULLS) AS N1
        ,ARRAY_AGG(ai.IncentiveName IGNORE NULLS) AS N2

FROM rd
join ei on...
join ai on ...
GROUP BY rd.cId, rd.dId

A: We found the problem, in many of the records, there was null value in 2nd column which was returning overall outcome as null.
Fixed that by checking with help of IFNull(N1, []) which solved the problem.
SELECT  rd.cId
    , rd.dId
    ARRAY_CONCAT(
           IFNULL(ARRAY_AGG(DISTINCT ei.IncentiveName IGNORE NULLS),[]),
           IFNULL(ARRAY_AGG(DISTINCT ai.IncentiveName IGNORE NULLS),[])
    )
FROM rd
join ei on...
join ai on ...
GROUP BY rd.cId, rd.dId

A: You can merge both arrays with array_concat. Then unnest the array and regroup to an arrray, but keep only distinct elements.
with tbl as
(select 1 id, [1,2,2,3] N1, [1,5,7,8] N2
union all select 2 ,[],[5,5,5,6])

select *,
array_concat(N1,N2),
(select array_agg(distinct x) from unnest(array_concat(N1,N2))x)
from tbl

In case you want to group by id column:
with tbl as
(select 1 id, [1,2,2,3] N1, [1,5,7,8] N2
union all select 2 ,[],[5,5,5,6]
union all select 2 ,[7,8],[9]),

helper as (
  select id, array_agg(N1_) N1, array_agg(N2_) N2
  from tbl,unnest(N1) N1_,unnest(N2) N2_
  group by 1
)
select *,
#array_concat(N1,N2),
(select array_agg(distinct x) from unnest(array_concat(N1,N2))x)
from helper

A: Consider below
with your_current_query as (
  SELECT  rd.cId
    , rd.dId
    ,ARRAY_AGG(ei.IncentiveName IGNORE NULLS) AS N1
    ,ARRAY_AGG(ai.IncentiveName IGNORE NULLS) AS N2
  FROM rd
  join ei on...
  join ai on ...
  GROUP BY rd.cId, rd.dId
)
select *, array(
    select * from t.N1 union distinct
    select * from t.N2
  ) as N3
from your_current_query  t


text:
Q: New error discovered when using Chromedriver Selenium When I try to open Chrome with selenium with webdriver, it shows a chrome that looks like this.

Even though it's been a long wait, it's still the same. While I open it by right clicking, it works fine.
I've tried using all versions of Chromedriver 100 and 99, but the results haven't changed much.

Here is the source code that I use:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument(f"--user-data-dir=G:\\Multi_Chrome\\testing\\Data\\profile")

driver = webdriver.Chrome(service=Service("D:\\Python\\Project\\chromedriver.exe"),
                          options=chrome_options)

input("Press any key to coutinue ...")
driver.close()
driver.quit()

Any ideas? By the way, I want to ask more, how to open a normal portable chrome. Instead of right clicking and choosing open. Is there a way to automatically open it?
I have partially mentioned it in this article: Open a complete portable chrome like regular Chrome

A: your question isn't clear because you didn't mention what is the error, but as I see in the screenshot you have already opened one chrome browser before you run the script, but you use --user-data-dir=G:\\Multi_Chrome\\testing\\Data\\profile it means that this profile is already is in use so you cant open another chrome browser with the same profile. so The simplest and easiest fix is to close all running chrome browsers and after that try to run your script again


text:
Q: Postman testing: How do I add information to the results of my tests when I export it? Postman ver 6:
How do I add information to the results of my tests when I export it? I though console.log would do it but it didn't.
This is when I'm in the test runner and I click export?

pm.test("Address is valid", function () {
    var jsonObj = data.Candidates[0].Codes.DpvMatchCode;
    console.log(Object.keys(jsonObj)[0]);
    pm.expect(Object.keys(jsonObj)[0]).to.be.oneOf(["Y","D","S"]);
    pm.expect(data.Candidates[0].Result.delivery_line_2).to.include(" BOX ");
});

A: Postman doesn't support that, I think your best bet will be to use Newman to run a collection and capture the output to a file:
newman run google_collection

Google

→ Drive - Set access token
POST https://accounts.google.com/o/oauth2/token [200 OK, 627B, 393ms]
√  Status code is 200

→ List all files
GET https://www.googleapis.com/drive/v3/files [200 OK, 17.36KB, 639ms]
┌
│ 'test drive#fileList'
└

→ Search for file by name
GET https://www.googleapis.com/drive/v3/files?q=name="00P0H00001EXpn8" [200 OK, 660B, 340ms]

Note that in the 2nd request the following output comes from console.log:
┌
│ 'test drive#fileList'
└

Not sure what you're trying to accomplish since doing might get messing trying to parse everything out but this might be your best bet. You could potentially also use some sort of custom html reporter but that also might be messy and definitely need to use newman.


text: Q: Testing functions for binary optimization It is well known that it is hard to find optimum of some functions, mainly those with lot of local extremes, discontinuities etc. To assess quality of optimization algorithms (particularly heuristics), testing functions suffering from mentioned "deficiencies" have been created. See for example here. However, these functions are continuous. Now I am looking for similar library of function or problems connected with binary optimization. I know that binary optimization is generally NP-hard task, however, I would like to test my algorithm on something "very difficult". Could anyone recommend me a suitable resource?


text:
Q: How to use map() on lists with different length, fill shortest lists with custom value I want to apply a function on multiple lists using map, and fill the shortest list(s) with a custom value. I have created a solution using a for loop and zip_longest but I think it could be improved using map(). I'm unaware which of the list(s) is the longest, they could have equal lengths. Here's my implementation:
import itertools

items1 = [1, 2, 3, 4]
items2 = [1, 2]
items3 = [1, 1, 1]

def multiply(a, b, c):
    if a is None:
        a = 0.5  # custom value, could also be set elsewhere
    if b is None:
        b = 0.4
    if c is None:
        c = 0.3
    return a * b * c

squared_numbers = []
for numbers in itertools.zip_longest(items1, items2, items3):
    squared_numbers.append(multiply(*numbers))

Value of squared_numbers:
[1, 4, 1.2000000000000002, 0.48]

Bonus: I prefer to set the custom values via def multiply(a=5, b=0.4, c=0.3), but I'm not sure if this is possible.
EDIT: The code works fine, I'm just curious if it can be optimized further.

A: Maybe you meant itertools.starmap instead of map? Here's something I came up with but I wouldn't really say it's better than what you've already written:
from itertools import zip_longest, starmap

lists = [
    [1, 2, 3, 4],
    [1, 2],
    [1, 1, 1]
]

def multiply(*args):
    from functools import reduce
    from operator import mul

    defaults = [0.5, 0.4, 0.3]

    return reduce(mul, (arg or default for arg, default in zip(args, defaults)))

squared_numbers = list(starmap(multiply, zip_longest(*lists)))

print(squared_numbers)

Output:
[1, 4, 1.2000000000000002, 0.48]
>>>

If you're using itertools.zip_longest, you can't really get around using a fillvalue - in our case that means we will always pass three arguments to multiply, even if all- or some of them are None (itertools.zip_longest's default fillvalue). This means you can't use default positional-arguments, because they only take effect when not enough positional-arguments are passed in, which will never be the case.
The generator expression in functools.reduce works through short-circuit evaluation. The expression arg or default will evaluate to arg if arg is truthy, and default otherwise. None is considered falsey, so if arg is None, the expression evaluates to default.


text:
Q: is there any possibility to execute bluetooth chat application in emulator? i got the sample code of bluetooth chat application.from here.
is it possible to execute the application in emulator?
http://developer.android.com/resources/samples/BluetoothChat/index.html

A: No You can not test it on emulator. You have to purchase a physical device.
Refer this link.


text:
Q: выхлоп асма linux gcc с -O2 и без есть функция
int foo(int num) {
if(num)
    return 1;
else
    return 3;
}

мне понятен выхлоп без оптимизаций:
foo(int):
  pushq %rbp
  movq %rsp, %rbp
  movl %edi, -4(%rbp)
  cmpl $0, -4(%rbp)
  je .L2
  movl $1, %eax
  jmp .L3
.L2:
  movl $3, %eax
.L3:
  popq %rbp
  ret

но совершенно не понятно что происходит с O2:
foo(int):
  cmpl $1, %edi
  sbbl %eax, %eax
  andl $2, %eax
  addl $1, %eax
  ret

зачем вообще использовать SuBtract with Borrow...
к тому же если заменить возвращаемое значение return 3 на return 2, то вообще как-то странно все отрабатывает
 foo(int):
  xorl %eax, %eax
  testl %edi, %edi
  sete %al
  addl $1, %eax
  ret

проясните немного что куда кладется при оптимизациях... а то что-то не могу въехать никак

A: Компилятор не обязан генерировать понятный и/или простой для понимания код. С другой стороны если провести все вычисления на бумажке для всех входов и выходов, то логика работы функции будет точно такая же:
foo(int):
  cmpl $1, %edi    # устанавливает CF, если %edi-1<0 т.е. если %edi==0
  sbbl %eax, %eax  # %eax = CF ? 0xFFFFFFFF : 0
  andl $2, %eax    # %eax &= 2 т.е. в зависимости от CF: %eax=={2|0}
  addl $1, %eax    # %eax += 1 т.е. %eax=={3|1}
  ret

Во втором случае всё проще, можно переписать в примерном псевдокоде Си:
 foo(int):
  xorl %eax, %eax   # int rv=0;
  testl %edi, %edi  # if(num==0)
  sete %al          #   rv = 1;
  addl $1, %eax     # rv++;
  ret               # return rv;

Идея этих оптимизаций в том чтобы избавиться от команд условного перехода, которые на современных (i586+) ЦП, если блок предсказаний не угадывает, вызывают сброс конвейера, а следовательно значительно замедляют вычисления.

A: Если вы поэкспериментируете с разными константами в качестве возвращаемых значений в вашей функции
int foo(int num)
{
  if(num)
    return A;
  else
    return B;
}

то можно заметить, что в общем случае в режиме -O2 компилятор в качестве оптимальной стратегии вычисления результата выбирает следующий подход
int foo(int edi)
{
  int eax = edi ? 0 : 0xFFFFFFFF;
  eax &= B - A;                   // `B - A` - константа
  return eax + A;
}

Комбинация
cmpl $1, %edi
sbbl %eax, %eax

это ни что иное, как эффективный способ вычислить значение оператора ?:. А дальнейший код тривиально соответствует вышенаписанному.
В случае же, когда возвращаемые константы отличаются не более чем на 1, компилятор выбирает другой подход - через sete.


text:
Q: Google Maps as texture map Hasn't anybody thought about creating dynamic texture of Google Maps? So for instance, we create a simple plane and apply a texture to it that is going to be an actual map of Google (with all of it properties, like drag, zoom, etc.).
Would be nice to somehow deploy google map to a canvas element, grab it as a map for Object3D texture, hide it and listen to its changes (mousemove, etc.) and update the texture map again as it's being changed.
Hasn't anybody implement this already? Or maybe at least somebody has some thoughts on how to do this implementation??? May be some alternative that I don't know about?
Correct me if I'm wrong, but I think that it would be nice to have Google Maps inside of THREE.js as a plugin or even as a part of library.

A: I have definitely thought about this and I'm not alone. You should be verrrrry prudent if you choose to do so, however: https://developers.google.com/maps/licensing
For student-ish projects you may be okay but don't be surprised if your game or real estate company gets a C&D letter in like 2 hours after release  :)

A: Seems like this has already been done.

The Google Maps team joined with B-Reel to make the Google Maps Cube
  Game, where you help a small blue ball navigate the streets of New
  York, Tokyo, Paris and San Francisco (among others). As you move your
  mouse the cube rotates and the ball rolls down the streets, bouncing
  off buildings and making its way towards the goal.
No discussion on WebGL is complete without mentioning Mr. doob's
  Three.js library at some point, and this is no exception: the Maps
  Cube game makes use of Three.js for its gorgeous rendering. If you're
  considering doing some WebGL work in a commercial setting, Three.js is
  a really good place to start; it's a very nice library that will save
  you a lot of headaches.

http://www.playmapscube.com/ (requires chrome).


text:
Q: Explicit invariants (under change of basis) of maps $V \to V \otimes V$. It is standard to construct numbers associated to a linear transformation $f: V \to V$  of a finite-dimensional vector space which are invariant under change of basis.  The coefficients of the characteristic polynomial are such, and it is quite simple to see for example that the trace is invariant by equating it with the map which takes $\sum v_i \otimes w_i \in V \otimes V^* \cong Hom(V, V)$ and then evaluates $\sum w_i(v_i)$.
My question is: can one explicitly associate quantities to maps $V \to V \otimes V$ which are invariant under change of basis?  A simple dimension count indicates there should be plenty of invariants, since the orbits will have dimension roughly $d^3 - d^2$, where $d$ is the dimension of $V$, but I have yet to construct a single one.

A: The answer depends on what you mean by "quantities"! As José demonstrated, there are no polynomial absolute invariants, essentially because of homogeneity, however, there are plenty of rational ones, obtained as fractions $F/G,$ where $F$ and $G$ are polynomial relative invariants of the same weight $k:$
$$ F(g\cdot f)=(\det g)^k F(f),\  G(g\cdot f)=(\det g)^k G(f), \quad g\in GL(V).$$
Your dimension count is one of the common false believes. In fact, sanity is restored when working with rational functions, for
$$ \operatorname{tr\ deg} K(X)^G=\operatorname{tr\ deg} K(X)-\dim O_x,$$
where $X$ is an irreducible algebraic variety over an alg. closed field $K$ of char 0 with an action of an algebraic group $G$, $O_x=G\cdot x$ is a generic orbit, $G_x$ is the stabilizer of $x$, $\dim O_x=\dim G-\dim G_x.$ In fact, rational invariants always separate generic orbits.1  What goes wrong with polynomial invariants is that orbits need not be Zariski closed. In your example, due to the presence of dilations, Zariski closure of every orbit contains zero. A $G$-invariant polynomial function $F$ is constant on any orbit $O$ and hence its value at any point $x\in O$ is equal to $F(0),$ so $F$ is constant.
Another way to resolve the issue is to replace the group $G$ with its subgroup $[G,G]$, which is the inter-section of the kernels of all 1-dimensional representations of $G$, thus replace $Gl(V)$ with $SL(V)$ om the example. After the $GL(V)$-equivariant identification $Hom(V,V\otimes V)\simeq V^*\otimes V\otimes V$ and polarization, which replaces a homogeneous degree $d$ polynomial function on $W$ with a multilinear map with $d$ arguments $W^\otimes d\to K$, the question reduces to finding multilinear $SL(V)$-invariants. Classical invariant theory shows that they are all obtained by composing $GL(V)$-invariant contractions $V^* \otimes V\to K,$ $\xi\otimes v\mapsto \xi(v)$ and expansions $K\to V^*\otimes V,$ $1\mapsto \sum e_i^*\otimes e_i$, permutations, symmetrizations, antisymmetrizations, and the $SL(V)$-invariant determinants $V^{\otimes k} \to K,$ $v_1\otimes\ldots\otimes v_k\mapsto \det[v_1|\ldots|v_k],$ $k=\dim V.$ Explicit formulas are a bit messy.

Footnotes
1See Vinberg and Popov's article on invariant theory in Algebraic Geometry 4 volume of the yellow Russian Math Encyclopaedia.

A: No nontrivial linear one exists, I'm afraid.
The underlying reason why the trace exists is that there is a $\mathrm{GL}(V)$-equivariant endomorphism of $V$: namely, the identity endomorphism.
By contrast, there cannot be any $\mathrm{GL}(V)$-equivariant linear maps $V \to V \otimes V$.
For definiteness, let us consider $V$ a real vector space.
Consider the action of the $\mathbb{R}^\times$ subgroup of $\mathrm{GL}(V)$ consisting of scalar matrices.  Then if $f:V \to V \otimes V$ is linear
$$f(\lambda v) = \lambda f(v)$$
for any $v \in V$ and $\lambda \in \mathbb{R}^\times$.
On the other hand, equivariance would say that
$$ \lambda \cdot f(v) = \lambda^2 f(v).$$
You can only reconcile both if $f$ is identically zero.
Edit
Unwisely, I had assumed linearity.  (The OP did mention other polynomial invariants.)  As pointed in comments to this answer, there are of course rational invariants.

A: This is essentially a rephrazing of Victor Protsak's reply (which I read too late).
In characteristic zero the answer is in principle given by classical invariant theory. Let $(e^i)$, $i=1,...,n$ be a basis for V. Then
coordinates on the space $Hom(V,V \otimes V)$ are given by tensors $c^i_{jk}$. Such a
tensor sends the vector $\lambda_i e^i$ to $c^i_{jk}\lambda_i e^j \otimes e^k$ (using the summation condition for repeated indices).
In addition let $\epsilon^{i_1,...,i_n}$ be the tensor which is $1$ if the $i_1,...,i_n$
form an even permutation of $1,...,n$, which is $-1$ for an odd permutation and which is zero otherwise. Similarly for $\epsilon_{i_1,...,i_n}$.
SL(V) invariants are now given by expressions in $c,\epsilon$ which have no free indices
(it is possible to do this via graphs). One has to be careful since many expressions
are zero for symmetry reasons.
There are clearly no linear invariants. If $dim(V)=2$ then I believe $\epsilon^{kl}c^i_{kj}c^j_{il}$ is an honest quadratic invariant. Another one
is $\epsilon^{kl}c^i_{ik}c^j_{lj}$. I.e. the determinant of the left partial
trace with the right partial trace.
EDIT:
The two dimensional case can also be viewed in a less abstract way. If $dim V=2$ then
$V\cong V^\ast$ as $SL(V)$ representation. Furthermore by Clebsch Gordan we have $V^* \otimes V\otimes V\cong
S^3V\oplus V\oplus V$. This is the problem of finding the generating concomitants for binary cubic forms. The answer can be found in Grace and Young. In this setting I
see only one quadratic invariant, namely the determinant between the two copies of V.
This means that the two quadratic invariants identified above are linearly
dependent which does not appear obvious. But they are indeed. If you write them
out explicitly you get (up to sign)
$c^1_{11}c^1_{12}-c^1_{21}c^1_{11}+c^1_{12}c^2_{12}-c^2_{21}c^1_{21}+c^2_{12}c^2_{22}
-c^2_{22}c^2_{21}$

A: Jose's argument proves that there are no polynomial invariants, i.e. no invariants that are polynomial in the matrix coefficients with respect to a given basis.  Victor suggests that there should be rational invariants.  Here's an easy one.  Let $\alpha : V \to V \otimes V$ be your function.  Then there are roughly four (not necessarily symmetric) bivectors $\beta: k \to V\otimes V$ by tracing $\alpha^{\otimes 2} : V^{\otimes 2} \to V^{\otimes 4}$ in various different ways.  For generic $\alpha$, this bivector $\beta$ will be nondegenerate, i.e. it will have an "inverse" $\beta^{-1}: V\otimes V \to k$, defined by declaring that one of the traces of $\beta\otimes \gamma$ is the identity map $V \to V$.  If $\beta^{-1}$ exists, then it is a (nonsymmetric) inner product on $V$.  Now, $\alpha$ determines two natural vectors $\operatorname{tr}_L(\alpha),\operatorname{tr}_R(\alpha)\in V$, by tracing in the two different ways.  So some invariants are the squared lengths of $\operatorname{tr}_L(\alpha),\operatorname{tr}_R(\alpha)$ and their two inner products with respect to $\beta^{-1}$.

A: I've been thinking about the case when $V$ is $2$-dimensional. Here, I claim, is a parametrization of the $GL(V)$-orbits of 'generic' linear maps $F:V\to V\otimes V$:
To numbers $p, a, b, c$ we associate a map which acts on a basis $v, w$ by:
$F(v)= -p(v\otimes v)+ w\otimes w$
$F(w)= (v\otimes w-w\otimes v)+ a(v\otimes v)+b(v\otimes w+w\otimes v)+ c(w\otimes w)$.
To put a generic $F$ in this form, write it as $F_++F_-$, symmetric plus antisymmetric. $F_-$ is given by $x\mapsto v\otimes x-x\otimes v$ for a unique $v\in V$. Assume $v\ne 0$.
Choose $w$ such that $v,w$ is a basis, but remember we are free to replace $w$ by $sv+tw$ for any scalars $s$ and $t\ne 0$. Think of the symmetric tensor $F_+(v)$ as a homogeneous quadratic polynomial in indeterminates $v,w$. Assume it has a $w^2$ term. Replacing $w$ by suitable $tw$ we can make that term $w^2$. Now replacing $w$ by suitable $sv+w$ ("completing the square") we can eliminate the $vw$ term. So $F_+(v)= -pv^2+w^2=-p(v\otimes v)+ w\otimes w$ for some $p$. And $F_+(w)= av^2+2bvw+cw^2=a(v\otimes v)+b(v\otimes w+w\otimes v)+ c(w\otimes w)$ for some $a,b,c$. This gives the formulas above for $F$.
I used up all the choices I had except that $w$ can still be changed to $-w$, which would change $p,a,b,c$ to $p,-a,b,-c$. So the "parametrization" is actually two to one.


text:
Q: Is there better method than this one to solve quadratic diophantine equations? Say we have the quadratic Diophantine equation :
$4x^2+9y^2=100$
I'm not really sure what the usual method to find integer solutions to these equations are , but one way I thought of was the following :
we know $4x^2\geq 0 \Rightarrow 9y^2 \leq 100 \Rightarrow y^2\leq 11.111 \Rightarrow -3.333 \geq y \leq 3.333$, so we know $y=-3,-2,-1,0,1,2$ or $3$.
We must also have the condition that $x^2=\tfrac{100-9y^2}{4}$ is an integer, and the square of an integer.
giving
$y=0, x=5$
$y=0, x=-5$
$y=2, x=4$
$y=2, x=-4$
$y=-2, x=4$
$y=-2, x=-4$
these pairs making up the set of integer solutions.
My questions are , firstly is this an okay method ? Secondly is there a better method ? After all if we had a very large number on the R.H.S. this trial and error method would be very impractical , I feel there must certainly be a more efficient one.
Edit: Particularly I would like to know is there a better method than this one for the general quadratic Diophantine equation , $ax^2+by^2=c$


text:
Q: How to use shortest_rout command of OSMX? how to run the Shortest path for a mapdata?
shortest_route(m::MapData, node1::Int, node2::Int; routing::Symbol = :astar)
what do we need to substitud as  routing and symbol??
Is there any possiblity to have k shoretest path?

A: Currently the parameter routing can have one of two values: either :astar or :dijkstra and the appropriate algorithm will be use respectively.
Currently in order to get k-shortest route you would need to use Graphs.jl. The distances are stored in the w field hence you could do (assuming you want to have 3 shortest paths between nodes 2341328633 and 52831601 and m is an object of MapData type):
Graphs.yen_k_shortest_paths(m.g, m.v[2341328633], m.v[52831601], m.w,3)

The field v stores information about mapping OSM nodes to vertices of SimpleDiGraph stored in the field g within a MapData object, and w is a sparse matrix with distances.


text:
Q: git pull - changes from Java I have a web app that serves some markdown files. What i would like to do is when there is a push to github i would ping my application using a webhook and i want my application to run git pull to retrieve changes. I am sure that no application specific files will change only markdown files in a specific folder.

*

*Does any one done something like this?

*Do you see any long term problems with this approach?

A: Here's how to do it in Clojure (since you have a Clojure-tag on your question): http://infolace.blogspot.com/2009/08/simple-webhooks-with-clojure-and-ring.html

A: http://www.kernel.org/pub/software/scm/git/docs/githooks.html
post-receive
Write a small script that will alert your java program somehow. Or even do the git pull in the script?


text:
Q: animation gets laggy after creating many objects dynamically I have the following code, after creating ~400 ImageView instance (by calling updateUI(NewImage) ~400 times) the newly created ImageView animation would be laggy, the more time elapsed the more laggy they become. I think after anImageView animation is done, i must destroy them to avoid being laggy. any idea?
public  void updateUI(final Bitmap bitmap)
   {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            final ImageView tmp = new ImageView(getApplicationContext());
            tmp.setImageBitmap(bitmap);
            tmp.setY(AT_THE_BOTTON_OF_ACTIVITY);
            rv.addView(tmp); add the ImageView to the Relalayout
           tmp.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View view) {
                    //disappear the imageView
                    ImageView t=imgs.get(id);
                    ObjectAnimator opacity = ObjectAnimator.ofFloat(tmp(The ImageView), "alpha", 0.0f);
                    opacity.setDuration(200);
                    opacity.start();

               }
           });

            ObjectAnimator anim2 = ObjectAnimator.ofFloat(tmp, "y", 0);
            anim2.setDuration(5000);
            anim2.setInterpolator(new LinearInterpolator());
            anim2.start();
        }
    });
}


text:
Q: View row with key oracle.jbo.key[300100120394155] is not found in SrCategoryParentIterator I have a tree table with each parent node may have child nodes.
When we are Searching for child node directly. It gives this JBO exception.
View row with key oracle.jbo.key[300100120394155] is not found in    SrCategoryParentIterator
In PageDef, Range Size is defined as '16'. If I changed it to '-1' and add maxFetchSize='10000' to VO.
This issue got resolved.
But Changing Range Size to '-1' reduces Performance and Scalability.
Do anybody know another efficient way to encounter this issue?
Or Root cause of this issue.
Any input would be great.

A: I will leave this here in hope it will help someone in the future.
I was having almost the same exception.
Exception stack:
oracle.jbo.RowAlreadyDeletedException: JBO-25019: Entity row with key oracle.jbo.Key[2520 ] is not found in .
at oracle.jbo.server.OracleSQLBuilderImpl.doEntitySelectForAltKey(OracleSQLBuilderImpl.java:881)
at oracle.jbo.server.BaseSQLBuilderImpl.doEntitySelect(BaseSQLBuilderImpl.java:566)
at oracle.jbo.server.EntityImpl.doSelect(EntityImpl.java:8836)
at oracle.jbo.server.EntityImpl.populate(EntityImpl.java:7451)
at oracle.jbo.server.EntityImpl.merge(EntityImpl.java:7790)

Solution
This exception was thrown due to the fact that there was an association of two tables and I was not adding it in the Query of the View.


text:
Q: Prolog: getting max/min value via backtracking? I would like to know if it's a good idea to get the max value (oldest person) of some facts via backtracking like this:
data(MaxID, MaxName, MaxAge),
\+ (data(ID, Name, Age), ID \= MaxID, MaxAge < Age).

Or vice versa for the min value (youngest person):
data(MinID, MinName, MinAge),
\+ (data(ID, Name, Age), ID \= MinID, MinAge > Age).

Is this efficient in terms of space or time complexity?
Is the implementation's style easy/straightforwarded? Do "nicer" implementations exist?

A:
Is this efficient in terms of space or time complexity?

Your implementation it's O(N^2) wrt time complexity, since for each candidate predicate all others gets 'called upon' for comparison. Space complexity is O(1).

Do "nicer" implementations exist?

Yes, nicer and more efficient implementations exist. Long time now, SWI-Prolog offers library(aggregate), a straight enhancement to setof/bagof/findall classical builtins:
?- aggregate(max(Age,data(ID,Name,Age)), ID^Name^data(ID,Name,Age), max(_,X)).

Note the style of quantification control expressed by ID^Name^.... It's the very same required by setof/3 and bagof/3. The implementation is more efficient tough, based on non backtrackable assignment.
The latest addition to could be considered library(solution_sequences).
Before digging inside this last one, consider exercising library(aggregate).
edit
Based on @false comment to the question, and the answer @boris, I would try to provide a 'nicer' (of course, a subjective evaluation) implementation:
min(P,A) :-
    copy_term(P,Q),
    arg(A,P,V), arg(A,Q,U),
    call(P), \+ ( call(Q), U@<V ).

now, you can pass your predicate as first parameter, and specify the argument of P to be used for comparison with the second parameter.

A: The short answer is, no, nothing really "nicer" exists, in terms of being always correct, easy to implement, and efficient all at the same time.
A small correction: it is enough to write
data(MaxID, MaxName, MaxAge),
\+ (data(ID, Name, Age), MaxAge < Age)

(as suggested by @false in the comment to your question)
You can see also this question and answers. This answer goes into some detail when and why using setof/3 can be problematic. It might be important for your use case.
Another way to do it (not mentioned in the very useful answer by @CapelliC) is to collect all solutions from your predicate and sort them, using a key. If you are using SWI-Prolog, or another Prolog that has the 4-argument version of sort that lets you choose the comparison and the key within a term, you could do, for example:
bagof(data(ID, Name, Age), data(ID, Name, Age), All),
sort(3, @>=, All, [data(Max_ID, Max_Name, Max_Age)|_])

As long as your data/3 is just a table of facts, this is safe to use.
This of course breaks down if you have equivalent but not equal elements in the list, as data(10, john, 34) and data(101, jane, 34). In the question and answer I linked there are examples how to deal with this, but again, I really don't think it gets any "nicer". It could be more efficient. I strongly recommend considering your use case carefully, and measuring performance if you think this can be a bottle neck.
Looking into the implementation of library(aggregate) suggested by @CapelliC it is obvious that it was meant for that use case exactly: it can find minimum, maximum, sum and so on in constant memory and touching each fact only once, and falls back to building the whole list if necessary.


text:
Q: How to reference a function after an argument in CodeIgniter URLs? My desired URL structure for a section of a web application is as follows:
/user/FooBar42/edit/privacy, and I would like this to route to controller: user, function: edit, with FooBar42 and privacy as arguments (in that order). How should I accomplish this with CodeIgniter?

A: Defining this route in application/config/routes.php should work:
$route['user/(:any)/edit/(:any)'] = "user/edit/$1/$2";

However, be aware that (:any) in the above route would match multiple segments. For example, user/one/two/edit/three would call the edit function in the user controller but only pass one as the fist parameter and two as the second.
Replacing the (:any) with the regex ([a-zA-Z0-9]+) will only allow one only alphanumeric values of length at least 1. This mitigates the issue above, where a / would be permitted allowing multiple segments to be allowed. Now, if user/one/two/edit/three was used, a 404 page would be shown.
$route['user/([a-zA-Z0-9]+)/edit/([a-zA-Z0-9]+)'] = "user/edit/$1/$2";

A: You can also use the remapping option of the CI controller
http://ellislab.com/codeigniter/user-guide/general/controllers.html#remapping
and doing something like this:
public function _remap($method, $params = array())
{
    // check if the method exists
    if (method_exists($this, $method))
    {
        // run the method
         return call_user_func_array(array($this, $method), $params);
    }
    else
    {
     // method does not exists so you can call nay other method you want
     $this->edit($params);
    }
}


text:
Q: Mail Merge - Adding space for response I am working on a word document into which we are merging excel data. We need to have either a line or some space when a field is blank. The merged form will be distributed for members to review the data on file and fill in any blank fields.
I have played around with IF statements and we are not getting the results we need. Here is an example of a line..
AM Bus: «AMBus»     PM Bus: «PMBus»          DOB: «Student_Date_of_Birth»
Any direction would be greatly appreciated!
Thanks,

A: Something like this should work:
{ IF { MERGEFIELD AMBus  } = "" "__________" { MERGEFIELD AMBus } }

Show us your IF statement attempts and we can troubleshoot them.  Press ALT + F9 to see all your merge info codes
Addendum:  I'm running office365 with version 1808 (Build 10730.20280 Click-to-Run) and this works great for me.
Full replication:
Create xlsx file with one column.  header=name, row1=steve, row2=(blank), row3=dave
create new docx. Type some stuff.
- Menu <mailings>
- tool bar <select recipients>
- <use an existing list>
- <choose list and sheet>
- tool bar <rules> (under Write&Insert Fields)
- <If...then...else>
- field name "name"
- comparison "is blank"
- Compare to (nothing)
- Insert this text "________"
<OK>
ALT+F9
place cursor inside the last set of double quotes "|"
- tool bar <insert Merge field>
- <name>
- tool bar <finish and merge>
- edit individual documents
<DONE>

Final docx:
Print the following name merge style: { IF { MERGEFILED name }= "" "__________" "{ MERGEFIELD name }" }


text:
Q: What are the properties of umbra with moments $1,1/2,1/3,1/4,1/5,...$? If we apply operator $D\Delta^{-1}$ to a function, we will get the (Bernoulli) umbral analog of the function. Particularly, applying it to $x^n$ we will get the Bernoulli polynomials $B_n(x)$. Evaluating them at zero we will get the moments of Bernoulli umbra, the Bernoulli numbers $1, -1/2, 1/6,...$ .
But what if we consider the operator $\Delta D^{-1}$? It is the inverse of the aforementioned operator.
What is interesting about it, it corresponds to an umbra with moments $1,1/2,1/3,1/4,...$.
This looks quite trivial, but what are the properties of this "anti-Bernoulli" umbra (let's denote it as $\overline B$)? Denoting the index-lowering operator as $\operatorname{eval}$, the following identities hold:
$\operatorname{eval} \psi(\overline{B}+x)=\ln (x)$
$\operatorname{eval} \ln(\overline{B}+x)=-x \ln (x)+x \ln (x+1)+\ln (x+1)-1$
$\operatorname{eval} \tan(\overline{B}+x)=\frac1\pi\ln \left(\frac{\frac{1}{2}+\frac{x}{\pi }}{\frac{1}{2}-\frac{x}{\pi }}\right)$
Thus, this operator also links exponential functions to logarithms.
Of interest also is the umbra $\overline{B}-1/2$, its moments are reciprocals of https://oeis.org/A001787, with even elements replaced by zeros.
Thus I wonder, what are other properties of umbra $\overline{B}$ and polynomials of it? Are there any known power series expansions with coefficients with denominators from https://oeis.org/A001787 ?
P.S., it seems, the following interesting identity holds:
$\operatorname{eval}\frac{x}{\overline{B} x+1}=\ln (x+1)$

A: I'll sketch here some of the general Sheffer Appell-umbral calculus relationships between the Bernoulli numbers / polynomials and the reciprocal (natural) numbers / polynomials. Perhaps when I have more time, I'll point to numerous sets of notes I've written over the years on this topic (some are included below).
The Bernoulli numbers
$(b.)^n = b_n$
are the moments defined by the e.g.f.
$e^{b.t} = \frac{t}{e^t-1}$
for the Appell Sheffer sequence of Bernoulli polynomials
$(B.(x))^n=B_n(x) = (b. + x)^n$
with the e.g.f.
$B(x,t) = B(t) e^{xt} = e^{b.t}e^{xt}= e^{(b.+x)t} = e^{B.(x)t}= \frac{t}{e^t-1}e^{xt}$.
Note that all umbral quantities are flagged with a period in the subscript to simplify and collate the notation and that umbral evaluation, i.e., the lowering of powers to the period subscript position, is understood to occur only after the analytic expressions are expressed as a power series in the umbral quantity of interest.
The reciprocal natural numbers
$(\bar{b}.)^n = \bar{b}_n = \frac{1}{n+1}$
are the moments with the e.g.f.
$e^{\bar{b}.} = \frac{e^t-1}{t}$
for the Appell Sheffer sequence of reciprocal polynomials
$\bar{B}_n(x) =(\bar{b}.+x)^n = \frac{(1+x)^{n+1}-x^{n+1}}{n+1}$
with the e.g.f.
$\bar{B}(x,t) = \bar{B}(t) e^{xt} = e^{\bar{b}.t}e^{xt}= e^{(\bar{b}.+x)t} = e^{\bar{B}.(x)t}= \frac{e^t-1}{t}e^{xt}$.
The operational generators, with the derivative op $D = \partial_x$, for the dual pair of polynomials are then the Todd operator
$B(D)x^n= \frac{D}{e^D-1}x^n = e^{b.D} x^n = (b.+x)^n = B_n(x)$
and the reciprocal op
$\bar{B}(D)x^n= \frac{e^D-1}{D}x^n = e^{\bar{b}.D} x^n = (b.+x)^n = \bar{B}_n(x)$.
Since the product of the two ops is the identity, i.e.,
$ 1 = \bar{B}(D) B(D) = B(D)\bar{B}(D),$
the pair of Appel sequences are mutually inverse under umbral composition, i.e.,
$x^n = B(D)\bar{B}(D)x^n =B(D)\bar{B}_n(x) = \bar{B}_n(b.+x)= \bar{B}_n(B.(x))= (\bar{b}.+b.+x)^n,$
implying the Kronecker delta relation for the pair of moments
$(\bar{b}.+b.)^n = 0^n = \delta_n$,
and, conversely (naturally for inverses),
$x^n =\bar{B}(D)B(D)  x^n =\bar{B}(D)B_n(x) = B_n(\bar{b}.+x)= B_n(\bar{B}.(x))= (\bar{b}.+b.+x)^n.$
This also follows, consistently, from the reciprocal relation of the moment e.g.f.s
$1 = B(t) \frac{1}{B(t)}  = B(t)\bar{B}(t) = e^{\bar{b}.t}e^{b.t}= e^{(b. + \bar{b}.)t}.$
This implies recursion relations among the moments and relations to important sequences of compositional partition polynomials (see, e.g., A133314 ).
Umbral composition of a pair of Sheffer sequences corresponds to matrix multiplication of their (infinite) lower triangular matrices of coefficients--in this case, for the pair of Appell Sheffer sequences $[B]$ with $B_{n,k} = \binom{n}{k}B_{n-k}$ and $[\bar{B}]$ with $\bar{B}_{n,k} = \binom{n}{k}\bar{B}_{n-k}$, so
$[B][\bar{B}]=[\bar{B}][B] = [I]$, the identity matrix.
See A178252 on $[\bar{B}]$.
The ops above can be used to find the raising $R$ and lowering $L$ ops for the pair of Appell sequences such that for the polynomials
$L P_n(x) = n \; P_{n-1}(x)$ and $R \; P_n(x) = P_{n+1}(x).$
Note the Graves-Pincherle-Weyl commutator relation $[L,R]P_n(x) = (LR-RL)P_n(x) = P_n(x)$, or $[L,R] = I$, is satisfied.
All Appell polynomial sequences $A_n(x)$ share the same lowering op $L =D$ since
$D \; A_n(x) = D \; (a.+x)^n = n (a.+x)^{n-1} = n\; A_{n-1}(x) = L \; A_n(x) .$
The raising ops are easily found from the conjugation of the raising op $R_P=x$ of the prototypical Appell sequence $P_n(x) = x^n$. For a generic Appell sequence $A_n(x)$ and its umbral inverse sequence $\bar{A}_n(x)$ (sometimes called reciprocal sequence),
$R_A = A(D) \; x\; (A(D))^{-1}  =  A(D) \; x \; \bar{A}(D) = x + \frac{d}{dt} \ln(A(t)) |_{t = D} = x + \frac{d}{dD} \ln(A(D))$
since
$R_A A_n(x) = A(D) \; x\; \bar{A}(D)A_n(x) = A(D) \; x\; x^{n} = A(D) \;  x^{n+1} = A_{n+1}(x).$
Similarly.
$R_\bar{A} = \bar{A}(D) \; x \;(\bar{A}(D))^{-1}  =  \bar{A}(D)\; x \; A(D) = x + \frac{d}{dD} \ln(\bar{A}(D)) = x - \frac{d}{dD} \ln(A(D)) $
(that one sign makes a big difference).
One defining property of the Bernoulli polynomials that can be couched in terms the umbral inversion duality of the pair $B_n(x)$ and $\bar{B}_n(x)$ is
$x^n =\bar{B}_n(B.(x)) = \frac{(B.(x)+1)^{n+1} - (B.(x))^{n+1}}{n+1}$
$ = \frac{(b.+x+1)^{n+1} - (B.(x))^{n+1}}{n+1}$
$ = \frac{(B.(x+1))^{n+1} - (B.(x))^{n+1}}{n+1} ,$
so
$\frac{(B.(x+1))^{n+1} - (B.(x))^{n+1}}{n+1} = x^n =  D \; \frac{x^{n+1}}{n+1}$ ,
implying the term by term derivative of a formal Taylor series
$T(x) = c_0 + c_1 x + c_2 \frac{x^2}{2!} + \cdots$
is
$D\; T(x) = T(B.(x+1)) - T(B.(x))$. (See this MO-Q also.)
The term-by-term action on a formal power series of umbral composition  with the reciprocal polynomials is evident in their form and, naturally, reflected in their differential generator--$D^{-1}$ suggests integration and $e^D-1$ generates a finite difference.
Reprising,
$\bar{B}(D) x^n=\frac{e^D-1}{D}x^n = e^{\bar{b}.D}\; x^n = (\bar{b}.+x)^n = (\bar{B}.(x))^n = \frac{(x+1)^{n+1}-x^{n+1}}{n+1}$
$ = \int_{x}^{x+1} t^n dt= \int_{0}^{1}(x+ t)^n dt,$
so umbral composition w.r.t. $\bar{B}_n(x)$ of a power series gives a sliding average of the function represented by the power series, i.e.,
$T(\bar{B}.(x)) = \int_{x}^{x+1} T(t) dt= \int_{0}^{1}T(x+ t) dt.$
Other identities, such as Faulhaber's formula, related to the Bernoulli numbers / polynomials can be fairly easily derived from the umbral inverse relationship between $B_n(x)$ and $\bar{B}_n(x)$. More advanced general algebraic relations presented by other authors can be couched in terms of this duality as well. See, e.g., "Bernoulli Appells".
Search (on the phrase within the quotes, i.e., don't include the quotes) "Copeland Bernoulli polynomials umbral" in the OEIS for possible info on the reciprocal polynomials.
See my response to the MO-Q Intuitive explanation why "shadow operator" $\frac{D}{e^D-1}$ connects logarithms with trigonometric functions? and the links therein.
Peruse my WordPress site "Shadows of Simplicity" for numerous sets of notes on the Bernoulli and reciprocal polynomials. Pretty much any entry with the keyword Bernoulli has some notes on the reciprocal polynomials as well. (Caveat: the term 'reciprocal polynomials' is used by me and others to refer to other types of sequences of polynomials as well as the above.)
Some OEIS sequences related to general Appell sequences are A133314 and A263634. All the generic compositional partition polynomials--the Bell / Faa di Bruno / refined Stirling polynomials of the second kind of A036040, the cycle index polynomials of the symmetric groups / the refined Stirling polynomials of the first kind of A036039, and the refined Lah polynomials of A036039 as well as the classic noncrossing partition / refined Narayana / Voiculescu (of free probability theory) polynomials of A134264 are Appell polynomial sequences in the distinguished initial indeterminate, e.g., $c_1$ or $c_0$. (To spot check these assertions, take the derivative of the first few partition polynomials with respect to the distinguished indeterminate. The proof with e.g.f.s is simple. Be aware that for the full panoply of the Appell operator calculus to apply, it must be that $A_0(x) = a_0 = 1$.)


text:
Q: Html5 video in-built next/previus chapter button i already made my research in the google but i
haven't found that if it is possible to use in-built
 next/previuse chapter(or track) like it was in some swf video.
I found this
Chapter Markers
But in my case it would be better if i can have the next/previous buttons next to the play button.Is this supported by basic html5 video player or should i use specific?


text:
Q: Number of five digit numbers that can be formed with this condition
Question: How many five digit numbers can be made having the digits 1,2,3 each of which can be used at most thrice in a number?

I did it by assuming that there are 9 digits that can be used (3 '1's, 3 '2's and 3 '3's). The first place can be filled in 9 ways, the second place can be filled in 8 ways and so on. I got 15120 as the answer.

A: As Mauve suggested in the comment, you could count the bad numbers and subtract their number from the total number of $3^5$. Bad numbers are of the form $xxxxx$ (which can be constructed in only $3$ different ways) of $xxxxy$ and its $5$ permutations (which can be chosen in $3\cdot 2\cdot 5$ ways), so the total number will be $3^5 - 3 - 30 = 210$.
Also, you can go the straight-forward way. The feasible numbers contain

*

*two digits once and one digit three times

*one digit twice and another digit three times

*two digits twice and one digit only once

Counting the combinations for all three cases, we get:

*

*$3$ ways to chose the number that will appear tree times, $4$ positions to place the lower of the remaining numbers and $5$ positions to place the last one, a total of $3\cdot 4\cdot 5 = 60$ different mumbers.

*$3$ ways to chose the digit that will appear tree times, $2$ ways to choses the other contained digit and $\binom{4}{2}+\binom{4}{1} = 10$ ways to place them between the other digits (they are allowed to appear side by side), making a total of $3\cdot 2\cdot 10 = 60$ different numbers.

*$3$ ways to chose the digit that will appear only once, $5$ ways to chose its position in the number and $\binom{4}{2} = 6$ ways to chose the positions of the lower remaining digits, making a total of $3\cdot 5\cdot 6 = 90$ different numbers.

Summing up the three results, we do of course obtain the same result from above: $60+60+90=210$.

A: Unfortunately, you're making distinctions where there aren't any--for example, one digit $1$ is the same as any other, though it may have a different meaning once we choose a place for it.
The first thing I notice about this problem is that, if I want to directly count the desired numbers, there will be several cases and subcases. We could start with the case of no $1$s (with subcases two $2$s and three $2$s), then the case of a single $1$ (with subcases one $2,$ two $2$s, and three $2$s), and so on. That seems like a pain, though.
More straightforwardly, we could figure out how many five-digit numbers can be made from only digits in $\{1,2,3\},$ then figure out how many of these we don't want--that is, those with four or more $1$s, $2$s, or $3$s--and subtract it from the total.
Hopefully the following facts are clear:

*

*There are $3^5=243$ five-digit numbers with only digits in $\{1,2,3\}.$

*Our "bad" numbers can only break one rule at a time--so we can't, for example, have more than three $1$s and more than three $3$s in a five-digit number--so we won't have to worry about over-counting our "bad" numbers.

*There are exactly the same amount of numbers with too many $1$s as there are with too many $2$s, and as there are with too many $3$s.

How many break the rule with too many $1$s? Well, only one can have all $1$s, but what about four $1$s? Well, we know that such a number has to have exactly one place that doesn't have a $1,$ and there are two choices for what can be in this place. Can you take it from there?


text:
Q: Are there any linux distributions similar to RedHat 5 Enterprise? I want to install RedHat 5 Enterprise Edition server on my home PC. I will install servers and clients on virtual machines using Virtual box and study server-client structure at home. But RedHat EE is not free. Instead, I will install a linux server distribution similar to RedHat 5 EE. But I don't know which one is most similar. I know that Fedora is based on RH but it doesn't have a server edition. What are my options?

A: Centos is basically RHEL recompiled from scratch, and i believe their version numbers are identical to their RHEL counterparts - Its commonly used as a replacement for RHEL. You might also want to consider scientific linux, which is another RHEL derivative, and is almost identical.
RHEL has archives of quite a few versions in the 5.x family, while SL has 5.7


text:
Q: React - add props to a component represented by an object Is it possible to add props to a component represented by an object?
I would like to add those props only once, inside the map function, if possible.
children: [
    {
      id: '1',
      isActive: false,
      label: 'Home',
      component: <ReportsIcon height={30} width={30} />,
    },
    {
      id: '2',
      isActive: true,
      label: 'Dashboard',
      component: <SettingsIcon height={30} width={30} />,
    },
  ].map((item) => (
    <MenuLink key={item.id} isActive={false} label={item.label}>
      <a href={`#`}>
        {item.component // ADD PROPS HERE //}
        {item.label}

    </MenuLink>
  )),

A: Two options proposed by Njuguna Mureithi
1.
children: [
    {
      id: '1',
      isActive: false,
      label: 'Home',
      component: props => <ReportsIcon height={30} width={30} {...props} />,
    },
    {
      id: '2',
      isActive: true,
      label: 'Dashboard',
      component: props => <SettingsIcon height={30} width={30} {...props} />,
    },
  ].map((item) => (
    <MenuLink key={item.id} isActive={false} label={item.label}>
      <a href={`#`}>
        {item.component({ prop: 123 })}
        {item.label}

    </MenuLink>
  )),

*

children: [
    {
      id: '1',
      isActive: false,
      label: 'Home',
      component: ReportsIcon,
    },
    {
      id: '2',
      isActive: true,
      label: 'Dashboard',
      component: SettingsIcon,
    },
  ].map((item) => (
    <MenuLink key={item.id} isActive={false} label={item.label}>
      <a href={`#`}>
        <item.component height={30} width={30} prop={123} />
        {item.label}

    </MenuLink>
  )),


text:
Q: Can one use "fealty" as a verb? I am in the process of writing a paper, and there is a sentence in there I'm not quite sure works.
Oxford English dictionary defines "fealty" as

A feudal tenant's or vassal's sworn loyalty to a lord.

In the paper I write:

...The general meaning to be fealt from Theorem 2.1...

Which is to mean, one must swear loyalty to a general meaning from this Theorem. Mostly I'm annoyed that it might seem like a typo (as the reader may just think I meant to type "felt"), but I don't want it to seem like a typo. And I wanna make sure, it can arguably not be a typo.
I am not looking for a rephrasing of this statement. As any rephrasing I have of this, looks like:

...the general meaning to pledge fealty to from Theorem 2.1...

doesn't sound right, and seems esoteric and over the top. Plus, I like that the original formation is an almost-pun on the use of "fealt" instead of "felt".
So the question is simple:

Can one write "to be fealt" as in, "to pledge loyalty to"?

A: Fealt is not a word, unfortunately. I've used the Longman Dictionary to confirm this.
I agree that pledging loyalty or fealty to a meaning also makes little sense. If it was pledging fealty to a cause it would be different.


text:
Q: how to count characters overlapping on itextpdf columntext no_more_column i'm trying to put text (Chunk) to ColumnText object with longer text than can fit in that column.. function go() returns NO_MORE_COLUMN as excepted, but how i can get remaining string that is not fitting in column? i use autohyphenation on column..
code is like that:
PdfContentByte bait=pdfw.getDirectContent();
bait.saveState();
Chunk c=new Chunk(text, font);
HyphenationAuto h=new HyphenationAuto("fi", "FI", 2, 2);
c.setHyphenation(h);
float rowheight=1.3f*font.getSize();
c.setLineHeight(rowheight);
ColumnText ct=new ColumnText(bait);
ct.setSimpleColumn(100, 100, 300, 300);
ct.setAlignment(com.itextpdf.text.Element.ALIGN_LEFT);
ct.addText(c);
int ret=ct.go();

i tried something like adding chars to chunk and then trying go() in loop so long that NO_MORE_COLUMN happens, but that column output is not right after that..


text:
Q: How to make a "hybrid" HTML drop-down list that can work as a text box as well? For my website, I need to have a way for users to enter their cities.
I'd like to use 2 drop-down list for that: a "State" and a "City" drop-down lists. The choices in the "City" list would depend on what "State' has been selected.
However, there bound to be cases where a user's "City" is not in the drop-down list. To handle those cases, I want the "City" input to be a "hybrid": while users could select a choice from a drop-down list, they could also use the input as a textbox and simply type out their city name.
An example of what I have in mind is Google Map. Enter any address into Google Map. Then click on "Directions" on the left panel. Then click the "By public transit" icon (2nd icon from left). The right-most drop-down box is what I'm talking about. You could select choices like "1:00pm", "1:30pm", "2:00pm" etc from a drop-down list. But you could also just type out a time like "1:23pm" inside the box.
How do I do something like that? Is there any javascript library/framework that does that? I'm currently using jQuery.

A: If you view source on the GMaps directions page that you are referring to, you can see how they do it; the "dropdown" button is really just an image. When a selection is made from the dropdown, the value is put into the textbox.

A: There are lots of JavaScript examples of this, using JQuery, or native JS.  They're typically called combo boxes - for their ability to select from the drop-down or accept typed entry - most of them including settings to enable free-form entry vs forcing selection from the list only.  I don't have any experience with a specific type, so I won't make a recommendation, but if you Google "javascript combo box" that'll get you started in the right direction :)

A: Some solutions I've found for whom it may concern:

*

*Using select2 library and Tagging .

*Selectize is the hybrid of a textbox and  box.

*Using Vue frawework see vue-multiselect and tagging support.

So probably you can consider "select taggging support" a good combination of words to search at Google.


text:
Q: Как исправить ошибку передачи строки в метод класса? #include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include <cstring>
#include <cctype>
using namespace std;
class test{
    public:
    string a={"12","13"};
    int b=sizeof(string);
    void set(string d){
        a[b]=d;
    }
    void print(){
        for(int i=0; i<b; i++){
            cout<<a[i]<<endl;
        }
    }
};
int main() {
    test aba;
    aba.set("1213");
    aba.print();

    return 0;
}

Пытаюсь передать в функцию set() строку и добавить её в массив 'a', но выдает ошибку, как это исправить?

A: Вариант:
#include <iostream>
#include <string>
#include <vector>
using namespace std;

class test{
    private:
        vector<string> a;

    public:
        void set(string d){
            a.push_back(d);
        }
        void print(){
            for(auto i: a){
                cout<< i <<endl;
            }
        }
};

int main() {
    test aba;
    aba.set("1213");
    aba.print();
    return 0;
}

A: Если хотите остаться с массивом — то и делайте массив...
class test{
    public:
    string a[2] = {"12","13"};
    int b = size(a);
    void set(string d){
        a[b-1]=d;
    }
    void print(){
        for(int i=0; i<b; i++){
            cout << a[i] << endl;
        }
    }
};

Заодно посмотрите на отличия этого кода от вашего и постарайтесь понять, почему они :)


text:
Q: reductions from $SAT$ to $DSAT$ and $DSAT$ to $SAT$ can someone help me to prove or disprove the 3 claims about reductionsbetween $SAT$ and $DSAT$, where:
$SAT=\{<\phi> | \text{$\phi$ is bolean formula in $CNF$ and there is an interpretation that satisfies $\phi$}\}$
$DSAT=\{<\phi> | \text{$\phi$ is bolean formula in $DNF$ and there is an interpretation that satisfies $\phi$}\}$
The 3 claimes:

*

*There is polynomial reduction from  $SAT$ to $DSAT$.

*There is polynomial reduction from  $DSAT$ to $SAT$.

*There is Logarithmic reduction from  $SAT$ to $DSAT$.

I am very confused... I think that there is a distinction on the running time between converting CNF to DNF and converting DNF to CNF but I don't know why and how to figure it out.
Any help will be appreciated

A: A Boolean function in DNF tells you explicitly which configurations satisfy it. This is feasible to determine in polynomial time. We iterate through the products to determine if one does not contain both a variable and its negation. If one such product is found, configure the variables so that product is $1$. Then the Boolean function is satisfiable. This is linear in the number of products and quadratic in the number of clauses.
SAT is NP-Complete, while DSAT is in P. We don't know if a polynomial time reduction exists from SAT to DSAT, as that would imply P = NP. A logspace computation necessarily takes polynomial time.
As P is a subset of NP and SAT is NP-Complete, there exists a polynomial time reduction from DSAT to SAT.


text:
Q: Dynamic refresh background-image with ngStyle In AngularJs When i use Angular to dynamic change div 's backgroundImage, i find there are two ways to set backgrond-image:
first:

the second:

But when i change example_expression, only the first way can dynamically change the backgroundImage.
There is a example in Plunker
What's wrong with ngStyle?

A: ng-style should not contain {{}} interpolation directive, you could directly access scope variable there. Also backgroundImage should be  'background-image'
Markup

Demo Plunkr


text:
Q: How to call javascript method from android Hi In my android phonegap app i need to call the javascript method from android code (DroidGap).I have tried the sample code.
Here is my code:
super.loadUrl("file:///android_asset/www/index.html");
super.loadUrl("javascript:onload()");

When i use super.loadUrl("javascript:alert('hai')"); i am getting this alert.But when i use the method "onload" i am getting the error.
Here is my error in logcat:
Uncaught TypeError: Property 'onload' of object [object DOMWindow] is not a function at null:1

Here is my script in index.html:
 <script type="text/javascript">
 function onload()
 {
     alert("hai");
 }
 </script>

I dont know where i am wrong.Please guide me.Thanks in Advance.

A: Try this one and add this line also
    super.setWebChromeClient(new WebChromeClient());
    super.loadUrl("file:///android_asset/www/index.html");

After this line call like this onPageFinished
webview.setWebViewClient(new WebViewClient() {
  @Override
    public void onPageFinished(WebView view, String url)  {

       webview.loadUrl("javascript:(function() {alert("hai") }
      );
   }
});

A: Android can only call the javascript method if an html page is currently loaded in webView
first call
webview.loadUrl("Your html page url");
then call
webView.loadUrl("javascript:hello()");

A: Try to handle the alert function in the java file, like this :
mWebView.setWebChromeClient(new MyWebChromeClient());

    final class MyWebChromeClient extends WebChromeClient {

        @Override
        public boolean onJsAlert(WebView view,String url,
                                 String message,JsResult result) {

            new AlertDialog.Builder(MainActivity.this).
                setTitle("Alert").setMessage(message).setPositiveButton("OK",
           new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface arg0, int arg1) {

                   }
            }).create().show();
           result.confirm();
            return super.onJsConfirm(view,url,message, result);
        }

    }

A: I had the same problem when I moved the target javascript function from the main page to an separate .js file. For some reason, the loadUrl() function can't find externally-loaded functions - only the ones in the main page. Once I moved the function back, it immediately started working.
Go figure.


text:
Q: How can I apply restrictions and limited accessibility to inputs based on values from other inputs in Shiny? I am completely new to shiny, and I am trying to create a quite simple app as part of learning it.
Questions:
(1) how can I apply a restriction on the sliderInput("n.sygdom" ...)? The intention is that the user receives an error if one chooses a value greater than the one set in sliderInput("n.fjernet" ...)?
(2) how can I make the radioButtons("ecs" ...) and radioButtons("contra.pos" ...) accessible only if sliderInput("n.sygdom" ...) ≥ 1? Preferable, if sliderInput("n.sygdom" ...)==0, then the radioButtons should be "removed" from the shinyapp
The shinyapp works by calculating a nomogram-score, which can be used to predict overall survival. It contains four components:
(1) n.fjernet is the number of lymph nodes removed on the cervical neck
(2) n.sygdom is the number of lymph nodes with evidence of cancer metastises. Therefore, n.sygdom cannot exceed the number of n.fjernet. If the user tries to choose n.sygdom greater than n.fjernet, the shinyapp should return: Error: Number of positive lymph nodes cannot exceed the lymph nodal yield (written in red)

(3) ecs is extracapsular spread (of metastises, i.e. the metastises penetrating one or more of the lymph nodes) in n.sygdom. Therefore, this option can only be available if n.sygdom ≥ 1
(4) contra.pos is whether the spread (of metastises) includes the uni- or contralateral side of the neck. Therefore, this option is only be available if n.sygdom ≥ 1.

The app function estimates the nomogram-score based on values stored in nom - which is attached below. If n.sygdom equals 0, and therefore unable access to ecs and contra.pos, then ecs and contra.pos should generate/add 0 to the calc_score printed in output$out.score <- renderText(calc_score()), i.e. exclusion from the nomogram.
My script
library(shiny)
library(survminer)

ui <- fluidPage(
  titlePanel("Survival Curve"),
  sidebarLayout(
    sidebarPanel(
      sliderInput("n.fjernet", "Lymph Nodal Yield", min = 2, max = 150, value = 30),
      sliderInput("n.sygdom", "Number of positive lymph nodes", min = 0, max = 40, value = 0),
      radioButtons("ecs", "Extracapsular extension", c("No","Yes")),
      radioButtons("contra.pos", "Neck involvement", c("Contra.","Ipsi.")),
      verbatimTextOutput("out.score"),
      verbatimTextOutput("out.score.group")
    ),
    mainPanel(
      plotOutput("surv_plot")
    )
  )
)

server <- function(input, output, session) {

  calc_score <- reactive({
    round(nom$ecs$points[nom$ecs$ecs==input$ecs] +
      nom$contra.pos$points[nom$contra.pos$contra.pos==input$contra.pos] +
      nom$n.fjernet$points[nom$n.fjernet$n.fjernet==input$n.fjernet] +
      nom$n.sygdom$points[nom$n.sygdom$n.sygdom==input$n.sygdom],digits=1)
  })

  calc_score_group <- function(score) {
    cut(score, c(0,35.9,55.2,70.0,83.3,Inf), include.lowest = TRUE, labels = c("1","2","3","4","5"))
  }

  fit_data <- reactive({
    p %>% filter(score.group == as.numeric(calc_score_group(calc_score())))
  })

  fit_model <- reactive({
    survfit(Surv(os.neck, mors) ~ 1, data = fit_data())
  })

  output$out.score <- renderText(calc_score())
  output$out.score.group <- renderText(calc_score_group(calc_score()))

  output$surv_plot <- renderPlot({
    ggsurvplot(
      fit_model(),
      data = fit_data(),
      risk.table = TRUE,
      pval = F,
      pval.coord = c(0, 0.25),
      conf.int = T,
      size=1,
      xlim = c(0,60),
      conf.int.alpha=c(0.2),
      break.x.by = 6,
      xlab="Time in months",
      ylab="Probability of overall survival",
      ggtheme = theme,
      surv.median.line = "v",
      ylim=c(0,1),
      palette="#2C77BF",
      tables.theme=theme,
      legend.title=paste("Score group", calc_score_group(calc_score())),
      surv.scale="percent",
      tables.col="strata",
      risk.table.col = "strata",
      risk.table.y.text = FALSE,
      tables.y.text = FALSE)
  })

}

shinyApp(ui, server)

My data (now with p$score.group)
p <- structure(list(contra.pos = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Ipsi.", "Contra."), class = "factor"),
    ecs = structure(c(1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L,
    2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L,
    2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L,
    2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
    2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
    1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
    1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L,
    1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L
    ), .Label = c("No", "Yes"), class = "factor"), n.fjernet = c(22L,
    61L, 50L, 47L, 30L, 60L, 82L, 60L, 33L, 67L, 35L, 56L, 15L,
    37L, 44L, 124L, 41L, 30L, 31L, 35L, 36L, 28L, 39L, 54L, 25L,
    27L, 69L, 53L, 24L, 33L, 52L, 77L, 51L, 7L, 22L, 53L, 26L,
    58L, 28L, 83L, 39L, 15L, 37L, 27L, 9L, 17L, 32L, 26L, 44L,
    52L, 22L, 62L, 53L, 68L, 52L, 38L, 50L, 21L, 41L, 74L, 15L,
    26L, 36L, 37L, 34L, 22L, 31L, 53L, 13L, 44L, 43L, 51L, 20L,
    21L, 63L, 40L, 25L, 17L, 43L, 47L, 35L, 21L, 4L, 23L, 35L,
    50L, 69L, 24L, 38L, 45L, 37L, 35L, 25L, 19L, 43L, 19L, 33L,
    38L, 50L, 21L, 40L, 100L, 45L, 53L, 41L, 7L, 75L, 48L, 20L,
    11L, 72L, 37L, 34L, 70L, 20L, 47L, 44L, 45L, 48L, 23L, 27L,
    24L, 39L, 9L, 34L, 22L, 89L, 40L, 35L, 34L, 61L, 28L, 27L,
    62L, 47L, 13L, 20L, 9L, 27L, 38L, 44L, 15L, 33L, 65L, 31L,
    49L, 53L, 15L, 26L, 17L, 24L, 20L, 25L, 12L, 34L, 22L, 27L,
    14L, 27L, 31L, 26L, 15L, 16L, 30L, 19L, 51L, 12L, 33L, 68L,
    26L, 20L, 34L, 31L, 7L, 76L, 7L, 24L, 36L, 22L, 27L, 35L,
    64L, 18L, 38L, 10L, 27L, 26L, 47L, 15L, 30L, 30L, 21L, 31L,
    14L, 14L, 22L, 28L, 13L, 17L, 16L, 7L, 11L, 37L, 55L, 13L,
    26L, 17L, 12L, 44L, 58L, 20L, 28L, 7L, 24L, 10L, 42L, 39L,
    14L, 31L, 49L), n.sygdom = c(1L, 2L, 1L, 3L, 1L, 0L, 3L,
    0L, 2L, 1L, 4L, 4L, 1L, 0L, 2L, 2L, 1L, 0L, 0L, 4L, 0L, 0L,
    1L, 1L, 0L, 1L, 4L, 3L, 1L, 0L, 8L, 1L, 1L, 1L, 1L, 1L, 0L,
    1L, 2L, 1L, 0L, 2L, 1L, 0L, 2L, 0L, 3L, 0L, 1L, 1L, 1L, 2L,
    0L, 3L, 2L, 1L, 0L, 0L, 0L, 2L, 0L, 3L, 0L, 0L, 0L, 1L, 1L,
    0L, 0L, 1L, 4L, 0L, 0L, 2L, 2L, 1L, 1L, 0L, 0L, 3L, 1L, 6L,
    0L, 0L, 0L, 3L, 2L, 2L, 4L, 0L, 3L, 27L, 0L, 2L, 1L, 0L,
    0L, 1L, 1L, 2L, 2L, 5L, 1L, 0L, 0L, 1L, 0L, 5L, 0L, 0L, 2L,
    10L, 0L, 6L, 2L, 1L, 2L, 0L, 0L, 0L, 0L, 4L, 0L, 0L, 1L,
    5L, 2L, 2L, 1L, 2L, 1L, 0L, 0L, 1L, 13L, 0L, 1L, 0L, 1L,
    0L, 1L, 1L, 0L, 23L, 0L, 2L, 2L, 0L, 2L, 0L, 0L, 1L, 1L,
    0L, 0L, 0L, 2L, 3L, 1L, 4L, 0L, 1L, 0L, 5L, 5L, 4L, 0L, 0L,
    4L, 0L, 1L, 1L, 0L, 2L, 5L, 1L, 3L, 6L, 1L, 1L, 1L, 0L, 0L,
    1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 2L, 0L, 1L, 1L,
    0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 40L, 2L, 0L, 1L,
    0L, 2L, 0L, 3L, 1L, 1L, 4L, 1L), mors = c(0L, 0L, 0L, 0L,
    1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L,
    1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L,
    0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L,
    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L,
    0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L,
    0L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L,
    0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L,
    0L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 1L, 1L,
    1L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L,
    0L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 1L,
    0L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L,
    0L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L,
    0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 1L,
    0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 1L,
    1L, 0L, 0L, 1L, 0L, 1L), os.neck = c(9.63, 7.03, 9.17, 10.48,
    7.69, 15.18, 13.5, 16.33, 15.31, 12.09, 12.35, 22.28, 15.77,
    14.39, 10.02, 14.52, 8.44, 23.82, 5.95, 3.78, 19.32, 20.14,
    15.51, 19.78, 12.98, 32.92, 9.76, 5.65, 30.75, 2.79, 33.58,
    27.53, 27.63, 14.62, 29.17, 25.4, 18.43, 5.29, 30.75, 28.48,
    14.69, 13.14, 6.6, 26.81, 40.74, 11.63, 13.31, 10.41, 9.56,
    17.51, 35.78, 35.75, 37.62, 33.25, 36.96, 34.56, 40.05, 41.26,
    24.34, 37.49, 40.94, 24.11, 39.33, 11.24, 39.1, 19.75, 38.93,
    39.36, 36.34, 48, 29.17, 47.93, 3.68, 24.21, 46.36, 49.12,
    50.96, 14.16, 54.01, 19.88, 50.86, 1.87, 54.24, 13.93, 11.6,
    10.05, 23.1, 62.78, 12.58, 39, 59.83, 6.77, 60.39, 18.46,
    61.77, 58.41, 49.45, 64.26, 2.4, 26.51, 58.94, 69.91, 64.66,
    55.56, 46.55, 29.63, 55.66, 19.68, 7.62, 2.73, 17.77, 10.12,
    9.95, 74.22, 57.3, 58.94, 27.01, 34.23, 78.82, 27.2, 83.02,
    76.68, 58.15, 22.18, 14.49, 3.91, 25.92, 74.64, 66.83, 70.74,
    38.08, 7.69, 74.55, 49.94, 11.1, 88.54, 6.44, 79.54, 80.82,
    70.83, 12.91, 81.25, 17.38, 29.96, 94.72, 73.53, 72.54, 1.35,
    89.69, 62.85, 7.62, 93.27, 5.09, 51.25, 62, 55.33, 44.62,
    56.94, 94.55, 88.61, 32.46, 11.04, 16.53, 100.04, 24.74,
    24.54, 5.75, 59.83, 59.83, 77.77, 92.78, 49.58, 91.2, 1.18,
    18.92, 6.34, 32.46, 72.41, 105.82, 1.84, 12.78, 57.56, 59.14,
    104.08, 15.54, 117.75, 4.27, 67.61, 19.78, 112.49, 53.59,
    107.01, 47.57, 9.46, 53.59, 46.46, 57.33, 18.76, 82.04, 13.67,
    67.45, 28.98, 21.19, 121.4, 91.07, 50.83, 121.72, 123.04,
    6.31, 123.5, 58.68, 9.56, 34.1, 90.48, 71.1, 11.33, 65.35,
    54.21, 34.99, 62.06), score = c(47.16, 47.55, 39.27, 72.23,
    44.91, 25.74, 62.36, 25.74, 55.44, 34.48, 82.32, 76.4, 60.64,
    32.22, 52.34, 36.13, 41.81, 34.2, 33.91, 65.66, 32.51, 34.76,
    42.37, 38.14, 35.61, 45.75, 61.23, 59.04, 46.6, 33.35, 84.05,
    26.5, 38.99, 62.89, 47.16, 38.42, 35.32, 37.01, 56.85, 29.96,
    31.66, 60.52, 42.93, 35.04, 62.21, 37.86, 64.96, 35.32, 40.96,
    38.71, 47.16, 58.77, 27.71, 54.81, 50.09, 42.65, 28.56, 36.73,
    31.1, 43.88, 38.43, 78.15, 32.51, 32.22, 33.07, 47.16, 44.63,
    27.71, 38.99, 40.96, 68.56, 28.28, 37.02, 58.83, 58.48, 42.09,
    46.32, 37.86, 30.53, 60.73, 55, 77.47, 41.53, 36.17, 32.79,
    71.38, 56.79, 57.98, 76.32, 29.97, 63.55, 123.86, 35.61,
    59.39, 41.24, 37.3, 33.35, 37.5, 39.27, 58.83, 53.47, 52.02,
    35.52, 27.71, 31.1, 51.39, 21.51, 83.34, 37.02, 39.55, 50.79,
    91.42, 33.07, 63.65, 70.61, 51.62, 52.34, 29.97, 29.12, 36.17,
    35.04, 85.42, 31.66, 40.12, 55.28, 90.67, 51.15, 53.47, 43.5,
    55.16, 47.67, 34.76, 35.04, 35.89, 98.47, 38.99, 59.23, 40.12,
    57.25, 31.94, 52.46, 49.14, 33.35, 92.46, 33.91, 50.93, 49.8,
    38.43, 57.42, 37.86, 35.89, 47.73, 57.82, 39.27, 33.07, 36.45,
    57.13, 70.03, 57.25, 71.95, 35.32, 60.64, 38.14, 71.76, 91.52,
    61.15, 39.27, 33.35, 56.36, 35.32, 47.73, 43.78, 33.91, 62.77,
    75.44, 51.39, 78.71, 78.39, 47.16, 45.75, 55, 24.61, 37.58,
    42.65, 62.05, 35.04, 35.32, 51.62, 38.43, 34.2, 34.2, 42.29,
    33.91, 49.42, 60.8, 36.45, 56.97, 61.2, 37.86, 38.14, 40.68,
    61.77, 54.43, 27.15, 49.7, 46.04, 60.07, 39.27, 130.25, 59.89,
    37.02, 40.32, 40.68, 69.48, 39.84, 73.64, 53.87, 60.92, 71.95,
    51.05), score.group = structure(c(2L, 2L, 2L, 4L, 2L, 1L,
    3L, 1L, 3L, 1L, 4L, 4L, 3L, 1L, 2L, 2L, 2L, 1L, 1L, 3L, 1L,
    1L, 2L, 2L, 1L, 2L, 3L, 3L, 2L, 1L, 5L, 1L, 2L, 3L, 2L, 2L,
    1L, 2L, 3L, 1L, 1L, 3L, 2L, 1L, 3L, 2L, 3L, 1L, 2L, 2L, 2L,
    3L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 4L, 1L, 1L, 1L, 2L,
    2L, 1L, 2L, 2L, 3L, 1L, 2L, 3L, 3L, 2L, 2L, 2L, 1L, 3L, 2L,
    4L, 2L, 2L, 1L, 4L, 3L, 3L, 4L, 1L, 3L, 5L, 1L, 3L, 2L, 2L,
    1L, 2L, 2L, 3L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 5L, 2L, 2L, 2L,
    5L, 1L, 3L, 4L, 2L, 2L, 1L, 1L, 2L, 1L, 5L, 1L, 2L, 3L, 5L,
    2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 5L, 2L, 3L, 2L, 3L, 1L, 2L,
    2L, 1L, 5L, 1L, 2L, 2L, 2L, 3L, 2L, 1L, 2L, 3L, 2L, 1L, 2L,
    3L, 4L, 3L, 4L, 1L, 3L, 2L, 4L, 5L, 3L, 2L, 1L, 3L, 1L, 2L,
    2L, 1L, 3L, 4L, 2L, 4L, 4L, 2L, 2L, 2L, 1L, 2L, 2L, 3L, 1L,
    1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 3L, 2L, 3L, 3L, 2L, 2L, 2L,
    3L, 2L, 1L, 2L, 2L, 3L, 2L, 5L, 3L, 2L, 2L, 2L, 3L, 2L, 4L,
    2L, 3L, 4L, 2L), .Label = c("1", "2", "3", "4", "5"), class = "factor")), row.names = c(NA,
220L), class = "data.frame")

And
# plot(nom) for nomogram

nom <- structure(list(n.fjernet = structure(list(n.fjernet = c(2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
127, 128, 129, 130, 131, 132, 133), Xbeta = c(`1` = -0.0114560716414661,
`2` = -0.0171841074621991, `3` = -0.0229121432829322, `4` = -0.0286401791036652,
`5` = -0.0343682149243983, `6` = -0.0400962507451313, `7` = -0.0458242865658644,
`8` = -0.0515523223865974, `9` = -0.0572803582073305, `10` = -0.0630083940280635,
`11` = -0.0687364298487966, `12` = -0.0744644656695296, `13` = -0.0801925014902627,
`14` = -0.0859205373109957, `15` = -0.0916485731317288, `16` = -0.0973766089524618,
`17` = -0.103104644773195, `18` = -0.108832680593928, `19` = -0.114560716414661,
`20` = -0.120288752235394, `21` = -0.126016788056127, `22` = -0.13174482387686,
`23` = -0.137472859697593, `24` = -0.143200895518326, `25` = -0.148928931339059,
`26` = -0.154656967159792, `27` = -0.160385002980525, `28` = -0.166113038801258,
`29` = -0.171841074621991, `30` = -0.177569110442725, `31` = -0.183297146263458,
`32` = -0.189025182084191, `33` = -0.194753217904924, `34` = -0.200481253725657,
`35` = -0.20620928954639, `36` = -0.211937325367123, `37` = -0.217665361187856,
`38` = -0.223393397008589, `39` = -0.229121432829322, `40` = -0.234849468650055,
`41` = -0.240577504470788, `42` = -0.246305540291521, `43` = -0.252033576112254,
`44` = -0.257761611932987, `45` = -0.26348964775372, `46` = -0.269217683574453,
`47` = -0.274945719395186, `48` = -0.280673755215919, `49` = -0.286401791036652,
`50` = -0.292129826857386, `51` = -0.297857862678119, `52` = -0.303585898498852,
`53` = -0.309313934319585, `54` = -0.315041970140318, `55` = -0.320770005961051,
`56` = -0.326498041781784, `57` = -0.332226077602517, `58` = -0.33795411342325,
`59` = -0.343682149243983, `60` = -0.349410185064716, `61` = -0.355138220885449,
`62` = -0.360866256706182, `63` = -0.366594292526915, `64` = -0.372322328347648,
`65` = -0.378050364168381, `66` = -0.383778399989114, `67` = -0.389506435809847,
`68` = -0.39523447163058, `69` = -0.400962507451313, `70` = -0.406690543272047,
`71` = -0.41241857909278, `72` = -0.418146614913513, `73` = -0.423874650734246,
`74` = -0.429602686554979, `75` = -0.435330722375712, `76` = -0.441058758196445,
`77` = -0.446786794017178, `78` = -0.452514829837911, `79` = -0.458242865658644,
`80` = -0.463970901479377, `81` = -0.46969893730011, `82` = -0.475426973120843,
`83` = -0.481155008941576, `84` = -0.486883044762309, `85` = -0.492611080583042,
`86` = -0.498339116403775, `87` = -0.504067152224508, `88` = -0.509795188045241,
`89` = -0.515523223865974, `90` = -0.521251259686707, `91` = -0.526979295507441,
`92` = -0.532707331328174, `93` = -0.538435367148907, `94` = -0.54416340296964,
`95` = -0.549891438790373, `96` = -0.555619474611106, `97` = -0.561347510431839,
`98` = -0.567075546252572, `99` = -0.572803582073305, `100` = -0.578531617894038,
`101` = -0.584259653714771, `102` = -0.589987689535504, `103` = -0.595715725356237,
`104` = -0.60144376117697, `105` = -0.607171796997703, `106` = -0.612899832818436,
`107` = -0.618627868639169, `108` = -0.624355904459902, `109` = -0.630083940280635,
`110` = -0.635811976101369, `111` = -0.641540011922102, `112` = -0.647268047742835,
`113` = -0.652996083563568, `114` = -0.658724119384301, `115` = -0.664452155205034,
`116` = -0.670180191025767, `117` = -0.6759082268465, `118` = -0.681636262667233,
`119` = -0.687364298487966, `120` = -0.693092334308699, `121` = -0.698820370129432,
`122` = -0.704548405950165, `123` = -0.710276441770898, `124` = -0.716004477591631,
`125` = -0.721732513412364, `126` = -0.727460549233097, `127` = -0.73318858505383,
`128` = -0.738916620874563, `129` = -0.744644656695296, `130` = -0.750372692516029,
`131` = -0.756100728336763, `132` = -0.761828764157496), points = c(`1` = 27.84103949255,
`2` = 27.6285124735229, `3` = 27.4159854544958, `4` = 27.2034584354687,
`5` = 26.9909314164416, `6` = 26.7784043974145, `7` = 26.5658773783874,
`8` = 26.3533503593603, `9` = 26.1408233403332, `10` = 25.9282963213061,
`11` = 25.715769302279, `12` = 25.5032422832519, `13` = 25.2907152642248,
`14` = 25.0781882451977, `15` = 24.8656612261706, `16` = 24.6531342071435,
`17` = 24.4406071881164, `18` = 24.2280801690893, `19` = 24.0155531500622,
`20` = 23.8030261310351, `21` = 23.590499112008, `22` = 23.3779720929809,
`23` = 23.1654450739538, `24` = 22.9529180549267, `25` = 22.7403910358996,
`26` = 22.5278640168725, `27` = 22.3153369978454, `28` = 22.1028099788183,
`29` = 21.8902829597912, `30` = 21.6777559407641, `31` = 21.465228921737,
`32` = 21.2527019027099, `33` = 21.0401748836828, `34` = 20.8276478646557,
`35` = 20.6151208456286, `36` = 20.4025938266015, `37` = 20.1900668075744,
`38` = 19.9775397885473, `39` = 19.7650127695202, `40` = 19.5524857504931,
`41` = 19.339958731466, `42` = 19.1274317124389, `43` = 18.9149046934118,
`44` = 18.7023776743847, `45` = 18.4898506553576, `46` = 18.2773236363305,
`47` = 18.0647966173034, `48` = 17.8522695982763, `49` = 17.6397425792492,
`50` = 17.4272155602221, `51` = 17.214688541195, `52` = 17.0021615221679,
`53` = 16.7896345031408, `54` = 16.5771074841137, `55` = 16.3645804650866,
`56` = 16.1520534460595, `57` = 15.9395264270324, `58` = 15.7269994080053,
`59` = 15.5144723889782, `60` = 15.3019453699511, `61` = 15.089418350924,
`62` = 14.8768913318969, `63` = 14.6643643128698, `64` = 14.4518372938427,
`65` = 14.2393102748156, `66` = 14.0267832557885, `67` = 13.8142562367614,
`68` = 13.6017292177343, `69` = 13.3892021987072, `70` = 13.1766751796801,
`71` = 12.964148160653, `72` = 12.7516211416259, `73` = 12.5390941225988,
`74` = 12.3265671035717, `75` = 12.1140400845446, `76` = 11.9015130655175,
`77` = 11.6889860464904, `78` = 11.4764590274633, `79` = 11.2639320084362,
`80` = 11.0514049894091, `81` = 10.838877970382, `82` = 10.6263509513549,
`83` = 10.4138239323278, `84` = 10.2012969133007, `85` = 9.98876989427365,
`86` = 9.77624287524655, `87` = 9.56371585621945, `88` = 9.35118883719235,
`89` = 9.13866181816525, `90` = 8.92613479913816, `91` = 8.71360778011105,
`92` = 8.50108076108396, `93` = 8.28855374205686, `94` = 8.07602672302976,
`95` = 7.86349970400266, `96` = 7.65097268497556, `97` = 7.43844566594846,
`98` = 7.22591864692136, `99` = 7.01339162789426, `100` = 6.80086460886717,
`101` = 6.58833758984007, `102` = 6.37581057081297, `103` = 6.16328355178587,
`104` = 5.95075653275877, `105` = 5.73822951373167, `106` = 5.52570249470457,
`107` = 5.31317547567747, `108` = 5.10064845665037, `109` = 4.88812143762328,
`110` = 4.67559441859617, `111` = 4.46306739956908, `112` = 4.25054038054198,
`113` = 4.03801336151488, `114` = 3.82548634248778, `115` = 3.61295932346068,
`116` = 3.40043230443358, `117` = 3.18790528540648, `118` = 2.97537826637939,
`119` = 2.76285124735228, `120` = 2.55032422832519, `121` = 2.33779720929809,
`122` = 2.12527019027099, `123` = 1.91274317124389, `124` = 1.70021615221679,
`125` = 1.48768913318969, `126` = 1.27516211416259, `127` = 1.06263509513549,
`128` = 0.850108076108397, `129` = 0.637581057081296, `130` = 0.425054038054198,
`131` = 0.212527019027097, `132` = 0)), info = list(nfun = 3L,
    predictor = "n.fjernet", effect.name = "n.fjernet", type = "main")),
    n.sygdom = structure(list(n.sygdom = c(0, 1, 2, 3, 4, 5,
    6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
    22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
    37, 38, 39, 40), Xbeta = c(`133` = 0, `134` = 0.32236136668714,
    `135` = 0.648650531337351, `136` = 0.909274081797897, `137` = 1.09719119915252,
    `138` = 1.2269431700224, `139` = 1.31307128102872, `140` = 1.37011681879267,
    `141` = 1.41262106993544, `142` = 1.452701773308, `143` = 1.49278247668057,
    `144` = 1.53286318005315, `145` = 1.57294388342572, `146` = 1.61302458679829,
    `147` = 1.65310529017085, `148` = 1.69318599354344, `149` = 1.733266696916,
    `150` = 1.77334740028855, `151` = 1.81342810366113, `152` = 1.8535088070337,
    `153` = 1.89358951040629, `154` = 1.93367021377884, `155` = 1.97375091715141,
    `156` = 2.01383162052397, `157` = 2.05391232389658, `158` = 2.09399302726916,
    `159` = 2.13407373064171, `160` = 2.17415443401433, `161` = 2.21423513738691,
    `162` = 2.25431584075947, `163` = 2.29439654413205, `164` = 2.33447724750454,
    `165` = 2.37455795087723, `166` = 2.41463865424957, `167` = 2.45471935762221,
    `168` = 2.49480006099482, `169` = 2.53488076436739, `170` = 2.57496146774009,
    `171` = 2.61504217111266, `172` = 2.65512287448523, `173` = 2.69520357785787
    ), points = c(`133` = 0, `134` = 11.9605572408505, `135` = 24.0668473679043,
    `136` = 33.7367495824038, `137` = 40.7090287415156, `138` = 45.5232094563172,
    `139` = 48.7188163378863, `140` = 50.8353739973004, `141` = 52.412407045637,
    `142` = 53.8995193254604, `143` = 55.3866316052841, `144` = 56.8737438851078,
    `145` = 58.3608561649314, `146` = 59.8479684447552, `147` = 61.3350807245785,
    `148` = 62.8221930044026, `149` = 64.309305284226, `150` = 65.7964175640487,
    `151` = 67.283529843873, `152` = 68.7706421236966, `153` = 70.257754403521,
    `154` = 71.7448666833438, `155` = 73.2319789631674, `156` = 74.7190912429907,
    `157` = 76.2062035228159, `158` = 77.6933158026398, `159` = 79.1804280824625,
    `160` = 80.6675403622881, `161` = 82.1546526421122, `162` = 83.6417649219352,
    `163` = 85.1288772017594, `164` = 86.6159894815798, `165` = 88.103101761408,
    `166` = 89.5902140412232, `167` = 91.0773263210494, `168` = 92.5644386008743,
    `169` = 94.0515508806979, `170` = 95.5386631605266, `171` = 97.0257754403502,
    `172` = 98.5128877201739, `173` = 100)), info = list(nfun = 3L,
        predictor = "n.sygdom", effect.name = "n.sygdom", type = "main")),
    ecs = structure(list(ecs = c("No", "Yes"), Xbeta = c(`174` = 0,
    `175` = 0.352802098746005), points = c(`174` = 0, `175` = 13.0899981598574
    )), info = list(nfun = 3L, predictor = "ecs", effect.name = "ecs",
        type = "main")), contra.pos = structure(list(contra.pos = c("Ipsi.",
    "Contra."), Xbeta = c(`176` = 0, `177` = -0.149053853083395
    ), points = c(`176` = 5.53033745977221, `177` = 0)), info = list(
        nfun = 3L, predictor = "contra.pos", effect.name = "contra.pos",
        type = "main")), total.points = list(x = c(0, 10, 20,
    30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140)), lp = list(
        x = c(8.59901355289166, 27.1504878870641, 45.7019622212365,
        64.253436555409, 82.8049108895814, 101.356385223754,
        119.907859557926, 138.459333892099), x.real = c(-1, -0.5,
        0, 0.5, 1, 1.5, 2, 2.5)), `Probability of 1 year survival` = list(
        x = c(132.923978485611, 122.154519662532, 112.023605643525,
        101.668496222993, 90.3441422980089, 77.0166169199793,
        59.6149679036176, 31.771904926561), x.real = c(0.2, 0.3,
        0.4, 0.5, 0.6, 0.7, 0.8, 0.9), fat = c("0.2", "0.3",
        "0.4", "0.5", "0.6", "0.7", "0.8", "0.9"), which = c(FALSE,
        TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE
        )), `Probability of 3 years survival` = list(x = c(111.455658509363,
    98.1672795067317, 87.3978451509886, 77.2669361851509, 66.9118109221416,
    55.5874579746061, 42.2599719337723, 24.8583283615229), x.real = c(0.1,
    0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8), fat = c("0.1", "0.2",
    "0.3", "0.4", "0.5", "0.6", "0.7", "0.8"), which = c(FALSE,
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)),
    `Probability of 5 years survival` = list(x = c(96.3366217164868,
    83.0483098712202, 72.2788509036931, 62.1479468853665, 51.7928216700398,
    40.468478298201, 27.1409533137375, 9.73931852863156), x.real = c(0.1,
    0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8), fat = c("0.1", "0.2",
    "0.3", "0.4", "0.5", "0.6", "0.7", "0.8"), which = c(FALSE,
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE))), info = list(
    fun = list(function (x)
    surv(12, x), function (x)
    surv(36, x), function (x)
    surv(60, x)), lp = TRUE, lp.at = c(-1, -0.5, 0, 0.5, 1, 1.5,
    2, 2.5), discrete = c(n.fjernet = FALSE, n.sygdom = FALSE,
    ecs = TRUE, contra.pos = TRUE, studie = TRUE), funlabel = c("Probability of 1 year survival",
    "Probability of 3 years survival", "Probability of 5 years survival"
    ), fun.at = NULL, fun.lp.at = NULL, Abbrev = list(), minlength = 4,
    conf.int = FALSE, R = structure(c(-0.761828764157496, -0.0114560716414661,
    0, 2.69520357785787, 0, 0.352802098746005, -0.149053853083395,
    0), .Dim = c(2L, 4L), .Dimnames = list(NULL, c("n.fjernet",
    "n.sygdom", "ecs", "contra.pos"))), sc = 37.1029486683449,
    maxscale = 100, Intercept = -1.23176092093802, nint = 10,
    space.used = c(main = 4, ia = 0)), class = "nomogram")

A: your first problem can be solved with an updateSliderInput call where you update the max value to be equal the selected value from the slider above.
The second problem can besolved with an conditionalPanel here I needed to change the naming of the n.sygdom slider to n_sygdom because the java script couldn't handle to dot notation. I would recommend you to the same for all you variables whenever you are working with shiny.
Below is working example
ui <- fluidPage(
  titlePanel("Survival Curve"),
  sidebarLayout(
    sidebarPanel(
      sliderInput("n.fjernet", "Lymph Nodal Yield", min = 2, max = 150, value = 40),
      sliderInput("n_sygdom", "Number of positive lymph nodes", min = 0, max = 40, value = 0),
      conditionalPanel(
        condition = "input.n_sygdom >= 1",
        radioButtons("ecs", "Extracapsular extension", c("No","Yes")),
        radioButtons("contra.pos", "Neck involvement", c("Contra.","Ipsi.")
        )
      ),
      verbatimTextOutput("out.score"),
      verbatimTextOutput("out.score.group")
    ),
    mainPanel(
      plotOutput("surv_plot")
    )
  )
)

server <- function(input, output, session) {

  calc_score <- reactive({
    round(nom$ecs$points[nom$ecs$ecs==input$ecs] +
            nom$contra.pos$points[nom$contra.pos$contra.pos==input$contra.pos] +
            nom$n.fjernet$points[nom$n.fjernet$n.fjernet==input$n.fjernet] +
            nom$n_sygdom$points[nom$n_sygdom$n_sygdom==input$n_sygdom],digits=1)
  })
  observe(
    updateSliderInput(
      session = session,
      inputId = "n_sygdom",
      max = min(40, input$n.fjernet),
      value = min(input$n.fjernet, input$n_sygdom)
    )
  )

  calc_score_group <- function(score) {
    cut(score, c(0,35.9,55.2,70.0,83.3,Inf), include.lowest = TRUE, labels = c("1","2","3","4","5"))
  }

  fit_data <- reactive({
    p %>% filter(score.group == as.numeric(calc_score_group(calc_score())))
  })

  fit_model <- reactive({
    survfit(Surv(os.neck, mors) ~ 1, data = fit_data())
  })

  output$out.score <- renderText(calc_score())
  output$out.score.group <- renderText(calc_score_group(calc_score()))

  output$surv_plot <- renderPlot({
    ggsurvplot(
      fit_model(),
      data = fit_data(),
      risk.table = TRUE,
      pval = F,
      pval.coord = c(0, 0.25),
      conf.int = T,
      size=1,
      xlim = c(0,60),
      conf.int.alpha=c(0.2),
      break.x.by = 6,
      xlab="Time in months",
      ylab="Probability of overall survival",
      ggtheme = theme,
      surv.median.line = "v",
      ylim=c(0,1),
      palette="#2C77BF",
      tables.theme=theme,
      legend.title=paste("Score group", calc_score_group(calc_score())),
      surv.scale="percent",
      tables.col="strata",
      risk.table.col = "strata",
      risk.table.y.text = FALSE,
      tables.y.text = FALSE)
  })

}

please not that I changed the naming also in the data set as well
Hope this helps!!


text:
Q: When the range is too large it generates an error: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() The code below works with up to 8000 lines. More than that, it generates the error: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
The df is ordered by 'ID'. I need to fill the 'ENTRADA' column with the 'ID' enumeration.
ID ... ENTRADA
150 ...      1
150 ...      2
150 ...      3
151 ...      1
152 ...      1
152 ...      2
Is there an easier way to do this?
def preencheEntrada():
    id_documento = 0
    numEntrada = 0
    for i in range(len(df)) :
        valor_id_documento = df.loc[i, 'ID']
        if (id_documento == valor_id_documento) :
            numEntrada = numEntrada + 1
        else :
            id_documento = valor_id_documento
            numEntrada = 1
        df.loc[i, 'ENTRADA'] = numEntrada

A: You shouldn't be using pandas like this, instead, always try to opt for vectorized operations.
In [1]: import pandas as pd

In [2]: df = pd.DataFrame({"ID": [150, 150, 150, 151, 152, 152]})

In [3]: df
Out[3]:
    ID
0  150
1  150
2  150
3  151
4  152
5  152

In [4]: df.groupby('ID').cumcount()
Out[4]:
0    0
1    1
2    2
3    0
4    0
5    1
dtype: int64

So, if you have to start at 1, you can do something like:
In [5]: df["ENTRADA"] = df.groupby("ID").cumcount() + 1

In [6]: df
Out[6]:
    ID  ENTRADA
0  150        1
1  150        2
2  150        3
3  151        1
4  152        1
5  152        2

In any case, the error you were getting doesn't make a whole lot of sense, it shouldn't depend on the length of your dataframe, without a reproducible example, we can only speculate.