Multiple products on add to cart?

Question: E.g. node contains a product Poster for $5 and e.g. a checkbox saying "+ Cup" which is another $5. So it's two different products, how do I let user select if they want just a poster of if they want the poster + the cup, so check the box for the cup and on add to cart it adds both items?
If you create a product reference field with Unlimited, it won't let to choose multiple items, it renders as a dropbox/select list for one item to choose and add to cart.
https://www.drupal.org/project/commerce_product_kit is locked to total products set for the page in the product reference field, so it always adds both products on Add to cart, no select option.
So basically how to add 1 to 2 products on same page clicking Add to cart only once.
Answer: Have you already tried the Commerce Product Add-On module? That sounds like exactly what you're describing.
Comment: It's strange any modifications done under Manage Display for products node or the product with referenced product has no effect. It's stuck displaying default values, can't edit which fields to display, eg add referenced product price, remove SKU, etc. https://i.imgur.com/EKPkwp7.png

Multiple products on add to cart?


How many cals do I need for a server handing out profiles

Question:
Possible Duplicate:
Can you help me with my software licensing question?

Suppose I have a windows 2003 server which hosts 500 roaming profiles. Do i need 500 cals for each user accessing his profile. How does this work?
Answer: This Microsoft Volume Licensing CAL Guide will probably spell out everything you need to know.
User CALs:

With the User CAL, you purchase a CAL
  for every user who accesses the server
  to use services such as file storage
  or printing, regardless of the number
  of devices they use for that access.
  Purchasing a User CAL might make more
  sense if your company employees need
  to have roaming access to the
  corporate network using multiple
  devices, or from unknown devices, or
  simply have more devices than users in
  your organization.

Device CALs:

With a Device CAL, you purchase a CAL
  for every device that accesses your
  server, regardless of the number of
  users who use that device to access
  the server. Device CALs may make more
  economic and administrative sense if
  your company has workers who share
  devices, for example, on different
  work shifts.

And on a slight technicality, if you purchase User CALs, you only need one per user, not 500 per user..
Answer: No.
You need NONE, provided every MACHINE retrieving the profile has a CAL assigned to it.
Now, the user probably has a CAL anyway, as... guess what ;) There are other computers it needs.
If not, you need ONE CAL FOR EVERY USER.
Comment: I don't understand how the user could already have a CAL? Because as I understand it (and as they tried to sell it to me some years ago) each user (or device) needs a CAL for each server so, even if the user has a CAL for another server, he will need a new one for the new server.
Comment: it's not a CAL for each server in a domain.  One single User CAL covers all the servers in the domain.
Comment: As it has been repeatedly explained to me: one single device CAL (for example, assigned to a workstation) allows any users using that specific workstation to connect to any server that the organization owns. One single user CAL (for example, assigned to "Stemen") allows the specific user "Stemen" to access any server using any device that the organization owns. I have specifically asked whether the boundary is on domain or organization, and the response I've received has always been "organization."


Drush or Drupal console command to list modules with security updates?

Question: Is there a command for Drupal 8.x that shows available updates?
I added forms_steps 1.1 that has an SA and a security update required in the Web UI, which is saying to update to 1.2

I tried drush pm:security but it reports that there is no outstanding security.
root@d568732a8640:/app# drush pm:security
 [success] There are no outstanding security updates for Drupal projects.

I might have overestimated the capability of this command so I'm looking for alternatives to get both update and security update in the console. My goal with this is to add a schedule job in our CI that will report on those.
Comment: Drupal's core module "Update" sends you reports out of the box. You can configure it to send an email to given email addresses when a security update is available. Just ensure Drupal's cron runs regularly. That's all.
Comment: Maybe include the link to the issue you created on GitHub for reference: https://github.com/drush-ops/drush/issues/4189
Comment: Thanks for linking the issue.  Two things; one I'm not sure it's an issue so I opened this discussion here to look for alternatives and two I'm looking for something that can report in a CI project without requiring a live site.
Comment: And letting your CI site send mails?
Comment: We are aiming small for now as a first step we just want to create a badge in our project with the numbers of update, green 0 update, yellow 1 or more updates, red when 1 update or more is a security update. The badge would also link to the report. After this we might want to automate the creation of a ticket in gitlab and eventually with an MR ready to review.
Answer: drush pm:security should be fine in listing Drupal modules with security updates.
There was a bug from the drupal-composer/drupal-security-advisories project that resulted in not listing the forms_steps module and some other modules.  It was promptly fixed and now it works!


ajax response comparison to string

Question: I am using this ajax code to get a 'YES' or a 'NO' value back from a VB function.
<code> $.ajax(
                {

                    type: 'POST',
                    url: 'validateWorkorder',
                    data: str,
                    dataType: "html",
                    success: function (data)
                    {
                        alert(data)
                        var result = data
                        alert(result)
                        if (result == "NO")
                        {
                            alert('Workorder cannot be found in Printline database.');
                            $('#textWorkorder').css('background-color', 'red');
                        }
                        else
                        {
                            $('#textWorkorder').css('background-color', 'white');

                        }
                    },

                    error: function (xhr, errorType, exception)
                    {
                        var errorMessage = exception || xhr.statusText;
                        alert(errorMessage);
                    }
                }
                );
</code>
If you notice in the success area, I have two alerts that result "YES" or "NO" depending on what I send to the function via json. However, when I try to compare
    If (result == "NO")
there seems to always be a false condition even though 'data' does in fact = NO in my testing.
What am I doing wrong and why so I can learn.
Thanks
Comment: Is it possible the ajax could be getting extra characters, either spaces or line breaks, I used to have this issue alot when I used to use ajax for string literals, i've since started using xml formatting for all my responses and it just makes life easier.
Comment: interesting Wobbles. When i set the return as json it does error that the is an extra line
Comment: this just fixed it: var result = $.trim(data)
Comment: Wobbles can you throw your comment in an answer?
Answer: Is it possible the ajax could be getting extra characters, either spaces or line breaks, I used to have this issue alot when I used to use ajax for string literals, i've since started using xml formatting for all my responses and it just makes life easier.

ajax response comparison to string


Python: Mapping data up a hierarchy

Question: Suppose I have a dataframe that maps a child-level address to a more macro level address:

Child
Child's Level
Parent
Parent's Level

Pivet Drive
Street
Little Whinging
Town

Little Whinging
Town
England
Country

England
Country
Europe
Continent

State Street
Street
New York
City

New York
City
USA
Country

USA
Country
North America
Continent

I have a second dataframe that list down each person's address, but that address may be stated at different hierarchical level

Name
Address
Continent?

Adam
Pivet Drive

Mary
New York

Dave
State Street

How can I fill up the continent column in the 2nd dataframe using python?
A naive way is to either turn the 1st dataframe into a dictionary and repeatedly map upwards, or to just repeatedly merge the two dataframes. However, this does not scale up well once I've millions of rows for both dataframes, especially since every record does not start from the same level in the hierarchy.
I've previously filled up the continent column using a graph database (Neo4j), but I can't seem to google any hint on how to do this using python instead.
Comment: This is a complicated question, what if two different continents contain the same City name? Graph DB is born to handle case like this, if you want to handle it under relational-db/df(they are the same issue), you can't avoid the query with many outer-joins. I'm thinking of use some algorithms to handle case like this.
Answer: Graph DB is born to handle case like this, if you want to handle it under relational-db/dataframe(they are the same), you can't avoid the query with many outer-joins. The concept hidden here is how to store and retrieve a tree-like data structure in relational db. You can treat dataframe like a table in db.
Here I use the Union-Find algorithm to handle this, notice that I didn't use the other level info except for Continet, which may be a buggy if Two Continets contain places of the same name under different levels, or under the same level. The following codes are just some demo thoughts, but it works for the demo data you provided, may not work well for your entire dataset:
<code>import pandas as pd
from collections import defaultdict

df = pd.DataFrame({'Child': ['Pivet Drive', 'Little Whinging', 'England', 'State Street', 'New York', 'USA'],
                   "ChildLevel": ['Street', 'Town', 'Country', 'Street', 'City', 'Country'],
                   "Parent": ['Little Whinging', 'England', 'Europe', 'New York', 'USA', 'North America'],
                   "ParentLevel": ['Town', 'Country', 'Continent', 'City', 'Country', 'Continent']})

df_to_fill = pd.DataFrame({
    'Name': ['Adam', 'Mary', 'Dave'],
    'Address': ['Pivet Drive', 'New York', 'State Street'],
})

child_parent_value_pairs = df[["Child", "Parent"]].values.tolist()

tree = lambda: defaultdict(tree)
G = tree()
for child, parent in child_parent_value_pairs:
    G[child][parent] = 1
    G[parent][child] = 1

E = [(G[u][v], u, v) for u in G for v in G[u]]
T = set()
C = {u: u for u in G}  # C stands for components
R = {u: 0 for u in G}

def find(C, u):
    if C[u] != u:
        C[u] = find(C, C[u])  # Path compression
    return C[u]

def union(C, R, u, v):
    u = find(C, u)
    v = find(C, v)
    if R[u] > R[v]:
        C[v] = u
    else:
        C[u] = v

    if R[u] == R[v]:
        R[v] += 1

for __, u, v in sorted(E):
    if find(C, u) != find(C, v):
        T.add((u, v))
        union(C, R, u, v)

all_continents = set(df[df['ParentLevel'] == 'Continent']['Parent'].tolist())
continent_lookup = {find(C, continent): continent for continent in all_continents}

df_to_fill['Continent'] = df_to_fill['Address'].apply(lambda x: continent_lookup.get(find(C, x), None))

print(df_to_fill)
</code>
Output:
<code>   Name       Address      Continent
0  Adam   Pivet Drive         Europe
1  Mary      New York  North America
2  Dave  State Street  North America
</code>

Python: Mapping data up a hierarchy


Properties of the relation $(x,y) \in R$ if $| x-y | = 2 $

Question: Is the following relation reflexive, symmetric, transitive, anti-symmetric and/or partial order :
$$(x,y) \in R \text{ if }| x-y | = 2 $$
I think it's reflexive, I don't understand how to find for the other ones.
Comment: Do you really think that $|x-x|=2$ is true?
Comment: Oh! I was doing it with a wrong x,y input ( something like |4-2| for x,y.
So for reflexive you only take x value?
Comment: See the definition of "reflexive"...
Comment: symmetric:  if $xRy \Rightarrow yRx$
Comment: What definitions of *reflexive*, *symmetric*, *transitive*, and *partial order* have you been given?  Particularly, please look at *reflexive* again.
Comment: So if $|x-y|=2$ is $|y-x|=2$??
Comment: @Hugo , isn't the answer yes? Since it is a mod function and let's say i take x = 4 and y = 2
Comment: But since xRy => yRx i guess you cannot take two different values
Comment: @luke well it depends. I guess your talking about absolute values of reals or integers then yes it should be symmetric.  .  it is not obvious what x,y  are elements of. If $x,y \in \mathbb{R}$ and $|.|$ is the absolute value then it should be symmetric. You might want to edit the question to include definition of transitive, partial order,anti-symmetric for yourself
Comment: @luke For symmetry you need $\lvert y-x\rvert=2$ to be true for *any* values of $(x,y)$ that make $\rvert x-y\lvert=2$ true.
Comment: @GrahamKemp So if x = 4, y = 2. The following relation is symmetric!!
Comment: You need to be able to assert that $y\operatorname R x$ holds for *any* $(x,y)$ where $x\operatorname Ry$ holds, not just for some particular example. @luke
Answer: A relationship $R$ is reflexive if, for all $x$, it's true that $x R x$.
$$\textsf{Is }\lvert x-x\rvert = 2 \textsf{ universally true?}$$

 Clearly no.

A relationship $R$ is reflexive if, for all $x,y$, it's true that $x R y\to y R x$
$$\textsf{Is }\lvert y-x\rvert = 2 \textsf{ true whenever }\lvert x-y\rvert = 2\textsf{ is true?}$$

 Obviously, yes.

A relationship $R$ is transitive if, for all $x,y,z$, it's true that $(x R y\wedge y R z)\to x R z$
$$\textsf{Is }\lvert x-z\rvert = 2 \textsf{ true whenever }\lvert x-y\rvert = 2\textsf{ and }\lvert y-z\rvert = 2\textsf{ are both true?}$$

 Not telling.  Is it?

A relationship $R$ is antisymmetric if, for all $x,y$, it's true that $(x R y\wedge y R x)\to x = y$
$$\textsf{Is }x=y \textsf{ true whenever }\lvert x-y\rvert = 2\textsf{ and }\lvert y-x\rvert = 2\textsf{ are both true?}$$

 Not telling.  Is it?

The way to falsify each of these claims is to find a counterexample.   Only by verifying a counterexample is not possible can you state that a claim is true.

A relationship $R$ is a partial order relation if it is reflexive, antisymetric, and transitive .

 ...


Why don't run ajax call for take java class in selected package?

Question: I'm building an application using Ajax,jsp and Java.
I meet the problem when I call Java reflection by Ajax call. This is the error:
Feb 22, 2014 11:39:13 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [optSim] in context with path [/Manager] threw     exception
java.lang.RuntimeException: No resource for it/Manager/Support

the code that thrown the exception is:
 public static Vector<Class> getClassesForPackage(Package pkg) {
    String pkgname = pkg.getName();

    Vector<Class> classes = new Vector<Class>();

    // Get a File object for the package
    File directory = null;
    String fullPath;
    String relPath = pkgname.replace('.', '/');
    System.out.println(System.getProperty("java.class.path"));
    // System.out.println("ClassDiscovery: Package: " + pkgname +
    // " becomes Path:" + relPath);

    System.out.println(System.getProperty("java.class.path"));

    URL resource = ClassLoader.getSystemClassLoader().getResource(relPath);

    // System.out.println("ClassDiscovery: Resource = " + resource);
    if (resource == null) {
        throw new RuntimeException("No resource for " + relPath);
    }
    ....

In input this method take a package name and it search the class in the selected package.
The problem is that if I call the method by jar file without Ajax this run correctly, otherwise return an error.
I print javaclass path and it contains the directory src where are  it/Manager/Support.
I thinks that the problem is in tomcat configuration.
Can anybody help me?
Thanks very Much
Comment: possible duplicate of [System.getProperty("java.class.path") does not show "WEB-INF/lib" and the including jars](http://stackoverflow.com/questions/4273039/system-getpropertyjava-class-path-does-not-show-web-inf-lib-and-the-includ)
Answer: The solution are:
URL resource = Thread.currentThread().getContextClassLoader().getResource("path");

because when ajax call java code, i must select the threads ClassLoader otherwise java don't kwon what class loader take!


Como fazer alteração de cor de uma row com um selected active do ngx-datatable?

Question: Boa tarde pessoal!
Já tentei de várias formas fazer uma alteração de mudança cor de uma row do ngx-datatable, mas única forma que consegui foi alterar o color hover da minha row.
O que preciso é alterar a cor ao selecionar uma linha, igual a este exemplo: https://stackblitz.com/edit/angular-gk6hut?file=src%2Fstyles.scss, mas não consegui de nenhuma forma.
Como está atual:
:host
::ng-deep
.ngx-datatable.bootstrap:not(.cell-selection)
.datatable-body-row:hover,
:host
::ng-deep
.ngx-datatable.material:not(.cell-selection)
.datatable-body-row:hover
.datatable-row-group {
background: blue;
}

Comment: Hugo, do jeito que está o código está funcionando, porém, está mudando somente a linha quando mantenho o mouse em cima da linha, que seria o *datatable-body-row:hover*, quando tiro o mouse, a cor do background volta. O que preciso é alterar a cor ao clicar, com um selected active que o próprio ngx-datatable possui, mas infelizmente não estou conseguindo.
Comment: Não seria uma `,` faltando depois do segundo `.datatable-body-row:hover` http://prntscr.com/o0lbl4
Answer: Acredito que se você utilizar como abaixo, funcione:
:host ::ng-deep .ngx-datatable.material.single-selection .datatable-body-row.active .datatable-row-group {
   background: red !important;
}

Mas você precisa deixar o view-encapsulation do seu componente como padrão.
Todo estilo com ::ng-deep fica global. Lembrando também que esse é um recurso deprecated pelo time do Angular: https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep. E a estilização do ngx-datatable é baseada em SCSS https://swimlane.gitbook.io/ngx-datatable/themeing
Comment: Desculpe a minha ignorância patrick, mas estou começando no angular agora, como deixo meu view-encapsulation como default?
Comment: Somente não setando ele no `decorator` do seu componente. Por exemplo, tem que ficar somente assim: `@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})`, sem a propriedade `encapsulation:`
Comment: Muito obrigado, mas infelizmente não funcionou, já tentei de várias formas, mas o único atributo que consigo alterar é o row: hover mesmo.


Is it possible to make a "centralized" MouseEvent?

Question: I have these two MouseEvents, and I want them "centralized" because I have other nodes that will do the same thing. I know that this can be done if you create multiple MouseEvents, but I reckon that there must be a shorter way.
public class scMain implements Initializable {

@FXML
private Button btnView, btnView2;
@FXML
private HBox hboxView, hboxView2;

public void translateTransition(Node node) {
    TranslateTransition translate = new TranslateTransition();
    translate.setNode(node);
    // ...animation stuff
    translate.play();
}

public void fadeOffTransition(Node node) {
    FadeTransition fade = new FadeTransition();
    fade.setNode(node);
    // ...animation stuff
    fade.play();
}

public void fadeInTransition(Node node) {
    FadeTransition fade = new FadeTransition();
    fade.setNode(node);
    // ...animation stuff
    fade.play();
}

@FXML
void btnMouseEnter(MouseEvent event) {
    fadeOffTransition(btnView);
    hboxView.setVisible(true);
    translateTransition(hboxView);
}

@FXML
void btnMouseExit(MouseEvent event) {
    fadeInTransition(btnView);
    hboxView.setVisible(false);
}}

What I tried but obviously didn't work :
@FXML
void btnMouseEnter(MouseEvent event, Node first, Node second) {
    fadeOffTransition(first);
    second.setVisible(true);
    translateTransition(second);
}

@FXML
void btnMouseExit(MouseEvent event, Node first, Node second) {
    fadeInTransition(first);
    second.setVisible(false);
}

@Override
public void initialize(URL url, ResourceBundle rb) {
   btnMouseEnter(event, btnView2, hboxView2); //error cannot find symbol
   btnMouseExit(event, btnView2, hboxView2); //error cannot find symbol
}

Any suggestions would be appreciated.
Comment: [mcve] please demonstrating what you are after and how it doesn't work
Comment: It's probably better to register the mouse events in Java (for example, in the controller's `initialize()` method) instead of in FXML in this scenario. That way you can use loops, etc., to do the same thing for multiple nodes. You almost certainly don't want a single event handler for multiple nodes; that is a bad design.
Answer: Register the event handler in the intialize() method, instead of in the FXML. Remove the onMouseEnter and onMouseExit attributes from the FXML file, and modify the controller as follows:
void btnMouseEnter(Node first, Node second) {
    fadeOffTransition(first);
    second.setVisible(true);
    translateTransition(second);
}

void btnMouseExit(Node first, Node second) {
    fadeInTransition(first);
    second.setVisible(false);
}

@Override
public void initialize(URL url, ResourceBundle rb) {
   btnView2.setOnMouseEnter(e -> btnMouseEnter(btnView2, hboxView2));
   btnView2.setOnMouseExit(e -> btnMouseExit(btnView2, hboxView2));
}

You can also make the obvious reductions in code, e.g.:
private void registerMouseHandlers(Button button, Node target) {
    button.setOnMouseEnter(e -> btnMouseEnter(button, target));
    button.setOnMouseExit(e -> btnMouseExit(button, target));
}

@Override
public void initialize(URL location, ResourceBundle resources) {
    registerMouseHandlers(btnView, hboxView);
    registerMouseHandlers(btnView2, hboxView2);
}

And if you have a fairly large number of these, it might also be more efficient (in terms of lines of code) to do
@Override
public void initialize(URL location, ResourceBundle resources) {
    List<Button> buttons = List.of(btnView, btnView2);
    List<Node> targets = List.of(hboxView, hboxView2);
    for (int i = 0 ; i < buttons.size() ; i++) {
        registerMouseHandlers(buttons.get(i), targets.get(i));
    }
}

You could also consider creating a custom component encapsulating your button and hbox, which simply implements the event handlers for a single button-hbox pair, and then including them in the FXML using fx:include.


How is induction justified in intuitionistic logic?

Question: This question might be extremely naïve for which I apologise in advance.
The induction principle can be stated as:

If $A ⊂ ℕ$ such that

$1 ∈ A$, and
$ν(A) ⊂ A$ (where $ν\colon ℕ → ℕ$ is the successor function),

then $A = ℕ$.

It can be proven as follows:

If $ℕ\setminus A$ was non-empty, it would have a least element (which again can be proven from the axiom of regularity using a set-theoretic definition of naturals and using contradiction), say $x ∈ ℕ\setminus A$: By 1.) $x ≠ 1$, so there is a $y ∈ ℕ$ with $x = ν(y)$. By assumption, $y ∈ A$, and by 2.) $x = ν(y) ∈ A$ which cannot be.

This proof uses contradiction. But it is, of course, assuming (other) axioms from ZF.
But how is this handled with intuitionistic logic where contradiction isn't allowed? Is induction an axiom on its own?
Comment: Bourbaki also uses contradiction in _Théorie des ensembles_, III.32.
Answer: The answer depends on the formal system you are working in. Here are some examples - and indeed, as you speculated it might be the case, in all of them we have induction  directly built into the axiomatics or the definition of ${\mathbb N}$:
In Constructive Set Theory like Intuitionistic Zermelo Fraenkel (IZF) you need to find a replacement for the Axiom of Foundation since it implies the Law of Excluded Middle (for a proposition $\phi$, consider a $\in$-minimal element of $\{\emptyset\ |\ \phi\}\cup\{\{\emptyset\}\}$). The (classically equivalent) alternative one uses is the following:
$$ \text{(Law of Set Induction):}\quad\quad\forall x ((\forall y\in x: A(y))\Rightarrow A(x))\Rightarrow \forall z: A(z)$$
Thus, inductive proofs of statements parametrized over ${\mathbb N}$ are realized directly through the axiomatics.
In topos theory, which one can also view of an intuitionistic foundation of mathematics, one uses the notion of a natural number object, which is by definition the initial pointed object with an endomorphism. Hence, it is the definition of ${\mathbb N}$ there that maps with domain ${\mathbb N}$ are constructed inductively.
In type theory, ${\mathbb N}$ is an example of an inductive type which usually comes directly with the corresponding induction scheme.
In System F, for example, the natural numbers could be implemented as the polymorphic type ${\mathbb N}:\equiv\forall X: X \to (X\to X)\to X$ which reads as: An element of ${\mathbb N}$ is a uniform procedure to associate to any type $X$, any element $x_0:X$ and any rule $X\to X$ an element of $X$. Indeed it turns out that these are, up to normalization, the Church presentations $\lambda X.\lambda (x_0:X) (f:X\to X). f(f(...(f(x))...))$ of the naturals.
In Coq the definition of an inductive type such as

Inductive Nat :=
| O : Nat
| succ : Nat -> Nat.

automatically results in the implementation of induction schemes such as

Nat_ind: forall P : Nat -> Prop, P O -> (forall n : Nat, P n -> P (succ n)) -> forall n : Nat, P n

allowing the 'inductive' construction of a proof of $\forall n\in{\mathbb N}: P(n)$ out of a proof of $P(0)$ and a rule turning a proof of $P(n)$ into a proof of $P(n+1)$.
Comment: @k.stm: Btw, may I ask, where are you from in Germany? :)
Comment: Not from Bonn, if you're hinting at that! ;) Thanks for the elaborate answer.


Does the type of wood on a solid body electric guitar affect its tone or sound?

Question: I know that on an acoustic guitar the sound is produced by the strings vibrating the top or soundboard and that the type wood used on the soundboard and body of an acoustic guitar will   be the biggest determining factor of how the guitar sounds.
But on a solid body electric guitar, the vibration of the strings is converted to sound through an electrical process whereby the magnetic pickups detect the vibration of the strings and translate that vibration to an electrical signal sent to an amplifier.  And for the most part -  the quality of the sound is dependent on the quality of the pickups and the amplifier.
But does the type of wood used to build the body or the neck or any other part of a solid body electric guitar have any significant effect on the way the guitar sounds?
Comment: I think that the bridge quality also plays a major role, appart from pickups, strings and amplifier.
Comment: https://www.youtube.com/watch?v=OLxE8iDWD_w
Comment: possible duplicate of [How much does an electric guitar's body physics affect the tone, playability, etc?](http://music.stackexchange.com/questions/14019/how-much-does-an-electric-guitars-body-physics-affect-the-tone-playability-et)
Comment: @leftaroundabout That link pretty much answer's the question.  Tried to give you a plus one but not sure it showed up.  I gave credit to Costagero for having the wisdom to include (and acknowledge your contribution) in an answer - but wanted to thank you in this comment.
Answer: The answer is "yes", because virtually every part of an electric guitar affects the quality of the sound to some degree. Electric guitarists agree that the selection of woods in the body, neck and fingerboard make significant differences in timbre (the distinguishing characteristics of the tone and sound).
(When we talk about the characteristics of the sound of a certain kind of wood, or of any musical instrument as a whole, we use the French term "timbre" (pronounced like "tam-ber") and this should not be confused with the English term "timber" which refers to logs of wood cut from trees.)
The Warmoth guitar company in the USA builds "bespoke" solid bodies and necks one-at-a-time according to the specifications of the purchaser. Warmoth has tables and charts which discuss the relative merits of different kinds of wood and what effect they have on the overall sound of the guitar.
Warmoth Body Wood Options
Warmoth Neck Wood Options
The species of wood is not the only factor; the quality of the piece of wood being used also matters a great deal. Wood harvested from young trees tends to have inferior timbre (sound quality) compared to wood of the same species harvested from old trees. How old is optimal varies with the different species of wood. Wood that has been harvested and stored for several decades tends to have superior sound to wood that is used to build an instrument shortly after the tree has been harvested. So the best tone-woods are from old stocks that are aged by decades. Since this difference in quality has to do mostly with the amount of moisture in the cut wood, some builders try to accelerate the process of aging the wood by baking the wood at low temperatures in kilns to remove the moisture from inside the wood.
It is also true that certain species of woods are chosen for their beautiful grain patterns and color rather than exclusively for their timbre. Some guitar customers want to see the natural grain of the wood, while others seem to prefer wood that is painted with "automotive" colors which hide the grain.
I should also mention that many high-end solid-body bass guitar luthiers build bass bodies that use a bewildering combination of pieces of different species of wood sandwiched and glued together. These luthiers usually claim that their unique combination of several different species of wood impart a unique tonal quality. Personally I think this is going too far, and these kinds of basses are more interesting for the visual appeal of the beautiful woods rather than any discernible improvement in tone. But these bass luthiers are successful, so it must mean that their choices are pleasing to their customers.
Answer: If we separate out the effects you could see,

The body/neck wood could absorb energy from the strings, causing the sound to decay faster (and with preference for certain frequencies)
The body/neck wood could then retransmit energy back into the strings, again possibly with preference for certain frequencies due to resonances in the wood
The body/neck could pick up acoustic energy from the air and transmit it to the strings
the body's resonances could cause the pickups to vibrate, affecting the motion of the strings relative to them.

I suspect that all of these effects are somewhat unpredictable unless you also consider the bridge, nut and tuners and the way they are mounted; The way the wood is sawn and glued; the way the pickups are mounted, whether you have a 400w amp ten feet away, how tightly you are holding the guitar to your body, and so on.
It would be very hard to do a traditional experiment to prove whether wood made a predictable difference - you'd have to build two guitars identical except for the wood, or try out a selection made of one wood, and a selection made of another, and see if there were any commonalities between the groups. Alternatively you could do some computer-based analysis. All difficult to do, and the people with the resources to do it (luthiers and instrument manufacturers) have a vested interest in letting people assume that carefully-chosen woods can make a predictable difference.
It's even difficult to do blind tests - how can you give someone two guitars to play without them knowing which is which? What if the resonances feel different when you're holding it?
All in all, I think it's inevitable that wood has some effect - but I don't think it's easy to know what that effect is!
Comment: I'm sure some of the bigger names in manufacturing have done just that - used different woods for exactly the same bodies etc. So a comparison may not be too difficult.
Comment: Definitely, but if doing a comparison of just two instruments they really need to be *exactly* the same apart from the wood. If one has the nut glued in a bit tighter, and the bridge screws tightened another half turn, that could change the acoustic coupling between strings and body - and of course different samples of the same type wood can have different mechanical properties, so for that reason too it would be good to have a few examples of each and then set up a blind test to see if there was any statistically-significant difference between perceptions/measurements of each group.
Comment: I believe that the wood must re-transmit some vibration back to the strings as you say.  That would explain why certain woods sustain better than others.  The strings vibrate the wood and the wood in turn vibrates the strings like a continuous feedback loop.  Interestingly, the link in @Costagero answer - is a vid of the controlled experiment you described.
Answer: The wood used in a electric guitar will add body to the pure vibrating string sound.
My luthier once told me that the wood you use is like a landscape and the pickups are like windows through which you observe it. If the landscape has some beautiful sections, but your window can only let you see the ugly portions of it, you have a problem.
The strings are what the pickups actually "see", so keep in mind that the wood isn't directly affecting this landscape. It acoustically affects how the strings ring.
Anyway, the type of wood contributes to the possibilities for your tone, along with things like hardware and the playing by itself. The pickups select some tonal qualities.

If you have to use a bad pickup, you can use wood to compensate it in some way. For instance, a bassy pickup that acts like a low-pass filter can be somewhat compensated with a very bright wood that doesn't emphasize low frequencies;
Using a type of wood known for a richer sound will let the pickups do their best work: A perfect landscape will stay perfect when seen through any window;
Active pickups are like larger windows, and they can also emphasize certain aspects of your tone.

In general, darker types of wood will provide more lows than highs and things like maple and ash would do the opposite. Check this out, as suggested by leftaroundabout, for a comparison between dark and light wood.
Think of the wood as the element that will provide the body - sustain and release times - of your tone. Different types of wood mean different colors in this body.
Comment: I really like the 'window on a landscape' idea, very poetic! I think calling having the *wood* as the landscape is a bit questionable, though, as the thing the pickups 'see' directly is the strings. Maybe our window looks over the sea (the strings) and the body can be the moon, causing the tide to run in and out? No? Ok, I never was a poet...
Comment: I think the interaction between the wood and strings would be more accurate way to describe this -  the wood affects what the strings are doing.  I don't see how the interaction between the wood and pickups would in itself, make any discernible difference.  But plus 1 for the link which is pretty much the controlled experiment suggested by @topomorto
Comment: You are right. The string vibration is affected by the type of wood, and that's what the pickups "see"... That makes your analogy pretty good!
Comment: I just edited the answer. Tried to improve it by making this point clear.
Answer: The question is a bit of a red herring.  Clearly the "electric guitar" is not an acoustic instrument and as such its tone is primarily determined by the amp and other factors in the set up (or more precisely, could be determined by...).
The pickup is picking up changes in magnetic flux from the vibrating string which is converted into an AC current in the pickup coil.  The pickup cannot pick up what isn't there and the pickup has its own response curve that accentuates some frequencies over others.  Any damping in the instrument will affect sustain.  The type of bridge will change the harmonic content of the vibrating string too.  From a basic physics point of view each and every piece of the instrument will have an impact on the tone of the guitar and the sustain.  This is what anyone should expect.  Neck through body versus bolt on will also have an effect.  The real question is can you tell.  This is where the question gets muddy in my opinion.
Many people consider the solid body electric to be an ideal rigid boundary that simply supports the strings.  This is fair to some degree.  But if you compare a solid body Les Paul to a plastic or acrylic solid body to one made of marble or other stone I think you will hear a difference provided all are played through the same gear and set up.  But a stone guitar is an extreme that most will never experience.  The slight deviations in guitar manufacturing are not as likely to make as big a difference.  Since you can shape the sound any way you like with electronics it isn't really a useful point.  Even if the choice of wood had an effect you can compensate for it electronically.  The only way the comparison is fair is if you ask, is there an noticeable difference in tone and sustain between a solid Maple and a solid Mahogany with exactly the same shape, same electronics, same set up etc.  And that doesn't really happen.  Fender vs Gibson has different electronics, hardware, neck etc.
An example of something that will affect sound that cannot be addressed with tone shaping is solid body versus hollow or semi-hollow body.


Separate points in compact group action by an invariant pseudometric

Question: Let $G$ be a compact (Hausdorff) group acting jointly continuously on a compact (Hausdorff) space $X$. Given $x \neq y \in X$, does there exist a continuous $G$-invariant pseudometric on $X$ such that $d(x,y) > 0$?
That is, given $x \neq y$, I want to find (the existence of) a continuous function $d : X^2 \to \mathbb{R^{\geq 0}}$ such that

For all $x$, $d(x,x) = 0$.
For all $x,y$, $d(x,y) = d(y,x)$.
For all $x,y,z$, $d(x,z) \leq d(x,y) + d(y,z)$.
For all $x,y,g$, $d(gx,gy) = d(x,y)$.
$d(x,y) > 0$ for the specific $x$ and $y$ we're given.

We may not assume either $G$ or $X$ is separable.
The context is that I'm a graduate student in mathematics working on a research problem where such an invariant pseudometric would be useful, and finding one is a little bit outside my usual expertise. I'll attempt to build one (and post the construction here if I do), but ideally I'd like to cite this as an easy consequence of some well-known, textbook theorem.
Answer: The positive answer to your question (even for an arbitrary Tychonoff space $X$) follows from Theorem A from the paper "Invariant pseudometrics on Palais proper $G$-spaces'' by Antonyan  and de Neymet.


How to Get Lilypond Music Engraver to Render File in SVG Format

Question: I am looking to get Lilypond to output my scores in SVG format. I'm working on the Windows 10 platform. So far I have only been able to get png outputs using the following command in the command line:
lilypond -fpng Name_of_File.ly
I can not figure out what command or string of commands will give an svg output but I suspect it will be similar to the above png output command. I have played with the dbackend command but have not been able to even get that to work.  In case it is of any help, the following link contains some disjointed and incomplete explanations of getting svg outputs:
http://lilypond.org/doc/v2.18/Documentation/usage/command_002dline-usage.en.html#advanced-command-line-options-for-lilypond
Answer: Use this just like the first example from the page you linked:
<code>lilypond -dbackend=svg filename.ly
</code>
Comment: Great thank you. You should write the documentation for Lilypond.


Add class to links in delete page

Question: I want to add a class to the link in my delete content page, currently the 'delete' button itself is styled because it falls under the styling for input[type=submit] in my CSS, but the 'cancel' button is just regular text.
I also have the webform edit page with links for 'clone', 'edit' and 'delete' how would I go about adding classes to these as well?
I don't want to just add a class for all links because thats overkill in my scenario
Thanks
Answer: Using the FAPI in a hook_form_alter() function:
$form['buttons']['delete']['#attributes']['class'] = 'my-class';

Add class to links in delete page


IllegalArgumentException in ondraw while loading images with picasso in recyclerview

Question: Crash while loading images with picasso in recycler view.below is the crash log. im unable to find the exact cause of the issue.
02-16 14:45:30.888  19543-19543/com.swen E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.IllegalArgumentException: Cannot draw recycled bitmaps
        at android.view.GLES20Canvas.drawBitmap(GLES20Canvas.java:791)
        at android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:118)
        at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:393)
        at com.squareup.picasso.PicassoDrawable.draw(PicassoDrawable.java:96)
        at android.widget.ImageView.onDraw(ImageView.java:985)
        at android.view.View.draw(View.java:13803)
        at android.view.View.getDisplayList(View.java:12741)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.View.draw(View.java:13519)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
        at android.view.View.getDisplayList(View.java:12739)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.View.draw(View.java:13519)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
        at android.view.View.getDisplayList(View.java:12739)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.View.draw(View.java:13519)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
        at android.view.View.getDisplayList(View.java:12739)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.View.draw(View.java:13519)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
        at android.view.View.draw(View.java:13806)
        at android.widget.FrameLayout.draw(FrameLayout.java:467)
        at android.view.View.getDisplayList(View.java:12741)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.View.draw(View.java:13519)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
        at android.view.View.draw(View.java:13806)
        at android.view.View.getDisplayList(View.java:12741)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.View.draw(View.java:13519)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3019)
        at android.support.v7.widget.RecyclerView.drawChild(RecyclerView.java:3588)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2883)
        at android.view.View.draw(View.java:13806)
        at android.support.v7.widget.RecyclerView.draw(RecyclerView.java:3097)
        at android.view.View.getDisplayList(View.java:12741)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)
        at android.view.View.getDisplayList(View.java:12670)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)
        at android.view.View.getDisplayList(View.java:12670)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)
        at android.view.View.getDisplayList(View.java:12670)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)
        at android.view.View.getDisplayList(View.java:12670)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)
        at android.view.View.getDisplayList(View.java:12670)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)
        at android.view.View.getDisplayList(View.java:12670)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)
        at android.view.View.getDisplayList(View.java:12670)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)
        at android.view.View.getDisplayList(View.java:12670)
        at android.view.View.getDisplayList(View.java:12785)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3001)

Proper guidance will help.
Comment: May be this will help you: http://stackoverflow.com/a/12239626/5352802
Comment: refer http://stackoverflow.com/questions/12218976/cannot-draw-recycled-bitmaps-when-displaying-bitmaps-in-gallery-attached-to-ad
Comment: Helps a lot if you show the code.
Answer: Bitmap thumbnail = Bitmap.createScaledBitmap(bmp, w, h, true)
if (!bmp.isRecycled()) {
    bmp.recycle();
}
bmp = null;


Combining 3 columns into one TextView in ListView

Question: I have SQLite Database with some columns, 3 of them is day month and year. I have 2 TextViews in the ListView - Title and Date.
I want to combine the 3 columns of the date (day, month and year) into the "Date" TextView.
Example:
My SQL Database -
title - title
day - 8
month - 3
year - 2013
and in the ListView it will look like -
title
8/3/2013

My code:
    c = db.query(DbHelper.TABLE_NAME, null, null, null, null, null, null);

    String[] from = {DbHelper.COLUMN_NAME_TITLE, DbHelper.COLUMN_NAME_DAY, DbHelper.COLUMN_NAME_MONTH, DbHelper.COLUMN_NAME_YEAR};
    int[] to = {R.id.text1, R.id.date};
    adapter = new SimpleCursorAdapter(this,
            R.layout.list_item_2,
            c, from, to);
    list.setAdapter(adapter);

I think that I need to change the 3 date columns before it put into the TextView but I dont know how to do this.
Thank you!
Comment: you need to override `getView` of your adapter and join those three columns as one string
Comment: use custom SimpleCursorAdapter. refer this http://android-er.blogspot.in/2012/10/list-images-with-thumbnails.html
Answer: String[] date = { DbHelper.COLUMN_NAME_TITLE, DbHelper.COLUMN_NAME_DAY+"/"+ DbHelper.COLUMN_NAME_MONTH+"/"+DbHelper.COLUMN_NAME_YEAR};

or
String temp = DbHelper.COLUMN_NAME_DAY+"/"+ DbHelper.COLUMN_NAME_MONTH+"/"+DbHelper.COLUMN_NAME_YEAR
String[] date = { DbHelper.COLUMN_NAME_TITLE, temp}

I think this is what you ask for


Does MySQL have max(a,b) function?

Question: Does MySQL have max(a,b) function? I mean a simple math function from two numbers.
Answer: You mean GREATEST( )
GREATEST(A, b)

Does MySQL have max(a,b) function?


Organic groups & views

Question: So... I created a few groups and a new content-type. The problem is that I don't know how to display content linked to a certain group using a path like: "/[-content-type]/[group-name] (using views, of course). As far as I know it has something to do with contextual filters, but that's where my knowledge ends.
Thanks for any help.
Answer: take some time and watch these very informative new videos: Modules Unraveled Kudos to Brian Lewis aka bjlewis2

Organic groups & views


lmer fixed effects t-statistic interpretation

Question: I'm struggling to explain some output from a linear mixed effects model. I've done a lot of reading and searching of previous questions but haven't been able to find what I'm looking for.
I have 3 conditions (HH, IH, and PH). For each of these I've calculated the change from baseline. The dependent variable is s1_d1_hbo (a measure of deoxygenated blood in the brain, loosely).
I'm expecting this to increase with each condition but am also interested in any between condition differences; this is why I set the equation as s1_d1_hbo ~ 0 + Condition + (1 | subject_ID) rather than s1_d1_hbo ~ Condition + (1 | subject_ID).
From the fixed effects results, I understand that the pre-post difference for HH is 63.9 – am I correct that the probability this is the same as zero has a t-value of 4.78 and the associated p-value? The confidence interval from emmeans shows that the 95 % CI is way above zero, which means that this difference is statistically significant from zero. Post hoc tests (Tukey's HSD) shows no between-condition differences.
The main point I'm confused about is how to write and explain the fixed effects – since the model has obviously done some test to get those test statistics do I need to correct for multiple comparisons? Can I just state that the fixed effects were significantly different from zero?
Code is below. Any help appreciated!
Formula: s1_d1_hbo ~ 0 + Condition + (1 | subject_ID)
   Data: hbo_summary.df

REML criterion at convergence: 350.9

Scaled residuals:
     Min       1Q   Median       3Q      Max
-2.08725 -0.42395 -0.02953  0.59511  2.03162

Random effects:
 Groups     Name        Variance Std.Dev.
 subject_ID (Intercept) 1177     34.30
 Residual               1148     33.88
Number of obs: 36, groups:  subject_ID, 16

Fixed effects:
                              Estimate Std. Error    df t value Pr(>|t|)
ConditionHH hypoxia - HH room    63.90      13.37 28.80   4.780 4.75e-05 ***
ConditionIH hypoxia - IH room    54.52      13.83 29.91   3.943 0.000448 ***
ConditionPH hypoxia - PH room    55.66      12.98 27.60   4.286 0.000199 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            CHh-Hr CIh-Ir
CndtIHh-IHr 0.393
CndtPHh-PHr 0.406  0.412
$emmeans
 Condition            emmean   SE   df lower.CL upper.CL
 HH hypoxia - HH room   63.9 13.4 28.8     36.5     91.3
 IH hypoxia - IH room   54.5 13.8 29.9     26.3     82.8
 PH hypoxia - PH room   55.7 13.0 27.6     29.0     82.3

Degrees-of-freedom method: satterthwaite
Confidence level used: 0.95

$contrasts
 contrast                                        estimate   SE   df t.ratio p.value
 (HH hypoxia - HH room) - (IH hypoxia - IH room)     9.38 15.0 20.1  0.626  0.8076
 (HH hypoxia - HH room) - (PH hypoxia - PH room)     8.24 14.4 20.3  0.574  0.8353
 (IH hypoxia - IH room) - (PH hypoxia - PH room)    -1.14 14.5 19.6 -0.078  0.9966

Degrees-of-freedom method: satterthwaite
P value adjustment: tukey method for comparing a family of 3 estimates

Answer: From your mixed model formulation, the unconditional mean is strictly a function of the fixed effects term "Condition" whereas the conditional mean (with respect to subject ID) is the sum of the unconditional mean and a subject-specific intercept term.  The unconditional mean may also be interpreted as the mean (with respect to subject ID) of the conditional mean.  Hence, an interpretation is: The estimated mean 's1_d1_hbo', marginalized over all subject IDs, for a subject with condition 'HH hypoxia - HH room' is 63.90.
When testing for the inclusion of a categorical variable, I do not look at the t-test outputs, which are based on asymptotic Wald statistics, but I calculate the likelihood ratio test statistic myself by fitting a Null model (intercept only) and the model with the categorical variable (your output given).  However, make sure to use the MLE fitting algorithm, not REML.  This overall test answers the question: does my categorical variable explain an appreciable amount of variation in the response variable?  This overall test does not require controlling for multiple comparisons.
After the above overall test (in your case it will have 2 degrees of freedom) shows significance, then you can test the differences within the levels of the categorical variable using the 'contrast' statements.  These should be controlled for multiple comparisons, which your R output does automatically for you.  From your output it is clear that given the presence of any of these 3 conditions the mean 's1_d1_hbo' is significantly different than the mean 's1_d1_hbo' for a subject without any of the conditions; however, no statistically significant difference in mean 's1_d1_hbo' is detected between subjects with two differing conditions at the .05 significance level.


Expected squared prediction error

Question: I'm reading about statistical decision theory and on one point in my book the author defines the expected squared prediction error by:
$$EPE = E(Y-g(X))^2 = \int(y -g(x))^2Pr(dx, dy)$$
I like to write this with the density function so that it stays more precise:
$$EPE = \int\int(y-g(x))^2f(x,y)\;dx\;dy$$
Now on the other part the author says that by conditioning on $X$, $EPE$ can be written as:
$$EPE = E_XE_{Y|X}([Y-g(X)]^2\;|\;X)$$
For some reason this notation confuses me...could someone write this conditional notation of $EPE$ more precisely, i.e. so that it would include the joint density function of random variables $X$ and $Y$ etc.?
Just to be sure: $X$ is the variable we use to predict $Y$ and $g(X)$ is the function we are trying to solve, which minimizes $EPE$.
Thank you for any help :)
Answer: $EPE = \int\int {(y-g(x))^2f(x,y)dxdy}$
By Bayes' Theorem $f(x,y)=f(y\,|\,x)\,f(x)$ we have:
$EPE = \int\int {(y-g(x))^2f(y\,|\,x)\,f(x)dxdy}$
Rearranging gives:
$EPE = \int f(x)\;\left(\,\int (y-g(x))^2f(y\,|\,x)dy\,\right)\;dx$
Using definition of $E_x$ we get:
$EPE = E_x(\;\int (y-g(x))^2f(y\,|\,x)dy\;) $
Using definition of $E_{Y\,|\,X}$ we get:
$EPE = E_x(\;\;\;E_{Y\,|\,X}(\,(Y-g(X))^2\,|\,X\,)\;\;\;) $
Or an even shorter notation:
$EPE = E_xE_{Y\,|\,X}(\,[Y-g(X)]^2\,|\,X\,) $

Expected squared prediction error


Need some hints for proving a logarithmic inequality.

Question: $$\frac{\log_ax}{\log_{ab}x} +
\frac{\log_b{x}}{\log_{bc}x} +
\frac{\log_cx}{\log_{ac}x} \ge 6$$
Did as you suggested and got this, im stuck again:
$$\log_ab + \log_bc + \log_ca \ge 3$$
Comment: If you don't add your thoughts respectively specify your question, it is likely to be disliked or even closed.
Comment: $$
\frac{\log_a x}{\log_{ab} x} = \frac{1/\log_x a}{1/\log_x(ab)} = \frac{\log_x (ab)}{\log_x a} = \log_a(ab) = \log_a a + \log_a b = 1 + \log_a b.
$$
Therefore
$$ \frac{\log_ax}{\log_{ab}x} + \frac{\log_b{x}}{\log_{bc}x} + \frac{\log_cx}{\log_{ac}x} = (1+ \log_a b) + (1+ \log_b c) + (1+ \log_c a) $$
$$= 3 + (\log_a b + \log_b c + \log_c a) = 3 + \frac{\log b}{\log a} + \frac{\log c}{\log b} + \frac{\log a}{\log c}  = 3 + \frac u v + \frac w u + \frac v w$$
Answer: Let $m = \log_x a, n = \log_x b, p = \log_x c\implies LHS = 3 + \dfrac{n}{m}+\dfrac{p}{n}+ \dfrac{m}{p} \ge 3+3 = 6$ by applying AM-GM inequality.
Answer: Consider making use of these three identities:
$$\log_{a}{x}=\frac{\log_{b}{x}}{\log_{b}{a}}$$
$$\log_{q}{a}+\log_{q}{b}=\log_{q}{ab}$$
$$\log_{b}{ab}=1+\log_{b}{a}$$
Answer: If you write $\frac{\log_a x}{\log_{ab} x}=\frac{\frac{\ln x}{\ln a}}{\frac{\ln x}{\ln ab}} = \frac{\ln ab}{\ln a} = 1+\frac{\ln b}{\ln a}$, and something similar with the other fractions, you can the use the familiar inequality :
$$\frac{x}{y}+\frac{y}{z}+\frac{z}{x}\ge3$$
which can be derived easily from the inequality between arithmetic and geometric means.
Answer: $$
\frac{\log_a x}{\log_{ab} x} = \frac{1/\log_x a}{1/\log_x(ab)} = \frac{\log_x (ab)}{\log_x a} = \log_a(ab) = \log_a a + \log_a b = 1 + \log_a b.
$$
Therefore
\begin{align}
& \frac{\log_ax}{\log_{ab}x} + \frac{\log_b{x}}{\log_{bc}x} + \frac{\log_cx}{\log_{ac}x} = (1+ \log_a b) + (1+ \log_b c) + (1+ \log_c a) \\[10pt]
= {} & 3 + (\log_a b + \log_b c + \log_c a) = 3 + \frac{\log b}{\log a} + \frac{\log c}{\log b} + \frac{\log a}{\log c}  = 3 + \frac u v + \frac w u + \frac v w
\end{align}


git merge only additions

Question: I have a library I've been using in different projects that I've been updating as needed. Because I forgot to copy to some changes I ended up with two files with different additions that I had only added to.
Because I was planning on making a git repo for this library anyway I made one, added the first file, added the second file on a branch and merged them. This left me with a copy of the second file, not a merged together file.
So instead what I ended up doing is creating a new repo with a blank file in it, then copying the first file into a new commit, then checking out the blank file commit, then copying the second file in and making a new branch, then merging. This caused a merge conflict but after I simply removed the
<<<<<<< HEAD, ======= and >>>>>>> <branch name> lines git had inserted I had the file I wanted.
I'm wondering if there was a better way to do this? Particularly if this happened again with multiple files. I tried a visual merge tool but it split chunks across function boundaries so I would've had to do it more manually.
Edit: examples of what I had and what I wanted.
I had two files (pseudocode):
File 1
defmodule foo

foo.bar = ...

foo.baz = ...

return foo

File 2
defmodule foo

foo.bar = ...

foo.qux = ...

return foo

Then I wanted to merge these into one file. Since the new functions (baz and qux) didn't call each other I would have been fine with either
defmodule foo

foo.bar = ...

foo.baz = ...

foo.qux = ...

return foo

or
defmodule foo

foo.bar = ...

foo.qux = ...

foo.baz = ...

return foo

Since I've only added to these files it seems like I should be able to get my desired file without having to cut and paste manually, and the trick with the empty file and two branches from that feels a overly complicated and doesn't scale well with multiple files. So I want to know if there's a better way.
Comment: Do you mean that, before making a new repo, you had: (1) a common merge base with files `A` and `B`; (2) a branch where you made some additions to file `A` but left file `B` untouched; and (3) a branch where you made some additions to file `B` but left file `A` untouched?  And if so, do you further mean that what you wanted was for git to somehow take "additions to `A`" and "additions to `B`" and add them both to the base version of `A` and leave the base version of `B` alone?
Comment: ... On re-reading your question, I don't think that's what you mean at all, but I still have no idea what you *do* mean.  I think you need a more precise description.  It would be even better if you included a sequence of git commands that set up the situation you would like resolved (perhaps with some trivial files, but set up as a small self-contained complete example).
Comment: Hopefully these examples clarify what I meant.
Answer: OK, so I made this up as the SSCCE / MVCE.  We start with a repository with a README in master:
$ mkdir mergesamp
$ cd mergesamp
$ git init
Initialized empty Git repository in .../mergesamp/.git/
$ cat << END > README
> We put a dummy README file into the base,
> to get an initial commit.
> END
$ git add README && git commit -m initial
[master (root-commit) 40d9565] initial
 1 file changed, 2 insertions(+)
 create mode 100644 README

Now we make a new branch b1 and create file1:
$ git checkout -b b1
Switched to a new branch 'b1'
$ cat << END > file1
> defmodule foo
>
> # We'll put a bunch of stuff in here
> # so that git can detect renames.
> # Files that are very short, that are
> # in fact renamed and modified, can
> # get missed because git does not
> # see that they are at least 50% matching
> # between the "before" and "after" versions.
>
> foo.bar = ...
>
> foo.baz = ...
>
> return foo
> END
$ git add file1 && git commit -m 'add file1'
[b1 f603e15] add file1
 1 file changed, 15 insertions(+)
 create mode 100644 file1

Then we go back to master and create a new branch b2 to hold file2 (I use a slight shortcut here, creating b2 starting at the commit identified by master rather than using two separate git commands):
$ git checkout -b b2 master
Switched to a new branch 'b2'
$ cat << END > file2
> defmodule foo
>
> # This is the b2 version of file1.
> # We'll put a bunch of stuff in here
> # so that git can detect renames.
> # Files that are very short, that are
> # in fact renamed and modified, can
> # get missed because git does not
> # see that they are at least 50% matching
> # between the "before" and "after" versions.
> defmodule foo
>
> foo.bar = ...
>
> foo.qux = ...
>
> return foo
> END
$ git add file2 && git commit -m 'add file2'
[b2 01ef1ca] add file2
 1 file changed, 17 insertions(+)
 create mode 100644 file2

Let's see where we are now:
$ git log --graph --oneline --decorate --all
* 01ef1ca (HEAD -> b2) add file2
| * f603e15 (b1) add file1
|/
* 40d9565 (master) initial
$

At this point we want to get back on master and make git merge file1 and file2.  But of course there's no common base version of the file in master, so a simple git merge won't work.
(Aside: maybe we just want to merge b2 into b1, or b1 into b2.  I didn't find this clear from your original, which is why this kind of SSCCE / MVCE is a good idea.  Fortunately it won't matter for the ultimate solution here.)
There are multiple ways to handle this.  Perhaps the simplest from a blue-sky "thinking about it" point of view would be to go back to master, create a common base file, then rebase the two branches onto this point so that they do have a common base file.
This is, however, the wrong way.  Nonetheless let's show it...
The wrong way
$ git checkout master
Switched to branch 'master'
$ git checkout b1 -- file1
$ git commit -m 'copy b1 file1 to common base'
[master 71b0f5e] copy b1 file1 to common base
 1 file changed, 15 insertions(+)
 create mode 100644 file1

Note that this new commit in master has the exact same file1 as in b1, so when I do a rebase I'll have to preserve an empty commit.  (If there were additional changes in branch b1 I would not need the -k and the rest of the stuff below.)
$ git rebase -k master b1
First, rewinding head to replay your work on top of it...
HEAD detached from 40d9565
You are currently cherry-picking commit f603e15.

nothing to commit, working directory clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

If you wish to skip this commit, use:

    git reset

Then "git cherry-pick --continue" will resume cherry-picking
the remaining commits.

I want the empty commit (for illustration) so I follow the directions (adding --no-edit since I don't want to edit the commit message):
$ git commit --allow-empty --no-edit
[detached HEAD 3080d64] add file1
 Date: Thu Mar 17 11:18:51 2016 -0700
$ git cherry-pick --continue
$ git status
$ git status
HEAD detached from 40d9565
nothing to commit, working directory clean

Alas, I've run into a git bug!  I don't have time to fix the example so I'll just forcibly finish the rebase and make git do what it should have done here.  (If you don't understand this bit, don't worry about it, git should not have done what it just did and I'm working around it.)
$ git branch -f b1 HEAD && git checkout b1
Switched to branch 'b1'
$ git log --graph --oneline --decorate --all
* 3080d64 (HEAD -> b1) add file1
* 71b0f5e (master) copy b1 file1 to common base
| * 01ef1ca (b2) add file2
|/
* 40d9565 initial

Now I'll repeat with b2.  After rebasing, I will need to rename file2 to file1, though.
$ git rebase master b2
First, rewinding head to replay your work on top of it...
Applying: add file2
$ git rm file1 && git mv file2 file1 && git commit -m 'rename file2->file1'
rm 'file1'
[b2 435e6e7] rename file2->file1
 2 files changed, 3 insertions(+), 18 deletions(-)
 delete mode 100644 file2

Let's view the commit graph:
$ git log --graph --oneline --decorate --all
* 435e6e7 (HEAD -> b2) rename file2->file1
* 63a19b5 add file2
| * 3080d64 (b1) add file1
|/
* 71b0f5e (master) copy b1 file1 to common base
* 40d9565 initial

Now I can do the merge on master (in two steps, and I need the --no-ff because master exactly matches b1 because this example is perhaps too small / minimal):
$ git checkout master
Switched to branch 'master'
$ git merge --no-ff --no-edit b1
Already up-to-date!
Merge made by the 'recursive' strategy.
$ git merge --no-edit b2
Merge made by the 'recursive' strategy.
 file1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

The merges are all done, but if we look at file1 we have the wrong version: git thinks it should just use the b2 version.
Let's unwind the mess and see what happens if we simply merge b2 into b1, now that they have a common base:
$ git reset --hard 71b0f5e
HEAD is now at 71b0f5e copy b1 file1 to common base

(I cut-and-pasted the SHA-1 here, as it was still in a window; or I could use master~2 since there are two merges to discard.)
$ git checkout b1
Switched to branch 'b1'
$ git merge --no-edit b2
Merge made by the 'recursive' strategy.
 file1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Alas, as before (and this should be unsurprising, really), file1 simply picks up b2's changes and now matches the version in b2.  So let's toss this merge as well, and in fact, go back to the setup we had before we did all the rebasing, because this is the wrong approach.
Fortunately we still have all the initial commit IDs in the original git log --graph --oneline --decorate --all output.
$ git checkout master && git reset --hard 40d9565
Switched to branch 'master'
HEAD is now at 40d9565 initial
$ git checkout b1 && git reset --hard f603e15
Switched to branch 'b1'
HEAD is now at f603e15 add file1
$ git checkout b2 && git reset --hard 01ef1ca
Switched to branch 'b2'
HEAD is now at 01ef1ca add file2

(Note: it would be possible to do all this with the reflogs for master, b1, and b2, but as long as we have the raw SHA-1s handy, this was easier.)
The right way: git merge-file
Since we just want to manually merge file1 and file2 from the two branches, using "the empty file" as the common base version, we really just want to do exactly that.  First, let's get the two files into the work tree:
$ git show b1:file1 > file1
$ git show b2:file2 > file2

Now we tell git merge-file to use the empty file /dev/null as the common base:
$ git merge-file file1 /dev/null file2

The merge, in this case, finds conflicts between the items added, so we have to manually edit the result (in file1), but it now has the usual <<<<<<< style markers in it, which should make the merge easier.  (Also, remember to delete file2 when done.)
If we had a better base file (than the empty /dev/null), merge-file could do a better job.  But in any case this is probably the way to go about it.
Comment: I followed your instructions for "The right way" for the files that originally prompted the question and I got an identical file to the one I got before. (I'm using git bash on windows and I got an error trying with `/dev/null/` so I made an empty file and used that instead. So this definitely works for my use-case. Assuming I don't care about keeping copies of file1 and file2 in a git repo, just using `git merge-file` as described seems to work just as well.

git merge only additions


Bilinear form proof by property-

Question: Show that $T: \mathbb{R}^2\times\mathbb{R}^2 \rightarrow \mathbb{R}$ given by $T(x,y)=x_1y_1+x_2y_2+x_1y_2+x_2y_1+1$ is not a bilinear form.
So by this property:
$$f(u,0)=f(0,u)=0$$
can i prove that is not a bilinear form?
Since:
$$T(x,0)=x_1(0)+x_2(0)+x_1(0)+x_2(0)+1=1$$
Answer: Yes, that suffices. If you fix any of the coordinates, say $a,$ then $T(a,-):\Bbb{R}^2\longrightarrow \Bbb{R},$ must be a linear map, and since $T(a,0)\ne 0,$ then $T(a,-)$ is not linear, and certainly not bilinear.

Bilinear form proof by property-


Using simple form on ruby on rails, how show required (*) asterisk on nested form label

Question: I'm using simple_form, haml, and need a label for a group of nested radio buttons to indicate a selection is necessary via an asterisk.
Answer: From the docs:

Required fields are marked with an * prepended to their labels.
By default all inputs are required. When the form object has presence validations attached to its fields, Simple Form tells required and optional fields apart. For performance reasons, this detection is skipped on validations that make use of conditional options, such as :if and :unless.
And of course, the required property of any input can be overwritten as needed:
<code><%= simple_form_for @user do |f| %>
  <%= f.input :name, required: false %>
  <%= f.input :username %>
  <%= f.input :password %>
  <%= f.button :submit %>
<% end %>
</code>
Comment: The thing is the only input is option buttons, and there is just a text only label. I need the text only label to show an asterisk.
Comment: Uhmm, you can prepend the asterisk manually to the label if it's not related to the form?
Comment: The label is related to the form. Picture a nested form with a label and two radio buttons underneath. How would I add an asterisk (other than manually) using simple_form?
Comment: I really don't understand what you're talking about now. I think it's harder NOT to add an asterisk in simple_form. Show your code, but perhaps read the linked [readme](https://github.com/plataformatec/simple_form) first.


Error install exchange 2016 coexistence with exchange 2010

Question: When installing exchange 2016.
Error: step 7 of 14 mailbox role: Transport service
The following error was generated when "$error.Clear();

          if ( ($server -eq $null) -and ($RoleIsDatacenter -ne $true) )
          {
            Update-RmsSharedIdentity -ServerName $RoleNetBIOSName
          }
        ": "Microsoft.Exchange.Data.DataValidationException: Database is mandatory in UserMailbox.
   in Microsoft.Exchange.Data.Directory.ADDataSession.Save(ADObject instanceToSave, IEnumerable`1 properties, Boolean bypassValidation)
   )".

Checking in exchange 2010. I have the following error, in the following Blog FederateMailbox comment on the problem. Also in this other  Blog SystemMailbox and Blog DiscoverySearchMailbox
Get-Mailbox -Arbitration | Format-Table Name, ServerName, Database -Auto

Get-Mailbox

Shows error of objects with server name that does not exist (mail-ex01 server that currently exists)
WARNING: The object contoso.com/Users/SystemMailbox
WARNING: The object contoso.com/Users/FederateMailbox
WARNING: The object contoso.com/Users/DiscoverySearchMailbox
has been corrupted and is in an incoherent state. The following validation errors have occurred:

NAME
server Name

SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}
mail-ex02

SystemMailbox{1f05a927-43f2-4459-9ea1-31ee79fcf789}
mail-ex02

FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042
mail-ex02

NAME
server Name

DiscoverySearchMailbox{D919BA05-46A6-415f-80AD-7E09334BB852}
mail-ex02

My query is, delete and recreate does not affect anything. Or fix registry attributes, which would be the most recommended.
Exchange 2010 (Mail-EX01) shows log of an old mail server with the name Mail-EX02.
Exchange 2010 (Mail-EX01 server that currently exists) is running smoothly with 100 users.
Comment: Exchange 2010 was off-topic years ago.
Answer: I noticed that you may have posted the same question in the two communities, it seems that someone has answered it for you in Microsoft Q&A, you could refer to the Microsoft Q&A.
https://learn.microsoft.com/en-us/answers/questions/1337562/error-install-exchange-2016-coexistence-with-excha?comment=question#answers
Comment: Yes, [Ivan LV](https://serverfault.com/users/1021235/ivan-lv). I also posted on the Microsoft Q&A forums. Sorry if I'm missing any community forum rules. I am looking for help and every opinion is useful. I will be careful not to repeat the post.
Answer: I struggled with a similar error when installing Exchange 2019 in an Exchange 2013 environment. It ended up beeing due to RecipientFilterApplied was set to $false.
It was solved by a simple update of the EmailAddressPolicy:
Get-EmailAddressPolicy | Update-EmailAddressPolicy

Answer: I can now install exchange server 2016.
Following the next steps

On the domain server I delete the arbitration accounts of the following tutorial.
Uninstall exchange 2016 CU23

Setup.exe /Mode:Uninstall /IAcceptExchangeServerLicenseTerms_DiagnosticDataON

Check in IIS on Server for Exchange Server 2016, When uninstalling
there is a temporary website, I delete the duplicate because it
generates an error when reinstalling.
Restart the exchange server 2016 server.
Recreate the arbitration accounts, on the exchange server 2016
server

setup.exe /PrepareAD /IAcceptExchangeServerLicenseTerms_DiagnosticDataON

Check on the domain server that the accounts are created.

I just installed the Exchange server 2016 CU23
Restart and test connection exchange 2016, Shell, Toolbox, ECP

Now I have a curiosity, the exchange 2016 installs without problem
When configuring for the migration I realize that only the mailbox role is installed.
   Get-ExchangeServer

Exchange 2010   (Roles)-> MailBox, ClientAccess, HubTransport

Exchange 2016   (Roles)-> Mailbox

I don't know if it is enabled later or if any problem occurred when installing exchange 2016
The idea is to migrate from Exchange 2010 to 2016 and then delete exchange 2010


Does Chernoff's bound work with negative values of $a$ where $P(Y\geq a) \leq e^{-at}M(t)$?

Question: Does Chernoff's bound work with negative values? In other words, it is defined for a SYMMETRIC random variable $Y$ with an MGF of $M(t)$ that exists and $a>0$, $t>0$ such that:
$$
P(Y\geq a) \leq e^{-at}M(t)
$$
But suppose $a<0$, would it work as well? If not, is there an alterate version to this? Thanks!
Comment: If your variable is symmetric, then $M(t)\geq 1$ for all $t>0$, so Chernoff's bound becomes useless for $a<0$.
Answer: Yes, but you can't get rid of the condition $t>0$. Since exponential function is positive and the sets $\{X\geq a\}$ and $\{e^{tX}\geq e^{ta}\}$ are equavalent for any $a$, you can apply Markov's inequality $\mathbb{P}(X \geq a) = \mathbb{P}(e^{t\cdot X} \geq e^{t\cdot a})\leq\mathbb{E}\left [e^{t\cdot X}\right]e^{-t\cdot a}.$


why ignore wwwroot/lib when using ASP.NET core?

Question: I am trying to create a web app using ASP.NET core, d3.js and jquery. I hired someone on upwork to create the app. He was able to get it working on my local machine by adding libraries d3, jquery, and others under wwwroot/lib. However, on the remote github repository, these libraries are not included.  I have seen others on stackoverflow also not include the libraries when pushing to remote and was wondering why this is the case.
I would like to publish my app using Azure, but when I do this I get an error and I believe it's because the libraries are missing. I know that I can just add the libraries to the remote repository, but I don't think this is the correct method.  how are the libraries added with MS Azure?
Comment: You should edit your question to include the exact error mesagge, just in case it is not due to what you think.
Answer: You can add this to a  inside your .csproj file to enforce copying NuGet assemblies to the built output:
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

However, note that the build output (bin/Release/netcoreapp*/*) is not supposed to be portable and distributable, the output of dotnet publish is. As you have said, you get work in local, so copy the assemblies to the build output is probably very useful when the app is upload to azure.
For more details, you could refer to this SO thread.


Getting error msg upon form submission: "The request sent by the client was syntactically incorrect"

Question: I'm working on a Web application developed using the Spring framework, version 3.1.0.
I have a JSP page containing a form which allows the user to select a country from a SELECT dropdown listbox. Submitting the form is supposed to run a database query and return the same JSP page which includes the form as well as an HTML table of author and institute data for the selected country.
Here's part of the code for the JSP page:
<c:url var="submitUrl" value="/authorsInstitutes.htm"/>
<form:form action="${submitUrl}" method="POST">
   <select id="countryCode">
      <option value="-1">-- Please Select --</option>
         <c:forEach var="country" items="${countryList}">
            <option value="${country.countryCode}">${country.countryName}</option>
         </c:forEach>
   </select>
   <input type="submit"/>
</form:form>

and here's the code from the controller class, for the methods that handle the 'GET' and 'POST' requests:
@RequestMapping(value = "/authorsInstitutes", method = RequestMethod.GET)
public ModelAndView displayAuthorsInstitutesForm() {
    ModelAndView mav = new ModelAndView("authorsInstitutes");

    List<Country> countryList = countrySrv.findAll();
    mav.addObject("countryList", countryList);

    return mav;
}

@RequestMapping(value = "/authorsInstitutes", method = RequestMethod.POST)
public ModelAndView displayAuthorsInstitutes(
    @RequestParam(value = "countryCode") String country) {
    ModelAndView mav = new ModelAndView("authorsInstitutes");

    List<Country> countryList = countrySrv.findAll();
    mav.addObject("countryList", countryList);

    if (country != null && !country.trim().equals("")) {
        List<Affiliation> affiliationList =
            affiliationSrv.getAffiliationsByCountryCode(country);
        mav.addObject("affiliationList", affiliationList);
    }

    return mav;
}

The 'GET' request works fine, but when I select a country and submit the form, I get a 404 error message:

HTTP Status 400 - type Status report message
  description The request sent by the client was syntactically incorrect
  ().

I'm sure it's something simple, but for the life of me, I'm just not seeing what it is that I'm doing wrong. I'd appreciate any help on resolving this, thanks.
Answer: Using Firebug or any similar tool , check if countryCode parameter is passed to server.
Also i see request mapping is
@RequestMapping(value = "/authorsInstitutes", method = RequestMethod.POST)
where as request is sent to /authorsInstitutes.htm
Comment: Thanks for responding. Regarding your second point, there's this mapping within the application's 'web.xml' file:

        dispatcher

        *.htm

dispatcher
*.htm
Comment: I'm not that familiar with Firebug. I looked around, and found this error message:

"NetworkError: 400 Bad Request - http://localhost:8084/ReferenceManager/authorsInstitutes.htm"
Comment: If I change the 'submitUrl' value on the JSP page, and submit, I get the following error message:

HTTP Status 404 - /ReferenceManager/authorsInstitutes

type Status report

message /ReferenceManager/authorsInstitutes

description The requested resource (/ReferenceManager/authorsInstitutes) is not available.
Comment: please change the method of form to GET(just for testing ) both in jsp and controller. and then check if parameter is passed properly in URL
Answer: As we have a request parameter countryCode in the POST method mapping. The controller expects that the parameter is sent in the request. This is in the below code
@RequestMapping(value = "/authorsInstitutes", method = RequestMethod.POST)
public ModelAndView displayAuthorsInstitutes(@RequestParam(value = "countryCode") String country) {
 }

Change the select tag in the jsp to include a name attribute like this.
<select id="countryCode" name="countryCode">
  <option value="-1">-- Please Select --</option>
     <c:forEach var="country" items="${countryList}">
        <option value="${country.countryCode}">${country.countryName}</option>
     </c:forEach>
</select>
<input type="submit"/>

This will assign the contryCode to the option selected.
Try this i hope it will work.
Answer: You need to remove slash from your url in url tag, like this:
<c:url var="submitUrl" value="authorsInstitutes.htm"/>
if you use absolute path with slash in jsp, form will not send data.


Como corrigir os problemas relatados com o plugin BlackBox Debug no Wordpress?

Question: Estou enfrentado diversos problemas de velocidade no meu site Wordpress.
Buscando identificar as causas, adicionei o plugin BlackBox Debug que identificou 33,1 erros com o tema que uso, que é bem carregado.
Removi o tema e coloquei um tema básico para ver se persistia e o seguinte log abaixo foi reportado, com ainda 12 erros:
Strict (259)    is_a(): Deprecated. Please use the instanceof operator on line 392 in file /home/meusite/public_html/wp-includes/post.php
Strict (11) is_a(): Deprecated. Please use the instanceof operator on line 498 in file /home/meusite/public_html/wp-includes/capabilities.php
Strict (3)  is_a(): Deprecated. Please use the instanceof operator on line 75 in file /home/meusite/public_html/wp-includes/functions.wp-scripts.php
Strict (2)  is_a(): Deprecated. Please use the instanceof operator on line 105 in file /home/meusite/public_html/wp-includes/functions.wp-styles.php
Strict (6)  is_a(): Deprecated. Please use the instanceof operator on line 160 in file /home/meusite/public_html/wp-includes/functions.wp-styles.php
Strict (12) is_a(): Deprecated. Please use the instanceof operator on line 197 in file /home/meusite/public_html/wp-includes/functions.wp-scripts.php
Strict  is_a(): Deprecated. Please use the instanceof operator on line 37 in file /home/meusite/public_html/wp-includes/functions.wp-styles.php
Strict  is_a(): Deprecated. Please use the instanceof operator on line 115 in file /home/meusite/public_html/wp-includes/functions.wp-scripts.php
Strict  is_a(): Deprecated. Please use the instanceof operator on line 812 in file /home/meusite/public_html/wp-includes/script-loader.php
Strict  is_a(): Deprecated. Please use the instanceof operator on line 729 in file /home/meusite/public_html/wp-includes/script-loader.php
Strict (101)    is_a(): Deprecated. Please use the instanceof operator on line 205 in file /home/meusite/public_html/wp-includes/class-wp-error.php
Notice (3)  Trying to get property of non-object on line 597 in file /home/meusite/public_html/wp-includes/nav-menu.php

O que significam estes erros? Como posso corrigí-los?
Comment: Esta pergunta não é ampla ou pouco clara. Eu, que uso o Wordpress constantemente, entendo perfeitamente qual é o problema. Além do mais, a questão já foi devidamente respondida pelo @Math.
Comment: Concordo que a pergunta foi feito meio largadona a princípio, mas achei precipitada a decisão de fechá-la, ninguém que fechou sequer adicionou um comentário pedindo para o autor elaborar melhor a pergunta.
Comment: Qual versão do PHP está instalada no servidor?
Answer: is_a() foi aposentado no php 5.0 mas foi reintroduzido no 5.3.
Para solucionar seu problema faça uma atualização do seu PHP.
Referência: PHP Manual
Comment: Correto! Referência da documentação [aqui](http://www.php.net/manual/en/function.is-a.php).
Comment: Boa! faltou uma referência.. Posso adicionar sua sugestão a minha respota?
Comment: Claro, fique à vontade!
Comment: Muito obrigado,foi muito simples e ,apenas uma atualização e ficou limpo!!!
Answer: Pelo que é possível verificar neste relatório de erros, é solicitada a substituição do método is_a() por instanceof, visto que o primeiro é obsoleto (conforme manual do PHP 5).
Por exemplo:
Onde constar
if (is_a($WF, 'WidgetFactory'))

Sugiro colocar
if ($WF instanceof WidgetFactory)

Provavelmente com esta alteração a quantidade de erros encontrados irá diminuir para 1.
Comment: A função `is_a()` não está mais depreciada. Não se deve alterar o *core* do Wordpress por causa disso.
Comment: E.thomas usei a resposta do math por ser mais fácil,mas obrigado mesmo assim,por ter pessoas que ajudam a comunidade desenvolvedora no Brasil,um Abraço.
Comment: Sem problemas @user5004. Fico feliz por também ter aprendido a ler a documentação completa, pois não reparei que a função is_a() foi reativada, cfe: 5.3.0  This function is no longer deprecated, and will therefore no longer throw E_STRICT warnings. (Fonte [http://br1.php.net/manual/en/function.is-a.php])


400 Bad Request - Ajax with Jquery and Wordpress

Question: Iḿ trying to use ajax in my JQuery script to read a JQuery var into functions.php of Wordpress.
$.ajax({

    url: js_admin_url.ajax_url,
                  type: 'POST',
                  beforeSend: function(xhr) {
                    xhr.setRequestHeader("Authorization", "CloudSight [key]");
                  },
                  data: JSON.stringify({
                      'action': 'send_ranking_data', // Ação do Ajax
                      '_ajax_nonce': js_admin_url.nonce,
                      's': settings.ranking // O que vamos postar para $_POST
                  }),
                  dataType: "json",
                  contentType: "application/json",
                  success: function(response) { console.log(response); },
                  error: function(e) { console.log(e); }
              });

Status Code: 400 Bad Request
Answer: I see at least that you shouldn't be using JSON.stringify with your ajax data, just do:
data: {
    'action': 'send_ranking_data',
    '_ajax_nonce': js_admin_url.nonce,
    's': settings.ranking
}

And that will automatically send the data as JSON


Nginx Location Rule with / or not

Question: I've been searching on internet for few days, but i can't found a response.
In Nginx, you can use Location and I want that my Location accept my request with a "/" or not at the end of the request.
How can I do it ?
Here my file:
server {
    server_tokens off;
    server_name test.fr;

    include /etc/nginx/include.d/ssl-default.conf;

    location ~*test\/(.*) {
            proxy_pass http://test.fr/$1$is_args$args;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
    }

}

Thx a lot
Answer: It is basic regex, on which you can find a great interactive tutorial here:
https://regexone.com/
So to make nginx accept a location with "/" or without one, you just need to add a question mark sign to the escaped "/" character like this:
location ~*test(\/)?(.*)

Note that the rest of your URL (the (.*) part) is now in a second capturing group, so you need to change your proxy_pass directive too:
proxy_pass http://test.fr/$2$is_args$args;

So your final config would be something like:
server {
    server_tokens off;
    server_name test.fr;

    include /etc/nginx/include.d/ssl-default.conf;

    location ~*test(\/)?(.*) {
            proxy_pass http://test.fr/$2$is_args$args;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
    }

}

Comment: One can use `~*test(?:\/)?(.*)` as the regex, the `?:` modifier prevents capturing, so the `(.*)` will be captured to the first variable as before.

Nginx Location Rule with / or not


Computation of an integral depending on the Legendre polynomials

Question: Let $P_l$ be a Legendre polynomial ($l$ is an integer). I want to know why the quantity
$$
v_l(k):=(-i)^l\int_{-1}^{+1}\mathrm{e}^{ikx}\,P_l(x)\;\mathrm{d}x
$$
is real?
Answer: Write $e^{i kx}=\cos(k x)+i\sin(k x)$. So your integral is
$$
\nu_l(k)=(-i)^l\left[\int_{-1}^1 dx \cos(kx)P_l(x)+i\int_{-1}^1 dx \sin(kx)P_l(x)\right]\ .
$$
But the Legendre polynomial of order $l$ have parity $(-1)^l$. So if $l=2m$ is even, the second integral (with $\sin$) is zero (the integrand is odd and the interval of integration is symmetric) and the final result is the real number [note that $i^{2m}=(-1)^m$]
$$
\nu_{2m}(k)=(-1)^m\int_{-1}^1 dx \cos(kx)P_{2m}(x)\ .
$$
Similarly, if $l$ is odd, the first integral is now zero, and the $i$ factors cancel.


Theorem 2.41 in Baby Rudin

Question: I am reading Theorem 2.41 in Baby Rudin. Rudin proves that in $R^n$ every infinite subset $E$ has a limit point of $E$ implies that $E$ is closed. I understand what he wants to do. For references his proof is here:

2.41 $\ \ $ Theorem $\ \ $ If a set $E$ in ${\bf R}^k$ has one of the following three properties, then it has the other two:
$\quad(a)\ \ $ $E$ is closed and bounded.
$\quad(b)\ \ $ $E$ is compact.
$\quad(c)\ \ $ Every infinite subset of $E$ has a limit point in $E$.
Proof $\ \ $ If $(a)$ holds, then $E\subset I$ for some $k$-cell $I$, and $(b)$ follows from Theorems $2.40$ and $2.35$. Theorem $2.37$ shows that $(b)$ implies $(c)$. It remains to be shown that $(c)$ implies $(a)$.
$\qquad$ If $E$ is not bounded, then $E$ contains points ${\bf x}_n$ with $$|{\bf x}_n|>n\qquad(n=1,2,3,...).$$ The set $S$ consisting of three points ${\bf x}_n$ is infinite and clearly has no limit point in ${\bf R}^k$, hence has none in $E$. Thus $(c)$ implies that $E$ is bounded.
$\qquad$ If $E$ is not closed, then there is a point ${\bf x}_0\in {\bf R}^k$ which is a limit point of $E$ but not a point of $E$. For $n=1,2,3,...,$ there are points ${\bf x}_n\in E$ such that $|{\bf x}_n-{\bf x}_0|<1/n$. Let $S$ be the set of these points ${\bf x}_n$ Then $S$ is infinite (otherwise $|{\bf x}_n-{\bf x}_0|$ would have a constant positive value, for infinitely many $n$), $S$ has ${\bf x}_0$ as a limit point, and $S$ has no other limit point in ${\bf R}^k$. For if $\mathbf y\in{\bf R}^k$, ${\bf y}\neq{\bf x}_0$, then $$\begin{align}|{\bf x}_n-{\bf y}| & \geq |{\bf x}_0-{\bf y}| - |{\bf x}_n-{\bf x}_0| \\ & \geq |{\bf x}_0-{\bf y}|-\dfrac1n\geq \dfrac12|{\bf x}_0-{\bf y}|\end{align}$$ for all but finitely many $n$; this shows that $\bf y$ is not a limit point of $S$ (Theorem $2.20$).
$\qquad$ Thus $S$ has no limit point in $E$; hence $E$ must be closed if $(c)$ holds.

Note that Theorem 2.20 is that if $p$ is a limit point of $E$, then every neighborhood of $p$ contains infinitely many points of $E$.
I have troubled with that "this shows that $y$ is not a limit point of $E$ (Theorem 2.20)."
I can't understand how to use Theorem 2.20. I think use the contrapositive of Theorem 2.20, but I don't think above inequality gives us a finite neighborhood.
Also, I read Baby Rudin theorem 2.41 . But I couldn't understand the answer that "We have shown that $\vert x_n - y \vert$ isn't getting smaller and smaller as it should be if $y$ were a limit point of $S$".
Answer: Let $\epsilon=\frac12|x_0-y|$, and let $B(y,\epsilon)=\left\{x\in\Bbb R^k:|x-y|<\epsilon\right\}$, the open ball of radius $\epsilon$ centred at $y$. We know that $|x_n-y|\ge\epsilon$ for all but finitely many $n$, so there are only finitely many $n$ such that $|x_n-y|<\epsilon$. That is, there are only finitely many $n$ such that $x_n\in B(y,\epsilon)$, and $B(y,\epsilon)$ is therefore a nbhd of $y$ that does not contain infinitely many points of $S$. By the contrapositive of Theorem $2.20$, therefore, $y$ is not a limit point of $S$.
The language that you quote from the linked answer is a bit sloppy, as it makes it sound as if the points $x_n$ ought to be a sequence converging to $y$. That's not true, but it is true that if $y$ were a limit point of $S$, there would be points of $S$ as close to $y$ as we like. Rudin shows that this isn't true: there are only finitely many points of $S$ closer to $y$ than $x_0$ is, and if we let $f$ be the distance from $y$ to the closest of these points, then no point of $S$ is within $\frac{r}2$ of $y$.
Answer: Actually, it is saying that a sequence of points in $\Bbb R^k$, it converges, has only one limit point. The way that Rudin has chosen is to show that if the sequence converges to one point then its members can not approach another point other than the limit point.
To see this in other ways, suppose $y$ is another limit point of a sequence $\{x_n\}$, then : $$\forall \epsilon > 0, \exists M_1 , M_2 \in \Bbb N ,\forall n_1 \geq M_1 \hspace{0.2cm} \wedge \forall n_2 \geq M_2 (|y - x_{{n_{1}}}| \leq \epsilon \wedge |x_0 - x_{n_{2}}| \leq \epsilon).$$
Now let $M = \max(M_1,M_2)$. So for every $ n \geq M$ we have $|y-x_{0}| \leq \epsilon.$
thus $ y = x_0$.
Comment: Could you please expand the last line a little? I can't quite follow how the last inequality is obtained.
Comment: @C_Arietta_C , Yup, it is just the triangle inequality.

Theorem 2.41 in Baby Rudin


How to run something on each node in service fabric

Question: In a service fabric application, using Actors or Services - what would the design be if you wanted to make sure that your block of code would be run on each node.
My first idea would be that it had to be a Service with instance count set to -1, but also in cases that you had set to to 3 instances. How would you make a design where the service ensured that it ran some operation on each instance.
My own idea would be having a Actor with state controlling the operations that need to run, and it would itterate over services using serviceProxy to call methods on each instance - but thats just a naive idea for which I dont know if its possible or if it is the proper way to do so?
Answer: Some background info
Only Stateless services can be given a -1 for instance count. You can't use a ServiceProxy to target a specific instance.
Stateful services are deployed using 1 or more partitions (data shards). Partition count is configured in advance, as part of the service deployment and can't be changed automatically. For instance if your cluster is scaled out, partitions aren't added automatically.
Autonomous workers
Maybe you can invert the control flow by running Stateless services (on all nodes) and have them query a 'repository' for work items. The repository could be a Stateful service, that stores work items in a Queue.
This way, adding more instances (scaling out the cluster) increases throughput without code modification. The stateless service instances become autonomous workers.
(opposed to an intelligent orchestrator Actor)
Comment: I did something similar like this. I had all the -1 instances of a service work as you described and then i stored state in a statefull actor.


LINQ Query to put data in a nested object

Question: I am working on writing a C# LINQ query to get data from a SQL table below
Table1
Id Status SubStatus
1  Review Pending
2  Review Complete
3  Review Approved
4  Review Denied
5  Info   Processing
6  Info   Pending
7  Info   Requested
8  Info   Received
9  Approval Approved
10 Review Approved

From the above table I would like to put the data in an object like below
public class LastStatusDto
    {
        public string StatusName { get; set; }
        public int StatusId { get; set; }
        public int Count { get; set; }
        public IEnumerable<LastStatusChildDataDto> drillDownData { get; set; }
    }

public class LastStatusChildDataDto
{
    public string SubStatusName { get; set; }
    public int Count { get; set; }
}

and the sample result(for Status "Review") looks like below
            {
              "statusName": "Review",
              "statusId": 0,
              "count": 5,
              "drillDownData":
              [{
               "subStatusName":"Approved",
               "count":2
              },
              {
               "subStatusName":"Complete",
               "count":1
              },
             {
              "subStatusName":"Pending",
              "count":1
              },
              {
               "subStatusName":"Denied",
               "count":1
              },
            ]
        }

Whats a good way to write a LINQ query for the above scenario. I tried grouping by status but not able to figured a way to put substatuses in the nested object like below
var res = from status in context.Table1
          group status by status.Status into s

          select new LastStatusDto
          {
               Count = s.Count(),
               StatusName = s.Key,
               drilldownData = {/* ? */}
          };

Comment: Why is `StatusId` a property of `LastStatusDto` if it's an aggregate?
Answer: This should do it:
 var res = table1.GroupBy(t => t.Status)
            .Select(g => new LastStatusDto()
            {
                StatusId = 0,
                StatusName = g.Key,
                Count = g.Count(),
                drillDownData = g.GroupBy(s => s.SubStatus)
                    .Select(st => new LastStatusChildDataDto()
                    {
                        SubStatusName = st.Key,
                        Count = st.Count()
                    })
            });

As I mentioned in a comment above, StatusId has no place as a property of LastStatusDto because it's an aggregate so I set it 0 just to match your structure.
Comment: Makes sense! Thanks


Prime number in set $\{1,...,60\}$

Question: How can we calculate by using the principle of inclusions and exclusions how many prime numbers are in the set $ \{1, ..., 60 \} $?
Comment: Use the prime counting function $\pi(x)$ where $x$ is the largest element in the set. There is no other way of computing $\pi(x)$ other than counting although $\operatorname{Li}(x)$ is pretty good for larger $x$'s.
Comment: @Alizter That's kind of tautological. The mention of inclusion-exclusion suggests the expected strategy was sieve-based, as in the answer below.
Answer: Observation: Any composite number between 2 and 60 has a prime factor less than $\sqrt{60}$. So any composite number in that range must be divisible by 2, 3, 5 or 7. What is the number of composites in this range then?
Comment: For a little bit extra help if you want see this page http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes

Prime number in set $\{1,...,60\}$